From 5ce5992d14b62d590ef4a50181c5d0e94ca3b032 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 2 Aug 2024 11:39:04 +0200 Subject: [PATCH 01/10] Update the LVGL submodule to v9.2.0 --- deps/lvgl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/lvgl b/deps/lvgl index 23c7b2db..aa744634 160000 --- a/deps/lvgl +++ b/deps/lvgl @@ -1 +1 @@ -Subproject commit 23c7b2dbf2bf91ceb2a731fb428a9a796c6f36e2 +Subproject commit aa7446344c6ec7631112ef031983ef24077e24d5 From df27e7d5512832b158c12bca246a706b0c606f84 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 2 Aug 2024 11:33:08 +0200 Subject: [PATCH 02/10] Remove the LVGL drivers submodule Since LVGL v9, the drivers are integrated in the main LVGL library and the drivers submodule is no longer needed. --- .gitmodules | 3 - CMakeLists.txt | 3 - deps/lv_drivers | 1 - deps/lv_drv_conf.h | 912 --------------------------------------------- 4 files changed, 919 deletions(-) delete mode 160000 deps/lv_drivers delete mode 100644 deps/lv_drv_conf.h diff --git a/.gitmodules b/.gitmodules index 0b9a2e78..715edc19 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "deps/lvgl"] path = deps/lvgl url = https://github.com/lvgl/lvgl.git -[submodule "deps/lv_drivers"] - path = deps/lv_drivers - url = https://github.com/lvgl/lv_drivers.git [submodule "deps/txiki"] path = deps/txiki url = https://github.com/saghul/txiki.js.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d6b911f..777843db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,7 +92,6 @@ endif() add_subdirectory(deps/txiki EXCLUDE_FROM_ALL) add_subdirectory(deps/lvgl EXCLUDE_FROM_ALL) -add_subdirectory(deps/lv_drivers EXCLUDE_FROM_ALL) target_include_directories(lvgljs PUBLIC ${LVGL_PATH} @@ -111,11 +110,9 @@ target_include_directories(lvgljs PUBLIC target_link_libraries(lvgljs PUBLIC tjs lvgl - lv_drivers ) if(${CMAKE_BUILD_TYPE} MATCHES Simulator) find_package(SDL2 REQUIRED) - target_include_directories(lv_drivers PUBLIC ${SDL2_INCLUDE_DIRS}) target_link_libraries(lvgljs PUBLIC ${SDL2_LIBRARIES}) endif() diff --git a/deps/lv_drivers b/deps/lv_drivers deleted file mode 160000 index 1bd4368e..00000000 --- a/deps/lv_drivers +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1bd4368e71df5cafd68d1ad0a37ce0f92b8f6b88 diff --git a/deps/lv_drv_conf.h b/deps/lv_drv_conf.h deleted file mode 100644 index 86bfc32b..00000000 --- a/deps/lv_drv_conf.h +++ /dev/null @@ -1,912 +0,0 @@ -/** - * @file lv_drv_conf.h - * Configuration file for v8.3.0-dev - */ - -/* - * COPY THIS FILE AS lv_drv_conf.h - */ - -/* clang-format off */ -#if IS_SIM /*Set it to "1" to enable the content*/ - -#ifndef LV_DRV_CONF_H -#define LV_DRV_CONF_H - -#include "lv_conf.h" - -/********************* - * DELAY INTERFACE - *********************/ -#define LV_DRV_DELAY_INCLUDE /*Dummy include by default*/ -#define LV_DRV_DELAY_US(us) /*delay_us(us)*/ /*Delay the given number of microseconds*/ -#define LV_DRV_DELAY_MS(ms) /*delay_ms(ms)*/ /*Delay the given number of milliseconds*/ - -/********************* - * DISPLAY INTERFACE - *********************/ - -/*------------ - * Common - *------------*/ -#define LV_DRV_DISP_INCLUDE /*Dummy include by default*/ -#define LV_DRV_DISP_CMD_DATA(val) /*pin_x_set(val)*/ /*Set the command/data pin to 'val'*/ -#define LV_DRV_DISP_RST(val) /*pin_x_set(val)*/ /*Set the reset pin to 'val'*/ - -/*--------- - * SPI - *---------*/ -#define LV_DRV_DISP_SPI_CS(val) /*spi_cs_set(val)*/ /*Set the SPI's Chip select to 'val'*/ -#define LV_DRV_DISP_SPI_WR_BYTE(data) /*spi_wr(data)*/ /*Write a byte the SPI bus*/ -#define LV_DRV_DISP_SPI_WR_ARRAY(adr, n) /*spi_wr_mem(adr, n)*/ /*Write 'n' bytes to SPI bus from 'adr'*/ - -/*------------------ - * Parallel port - *-----------------*/ -#define LV_DRV_DISP_PAR_CS(val) /*par_cs_set(val)*/ /*Set the Parallel port's Chip select to 'val'*/ -#define LV_DRV_DISP_PAR_SLOW /*par_slow()*/ /*Set low speed on the parallel port*/ -#define LV_DRV_DISP_PAR_FAST /*par_fast()*/ /*Set high speed on the parallel port*/ -#define LV_DRV_DISP_PAR_WR_WORD(data) /*par_wr(data)*/ /*Write a word to the parallel port*/ -#define LV_DRV_DISP_PAR_WR_ARRAY(adr, n) /*par_wr_mem(adr,n)*/ /*Write 'n' bytes to Parallel ports from 'adr'*/ - -/*************************** - * INPUT DEVICE INTERFACE - ***************************/ - -/*---------- - * Common - *----------*/ -#define LV_DRV_INDEV_INCLUDE /*Dummy include by default*/ -#define LV_DRV_INDEV_RST(val) /*pin_x_set(val)*/ /*Set the reset pin to 'val'*/ -#define LV_DRV_INDEV_IRQ_READ 0 /*pn_x_read()*/ /*Read the IRQ pin*/ - -/*--------- - * SPI - *---------*/ -#define LV_DRV_INDEV_SPI_CS(val) /*spi_cs_set(val)*/ /*Set the SPI's Chip select to 'val'*/ -#define LV_DRV_INDEV_SPI_XCHG_BYTE(data) 0 /*spi_xchg(val)*/ /*Write 'val' to SPI and give the read value*/ - -/*--------- - * I2C - *---------*/ -#define LV_DRV_INDEV_I2C_START /*i2c_start()*/ /*Make an I2C start*/ -#define LV_DRV_INDEV_I2C_STOP /*i2c_stop()*/ /*Make an I2C stop*/ -#define LV_DRV_INDEV_I2C_RESTART /*i2c_restart()*/ /*Make an I2C restart*/ -#define LV_DRV_INDEV_I2C_WR(data) /*i2c_wr(data)*/ /*Write a byte to the I1C bus*/ -#define LV_DRV_INDEV_I2C_READ(last_read) 0 /*i2c_rd()*/ /*Read a byte from the I2C bud*/ - - -/********************* - * DISPLAY DRIVERS - *********************/ - -/*------------------- - * SDL - *-------------------*/ - -/* SDL based drivers for display, mouse, mousewheel and keyboard*/ -#ifndef USE_SDL -# define USE_SDL 01 -#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 1024 -# define SDL_VER_RES 600 - -/* 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 0 -#endif - -#if USE_MONITOR -# define MONITOR_HOR_RES 1024 -# define MONITOR_VER_RES 600 - -/* Scale window by this factor (useful when simulating small screens) */ -# define MONITOR_ZOOM 1 - -/* Used to test true double buffering with only address changing. - * Use 2 draw buffers, bith with MONITOR_HOR_RES x MONITOR_VER_RES size*/ -# define MONITOR_DOUBLE_BUFFERED 0 - -/*Eclipse: Visual Studio: */ -# define MONITOR_SDL_INCLUDE_PATH - -/*Open two windows to test multi display support*/ -# define MONITOR_DUAL 0 -#endif - -/*----------------------------------- - * Native Windows (including mouse) - *----------------------------------*/ -#ifndef USE_WINDOWS -# define USE_WINDOWS 0 -#endif - -#if USE_WINDOWS -# define WINDOW_HOR_RES 480 -# define WINDOW_VER_RES 320 -#endif - -/*---------------------------- - * Native Windows (win32drv) - *---------------------------*/ -#ifndef USE_WIN32DRV -# define USE_WIN32DRV 0 -#endif - -#if USE_WIN32DRV -/* Scale window by this factor (useful when simulating small screens) */ -# define WIN32DRV_MONITOR_ZOOM 1 -#endif - -/*---------------------------------------- - * GTK drivers (monitor, mouse, keyboard - *---------------------------------------*/ -#ifndef USE_GTK -# define USE_GTK 0 -#endif - -/*---------------------------------------- - * Wayland drivers (monitor, mouse, keyboard, touchscreen) - *---------------------------------------*/ -#ifndef USE_WAYLAND -# define USE_WAYLAND 0 -#endif - -#if USE_WAYLAND -/* 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 - -/*---------------- - * SSD1963 - *--------------*/ -#ifndef USE_SSD1963 -# define USE_SSD1963 0 -#endif - -#if USE_SSD1963 -# define SSD1963_HOR_RES LV_HOR_RES -# define SSD1963_VER_RES LV_VER_RES -# define SSD1963_HT 531 -# define SSD1963_HPS 43 -# define SSD1963_LPS 8 -# define SSD1963_HPW 10 -# define SSD1963_VT 288 -# define SSD1963_VPS 12 -# define SSD1963_FPS 4 -# define SSD1963_VPW 10 -# define SSD1963_HS_NEG 0 /*Negative hsync*/ -# define SSD1963_VS_NEG 0 /*Negative vsync*/ -# define SSD1963_ORI 0 /*0, 90, 180, 270*/ -# define SSD1963_COLOR_DEPTH 16 -#endif - -/*---------------- - * R61581 - *--------------*/ -#ifndef USE_R61581 -# define USE_R61581 0 -#endif - -#if USE_R61581 -# define R61581_HOR_RES LV_HOR_RES -# define R61581_VER_RES LV_VER_RES -# define R61581_HSPL 0 /*HSYNC signal polarity*/ -# define R61581_HSL 10 /*HSYNC length (Not Implemented)*/ -# define R61581_HFP 10 /*Horitontal Front poarch (Not Implemented)*/ -# define R61581_HBP 10 /*Horitontal Back poarch (Not Implemented */ -# define R61581_VSPL 0 /*VSYNC signal polarity*/ -# define R61581_VSL 10 /*VSYNC length (Not Implemented)*/ -# define R61581_VFP 8 /*Vertical Front poarch*/ -# define R61581_VBP 8 /*Vertical Back poarch */ -# define R61581_DPL 0 /*DCLK signal polarity*/ -# define R61581_EPL 1 /*ENABLE signal polarity*/ -# define R61581_ORI 0 /*0, 180*/ -# define R61581_LV_COLOR_DEPTH 16 /*Fix 16 bit*/ -#endif - -/*------------------------------ - * ST7565 (Monochrome, low res.) - *-----------------------------*/ -#ifndef USE_ST7565 -# define USE_ST7565 0 -#endif - -#if USE_ST7565 -/*No settings*/ -#endif /*USE_ST7565*/ - -/*------------------------------ - * GC9A01 (color, low res.) - *-----------------------------*/ -#ifndef USE_GC9A01 -# define USE_GC9A01 0 -#endif - -#if USE_GC9A01 -/*No settings*/ -#endif /*USE_GC9A01*/ - -/*------------------------------------------ - * UC1610 (4 gray 160*[104|128]) - * (EA DOGXL160 160x104 tested) - *-----------------------------------------*/ -#ifndef USE_UC1610 -# define USE_UC1610 0 -#endif - -#if USE_UC1610 -# define UC1610_HOR_RES LV_HOR_RES -# define UC1610_VER_RES LV_VER_RES -# define UC1610_INIT_CONTRAST 33 /* init contrast, values in [%] */ -# define UC1610_INIT_HARD_RST 0 /* 1 : hardware reset at init, 0 : software reset */ -# define UC1610_TOP_VIEW 0 /* 0 : Bottom View, 1 : Top View */ -#endif /*USE_UC1610*/ - -/*------------------------------------------------- - * SHARP memory in pixel monochrome display series - * LS012B7DD01 (184x38 pixels.) - * LS013B7DH03 (128x128 pixels.) - * LS013B7DH05 (144x168 pixels.) - * LS027B7DH01 (400x240 pixels.) (tested) - * LS032B7DD02 (336x536 pixels.) - * LS044Q7DH01 (320x240 pixels.) - *------------------------------------------------*/ -#ifndef USE_SHARP_MIP -# define USE_SHARP_MIP 0 -#endif - -#if USE_SHARP_MIP -# define SHARP_MIP_HOR_RES LV_HOR_RES -# define SHARP_MIP_VER_RES LV_VER_RES -# define SHARP_MIP_SOFT_COM_INVERSION 0 -# define SHARP_MIP_REV_BYTE(b) /*((uint8_t) __REV(__RBIT(b)))*/ /*Architecture / compiler dependent byte bits order reverse*/ -#endif /*USE_SHARP_MIP*/ - -/*------------------------------------------------- - * ILI9341 240X320 TFT LCD - *------------------------------------------------*/ -#ifndef USE_ILI9341 -# define USE_ILI9341 0 -#endif - -#if USE_ILI9341 -# define ILI9341_HOR_RES LV_HOR_RES -# define ILI9341_VER_RES LV_VER_RES -# define ILI9341_GAMMA 1 -# define ILI9341_TEARING 0 -#endif /*USE_ILI9341*/ - -/*----------------------------------------- - * Linux frame buffer device (/dev/fbx) - *-----------------------------------------*/ -#ifndef USE_FBDEV -# define USE_FBDEV 0 -#endif - -#if USE_FBDEV -# define FBDEV_PATH "/dev/fb0" -#endif - -/*----------------------------------------- - * FreeBSD frame buffer device (/dev/fbx) - *.........................................*/ -#ifndef USE_BSD_FBDEV -# define USE_BSD_FBDEV 0 -#endif - -#if USE_BSD_FBDEV -# define FBDEV_PATH "/dev/fb0" -#endif - -/*----------------------------------------- - * DRM/KMS device (/dev/dri/cardX) - *-----------------------------------------*/ -#ifndef USE_DRM -# define USE_DRM 0 -#endif - -#if USE_DRM -# define DRM_CARD "/dev/dri/card0" -# define DRM_CONNECTOR_ID -1 /* -1 for the first connected one */ -#endif - -/********************* - * INPUT DEVICES - *********************/ - -/*-------------- - * XPT2046 - *--------------*/ -#ifndef USE_XPT2046 -# define USE_XPT2046 0 -#endif - -#if USE_XPT2046 -# define XPT2046_HOR_RES 480 -# define XPT2046_VER_RES 320 -# define XPT2046_X_MIN 200 -# define XPT2046_Y_MIN 200 -# define XPT2046_X_MAX 3800 -# define XPT2046_Y_MAX 3800 -# define XPT2046_AVG 4 -# define XPT2046_X_INV 0 -# define XPT2046_Y_INV 0 -# define XPT2046_XY_SWAP 0 -#endif - -/*----------------- - * FT5406EE8 - *-----------------*/ -#ifndef USE_FT5406EE8 -# define USE_FT5406EE8 0 -#endif - -#if USE_FT5406EE8 -# define FT5406EE8_I2C_ADR 0x38 /*7 bit address*/ -#endif - -/*--------------- - * AD TOUCH - *--------------*/ -#ifndef USE_AD_TOUCH -# define USE_AD_TOUCH 0 -#endif - -#if USE_AD_TOUCH -/*No settings*/ -#endif - - -/*--------------------------------------- - * Mouse or touchpad on PC (using SDL) - *-------------------------------------*/ -/*DEPRECATED: Use the SDL driver instead. */ -#ifndef USE_MOUSE -# define USE_MOUSE 0 -#endif - -#if USE_MOUSE -/*No settings*/ -#endif - -/*------------------------------------------- - * Mousewheel as encoder on PC (using SDL) - *------------------------------------------*/ -/*DEPRECATED: Use the SDL driver instead. */ -#ifndef USE_MOUSEWHEEL -# define USE_MOUSEWHEEL 0 -#endif - -#if USE_MOUSEWHEEL -/*No settings*/ -#endif - -/*------------------------------------------------- - * Touchscreen, mouse/touchpad or keyboard as libinput interface (for Linux based systems) - *------------------------------------------------*/ -#ifndef USE_LIBINPUT -# define USE_LIBINPUT 0 -#endif - -#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 || USE_BSD_LIBINPUT*/ - -/*------------------------------------------------- - * Mouse or touchpad as evdev interface (for Linux based systems) - *------------------------------------------------*/ -#ifndef USE_EVDEV -# define USE_EVDEV 0 -#endif - -#ifndef USE_BSD_EVDEV -# define USE_BSD_EVDEV 0 -#endif - -#if USE_EVDEV || USE_BSD_EVDEV -# define EVDEV_NAME "/dev/input/event0" /*You can use the "evtest" Linux tool to get the list of devices and test them*/ -# define EVDEV_SWAP_AXES 0 /*Swap the x and y axes of the touchscreen*/ - -# define EVDEV_CALIBRATE 0 /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/ - -# if EVDEV_CALIBRATE -# define EVDEV_HOR_MIN 0 /*to invert axis swap EVDEV_XXX_MIN by EVDEV_XXX_MAX*/ -# define EVDEV_HOR_MAX 4096 /*"evtest" Linux tool can help to get the correct calibraion values>*/ -# define EVDEV_VER_MIN 0 -# define EVDEV_VER_MAX 4096 -# 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 0 -#endif - -#if USE_KEYBOARD -/*No settings*/ -#endif - -#endif /*LV_DRV_CONF_H*/ - -#endif /*End of "Content enable"*/ - -#if IS_DEVICE -#ifndef LV_DRV_CONF_H -#define LV_DRV_CONF_H - -#include "lv_conf.h" - -// lvgljs change begin -#define USE_EVDEV 1 - -// lvgljs change end - -/********************* - * DELAY INTERFACE - *********************/ -#define LV_DRV_DELAY_INCLUDE /*Dummy include by default*/ -#define LV_DRV_DELAY_US(us) /*delay_us(us)*/ /*Delay the given number of microseconds*/ -#define LV_DRV_DELAY_MS(ms) /*delay_ms(ms)*/ /*Delay the given number of milliseconds*/ - -/********************* - * DISPLAY INTERFACE - *********************/ - -/*------------ - * Common - *------------*/ -#define LV_DRV_DISP_INCLUDE /*Dummy include by default*/ -#define LV_DRV_DISP_CMD_DATA(val) /*pin_x_set(val)*/ /*Set the command/data pin to 'val'*/ -#define LV_DRV_DISP_RST(val) /*pin_x_set(val)*/ /*Set the reset pin to 'val'*/ - -/*--------- - * SPI - *---------*/ -#define LV_DRV_DISP_SPI_CS(val) /*spi_cs_set(val)*/ /*Set the SPI's Chip select to 'val'*/ -#define LV_DRV_DISP_SPI_WR_BYTE(data) /*spi_wr(data)*/ /*Write a byte the SPI bus*/ -#define LV_DRV_DISP_SPI_WR_ARRAY(adr, n) /*spi_wr_mem(adr, n)*/ /*Write 'n' bytes to SPI bus from 'adr'*/ - -/*------------------ - * Parallel port - *-----------------*/ -#define LV_DRV_DISP_PAR_CS(val) /*par_cs_set(val)*/ /*Set the Parallel port's Chip select to 'val'*/ -#define LV_DRV_DISP_PAR_SLOW /*par_slow()*/ /*Set low speed on the parallel port*/ -#define LV_DRV_DISP_PAR_FAST /*par_fast()*/ /*Set high speed on the parallel port*/ -#define LV_DRV_DISP_PAR_WR_WORD(data) /*par_wr(data)*/ /*Write a word to the parallel port*/ -#define LV_DRV_DISP_PAR_WR_ARRAY(adr, n) /*par_wr_mem(adr,n)*/ /*Write 'n' bytes to Parallel ports from 'adr'*/ - -/*************************** - * INPUT DEVICE INTERFACE - ***************************/ - -/*---------- - * Common - *----------*/ -#define LV_DRV_INDEV_INCLUDE /*Dummy include by default*/ -#define LV_DRV_INDEV_RST(val) /*pin_x_set(val)*/ /*Set the reset pin to 'val'*/ -#define LV_DRV_INDEV_IRQ_READ 0 /*pn_x_read()*/ /*Read the IRQ pin*/ - -/*--------- - * SPI - *---------*/ -#define LV_DRV_INDEV_SPI_CS(val) /*spi_cs_set(val)*/ /*Set the SPI's Chip select to 'val'*/ -#define LV_DRV_INDEV_SPI_XCHG_BYTE(data) 0 /*spi_xchg(val)*/ /*Write 'val' to SPI and give the read value*/ - -/*--------- - * I2C - *---------*/ -#define LV_DRV_INDEV_I2C_START /*i2c_start()*/ /*Make an I2C start*/ -#define LV_DRV_INDEV_I2C_STOP /*i2c_stop()*/ /*Make an I2C stop*/ -#define LV_DRV_INDEV_I2C_RESTART /*i2c_restart()*/ /*Make an I2C restart*/ -#define LV_DRV_INDEV_I2C_WR(data) /*i2c_wr(data)*/ /*Write a byte to the I1C bus*/ -#define LV_DRV_INDEV_I2C_READ(last_read) 0 /*i2c_rd()*/ /*Read a byte from the I2C bud*/ - - -/********************* - * DISPLAY DRIVERS - *********************/ - -/*------------------- - * Monitor of PC - *-------------------*/ -#ifndef USE_MONITOR -# define USE_MONITOR 0 -#endif - -#if USE_MONITOR -# define MONITOR_HOR_RES 480 -# define MONITOR_VER_RES 320 - -/* Scale window by this factor (useful when simulating small screens) */ -# define MONITOR_ZOOM 1 - -/* Used to test true double buffering with only address changing. - * Use 2 draw buffers, bith with MONITOR_HOR_RES x MONITOR_VER_RES size*/ -# define MONITOR_DOUBLE_BUFFERED 0 - -/*Eclipse: Visual Studio: */ -# define MONITOR_SDL_INCLUDE_PATH - -/*Open two windows to test multi display support*/ -# define MONITOR_DUAL 0 -#endif - -/*----------------------------------- - * Native Windows (including mouse) - *----------------------------------*/ -#ifndef USE_WINDOWS -# define USE_WINDOWS 0 -#endif - -#if USE_WINDOWS -# define WINDOW_HOR_RES 480 -# define WINDOW_VER_RES 320 -#endif - -/*---------------------------- - * Native Windows (win32drv) - *---------------------------*/ -#ifndef USE_WIN32DRV -# define USE_WIN32DRV 0 -#endif - -#if USE_WIN32DRV -/* Scale window by this factor (useful when simulating small screens) */ -# define WIN32DRV_MONITOR_ZOOM 1 -#endif - -/*---------------------------------------- - * GTK drivers (monitor, mouse, keyboard - *---------------------------------------*/ -#ifndef USE_GTK -# define USE_GTK 0 -#endif - -/*---------------------------------------- - * Wayland drivers (monitor, mouse, keyboard, touchscreen) - *---------------------------------------*/ -#ifndef USE_WAYLAND -# define USE_WAYLAND 0 -#endif - -#if USE_WAYLAND -# define WAYLAND_HOR_RES 480 -# define WAYLAND_VER_RES 320 -# define WAYLAND_SURF_TITLE "LVGL" -#endif - -/*---------------- - * SSD1963 - *--------------*/ -#ifndef USE_SSD1963 -# define USE_SSD1963 0 -#endif - -#if USE_SSD1963 -# define SSD1963_HOR_RES LV_HOR_RES -# define SSD1963_VER_RES LV_VER_RES -# define SSD1963_HT 531 -# define SSD1963_HPS 43 -# define SSD1963_LPS 8 -# define SSD1963_HPW 10 -# define SSD1963_VT 288 -# define SSD1963_VPS 12 -# define SSD1963_FPS 4 -# define SSD1963_VPW 10 -# define SSD1963_HS_NEG 0 /*Negative hsync*/ -# define SSD1963_VS_NEG 0 /*Negative vsync*/ -# define SSD1963_ORI 0 /*0, 90, 180, 270*/ -# define SSD1963_COLOR_DEPTH 16 -#endif - -/*---------------- - * R61581 - *--------------*/ -#ifndef USE_R61581 -# define USE_R61581 0 -#endif - -#if USE_R61581 -# define R61581_HOR_RES LV_HOR_RES -# define R61581_VER_RES LV_VER_RES -# define R61581_HSPL 0 /*HSYNC signal polarity*/ -# define R61581_HSL 10 /*HSYNC length (Not Implemented)*/ -# define R61581_HFP 10 /*Horitontal Front poarch (Not Implemented)*/ -# define R61581_HBP 10 /*Horitontal Back poarch (Not Implemented */ -# define R61581_VSPL 0 /*VSYNC signal polarity*/ -# define R61581_VSL 10 /*VSYNC length (Not Implemented)*/ -# define R61581_VFP 8 /*Vertical Front poarch*/ -# define R61581_VBP 8 /*Vertical Back poarch */ -# define R61581_DPL 0 /*DCLK signal polarity*/ -# define R61581_EPL 1 /*ENABLE signal polarity*/ -# define R61581_ORI 0 /*0, 180*/ -# define R61581_LV_COLOR_DEPTH 16 /*Fix 16 bit*/ -#endif - -/*------------------------------ - * ST7565 (Monochrome, low res.) - *-----------------------------*/ -#ifndef USE_ST7565 -# define USE_ST7565 0 -#endif - -#if USE_ST7565 -/*No settings*/ -#endif /*USE_ST7565*/ - -/*------------------------------ - * GC9A01 (color, low res.) - *-----------------------------*/ -#ifndef USE_GC9A01 -# define USE_GC9A01 0 -#endif - -#if USE_GC9A01 -/*No settings*/ -#endif /*USE_GC9A01*/ - -/*------------------------------------------ - * UC1610 (4 gray 160*[104|128]) - * (EA DOGXL160 160x104 tested) - *-----------------------------------------*/ -#ifndef USE_UC1610 -# define USE_UC1610 0 -#endif - -#if USE_UC1610 -# define UC1610_HOR_RES LV_HOR_RES -# define UC1610_VER_RES LV_VER_RES -# define UC1610_INIT_CONTRAST 33 /* init contrast, values in [%] */ -# define UC1610_INIT_HARD_RST 0 /* 1 : hardware reset at init, 0 : software reset */ -# define UC1610_TOP_VIEW 0 /* 0 : Bottom View, 1 : Top View */ -#endif /*USE_UC1610*/ - -/*------------------------------------------------- - * SHARP memory in pixel monochrome display series - * LS012B7DD01 (184x38 pixels.) - * LS013B7DH03 (128x128 pixels.) - * LS013B7DH05 (144x168 pixels.) - * LS027B7DH01 (400x240 pixels.) (tested) - * LS032B7DD02 (336x536 pixels.) - * LS044Q7DH01 (320x240 pixels.) - *------------------------------------------------*/ -#ifndef USE_SHARP_MIP -# define USE_SHARP_MIP 0 -#endif - -#if USE_SHARP_MIP -# define SHARP_MIP_HOR_RES LV_HOR_RES -# define SHARP_MIP_VER_RES LV_VER_RES -# define SHARP_MIP_SOFT_COM_INVERSION 0 -# define SHARP_MIP_REV_BYTE(b) /*((uint8_t) __REV(__RBIT(b)))*/ /*Architecture / compiler dependent byte bits order reverse*/ -#endif /*USE_SHARP_MIP*/ - -/*------------------------------------------------- - * ILI9341 240X320 TFT LCD - *------------------------------------------------*/ -#ifndef USE_ILI9341 -# define USE_ILI9341 0 -#endif - -#if USE_ILI9341 -# define ILI9341_HOR_RES LV_HOR_RES -# define ILI9341_VER_RES LV_VER_RES -# define ILI9341_GAMMA 1 -# define ILI9341_TEARING 0 -#endif /*USE_ILI9341*/ - -/*----------------------------------------- - * Linux frame buffer device (/dev/fbx) - *-----------------------------------------*/ -#ifndef USE_FBDEV -# define USE_FBDEV 1 -#endif - -#if USE_FBDEV -# define FBDEV_PATH "/dev/fb0" -#endif - -/*----------------------------------------- - * FreeBSD frame buffer device (/dev/fbx) - *.........................................*/ -#ifndef USE_BSD_FBDEV -# define USE_BSD_FBDEV 0 -#endif - -#if USE_BSD_FBDEV -# define FBDEV_PATH "/dev/fb0" -#endif - -/*----------------------------------------- - * DRM/KMS device (/dev/dri/cardX) - *-----------------------------------------*/ -#ifndef USE_DRM -# define USE_DRM 0 -#endif - -#if USE_DRM -# define DRM_CARD "/dev/dri/card0" -# define DRM_CONNECTOR_ID -1 /* -1 for the first connected one */ -#endif - -/********************* - * INPUT DEVICES - *********************/ - -/*-------------- - * XPT2046 - *--------------*/ -#ifndef USE_XPT2046 -# define USE_XPT2046 0 -#endif - -#if USE_XPT2046 -# define XPT2046_HOR_RES 480 -# define XPT2046_VER_RES 320 -# define XPT2046_X_MIN 200 -# define XPT2046_Y_MIN 200 -# define XPT2046_X_MAX 3800 -# define XPT2046_Y_MAX 3800 -# define XPT2046_AVG 4 -# define XPT2046_X_INV 0 -# define XPT2046_Y_INV 0 -# define XPT2046_XY_SWAP 0 -#endif - -/*----------------- - * FT5406EE8 - *-----------------*/ -#ifndef USE_FT5406EE8 -# define USE_FT5406EE8 0 -#endif - -#if USE_FT5406EE8 -# define FT5406EE8_I2C_ADR 0x38 /*7 bit address*/ -#endif - -/*--------------- - * AD TOUCH - *--------------*/ -#ifndef USE_AD_TOUCH -# define USE_AD_TOUCH 0 -#endif - -#if USE_AD_TOUCH -/*No settings*/ -#endif - - -/*--------------------------------------- - * Mouse or touchpad on PC (using SDL) - *-------------------------------------*/ -#ifndef USE_MOUSE -# define USE_MOUSE 0 -#endif - -#if USE_MOUSE -/*No settings*/ -#endif - -/*------------------------------------------- - * Mousewheel as encoder on PC (using SDL) - *------------------------------------------*/ -#ifndef USE_MOUSEWHEEL -# define USE_MOUSEWHEEL 0 -#endif - -#if USE_MOUSEWHEEL -/*No settings*/ -#endif - -/*------------------------------------------------- - * Touchscreen as libinput interface (for Linux based systems) - *------------------------------------------------*/ -#ifndef USE_LIBINPUT -# define USE_LIBINPUT 0 -#endif - -#if USE_LIBINPUT -# define LIBINPUT_NAME "/dev/input/event3" /*You can use the "evtest" Linux tool to get the list of devices and test them*/ -#endif /*USE_LIBINPUT*/ - -/*------------------------------------------------- - * Mouse or touchpad as evdev interface (for Linux based systems) - *------------------------------------------------*/ -#ifndef USE_EVDEV -# define USE_EVDEV 0 -#endif - -#ifndef USE_BSD_EVDEV -# define USE_BSD_EVDEV 0 -#endif - -#if USE_EVDEV || USE_BSD_EVDEV -# define EVDEV_NAME "/dev/input/event3" /*You can use the "evtest" Linux tool to get the list of devices and test them*/ -# define EVDEV_SWAP_AXES 0 /*Swap the x and y axes of the touchscreen*/ - -# define EVDEV_CALIBRATE 0 /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/ - -# if EVDEV_CALIBRATE -# define EVDEV_HOR_MIN 0 /*to invert axis swap EVDEV_XXX_MIN by EVDEV_XXX_MAX*/ -# define EVDEV_HOR_MAX 4096 /*"evtest" Linux tool can help to get the correct calibraion values>*/ -# define EVDEV_VER_MIN 0 -# define EVDEV_VER_MAX 4096 -# endif /*EVDEV_CALIBRATE*/ -#endif /*USE_EVDEV*/ - -/*------------------------------- - * Keyboard of a PC (using SDL) - *------------------------------*/ -#ifndef USE_KEYBOARD -# define USE_KEYBOARD 0 -#endif - -#if USE_KEYBOARD -/*No settings*/ -#endif - -#endif /*LV_DRV_CONF_H*/ -#endif /*End of "Content enable"*/ \ No newline at end of file From e9027e364a4e07f0be676c30356a80eab445f5f3 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 2 Aug 2024 14:22:06 +0200 Subject: [PATCH 03/10] Remove the deps directory from the include dirs The only header file left in the deps directory is the lv_conf.h header file, and that one is already detected by means of the LV_CONF_PATH and LVGL_PATH. Removing the hardcoded path also makes it easier to use an externally build LVGL library with its own config file. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 777843db..47a4fac6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,6 @@ add_subdirectory(deps/lvgl EXCLUDE_FROM_ALL) target_include_directories(lvgljs PUBLIC ${LVGL_PATH} - deps src/ src/engine src/engine/hal From b16d4b2f5be2e6440fbab7a3cc1c1a99639a8882 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 2 Aug 2024 13:35:30 +0200 Subject: [PATCH 04/10] Update the LVGL config file to v9.2.0 Replace the config file with the template config file from LVGL 9.2.0 and split the simulator and device configuration into two separate files. --- deps/lv_conf.h | 1281 +---------------------------------------- deps/lv_conf_device.h | 1113 +++++++++++++++++++++++++++++++++++ deps/lv_conf_sim.h | 1113 +++++++++++++++++++++++++++++++++++ 3 files changed, 2228 insertions(+), 1279 deletions(-) create mode 100644 deps/lv_conf_device.h create mode 100644 deps/lv_conf_sim.h diff --git a/deps/lv_conf.h b/deps/lv_conf.h index 305a4793..2403903d 100644 --- a/deps/lv_conf.h +++ b/deps/lv_conf.h @@ -1,1279 +1,2 @@ -/** - * @file lv_conf.h - * Configuration file for v8.2.0 - */ - -/* - * Copy this file as `lv_conf.h` - * 1. simply next to the `lvgl` folder - * 2. or any other places and - * - define `LV_CONF_INCLUDE_SIMPLE` - * - add the path as include path - */ - -/* clang-format off */ -#if IS_SIM /*Set it to "1" to enable content*/ - -#ifndef LV_CONF_H -#define LV_CONF_H - -#include - -/*==================== - COLOR SETTINGS - *====================*/ - -/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/ -#define LV_COLOR_DEPTH 32 - -/*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/ -#define LV_COLOR_16_SWAP 0 - -/*Enable more complex drawing routines to manage screens transparency. - *Can be used if the UI is above another layer, e.g. an OSD menu or video player. - *Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/ -#define LV_COLOR_SCREEN_TRANSP 0 - -/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. - * 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */ -#define LV_COLOR_MIX_ROUND_OFS (LV_COLOR_DEPTH == 32 ? 0: 128) - -/*Images pixels with this color will not be drawn if they are chroma keyed)*/ -#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/ - -/*========================= - MEMORY SETTINGS - *=========================*/ - -/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/ -#define LV_MEM_CUSTOM 0 -#if LV_MEM_CUSTOM == 0 - /*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/ - #define LV_MEM_SIZE (4096 * 4096U) /*[bytes]*/ - - /*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ - #define LV_MEM_ADR 0 /*0: unused*/ - /*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ - #if LV_MEM_ADR == 0 - //#define LV_MEM_POOL_INCLUDE your_alloc_library /* Uncomment if using an external allocator*/ - //#define LV_MEM_POOL_ALLOC your_alloc /* Uncomment if using an external allocator*/ - #endif - -#else /*LV_MEM_CUSTOM*/ - #define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ - #define LV_MEM_CUSTOM_ALLOC malloc - #define LV_MEM_CUSTOM_FREE free - #define LV_MEM_CUSTOM_REALLOC realloc -#endif /*LV_MEM_CUSTOM*/ - -/*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms. - *You will see an error log message if there wasn't enough buffers. */ -#define LV_MEM_BUF_MAX_NUM 16 - -/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/ -#define LV_MEMCPY_MEMSET_STD 0 - -/*==================== - HAL SETTINGS - *====================*/ - -/*Default display refresh period. LVG will redraw changed areas with this period time*/ -#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ - -/*Input device read period in milliseconds*/ -#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/ - -/*Use a custom tick source that tells the elapsed time in milliseconds. - *It removes the need to manually update the tick with `lv_tick_inc()`)*/ -#define LV_TICK_CUSTOM 0 -#if LV_TICK_CUSTOM - #define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ - #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ -#endif /*LV_TICK_CUSTOM*/ - -/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. - *(Not so important, you can adjust it to modify default sizes and spaces)*/ -#define LV_DPI_DEF 130 /*[px/inch]*/ - -/*======================= - * FEATURE CONFIGURATION - *=======================*/ - -/*------------- - * Drawing - *-----------*/ - -/*Enable complex draw engine. - *Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/ -#define LV_DRAW_COMPLEX 1 -#if LV_DRAW_COMPLEX != 0 - - /*Allow buffering some shadow calculation. - *LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` - *Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ - #define LV_SHADOW_CACHE_SIZE 0 - - /* Set number of maximally cached circle data. - * The circumference of 1/4 circle are saved for anti-aliasing - * radius * 4 bytes are used per circle (the most often used radiuses are saved) - * 0: to disable caching */ - #define LV_CIRCLE_CACHE_SIZE 4 -#endif /*LV_DRAW_COMPLEX*/ - -/*Default image cache size. Image caching keeps the images opened. - *If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added) - *With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. - *However the opened images might consume additional RAM. - *0: to disable caching*/ -#define LV_IMG_CACHE_DEF_SIZE 8 - -/*Number of stops allowed per gradient. Increase this to allow more stops. - *This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/ -#define LV_GRADIENT_MAX_STOPS 2 - -/*Default gradient buffer size. - *When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again. - *LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes. - *If the cache is too small the map will be allocated only while it's required for the drawing. - *0 mean no caching.*/ -#define LV_GRAD_CACHE_DEF_SIZE 0 - -/*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display) - *LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface - *The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */ -#define LV_DITHER_GRADIENT 1 -#if LV_DITHER_GRADIENT - /*Add support for error diffusion dithering. - *Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing. - *The increase in memory consumption is (24 bits * object's width)*/ - #define LV_DITHER_ERROR_DIFFUSION 1 -#endif - -/*Maximum buffer size to allocate for rotation. - *Only used if software rotation is enabled in the display driver.*/ -#define LV_DISP_ROT_MAX_BUF (32*1024) - -/*------------- - * GPU - *-----------*/ - -/*Use STM32's DMA2D (aka Chrom Art) GPU*/ -#define LV_USE_GPU_STM32_DMA2D 0 -#if LV_USE_GPU_STM32_DMA2D - /*Must be defined to include path of CMSIS header of target processor - e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ - #define LV_GPU_DMA2D_CMSIS_INCLUDE -#endif - -/*Use NXP's PXP GPU iMX RTxxx platforms*/ -#define LV_USE_GPU_NXP_PXP 0 -#if LV_USE_GPU_NXP_PXP - /*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) - * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS - * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected. - *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() - */ - #define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 -#endif - -/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/ -#define LV_USE_GPU_NXP_VG_LITE 0 - -/*Use SDL renderer API*/ -#define LV_USE_GPU_SDL 0 -#if LV_USE_GPU_SDL - #define LV_GPU_SDL_INCLUDE_PATH - /*Texture cache size, 8MB by default*/ - #define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8) - /*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/ - #define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6)) -#endif - -/*------------- - * Logging - *-----------*/ - -/*Enable the log module*/ -#define LV_USE_LOG 1 -#if LV_USE_LOG - - /*How important log should be added: - *LV_LOG_LEVEL_TRACE A lot of logs to give detailed information - *LV_LOG_LEVEL_INFO Log important events - *LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem - *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail - *LV_LOG_LEVEL_USER Only logs added by the user - *LV_LOG_LEVEL_NONE Do not log anything*/ - #define LV_LOG_LEVEL LV_LOG_LEVEL_USER - - /*1: Print the log with 'printf'; - *0: User need to register a callback with `lv_log_register_print_cb()`*/ - #define LV_LOG_PRINTF 1 - - /*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ - #define LV_LOG_TRACE_MEM 1 - #define LV_LOG_TRACE_TIMER 1 - #define LV_LOG_TRACE_INDEV 1 - #define LV_LOG_TRACE_DISP_REFR 1 - #define LV_LOG_TRACE_EVENT 1 - #define LV_LOG_TRACE_OBJ_CREATE 1 - #define LV_LOG_TRACE_LAYOUT 1 - #define LV_LOG_TRACE_ANIM 1 - -#endif /*LV_USE_LOG*/ - -/*------------- - * Asserts - *-----------*/ - -/*Enable asserts if an operation is failed or an invalid data is found. - *If LV_USE_LOG is enabled an error message will be printed on failure*/ -#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ -#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ -#define LV_USE_ASSERT_STYLE 1 /*Check if the styles are properly initialized. (Very fast, recommended)*/ -#define LV_USE_ASSERT_MEM_INTEGRITY 1 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ -#define LV_USE_ASSERT_OBJ 1 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ - -/*Add a custom handler when assert happens e.g. to restart the MCU*/ -#define LV_ASSERT_HANDLER_INCLUDE -#define LV_ASSERT_HANDLER while(1); /*Halt by default*/ - -/*------------- - * Others - *-----------*/ - -/*1: Show CPU usage and FPS count*/ -#define LV_USE_PERF_MONITOR 1 -#if LV_USE_PERF_MONITOR - #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT -#endif - -/*1: Show the used memory and the memory fragmentation - * Requires LV_MEM_CUSTOM = 0*/ -#define LV_USE_MEM_MONITOR 1 -#if LV_USE_MEM_MONITOR - #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT -#endif - -/*1: Draw random colored rectangles over the redrawn areas*/ -#define LV_USE_REFR_DEBUG 0 - -/*Change the built in (v)snprintf functions*/ -#define LV_SPRINTF_CUSTOM 0 -#if LV_SPRINTF_CUSTOM - #define LV_SPRINTF_INCLUDE - #define lv_snprintf snprintf - #define lv_vsnprintf vsnprintf -#else /*LV_SPRINTF_CUSTOM*/ - #define LV_SPRINTF_USE_FLOAT 0 -#endif /*LV_SPRINTF_CUSTOM*/ - -#define LV_USE_USER_DATA 1 - -/*Garbage Collector settings - *Used if lvgl is bound to higher level language and the memory is managed by that language*/ -#define LV_ENABLE_GC 0 -#if LV_ENABLE_GC != 0 - #define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ -#endif /*LV_ENABLE_GC*/ - -/*===================== - * COMPILER SETTINGS - *====================*/ - -/*For big endian systems set to 1*/ -#define LV_BIG_ENDIAN_SYSTEM 0 - -/*Define a custom attribute to `lv_tick_inc` function*/ -#define LV_ATTRIBUTE_TICK_INC - -/*Define a custom attribute to `lv_timer_handler` function*/ -#define LV_ATTRIBUTE_TIMER_HANDLER - -/*Define a custom attribute to `lv_disp_flush_ready` function*/ -#define LV_ATTRIBUTE_FLUSH_READY - -/*Required alignment size for buffers*/ -#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 - -/*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 to mark large constant arrays for example font's bitmaps*/ -#define LV_ATTRIBUTE_LARGE_CONST - -/*Compiler prefix for a big array declaration in RAM*/ -#define LV_ATTRIBUTE_LARGE_RAM_ARRAY - -/*Place performance critical functions into a faster memory (e.g RAM)*/ -#define LV_ATTRIBUTE_FAST_MEM - -/*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/ -#define LV_ATTRIBUTE_DMA - -/*Export integer constant to binding. This macro is used with constants in the form of LV_ that - *should also appear on LVGL binding API such as Micropython.*/ -#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/ - -/*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/ -#define LV_USE_LARGE_COORD 0 - -/*================== - * FONT USAGE - *===================*/ - -/*Montserrat fonts with ASCII range and some symbols using bpp = 4 - *https://fonts.google.com/specimen/Montserrat*/ -#define LV_FONT_MONTSERRAT_8 1 -#define LV_FONT_MONTSERRAT_10 1 -#define LV_FONT_MONTSERRAT_12 1 -#define LV_FONT_MONTSERRAT_14 1 -#define LV_FONT_MONTSERRAT_16 1 -#define LV_FONT_MONTSERRAT_18 1 -#define LV_FONT_MONTSERRAT_20 1 -#define LV_FONT_MONTSERRAT_22 1 -#define LV_FONT_MONTSERRAT_24 1 -#define LV_FONT_MONTSERRAT_26 1 -#define LV_FONT_MONTSERRAT_28 1 -#define LV_FONT_MONTSERRAT_30 1 -#define LV_FONT_MONTSERRAT_32 1 -#define LV_FONT_MONTSERRAT_34 1 -#define LV_FONT_MONTSERRAT_36 1 -#define LV_FONT_MONTSERRAT_38 1 -#define LV_FONT_MONTSERRAT_40 1 -#define LV_FONT_MONTSERRAT_42 1 -#define LV_FONT_MONTSERRAT_44 1 -#define LV_FONT_MONTSERRAT_46 1 -#define LV_FONT_MONTSERRAT_48 1 - -/*Demonstrate special features*/ -#define LV_FONT_MONTSERRAT_12_SUBPX 1 -#define LV_FONT_MONTSERRAT_28_COMPRESSED 1 /*bpp = 3*/ -#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1 /*Hebrew, Arabic, Persian letters and all their forms*/ -#define LV_FONT_SIMSUN_16_CJK 1 /*1000 most common CJK radicals*/ - -/*Pixel perfect monospace fonts*/ -#define LV_FONT_UNSCII_8 1 -#define LV_FONT_UNSCII_16 1 - -/*Optionally declare custom fonts here. - *You can use these fonts as default font too and they will be available globally. - *E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/ -#define LV_FONT_CUSTOM_DECLARE - -/*Always set a default font*/ -#define LV_FONT_DEFAULT &lv_font_montserrat_14 - -/*Enable handling large font and/or fonts with a lot of characters. - *The limit depends on the font size, font face and bpp. - *Compiler error will be triggered if a font needs it.*/ -#define LV_FONT_FMT_TXT_LARGE 1 - -/*Enables/disables support for compressed fonts.*/ -#define LV_USE_FONT_COMPRESSED 1 - -/*Enable subpixel rendering*/ -#define LV_USE_FONT_SUBPX 1 -#if LV_USE_FONT_SUBPX - /*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/ - #define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/ -#endif - -/*================= - * TEXT SETTINGS - *=================*/ - -/** - * Select a character encoding for strings. - * Your IDE or editor should have the same character encoding - * - LV_TXT_ENC_UTF8 - * - LV_TXT_ENC_ASCII - */ -#define LV_TXT_ENC LV_TXT_ENC_UTF8 - -/*Can break (wrap) texts on these chars*/ -#define LV_TXT_BREAK_CHARS " ,.;:-_" - -/*If a word is at least this long, will break wherever "prettiest" - *To disable, set to a value <= 0*/ -#define LV_TXT_LINE_BREAK_LONG_LEN 0 - -/*Minimum number of characters in a long word to put on a line before a break. - *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ -#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 - -/*Minimum number of characters in a long word to put on a line after a break. - *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ -#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 - -/*The control character to use for signalling text recoloring.*/ -#define LV_TXT_COLOR_CMD "#" - -/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. - *The direction will be processed according to the Unicode Bidirectional Algorithm: - *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ -#define LV_USE_BIDI 1 -#if LV_USE_BIDI - /*Set the default direction. Supported values: - *`LV_BASE_DIR_LTR` Left-to-Right - *`LV_BASE_DIR_RTL` Right-to-Left - *`LV_BASE_DIR_AUTO` detect texts base direction*/ - #define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO -#endif - -/*Enable Arabic/Persian processing - *In these languages characters should be replaced with an other form based on their position in the text*/ -#define LV_USE_ARABIC_PERSIAN_CHARS 1 - -/*================== - * WIDGET USAGE - *================*/ - -/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ - -#define LV_USE_ARC 1 - -#define LV_USE_ANIMIMG 1 - -#define LV_USE_BAR 1 - -#define LV_USE_BTN 1 - -#define LV_USE_BTNMATRIX 1 - -#define LV_USE_CANVAS 1 - -#define LV_USE_CHECKBOX 1 - -#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ - -#define LV_USE_IMG 1 /*Requires: lv_label*/ - -#define LV_USE_LABEL 1 -#if LV_USE_LABEL - #define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ - #define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ -#endif - -#define LV_USE_LINE 1 - -#define LV_USE_ROLLER 1 /*Requires: lv_label*/ -#if LV_USE_ROLLER - #define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/ -#endif - -#define LV_USE_SLIDER 1 /*Requires: lv_bar*/ - -#define LV_USE_SWITCH 1 - -#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ -#if LV_USE_TEXTAREA != 0 - #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ -#endif - -#define LV_USE_TABLE 1 - -/*================== - * EXTRA COMPONENTS - *==================*/ - -/*----------- - * Widgets - *----------*/ -#define LV_USE_CALENDAR 1 -#if LV_USE_CALENDAR - #define LV_CALENDAR_WEEK_STARTS_MONDAY 0 - #if LV_CALENDAR_WEEK_STARTS_MONDAY - #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"} - #else - #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} - #endif - - #define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} - #define LV_USE_CALENDAR_HEADER_ARROW 1 - #define LV_USE_CALENDAR_HEADER_DROPDOWN 1 -#endif /*LV_USE_CALENDAR*/ - -#define LV_USE_CHART 1 - -#define LV_USE_COLORWHEEL 1 - -#define LV_USE_IMGBTN 1 - -#define LV_USE_KEYBOARD 1 - -#define LV_USE_LED 1 - -#define LV_USE_LIST 1 - -#define LV_USE_MENU 1 - -#define LV_USE_METER 1 - -#define LV_USE_MSGBOX 1 - -#define LV_USE_SPINBOX 1 - -#define LV_USE_SPINNER 1 - -#define LV_USE_TABVIEW 1 - -#define LV_USE_TILEVIEW 1 - -#define LV_USE_WIN 1 - -#define LV_USE_SPAN 1 -#if LV_USE_SPAN - /*A line text can contain maximum num of span descriptor */ - #define LV_SPAN_SNIPPET_STACK_SIZE 64 -#endif - -/*----------- - * Themes - *----------*/ - -/*A simple, impressive and very complete theme*/ -#define LV_USE_THEME_DEFAULT 1 -#if LV_USE_THEME_DEFAULT - - /*0: Light mode; 1: Dark mode*/ - #define LV_THEME_DEFAULT_DARK 0 - - /*1: Enable grow on press*/ - #define LV_THEME_DEFAULT_GROW 1 - - /*Default transition time in [ms]*/ - #define LV_THEME_DEFAULT_TRANSITION_TIME 80 -#endif /*LV_USE_THEME_DEFAULT*/ - -/*A very simple theme that is a good starting point for a custom theme*/ -#define LV_USE_THEME_BASIC 1 - -/*A theme designed for monochrome displays*/ -#define LV_USE_THEME_MONO 1 - -/*----------- - * Layouts - *----------*/ - -/*A layout similar to Flexbox in CSS.*/ -#define LV_USE_FLEX 1 - -/*A layout similar to Grid in CSS.*/ -#define LV_USE_GRID 1 - -/*--------------------- - * 3rd party libraries - *--------------------*/ - -/*File system interfaces for common APIs */ - -/*API for fopen, fread, etc*/ -#define LV_USE_FS_STDIO 1 -#if LV_USE_FS_STDIO - #define LV_FS_STDIO_LETTER 'A' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ - #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ -#endif - -/*API for open, read, etc*/ -#define LV_USE_FS_POSIX 0 -#if LV_USE_FS_POSIX - #define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ - #define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ -#endif - -/*API for CreateFile, ReadFile, etc*/ -#define LV_USE_FS_WIN32 0 -#if LV_USE_FS_WIN32 - #define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ - #define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ -#endif - -/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/ -#define LV_USE_FS_FATFS 0 -#if LV_USE_FS_FATFS - #define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ -#endif - -/*PNG decoder library*/ -#define LV_USE_PNG 0 - -/*BMP decoder library*/ -#define LV_USE_BMP 0 - -/* JPG + split JPG decoder library. - * Split JPG is a custom format optimized for embedded systems. */ -#define LV_USE_SJPG 0 - -/*GIF decoder library*/ -#define LV_USE_GIF 1 - -/*QR code library*/ -#define LV_USE_QRCODE 0 - -/*FreeType library*/ -#define LV_USE_FREETYPE 0 -#if LV_USE_FREETYPE - /*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/ - #define LV_FREETYPE_CACHE_SIZE (16 * 1024) - #if LV_FREETYPE_CACHE_SIZE >= 0 - /* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */ - /* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */ - /* if font size >= 256, must be configured as image cache */ - #define LV_FREETYPE_SBIT_CACHE 0 - /* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */ - /* (0:use system defaults) */ - #define LV_FREETYPE_CACHE_FT_FACES 0 - #define LV_FREETYPE_CACHE_FT_SIZES 0 - #endif -#endif - -/*Rlottie library*/ -#define LV_USE_RLOTTIE 0 - -/*FFmpeg library for image decoding and playing videos - *Supports all major image formats so do not enable other image decoder with it*/ -#define LV_USE_FFMPEG 0 -#if LV_USE_FFMPEG - /*Dump input information to stderr*/ - #define LV_FFMPEG_AV_DUMP_FORMAT 0 -#endif - -/*----------- - * Others - *----------*/ - -/*1: Enable API to take snapshot for object*/ -#define LV_USE_SNAPSHOT 1 - -/*1: Enable Monkey test*/ -#define LV_USE_MONKEY 1 - -/*1: Enable grid navigation*/ -#define LV_USE_GRIDNAV 1 - -/*================== -* EXAMPLES -*==================*/ - -/*Enable the examples to be built with the library*/ -#define LV_BUILD_EXAMPLES 1 - -/*=================== - * DEMO USAGE - ====================*/ - -/*Show some widget. It might be required to increase `LV_MEM_SIZE` */ -#define LV_USE_DEMO_WIDGETS 1 -#if LV_USE_DEMO_WIDGETS -#define LV_DEMO_WIDGETS_SLIDESHOW 0 -#endif - -/*Demonstrate the usage of encoder and keyboard*/ -#define LV_USE_DEMO_KEYPAD_AND_ENCODER 1 - -/*Benchmark your system*/ -#define LV_USE_DEMO_BENCHMARK 1 - -/*Stress test for LVGL*/ -#define LV_USE_DEMO_STRESS 1 - -/*Music player demo*/ -#define LV_USE_DEMO_MUSIC 1 -#if LV_USE_DEMO_MUSIC -# define LV_DEMO_MUSIC_SQUARE 0 -# define LV_DEMO_MUSIC_LANDSCAPE 0 -# define LV_DEMO_MUSIC_ROUND 0 -# define LV_DEMO_MUSIC_LARGE 0 -# define LV_DEMO_MUSIC_AUTO_PLAY 0 -#endif - -/*--END OF LV_CONF_H--*/ - -#endif /*LV_CONF_H*/ - -#endif /*End of "Content enable"*/ - -#if IS_DEVICE /*Set it to "1" to enable content*/ -#ifndef LV_CONF_H -#define LV_CONF_H - -#include - -/*==================== - COLOR SETTINGS - *====================*/ - -/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/ -#define LV_COLOR_DEPTH 32 - -/*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/ -#define LV_COLOR_16_SWAP 0 - -/*Enable more complex drawing routines to manage screens transparency. - *Can be used if the UI is above another layer, e.g. an OSD menu or video player. - *Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/ -#define LV_COLOR_SCREEN_TRANSP 0 - -/*Images pixels with this color will not be drawn if they are chroma keyed)*/ -#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/ - -/*========================= - MEMORY SETTINGS - *=========================*/ - -/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/ -#define LV_MEM_CUSTOM 0 -#if LV_MEM_CUSTOM == 0 -/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/ -# define LV_MEM_SIZE (4096U * 4096U) /*[bytes]*/ - -/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ -# define LV_MEM_ADR 0 /*0: unused*/ -/*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ -#if LV_MEM_ADR == 0 -//#define LV_MEM_POOL_INCLUDE your_alloc_library /* Uncomment if using an external allocator*/ -//#define LV_MEM_POOL_ALLOC your_alloc /* Uncomment if using an external allocator*/ -#endif - -#else /*LV_MEM_CUSTOM*/ -# define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ -# define LV_MEM_CUSTOM_ALLOC malloc -# define LV_MEM_CUSTOM_FREE free -# define LV_MEM_CUSTOM_REALLOC realloc -#endif /*LV_MEM_CUSTOM*/ - -/*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms. - *You will see an error log message if there wasn't enough buffers. */ -#define LV_MEM_BUF_MAX_NUM 64//16 - -/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/ -#define LV_MEMCPY_MEMSET_STD 0 - -/*==================== - HAL SETTINGS - *====================*/ - -/*Default display refresh period. LVG will redraw changed areas with this period time*/ -#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ - -/*Input device read period in milliseconds*/ -#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/ - -/*Use a custom tick source that tells the elapsed time in milliseconds. - *It removes the need to manually update the tick with `lv_tick_inc()`)*/ -uint32_t custom_tick_get(void); -#define LV_TICK_CUSTOM 1 -#if LV_TICK_CUSTOM -#define LV_TICK_CUSTOM_INCLUDE /*Header for the system time function*/ -#define LV_TICK_CUSTOM_SYS_TIME_EXPR (custom_tick_get()) /*Expression evaluating to current system time in ms*/ -#endif /*LV_TICK_CUSTOM*/ - -/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. - *(Not so important, you can adjust it to modify default sizes and spaces)*/ -#define LV_DPI_DEF 130 /*[px/inch]*/ - -/*======================= - * FEATURE CONFIGURATION - *=======================*/ - -/*------------- - * Drawing - *-----------*/ - -/*Enable complex draw engine. - *Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/ -#define LV_DRAW_COMPLEX 1 -#if LV_DRAW_COMPLEX != 0 - -/*Allow buffering some shadow calculation. - *LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` - *Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ -#define LV_SHADOW_CACHE_SIZE 0 - -/* Set number of maximally cached circle data. - * The circumference of 1/4 circle are saved for anti-aliasing - * radius * 4 bytes are used per circle (the most often used radiuses are saved) - * 0: to disable caching */ -#define LV_CIRCLE_CACHE_SIZE 4 - -#endif /*LV_DRAW_COMPLEX*/ - -/*Default image cache size. Image caching keeps the images opened. - *If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added) - *With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. - *However the opened images might consume additional RAM. - *0: to disable caching*/ -#define LV_IMG_CACHE_DEF_SIZE 1 - -/*Maximum buffer size to allocate for rotation. Only used if software rotation is enabled in the display driver.*/ -#define LV_DISP_ROT_MAX_BUF (128*1024) //(10*1024) - -/*------------- - * GPU - *-----------*/ - -/*Use STM32's DMA2D (aka Chrom Art) GPU*/ -#define LV_USE_GPU_STM32_DMA2D 0 -#if LV_USE_GPU_STM32_DMA2D -/*Must be defined to include path of CMSIS header of target processor -e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ -#define LV_GPU_DMA2D_CMSIS_INCLUDE -#endif - -/*Use NXP's PXP GPU iMX RTxxx platforms*/ -#define LV_USE_GPU_NXP_PXP 0 -#if LV_USE_GPU_NXP_PXP -/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) - * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS - * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected. - *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() - */ -#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 -#endif - -/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/ -#define LV_USE_GPU_NXP_VG_LITE 0 - -/*Use exnternal renderer*/ -#define LV_USE_EXTERNAL_RENDERER 0 - -/*Use SDL renderer API. Requires LV_USE_EXTERNAL_RENDERER*/ -#define LV_USE_GPU_SDL 0 -#if LV_USE_GPU_SDL -# define LV_GPU_SDL_INCLUDE_PATH -#endif - -/*------------- - * Logging - *-----------*/ - -/*Enable the log module*/ -#define LV_USE_LOG 1 -#if LV_USE_LOG - -/*How important log should be added: - *LV_LOG_LEVEL_TRACE A lot of logs to give detailed information - *LV_LOG_LEVEL_INFO Log important events - *LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem - *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail - *LV_LOG_LEVEL_USER Only logs added by the user - *LV_LOG_LEVEL_NONE Do not log anything*/ -# define LV_LOG_LEVEL LV_LOG_LEVEL_USER - -/*1: Print the log with 'printf'; - *0: User need to register a callback with `lv_log_register_print_cb()`*/ -# define LV_LOG_PRINTF 1 - -/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ -# define LV_LOG_TRACE_MEM 1 -# define LV_LOG_TRACE_TIMER 1 -# define LV_LOG_TRACE_INDEV 1 -# define LV_LOG_TRACE_DISP_REFR 1 -# define LV_LOG_TRACE_EVENT 1 -# define LV_LOG_TRACE_OBJ_CREATE 1 -# define LV_LOG_TRACE_LAYOUT 1 -# define LV_LOG_TRACE_ANIM 1 - -#endif /*LV_USE_LOG*/ - -/*------------- - * Asserts - *-----------*/ - -/*Enable asserts if an operation is failed or an invalid data is found. - *If LV_USE_LOG is enabled an error message will be printed on failure*/ -#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ -#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ -#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/ -#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ -#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ - -/*Add a custom handler when assert happens e.g. to restart the MCU*/ -#define LV_ASSERT_HANDLER_INCLUDE -#define LV_ASSERT_HANDLER while(1); /*Halt by default*/ - -/*------------- - * Others - *-----------*/ - -/*1: Show CPU usage and FPS count in the right bottom corner*/ -#define LV_USE_PERF_MONITOR 0 - -/*1: Show the used memory and the memory fragmentation in the left bottom corner - * Requires LV_MEM_CUSTOM = 0*/ -#define LV_USE_MEM_MONITOR 0 - -/*1: Draw random colored rectangles over the redrawn areas*/ -#define LV_USE_REFR_DEBUG 0 - -/*Change the built in (v)snprintf functions*/ -#define LV_SPRINTF_CUSTOM 0 -#if LV_SPRINTF_CUSTOM -# define LV_SPRINTF_INCLUDE -# define lv_snprintf snprintf -# define lv_vsnprintf vsnprintf -#else /*LV_SPRINTF_CUSTOM*/ -# define LV_SPRINTF_USE_FLOAT 0 -#endif /*LV_SPRINTF_CUSTOM*/ - -#define LV_USE_USER_DATA 1 - -/*Garbage Collector settings - *Used if lvgl is bound to higher level language and the memory is managed by that language*/ -#define LV_ENABLE_GC 0 -#if LV_ENABLE_GC != 0 -# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ -#endif /*LV_ENABLE_GC*/ - -/*===================== - * COMPILER SETTINGS - *====================*/ - -/*For big endian systems set to 1*/ -#define LV_BIG_ENDIAN_SYSTEM 0 - -/*Define a custom attribute to `lv_tick_inc` function*/ -#define LV_ATTRIBUTE_TICK_INC - -/*Define a custom attribute to `lv_timer_handler` function*/ -#define LV_ATTRIBUTE_TIMER_HANDLER - -/*Define a custom attribute to `lv_disp_flush_ready` function*/ -#define LV_ATTRIBUTE_FLUSH_READY - -/*Required alignment size for buffers*/ -#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 - -/*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 to mark large constant arrays for example font's bitmaps*/ -#define LV_ATTRIBUTE_LARGE_CONST - -/*Complier prefix for a big array declaration in RAM*/ -#define LV_ATTRIBUTE_LARGE_RAM_ARRAY - -/*Place performance critical functions into a faster memory (e.g RAM)*/ -#define LV_ATTRIBUTE_FAST_MEM - -/*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/ -#define LV_ATTRIBUTE_DMA - -/*Export integer constant to binding. This macro is used with constants in the form of LV_ that - *should also appear on LVGL binding API such as Micropython.*/ -#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/ - -/*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/ -#define LV_USE_LARGE_COORD 0 - -/*================== - * FONT USAGE - *===================*/ - -/*Montserrat fonts with ASCII range and some symbols using bpp = 4 - *https://fonts.google.com/specimen/Montserrat*/ -#define LV_FONT_MONTSERRAT_8 1 -#define LV_FONT_MONTSERRAT_10 1 -#define LV_FONT_MONTSERRAT_12 1 -#define LV_FONT_MONTSERRAT_14 1 -#define LV_FONT_MONTSERRAT_16 1 -#define LV_FONT_MONTSERRAT_18 1 -#define LV_FONT_MONTSERRAT_20 1 -#define LV_FONT_MONTSERRAT_22 1 -#define LV_FONT_MONTSERRAT_24 1 -#define LV_FONT_MONTSERRAT_26 1 -#define LV_FONT_MONTSERRAT_28 1 -#define LV_FONT_MONTSERRAT_30 1 -#define LV_FONT_MONTSERRAT_32 1 -#define LV_FONT_MONTSERRAT_34 1 -#define LV_FONT_MONTSERRAT_36 1 -#define LV_FONT_MONTSERRAT_38 1 -#define LV_FONT_MONTSERRAT_40 1 -#define LV_FONT_MONTSERRAT_42 1 -#define LV_FONT_MONTSERRAT_44 1 -#define LV_FONT_MONTSERRAT_46 1 -#define LV_FONT_MONTSERRAT_48 1 - -/*Demonstrate special features*/ -#define LV_FONT_MONTSERRAT_12_SUBPX 1 -#define LV_FONT_MONTSERRAT_28_COMPRESSED 1 /*bpp = 3*/ -#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1 /*Hebrew, Arabic, Perisan letters and all their forms*/ -#define LV_FONT_SIMSUN_16_CJK 1 /*1000 most common CJK radicals*/ - -/*Pixel perfect monospace fonts*/ -#define LV_FONT_UNSCII_8 1 -#define LV_FONT_UNSCII_16 1 - -/*Optionally declare custom fonts here. - *You can use these fonts as default font too and they will be available globally. - *E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/ -#define LV_FONT_CUSTOM_DECLARE - -/*Always set a default font*/ -#define LV_FONT_DEFAULT &lv_font_montserrat_14 - -/*Enable handling large font and/or fonts with a lot of characters. - *The limit depends on the font size, font face and bpp. - *Compiler error will be triggered if a font needs it.*/ -#define LV_FONT_FMT_TXT_LARGE 0 - -/*Enables/disables support for compressed fonts.*/ -#define LV_USE_FONT_COMPRESSED 0 - -/*Enable subpixel rendering*/ -#define LV_USE_FONT_SUBPX 0 -#if LV_USE_FONT_SUBPX -/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/ -#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/ -#endif - -/*================= - * TEXT SETTINGS - *=================*/ - -/** - * Select a character encoding for strings. - * Your IDE or editor should have the same character encoding - * - LV_TXT_ENC_UTF8 - * - LV_TXT_ENC_ASCII - */ -#define LV_TXT_ENC LV_TXT_ENC_UTF8 - - /*Can break (wrap) texts on these chars*/ -#define LV_TXT_BREAK_CHARS " ,.;:-_" - -/*If a word is at least this long, will break wherever "prettiest" - *To disable, set to a value <= 0*/ -#define LV_TXT_LINE_BREAK_LONG_LEN 0 - -/*Minimum number of characters in a long word to put on a line before a break. - *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ -#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 - -/*Minimum number of characters in a long word to put on a line after a break. - *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ -#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 - -/*The control character to use for signalling text recoloring.*/ -#define LV_TXT_COLOR_CMD "#" - -/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. - *The direction will be processed according to the Unicode Bidirectional Algorithm: - *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ -#define LV_USE_BIDI 0 -#if LV_USE_BIDI -/*Set the default direction. Supported values: - *`LV_BASE_DIR_LTR` Left-to-Right - *`LV_BASE_DIR_RTL` Right-to-Left - *`LV_BASE_DIR_AUTO` detect texts base direction*/ -#define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO -#endif - -/*Enable Arabic/Persian processing - *In these languages characters should be replaced with an other form based on their position in the text*/ -#define LV_USE_ARABIC_PERSIAN_CHARS 0 - -/*================== - * WIDGET USAGE - *================*/ - -/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ - -#define LV_USE_ARC 1 - -#define LV_USE_ANIMIMG 1 - -#define LV_USE_BAR 1 - -#define LV_USE_BTN 1 - -#define LV_USE_BTNMATRIX 1 - -#define LV_USE_CANVAS 1 - -#define LV_USE_CHECKBOX 1 - -#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ - -#define LV_USE_IMG 1 /*Requires: lv_label*/ - -#define LV_USE_LABEL 1 -#if LV_USE_LABEL -# define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ -# define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ -#endif - -#define LV_USE_LINE 1 - -#define LV_USE_ROLLER 1 /*Requires: lv_label*/ -#if LV_USE_ROLLER -# define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/ -#endif - -#define LV_USE_SLIDER 1 /*Requires: lv_bar*/ - -#define LV_USE_SWITCH 1 - -#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ -#if LV_USE_TEXTAREA != 0 -# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ -#endif - -#define LV_USE_TABLE 1 - -/*================== - * EXTRA COMPONENTS - *==================*/ - -/*----------- - * Widgets - *----------*/ -#define LV_USE_CALENDAR 1 -#if LV_USE_CALENDAR -# define LV_CALENDAR_WEEK_STARTS_MONDAY 0 -# if LV_CALENDAR_WEEK_STARTS_MONDAY -# define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"} -# else -# define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} -# endif - -# define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} -# define LV_USE_CALENDAR_HEADER_ARROW 1 -# define LV_USE_CALENDAR_HEADER_DROPDOWN 1 -#endif /*LV_USE_CALENDAR*/ - -#define LV_USE_CHART 1 - -#define LV_USE_COLORWHEEL 1 - -#define LV_USE_IMGBTN 1 - -#define LV_USE_KEYBOARD 1 - -#define LV_USE_LED 1 - -#define LV_USE_LIST 1 - -#define LV_USE_METER 1 - -#define LV_USE_MSGBOX 1 - -#define LV_USE_SPINBOX 1 - -#define LV_USE_SPINNER 1 - -#define LV_USE_TABVIEW 1 - -#define LV_USE_TILEVIEW 1 - -#define LV_USE_WIN 1 - -#define LV_USE_SPAN 1 -#if LV_USE_SPAN -/*A line text can contain maximum num of span descriptor */ -# define LV_SPAN_SNIPPET_STACK_SIZE 64 -#endif - -/*----------- - * Themes - *----------*/ - -/*A simple, impressive and very complete theme*/ -#define LV_USE_THEME_DEFAULT 1 -#if LV_USE_THEME_DEFAULT - -/*0: Light mode; 1: Dark mode*/ -# define LV_THEME_DEFAULT_DARK 0 - -/*1: Enable grow on press*/ -# define LV_THEME_DEFAULT_GROW 1 - -/*Default transition time in [ms]*/ -# define LV_THEME_DEFAULT_TRANSITION_TIME 80 -#endif /*LV_USE_THEME_DEFAULT*/ - -/*A very simple theme that is a good starting point for a custom theme*/ - #define LV_USE_THEME_BASIC 1 - -/*A theme designed for monochrome displays*/ -#define LV_USE_THEME_MONO 1 - -/*----------- - * Layouts - *----------*/ - -/*A layout similar to Flexbox in CSS.*/ -#define LV_USE_FLEX 1 - -/*A layout similar to Grid in CSS.*/ -#define LV_USE_GRID 1 - -/*--------------------- - * 3rd party libraries - *--------------------*/ - -/*File system interfaces for common APIs - *To enable set a driver letter for that API*/ -#define LV_USE_FS_STDIO '\0' /*Uses fopen, fread, etc*/ -//#define LV_FS_STDIO_PATH "/home/john/" /*Set the working directory. If commented it will be "./" */ - -#define LV_USE_FS_POSIX '\0' /*Uses open, read, etc*/ -//#define LV_FS_POSIX_PATH "/home/john/" /*Set the working directory. If commented it will be "./" */ - -#define LV_USE_FS_WIN32 '\0' /*Uses CreateFile, ReadFile, etc*/ -//#define LV_FS_WIN32_PATH "C:\\Users\\john\\" /*Set the working directory. If commented it will be ".\\" */ - -#define LV_USE_FS_FATFS '\0' /*Uses f_open, f_read, etc*/ - -/*PNG decoder library*/ -#define LV_USE_PNG 0 - -/*BMP decoder library*/ -#define LV_USE_BMP 0 - -/* JPG + split JPG decoder library. - * Split JPG is a custom format optimized for embedded systems. */ -#define LV_USE_SJPG 0 - -/*GIF decoder library*/ -#define LV_USE_GIF 1 - -/*QR code library*/ -#define LV_USE_QRCODE 1 - -/*FreeType library*/ -#define LV_USE_FREETYPE 0 -#if LV_USE_FREETYPE -/*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/ -# define LV_FREETYPE_CACHE_SIZE (16 * 1024) -#endif - -/*Rlottie library*/ -#define LV_USE_RLOTTIE 0 - -/*----------- - * Others - *----------*/ - -/*1: Enable API to take snapshot for object*/ -#define LV_USE_SNAPSHOT 1 - - -/*================== -* EXAMPLES -*==================*/ - -/*Enable the examples to be built with the library*/ -#define LV_BUILD_EXAMPLES 0 - -/*--END OF LV_CONF_H--*/ - -#endif /*LV_CONF_H*/ -#endif /*End of "Content enable"*/ \ No newline at end of file +#include "lv_conf_sim.h" +#include "lv_conf_device.h" diff --git a/deps/lv_conf_device.h b/deps/lv_conf_device.h new file mode 100644 index 00000000..9d0ba1da --- /dev/null +++ b/deps/lv_conf_device.h @@ -0,0 +1,1113 @@ +/** + * @file lv_conf.h + * Configuration file for v9.2.0 + */ + +/* + * Copy this file as `lv_conf.h` + * 1. simply next to the `lvgl` folder + * 2. or any other places and + * - define `LV_CONF_INCLUDE_SIMPLE` + * - add the path as include path + */ + +/* clang-format off */ +#if IS_DEVICE /*Set it to "1" to enable content*/ + +#ifndef LV_CONF_H +#define LV_CONF_H + +/*If you need to include anything here, do it inside the `__ASSEMBLY__` guard */ +#if 0 && defined(__ASSEMBLY__) +#include "my_include.h" +#endif + +/*==================== + COLOR SETTINGS + *====================*/ + +/*Color depth: 1 (I1), 8 (L8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888)*/ +#define LV_COLOR_DEPTH 16 + +/*========================= + STDLIB WRAPPER SETTINGS + *=========================*/ + +/* Possible values + * - LV_STDLIB_BUILTIN: LVGL's built in implementation + * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc + * - LV_STDLIB_MICROPYTHON: MicroPython implementation + * - LV_STDLIB_RTTHREAD: RT-Thread implementation + * - LV_STDLIB_CUSTOM: Implement the functions externally + */ +#define LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN +#define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN +#define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN + +#define LV_STDINT_INCLUDE +#define LV_STDDEF_INCLUDE +#define LV_STDBOOL_INCLUDE +#define LV_INTTYPES_INCLUDE +#define LV_LIMITS_INCLUDE +#define LV_STDARG_INCLUDE + +#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN + /*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/ + #define LV_MEM_SIZE (64 * 1024U) /*[bytes]*/ + + /*Size of the memory expand for `lv_malloc()` in bytes*/ + #define LV_MEM_POOL_EXPAND_SIZE 0 + + /*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ + #define LV_MEM_ADR 0 /*0: unused*/ + /*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ + #if LV_MEM_ADR == 0 + #undef LV_MEM_POOL_INCLUDE + #undef LV_MEM_POOL_ALLOC + #endif +#endif /*LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN*/ + +/*==================== + HAL SETTINGS + *====================*/ + +/*Default display refresh, input device read and animation step period.*/ +#define LV_DEF_REFR_PERIOD 33 /*[ms]*/ + +/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. + *(Not so important, you can adjust it to modify default sizes and spaces)*/ +#define LV_DPI_DEF 130 /*[px/inch]*/ + +/*================= + * OPERATING SYSTEM + *=================*/ +/*Select an operating system to use. Possible options: + * - LV_OS_NONE + * - LV_OS_PTHREAD + * - LV_OS_FREERTOS + * - LV_OS_CMSIS_RTOS2 + * - LV_OS_RTTHREAD + * - LV_OS_WINDOWS + * - LV_OS_MQX + * - LV_OS_CUSTOM */ +#define LV_USE_OS LV_OS_NONE + +#if LV_USE_OS == LV_OS_CUSTOM + #define LV_OS_CUSTOM_INCLUDE +#endif + +/*======================== + * RENDERING CONFIGURATION + *========================*/ + +/*Align the stride of all layers and images to this bytes*/ +#define LV_DRAW_BUF_STRIDE_ALIGN 1 + +/*Align the start address of draw_buf addresses to this bytes*/ +#define LV_DRAW_BUF_ALIGN 4 + +/*Using matrix for transformations. + *Requirements: + `LV_USE_MATRIX = 1`. + The rendering engine needs to support 3x3 matrix transformations.*/ +#define LV_DRAW_TRANSFORM_USE_MATRIX 0 + +/* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode + * it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks. + * "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers + * and can't be drawn in chunks. */ + +/*The target buffer size for simple layer chunks.*/ +#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/ + +/* The stack size of the drawing thread. + * NOTE: If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more. + */ +#define LV_DRAW_THREAD_STACK_SIZE (8 * 1024) /*[bytes]*/ + +#define LV_USE_DRAW_SW 1 +#if LV_USE_DRAW_SW == 1 + + /* + * Selectively disable color format support in order to reduce code size. + * NOTE: some features use certain color formats internally, e.g. + * - gradients use RGB888 + * - bitmaps with transparency may use ARGB8888 + */ + + #define LV_DRAW_SW_SUPPORT_RGB565 1 + #define LV_DRAW_SW_SUPPORT_RGB565A8 1 + #define LV_DRAW_SW_SUPPORT_RGB888 1 + #define LV_DRAW_SW_SUPPORT_XRGB8888 1 + #define LV_DRAW_SW_SUPPORT_ARGB8888 1 + #define LV_DRAW_SW_SUPPORT_L8 1 + #define LV_DRAW_SW_SUPPORT_AL88 1 + #define LV_DRAW_SW_SUPPORT_A8 1 + #define LV_DRAW_SW_SUPPORT_I1 1 + + /* Set the number of draw unit. + * > 1 requires an operating system enabled in `LV_USE_OS` + * > 1 means multiple threads will render the screen in parallel */ + #define LV_DRAW_SW_DRAW_UNIT_CNT 1 + + /* Use Arm-2D to accelerate the sw render */ + #define LV_USE_DRAW_ARM2D_SYNC 0 + + /* Enable native helium assembly to be compiled */ + #define LV_USE_NATIVE_HELIUM_ASM 0 + + /* 0: use a simple renderer capable of drawing only simple rectangles with gradient, images, texts, and straight lines only + * 1: use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too */ + #define LV_DRAW_SW_COMPLEX 1 + + #if LV_DRAW_SW_COMPLEX == 1 + /*Allow buffering some shadow calculation. + *LV_DRAW_SW_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` + *Caching has LV_DRAW_SW_SHADOW_CACHE_SIZE^2 RAM cost*/ + #define LV_DRAW_SW_SHADOW_CACHE_SIZE 0 + + /* Set number of maximally cached circle data. + * The circumference of 1/4 circle are saved for anti-aliasing + * radius * 4 bytes are used per circle (the most often used radiuses are saved) + * 0: to disable caching */ + #define LV_DRAW_SW_CIRCLE_CACHE_SIZE 4 + #endif + + #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE + + #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM + #define LV_DRAW_SW_ASM_CUSTOM_INCLUDE "" + #endif + + /* Enable drawing complex gradients in software: linear at an angle, radial or conical */ + #define LV_USE_DRAW_SW_COMPLEX_GRADIENTS 0 +#endif + +/* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */ +#define LV_USE_DRAW_VGLITE 0 + +#if LV_USE_DRAW_VGLITE + /* Enable blit quality degradation workaround recommended for screen's dimension > 352 pixels. */ + #define LV_USE_VGLITE_BLIT_SPLIT 0 + + #if LV_USE_OS + /* Use additional draw thread for VG-Lite processing.*/ + #define LV_USE_VGLITE_DRAW_THREAD 1 + + #if LV_USE_VGLITE_DRAW_THREAD + /* Enable VGLite draw async. Queue multiple tasks and flash them once to the GPU. */ + #define LV_USE_VGLITE_DRAW_ASYNC 1 + #endif + #endif + + /* Enable VGLite asserts. */ + #define LV_USE_VGLITE_ASSERT 0 +#endif + +/* Use NXP's PXP on iMX RTxxx platforms. */ +#define LV_USE_DRAW_PXP 0 + +#if LV_USE_DRAW_PXP + #if LV_USE_OS + /* Use additional draw thread for PXP processing.*/ + #define LV_USE_PXP_DRAW_THREAD 1 + #endif + + /* Enable PXP asserts. */ + #define LV_USE_PXP_ASSERT 0 +#endif + +/* Use Renesas Dave2D on RA platforms. */ +#define LV_USE_DRAW_DAVE2D 0 + +/* Draw using cached SDL textures*/ +#define LV_USE_DRAW_SDL 0 + +/* Use VG-Lite GPU. */ +#define LV_USE_DRAW_VG_LITE 0 + +#if LV_USE_DRAW_VG_LITE + /* Enable VG-Lite custom external 'gpu_init()' function */ + #define LV_VG_LITE_USE_GPU_INIT 0 + + /* Enable VG-Lite assert. */ + #define LV_VG_LITE_USE_ASSERT 0 + + /* VG-Lite flush commit trigger threshold. GPU will try to batch these many draw tasks. */ + #define LV_VG_LITE_FLUSH_MAX_COUNT 8 + + /* Enable border to simulate shadow + * NOTE: which usually improves performance, + * but does not guarantee the same rendering quality as the software. */ + #define LV_VG_LITE_USE_BOX_SHADOW 0 + + /* VG-Lite gradient maximum cache number. + * NOTE: The memory usage of a single gradient image is 4K bytes. + */ + #define LV_VG_LITE_GRAD_CACHE_CNT 32 + + /* VG-Lite stroke maximum cache number. + */ + #define LV_VG_LITE_STROKE_CACHE_CNT 32 + +#endif + +/*======================= + * FEATURE CONFIGURATION + *=======================*/ + +/*------------- + * Logging + *-----------*/ + +/*Enable the log module*/ +#define LV_USE_LOG 0 +#if LV_USE_LOG + + /*How important log should be added: + *LV_LOG_LEVEL_TRACE A lot of logs to give detailed information + *LV_LOG_LEVEL_INFO Log important events + *LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem + *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail + *LV_LOG_LEVEL_USER Only logs added by the user + *LV_LOG_LEVEL_NONE Do not log anything*/ + #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN + + /*1: Print the log with 'printf'; + *0: User need to register a callback with `lv_log_register_print_cb()`*/ + #define LV_LOG_PRINTF 0 + + /*Set callback to print the logs. + *E.g `my_print`. The prototype should be `void my_print(lv_log_level_t level, const char * buf)` + *Can be overwritten by `lv_log_register_print_cb`*/ + //#define LV_LOG_PRINT_CB + + /*1: Enable print timestamp; + *0: Disable print timestamp*/ + #define LV_LOG_USE_TIMESTAMP 1 + + /*1: Print file and line number of the log; + *0: Do not print file and line number of the log*/ + #define LV_LOG_USE_FILE_LINE 1 + + + /*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ + #define LV_LOG_TRACE_MEM 1 + #define LV_LOG_TRACE_TIMER 1 + #define LV_LOG_TRACE_INDEV 1 + #define LV_LOG_TRACE_DISP_REFR 1 + #define LV_LOG_TRACE_EVENT 1 + #define LV_LOG_TRACE_OBJ_CREATE 1 + #define LV_LOG_TRACE_LAYOUT 1 + #define LV_LOG_TRACE_ANIM 1 + #define LV_LOG_TRACE_CACHE 1 + +#endif /*LV_USE_LOG*/ + +/*------------- + * Asserts + *-----------*/ + +/*Enable asserts if an operation is failed or an invalid data is found. + *If LV_USE_LOG is enabled an error message will be printed on failure*/ +#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ +#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ +#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/ +#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ +#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ + +/*Add a custom handler when assert happens e.g. to restart the MCU*/ +#define LV_ASSERT_HANDLER_INCLUDE +#define LV_ASSERT_HANDLER while(1); /*Halt by default*/ + +/*------------- + * Debug + *-----------*/ + +/*1: Draw random colored rectangles over the redrawn areas*/ +#define LV_USE_REFR_DEBUG 0 + +/*1: Draw a red overlay for ARGB layers and a green overlay for RGB layers*/ +#define LV_USE_LAYER_DEBUG 0 + +/*1: Draw overlays with different colors for each draw_unit's tasks. + *Also add the index number of the draw unit on white background. + *For layers add the index number of the draw unit on black background.*/ +#define LV_USE_PARALLEL_DRAW_DEBUG 0 + +/*------------- + * Others + *-----------*/ + +#define LV_ENABLE_GLOBAL_CUSTOM 0 +#if LV_ENABLE_GLOBAL_CUSTOM + /*Header to include for the custom 'lv_global' function"*/ + #define LV_GLOBAL_CUSTOM_INCLUDE +#endif + +/*Default cache size in bytes. + *Used by image decoders such as `lv_lodepng` to keep the decoded image in the memory. + *If size is not set to 0, the decoder will fail to decode when the cache is full. + *If size is 0, the cache function is not enabled and the decoded mem will be released immediately after use.*/ +#define LV_CACHE_DEF_SIZE 0 + +/*Default number of image header cache entries. The cache is used to store the headers of images + *The main logic is like `LV_CACHE_DEF_SIZE` but for image headers.*/ +#define LV_IMAGE_HEADER_CACHE_DEF_CNT 0 + +/*Number of stops allowed per gradient. Increase this to allow more stops. + *This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/ +#define LV_GRADIENT_MAX_STOPS 2 + +/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. + * 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */ +#define LV_COLOR_MIX_ROUND_OFS 0 + +/* Add 2 x 32 bit variables to each lv_obj_t to speed up getting style properties */ +#define LV_OBJ_STYLE_CACHE 0 + +/* Add `id` field to `lv_obj_t` */ +#define LV_USE_OBJ_ID 0 + +/* Automatically assign an ID when obj is created */ +#define LV_OBJ_ID_AUTO_ASSIGN LV_USE_OBJ_ID + +/*Use the builtin obj ID handler functions: +* - lv_obj_assign_id: Called when a widget is created. Use a separate counter for each widget class as an ID. +* - lv_obj_id_compare: Compare the ID to decide if it matches with a requested value. +* - lv_obj_stringify_id: Return e.g. "button3" +* - lv_obj_free_id: Does nothing, as there is no memory allocation for the ID. +* When disabled these functions needs to be implemented by the user.*/ +#define LV_USE_OBJ_ID_BUILTIN 1 + +/*Use obj property set/get API*/ +#define LV_USE_OBJ_PROPERTY 0 + +/*Enable property name support*/ +#define LV_USE_OBJ_PROPERTY_NAME 1 + +/* VG-Lite Simulator */ +/*Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */ +#define LV_USE_VG_LITE_THORVG 0 + +#if LV_USE_VG_LITE_THORVG + + /*Enable LVGL's blend mode support*/ + #define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT 0 + + /*Enable YUV color format support*/ + #define LV_VG_LITE_THORVG_YUV_SUPPORT 0 + + /*Enable Linear gradient extension support*/ + #define LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT 0 + + /*Enable 16 pixels alignment*/ + #define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1 + + /*Buffer address alignment*/ + #define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN 64 + + /*Enable multi-thread render*/ + #define LV_VG_LITE_THORVG_THREAD_RENDER 0 + +#endif + +/*===================== + * COMPILER SETTINGS + *====================*/ + +/*For big endian systems set to 1*/ +#define LV_BIG_ENDIAN_SYSTEM 0 + +/*Define a custom attribute to `lv_tick_inc` function*/ +#define LV_ATTRIBUTE_TICK_INC + +/*Define a custom attribute to `lv_timer_handler` function*/ +#define LV_ATTRIBUTE_TIMER_HANDLER + +/*Define a custom attribute to `lv_display_flush_ready` function*/ +#define LV_ATTRIBUTE_FLUSH_READY + +/*Required alignment size for buffers*/ +#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 + +/*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 to mark large constant arrays for example font's bitmaps*/ +#define LV_ATTRIBUTE_LARGE_CONST + +/*Compiler prefix for a big array declaration in RAM*/ +#define LV_ATTRIBUTE_LARGE_RAM_ARRAY + +/*Place performance critical functions into a faster memory (e.g RAM)*/ +#define LV_ATTRIBUTE_FAST_MEM + +/*Export integer constant to binding. This macro is used with constants in the form of LV_ that + *should also appear on LVGL binding API such as MicroPython.*/ +#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/ + +/*Prefix all global extern data with this*/ +#define LV_ATTRIBUTE_EXTERN_DATA + +/* Use `float` as `lv_value_precise_t` */ +#define LV_USE_FLOAT 0 + +/*Enable matrix support + *Requires `LV_USE_FLOAT = 1`*/ +#define LV_USE_MATRIX 0 + +/*Include `lvgl_private.h` in `lvgl.h` to access internal data and functions by default*/ +#define LV_USE_PRIVATE_API 0 + +/*================== + * FONT USAGE + *===================*/ + +/*Montserrat fonts with ASCII range and some symbols using bpp = 4 + *https://fonts.google.com/specimen/Montserrat*/ +#define LV_FONT_MONTSERRAT_8 0 +#define LV_FONT_MONTSERRAT_10 0 +#define LV_FONT_MONTSERRAT_12 0 +#define LV_FONT_MONTSERRAT_14 1 +#define LV_FONT_MONTSERRAT_16 0 +#define LV_FONT_MONTSERRAT_18 0 +#define LV_FONT_MONTSERRAT_20 0 +#define LV_FONT_MONTSERRAT_22 0 +#define LV_FONT_MONTSERRAT_24 0 +#define LV_FONT_MONTSERRAT_26 0 +#define LV_FONT_MONTSERRAT_28 0 +#define LV_FONT_MONTSERRAT_30 0 +#define LV_FONT_MONTSERRAT_32 0 +#define LV_FONT_MONTSERRAT_34 0 +#define LV_FONT_MONTSERRAT_36 0 +#define LV_FONT_MONTSERRAT_38 0 +#define LV_FONT_MONTSERRAT_40 0 +#define LV_FONT_MONTSERRAT_42 0 +#define LV_FONT_MONTSERRAT_44 0 +#define LV_FONT_MONTSERRAT_46 0 +#define LV_FONT_MONTSERRAT_48 0 + +/*Demonstrate special features*/ +#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ +#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/ +#define LV_FONT_SIMSUN_14_CJK 0 /*1000 most common CJK radicals*/ +#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ + +/*Pixel perfect monospace fonts*/ +#define LV_FONT_UNSCII_8 0 +#define LV_FONT_UNSCII_16 0 + +/*Optionally declare custom fonts here. + *You can use these fonts as default font too and they will be available globally. + *E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/ +#define LV_FONT_CUSTOM_DECLARE + +/*Always set a default font*/ +#define LV_FONT_DEFAULT &lv_font_montserrat_14 + +/*Enable handling large font and/or fonts with a lot of characters. + *The limit depends on the font size, font face and bpp. + *Compiler error will be triggered if a font needs it.*/ +#define LV_FONT_FMT_TXT_LARGE 0 + +/*Enables/disables support for compressed fonts.*/ +#define LV_USE_FONT_COMPRESSED 0 + +/*Enable drawing placeholders when glyph dsc is not found*/ +#define LV_USE_FONT_PLACEHOLDER 1 + +/*================= + * TEXT SETTINGS + *=================*/ + +/** + * Select a character encoding for strings. + * Your IDE or editor should have the same character encoding + * - LV_TXT_ENC_UTF8 + * - LV_TXT_ENC_ASCII + */ +#define LV_TXT_ENC LV_TXT_ENC_UTF8 + +/*Can break (wrap) texts on these chars*/ +#define LV_TXT_BREAK_CHARS " ,.;:-_)]}" + +/*If a word is at least this long, will break wherever "prettiest" + *To disable, set to a value <= 0*/ +#define LV_TXT_LINE_BREAK_LONG_LEN 0 + +/*Minimum number of characters in a long word to put on a line before a break. + *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ +#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 + +/*Minimum number of characters in a long word to put on a line after a break. + *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ +#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 + +/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. + *The direction will be processed according to the Unicode Bidirectional Algorithm: + *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ +#define LV_USE_BIDI 0 +#if LV_USE_BIDI + /*Set the default direction. Supported values: + *`LV_BASE_DIR_LTR` Left-to-Right + *`LV_BASE_DIR_RTL` Right-to-Left + *`LV_BASE_DIR_AUTO` detect texts base direction*/ + #define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO +#endif + +/*Enable Arabic/Persian processing + *In these languages characters should be replaced with another form based on their position in the text*/ +#define LV_USE_ARABIC_PERSIAN_CHARS 0 + +/*================== + * WIDGETS + *================*/ + +/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ + +#define LV_WIDGETS_HAS_DEFAULT_VALUE 1 + +#define LV_USE_ANIMIMG 1 + +#define LV_USE_ARC 1 + +#define LV_USE_BAR 1 + +#define LV_USE_BUTTON 1 + +#define LV_USE_BUTTONMATRIX 1 + +#define LV_USE_CALENDAR 1 +#if LV_USE_CALENDAR + #define LV_CALENDAR_WEEK_STARTS_MONDAY 0 + #if LV_CALENDAR_WEEK_STARTS_MONDAY + #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"} + #else + #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} + #endif + + #define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} + #define LV_USE_CALENDAR_HEADER_ARROW 1 + #define LV_USE_CALENDAR_HEADER_DROPDOWN 1 + #define LV_USE_CALENDAR_CHINESE 0 +#endif /*LV_USE_CALENDAR*/ + +#define LV_USE_CANVAS 1 + +#define LV_USE_CHART 1 + +#define LV_USE_CHECKBOX 1 + +#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ + +#define LV_USE_IMAGE 1 /*Requires: lv_label*/ + +#define LV_USE_IMAGEBUTTON 1 + +#define LV_USE_KEYBOARD 1 + +#define LV_USE_LABEL 1 +#if LV_USE_LABEL + #define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ + #define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ + #define LV_LABEL_WAIT_CHAR_COUNT 3 /*The count of wait chart*/ +#endif + +#define LV_USE_LED 1 + +#define LV_USE_LINE 1 + +#define LV_USE_LIST 1 + +#define LV_USE_LOTTIE 0 /*Requires: lv_canvas, thorvg */ + +#define LV_USE_MENU 1 + +#define LV_USE_MSGBOX 1 + +#define LV_USE_ROLLER 1 /*Requires: lv_label*/ + +#define LV_USE_SCALE 1 + +#define LV_USE_SLIDER 1 /*Requires: lv_bar*/ + +#define LV_USE_SPAN 1 +#if LV_USE_SPAN + /*A line text can contain maximum num of span descriptor */ + #define LV_SPAN_SNIPPET_STACK_SIZE 64 +#endif + +#define LV_USE_SPINBOX 1 + +#define LV_USE_SPINNER 1 + +#define LV_USE_SWITCH 1 + +#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ +#if LV_USE_TEXTAREA != 0 + #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ +#endif + +#define LV_USE_TABLE 1 + +#define LV_USE_TABVIEW 1 + +#define LV_USE_TILEVIEW 1 + +#define LV_USE_WIN 1 + +/*================== + * THEMES + *==================*/ + +/*A simple, impressive and very complete theme*/ +#define LV_USE_THEME_DEFAULT 1 +#if LV_USE_THEME_DEFAULT + + /*0: Light mode; 1: Dark mode*/ + #define LV_THEME_DEFAULT_DARK 0 + + /*1: Enable grow on press*/ + #define LV_THEME_DEFAULT_GROW 1 + + /*Default transition time in [ms]*/ + #define LV_THEME_DEFAULT_TRANSITION_TIME 80 +#endif /*LV_USE_THEME_DEFAULT*/ + +/*A very simple theme that is a good starting point for a custom theme*/ +#define LV_USE_THEME_SIMPLE 1 + +/*A theme designed for monochrome displays*/ +#define LV_USE_THEME_MONO 1 + +/*================== + * LAYOUTS + *==================*/ + +/*A layout similar to Flexbox in CSS.*/ +#define LV_USE_FLEX 1 + +/*A layout similar to Grid in CSS.*/ +#define LV_USE_GRID 1 + +/*==================== + * 3RD PARTS LIBRARIES + *====================*/ + +/*File system interfaces for common APIs */ + +/*Setting a default driver letter allows skipping the driver prefix in filepaths*/ +#define LV_FS_DEFAULT_DRIVE_LETTER '\0' + +/*API for fopen, fread, etc*/ +#define LV_USE_FS_STDIO 0 +#if LV_USE_FS_STDIO + #define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ + #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ +#endif + +/*API for open, read, etc*/ +#define LV_USE_FS_POSIX 0 +#if LV_USE_FS_POSIX + #define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ + #define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ +#endif + +/*API for CreateFile, ReadFile, etc*/ +#define LV_USE_FS_WIN32 0 +#if LV_USE_FS_WIN32 + #define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ + #define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ +#endif + +/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/ +#define LV_USE_FS_FATFS 0 +#if LV_USE_FS_FATFS + #define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ +#endif + +/*API for memory-mapped file access. */ +#define LV_USE_FS_MEMFS 0 +#if LV_USE_FS_MEMFS + #define LV_FS_MEMFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ +#endif + +/*API for LittleFs. */ +#define LV_USE_FS_LITTLEFS 0 +#if LV_USE_FS_LITTLEFS + #define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ +#endif + +/*API for Arduino LittleFs. */ +#define LV_USE_FS_ARDUINO_ESP_LITTLEFS 0 +#if LV_USE_FS_ARDUINO_ESP_LITTLEFS + #define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ +#endif + +/*API for Arduino Sd. */ +#define LV_USE_FS_ARDUINO_SD 0 +#if LV_USE_FS_ARDUINO_SD + #define LV_FS_ARDUINO_SD_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ +#endif + +/*LODEPNG decoder library*/ +#define LV_USE_LODEPNG 0 + +/*PNG decoder(libpng) library*/ +#define LV_USE_LIBPNG 0 + +/*BMP decoder library*/ +#define LV_USE_BMP 0 + +/* JPG + split JPG decoder library. + * Split JPG is a custom format optimized for embedded systems. */ +#define LV_USE_TJPGD 0 + +/* libjpeg-turbo decoder library. + * Supports complete JPEG specifications and high-performance JPEG decoding. */ +#define LV_USE_LIBJPEG_TURBO 0 + +/*GIF decoder library*/ +#define LV_USE_GIF 0 +#if LV_USE_GIF + /*GIF decoder accelerate*/ + #define LV_GIF_CACHE_DECODE_DATA 0 +#endif + + +/*Decode bin images to RAM*/ +#define LV_BIN_DECODER_RAM_LOAD 0 + +/*RLE decompress library*/ +#define LV_USE_RLE 0 + +/*QR code library*/ +#define LV_USE_QRCODE 0 + +/*Barcode code library*/ +#define LV_USE_BARCODE 0 + +/*FreeType library*/ +#define LV_USE_FREETYPE 0 +#if LV_USE_FREETYPE + /*Let FreeType to use LVGL memory and file porting*/ + #define LV_FREETYPE_USE_LVGL_PORT 0 + + /*Cache count of the glyphs in FreeType. It means the number of glyphs that can be cached. + *The higher the value, the more memory will be used.*/ + #define LV_FREETYPE_CACHE_FT_GLYPH_CNT 256 +#endif + +/* Built-in TTF decoder */ +#define LV_USE_TINY_TTF 0 +#if LV_USE_TINY_TTF + /* Enable loading TTF data from files */ + #define LV_TINY_TTF_FILE_SUPPORT 0 + #define LV_TINY_TTF_CACHE_GLYPH_CNT 256 +#endif + +/*Rlottie library*/ +#define LV_USE_RLOTTIE 0 + +/*Enable Vector Graphic APIs + *Requires `LV_USE_MATRIX = 1`*/ +#define LV_USE_VECTOR_GRAPHIC 0 + +/* Enable ThorVG (vector graphics library) from the src/libs folder */ +#define LV_USE_THORVG_INTERNAL 0 + +/* Enable ThorVG by assuming that its installed and linked to the project */ +#define LV_USE_THORVG_EXTERNAL 0 + +/*Use lvgl built-in LZ4 lib*/ +#define LV_USE_LZ4_INTERNAL 0 + +/*Use external LZ4 library*/ +#define LV_USE_LZ4_EXTERNAL 0 + +/*FFmpeg library for image decoding and playing videos + *Supports all major image formats so do not enable other image decoder with it*/ +#define LV_USE_FFMPEG 0 +#if LV_USE_FFMPEG + /*Dump input information to stderr*/ + #define LV_FFMPEG_DUMP_FORMAT 0 +#endif + +/*================== + * OTHERS + *==================*/ + +/*1: Enable API to take snapshot for object*/ +#define LV_USE_SNAPSHOT 0 + +/*1: Enable system monitor component*/ +#define LV_USE_SYSMON 0 +#if LV_USE_SYSMON + /*Get the idle percentage. E.g. uint32_t my_get_idle(void);*/ + #define LV_SYSMON_GET_IDLE lv_timer_get_idle + + /*1: Show CPU usage and FPS count + * Requires `LV_USE_SYSMON = 1`*/ + #define LV_USE_PERF_MONITOR 0 + #if LV_USE_PERF_MONITOR + #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT + + /*0: Displays performance data on the screen, 1: Prints performance data using log.*/ + #define LV_USE_PERF_MONITOR_LOG_MODE 0 + #endif + + /*1: Show the used memory and the memory fragmentation + * Requires `LV_USE_STDLIB_MALLOC = LV_STDLIB_BUILTIN` + * Requires `LV_USE_SYSMON = 1`*/ + #define LV_USE_MEM_MONITOR 0 + #if LV_USE_MEM_MONITOR + #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT + #endif + +#endif /*LV_USE_SYSMON*/ + +/*1: Enable the runtime performance profiler*/ +#define LV_USE_PROFILER 0 +#if LV_USE_PROFILER + /*1: Enable the built-in profiler*/ + #define LV_USE_PROFILER_BUILTIN 1 + #if LV_USE_PROFILER_BUILTIN + /*Default profiler trace buffer size*/ + #define LV_PROFILER_BUILTIN_BUF_SIZE (16 * 1024) /*[bytes]*/ + #endif + + /*Header to include for the profiler*/ + #define LV_PROFILER_INCLUDE "lvgl/src/misc/lv_profiler_builtin.h" + + /*Profiler start point function*/ + #define LV_PROFILER_BEGIN LV_PROFILER_BUILTIN_BEGIN + + /*Profiler end point function*/ + #define LV_PROFILER_END LV_PROFILER_BUILTIN_END + + /*Profiler start point function with custom tag*/ + #define LV_PROFILER_BEGIN_TAG LV_PROFILER_BUILTIN_BEGIN_TAG + + /*Profiler end point function with custom tag*/ + #define LV_PROFILER_END_TAG LV_PROFILER_BUILTIN_END_TAG +#endif + +/*1: Enable Monkey test*/ +#define LV_USE_MONKEY 0 + +/*1: Enable grid navigation*/ +#define LV_USE_GRIDNAV 0 + +/*1: Enable lv_obj fragment*/ +#define LV_USE_FRAGMENT 0 + +/*1: Support using images as font in label or span widgets */ +#define LV_USE_IMGFONT 0 + +/*1: Enable an observer pattern implementation*/ +#define LV_USE_OBSERVER 1 + +/*1: Enable Pinyin input method*/ +/*Requires: lv_keyboard*/ +#define LV_USE_IME_PINYIN 0 +#if LV_USE_IME_PINYIN + /*1: Use default thesaurus*/ + /*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesaurus*/ + #define LV_IME_PINYIN_USE_DEFAULT_DICT 1 + /*Set the maximum number of candidate panels that can be displayed*/ + /*This needs to be adjusted according to the size of the screen*/ + #define LV_IME_PINYIN_CAND_TEXT_NUM 6 + + /*Use 9 key input(k9)*/ + #define LV_IME_PINYIN_USE_K9_MODE 1 + #if LV_IME_PINYIN_USE_K9_MODE == 1 + #define LV_IME_PINYIN_K9_CAND_TEXT_NUM 3 + #endif /*LV_IME_PINYIN_USE_K9_MODE*/ +#endif + +/*1: Enable file explorer*/ +/*Requires: lv_table*/ +#define LV_USE_FILE_EXPLORER 0 +#if LV_USE_FILE_EXPLORER + /*Maximum length of path*/ + #define LV_FILE_EXPLORER_PATH_MAX_LEN (128) + /*Quick access bar, 1:use, 0:not use*/ + /*Requires: lv_list*/ + #define LV_FILE_EXPLORER_QUICK_ACCESS 1 +#endif + +/*================== + * DEVICES + *==================*/ + +/*Use SDL to open window on PC and handle mouse and keyboard*/ +#define LV_USE_SDL 0 +#if LV_USE_SDL + #define LV_SDL_INCLUDE_PATH + #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /*LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance*/ + #define LV_SDL_BUF_COUNT 1 /*1 or 2*/ + #define LV_SDL_ACCELERATED 1 /*1: Use hardware acceleration*/ + #define LV_SDL_FULLSCREEN 0 /*1: Make the window full screen by default*/ + #define LV_SDL_DIRECT_EXIT 1 /*1: Exit the application when all SDL windows are closed*/ + #define LV_SDL_MOUSEWHEEL_MODE LV_SDL_MOUSEWHEEL_MODE_ENCODER /*LV_SDL_MOUSEWHEEL_MODE_ENCODER/CROWN*/ +#endif + +/*Use X11 to open window on Linux desktop and handle mouse and keyboard*/ +#define LV_USE_X11 0 +#if LV_USE_X11 + #define LV_X11_DIRECT_EXIT 1 /*Exit the application when all X11 windows have been closed*/ + #define LV_X11_DOUBLE_BUFFER 1 /*Use double buffers for rendering*/ + /*select only 1 of the following render modes (LV_X11_RENDER_MODE_PARTIAL preferred!)*/ + #define LV_X11_RENDER_MODE_PARTIAL 1 /*Partial render mode (preferred)*/ + #define LV_X11_RENDER_MODE_DIRECT 0 /*direct render mode*/ + #define LV_X11_RENDER_MODE_FULL 0 /*Full render mode*/ +#endif + +/*Use Wayland to open a window and handle input on Linux or BSD desktops */ +#define LV_USE_WAYLAND 0 +#if LV_USE_WAYLAND + #define LV_WAYLAND_WINDOW_DECORATIONS 0 /*Draw client side window decorations only necessary on Mutter/GNOME*/ + #define LV_WAYLAND_WL_SHELL 0 /*Use the legacy wl_shell protocol instead of the default XDG shell*/ +#endif + +/*Driver for /dev/fb*/ +#define LV_USE_LINUX_FBDEV 0 +#if LV_USE_LINUX_FBDEV + #define LV_LINUX_FBDEV_BSD 0 + #define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL + #define LV_LINUX_FBDEV_BUFFER_COUNT 0 + #define LV_LINUX_FBDEV_BUFFER_SIZE 60 +#endif + +/*Use Nuttx to open window and handle touchscreen*/ +#define LV_USE_NUTTX 0 + +#if LV_USE_NUTTX + #define LV_USE_NUTTX_LIBUV 0 + + /*Use Nuttx custom init API to open window and handle touchscreen*/ + #define LV_USE_NUTTX_CUSTOM_INIT 0 + + /*Driver for /dev/lcd*/ + #define LV_USE_NUTTX_LCD 0 + #if LV_USE_NUTTX_LCD + #define LV_NUTTX_LCD_BUFFER_COUNT 0 + #define LV_NUTTX_LCD_BUFFER_SIZE 60 + #endif + + /*Driver for /dev/input*/ + #define LV_USE_NUTTX_TOUCHSCREEN 0 + +#endif + +/*Driver for /dev/dri/card*/ +#define LV_USE_LINUX_DRM 0 + +/*Interface for TFT_eSPI*/ +#define LV_USE_TFT_ESPI 0 + +/*Driver for evdev input devices*/ +#define LV_USE_EVDEV 0 + +/*Driver for libinput input devices*/ +#define LV_USE_LIBINPUT 0 + +#if LV_USE_LIBINPUT + #define LV_LIBINPUT_BSD 0 + + /*Full keyboard support*/ + #define LV_LIBINPUT_XKB 0 + #if LV_LIBINPUT_XKB + /*"setxkbmap -query" can help find the right values for your keyboard*/ + #define LV_LIBINPUT_XKB_KEY_MAP { .rules = NULL, .model = "pc101", .layout = "us", .variant = NULL, .options = NULL } + #endif +#endif + +/*Drivers for LCD devices connected via SPI/parallel port*/ +#define LV_USE_ST7735 0 +#define LV_USE_ST7789 0 +#define LV_USE_ST7796 0 +#define LV_USE_ILI9341 0 + +#define LV_USE_GENERIC_MIPI (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341) + +/*Driver for Renesas GLCD*/ +#define LV_USE_RENESAS_GLCDC 0 + +/* LVGL Windows backend */ +#define LV_USE_WINDOWS 0 + +/* Use OpenGL to open window on PC and handle mouse and keyboard */ +#define LV_USE_OPENGLES 0 +#if LV_USE_OPENGLES + #define LV_USE_OPENGLES_DEBUG 1 /* Enable or disable debug for opengles */ +#endif + +/* QNX Screen display and input drivers */ +#define LV_USE_QNX 0 +#if LV_USE_QNX + #define LV_QNX_BUF_COUNT 1 /*1 or 2*/ +#endif + +/*================== +* EXAMPLES +*==================*/ + +/*Enable the examples to be built with the library*/ +#define LV_BUILD_EXAMPLES 1 + +/*=================== + * DEMO USAGE + ====================*/ + +/*Show some widget. It might be required to increase `LV_MEM_SIZE` */ +#define LV_USE_DEMO_WIDGETS 0 + +/*Demonstrate the usage of encoder and keyboard*/ +#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 + +/*Benchmark your system*/ +#define LV_USE_DEMO_BENCHMARK 0 + +/*Render test for each primitives. Requires at least 480x272 display*/ +#define LV_USE_DEMO_RENDER 0 + +/*Stress test for LVGL*/ +#define LV_USE_DEMO_STRESS 0 + +/*Music player demo*/ +#define LV_USE_DEMO_MUSIC 0 +#if LV_USE_DEMO_MUSIC + #define LV_DEMO_MUSIC_SQUARE 0 + #define LV_DEMO_MUSIC_LANDSCAPE 0 + #define LV_DEMO_MUSIC_ROUND 0 + #define LV_DEMO_MUSIC_LARGE 0 + #define LV_DEMO_MUSIC_AUTO_PLAY 0 +#endif + +/*Flex layout demo*/ +#define LV_USE_DEMO_FLEX_LAYOUT 0 + +/*Smart-phone like multi-language demo*/ +#define LV_USE_DEMO_MULTILANG 0 + +/*Widget transformation demo*/ +#define LV_USE_DEMO_TRANSFORM 0 + +/*Demonstrate scroll settings*/ +#define LV_USE_DEMO_SCROLL 0 + +/*Vector graphic demo*/ +#define LV_USE_DEMO_VECTOR_GRAPHIC 0 + +/*--END OF LV_CONF_H--*/ + +#endif /*LV_CONF_H*/ + +#endif /*End of "Content enable"*/ diff --git a/deps/lv_conf_sim.h b/deps/lv_conf_sim.h new file mode 100644 index 00000000..6fe867d7 --- /dev/null +++ b/deps/lv_conf_sim.h @@ -0,0 +1,1113 @@ +/** + * @file lv_conf.h + * Configuration file for v9.2.0 + */ + +/* + * Copy this file as `lv_conf.h` + * 1. simply next to the `lvgl` folder + * 2. or any other places and + * - define `LV_CONF_INCLUDE_SIMPLE` + * - add the path as include path + */ + +/* clang-format off */ +#if IS_SIM /*Set it to "1" to enable content*/ + +#ifndef LV_CONF_H +#define LV_CONF_H + +/*If you need to include anything here, do it inside the `__ASSEMBLY__` guard */ +#if 0 && defined(__ASSEMBLY__) +#include "my_include.h" +#endif + +/*==================== + COLOR SETTINGS + *====================*/ + +/*Color depth: 1 (I1), 8 (L8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888)*/ +#define LV_COLOR_DEPTH 16 + +/*========================= + STDLIB WRAPPER SETTINGS + *=========================*/ + +/* Possible values + * - LV_STDLIB_BUILTIN: LVGL's built in implementation + * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc + * - LV_STDLIB_MICROPYTHON: MicroPython implementation + * - LV_STDLIB_RTTHREAD: RT-Thread implementation + * - LV_STDLIB_CUSTOM: Implement the functions externally + */ +#define LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN +#define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN +#define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN + +#define LV_STDINT_INCLUDE +#define LV_STDDEF_INCLUDE +#define LV_STDBOOL_INCLUDE +#define LV_INTTYPES_INCLUDE +#define LV_LIMITS_INCLUDE +#define LV_STDARG_INCLUDE + +#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN + /*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/ + #define LV_MEM_SIZE (64 * 1024U) /*[bytes]*/ + + /*Size of the memory expand for `lv_malloc()` in bytes*/ + #define LV_MEM_POOL_EXPAND_SIZE 0 + + /*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ + #define LV_MEM_ADR 0 /*0: unused*/ + /*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ + #if LV_MEM_ADR == 0 + #undef LV_MEM_POOL_INCLUDE + #undef LV_MEM_POOL_ALLOC + #endif +#endif /*LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN*/ + +/*==================== + HAL SETTINGS + *====================*/ + +/*Default display refresh, input device read and animation step period.*/ +#define LV_DEF_REFR_PERIOD 33 /*[ms]*/ + +/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. + *(Not so important, you can adjust it to modify default sizes and spaces)*/ +#define LV_DPI_DEF 130 /*[px/inch]*/ + +/*================= + * OPERATING SYSTEM + *=================*/ +/*Select an operating system to use. Possible options: + * - LV_OS_NONE + * - LV_OS_PTHREAD + * - LV_OS_FREERTOS + * - LV_OS_CMSIS_RTOS2 + * - LV_OS_RTTHREAD + * - LV_OS_WINDOWS + * - LV_OS_MQX + * - LV_OS_CUSTOM */ +#define LV_USE_OS LV_OS_NONE + +#if LV_USE_OS == LV_OS_CUSTOM + #define LV_OS_CUSTOM_INCLUDE +#endif + +/*======================== + * RENDERING CONFIGURATION + *========================*/ + +/*Align the stride of all layers and images to this bytes*/ +#define LV_DRAW_BUF_STRIDE_ALIGN 1 + +/*Align the start address of draw_buf addresses to this bytes*/ +#define LV_DRAW_BUF_ALIGN 4 + +/*Using matrix for transformations. + *Requirements: + `LV_USE_MATRIX = 1`. + The rendering engine needs to support 3x3 matrix transformations.*/ +#define LV_DRAW_TRANSFORM_USE_MATRIX 0 + +/* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode + * it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks. + * "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers + * and can't be drawn in chunks. */ + +/*The target buffer size for simple layer chunks.*/ +#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/ + +/* The stack size of the drawing thread. + * NOTE: If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more. + */ +#define LV_DRAW_THREAD_STACK_SIZE (8 * 1024) /*[bytes]*/ + +#define LV_USE_DRAW_SW 1 +#if LV_USE_DRAW_SW == 1 + + /* + * Selectively disable color format support in order to reduce code size. + * NOTE: some features use certain color formats internally, e.g. + * - gradients use RGB888 + * - bitmaps with transparency may use ARGB8888 + */ + + #define LV_DRAW_SW_SUPPORT_RGB565 1 + #define LV_DRAW_SW_SUPPORT_RGB565A8 1 + #define LV_DRAW_SW_SUPPORT_RGB888 1 + #define LV_DRAW_SW_SUPPORT_XRGB8888 1 + #define LV_DRAW_SW_SUPPORT_ARGB8888 1 + #define LV_DRAW_SW_SUPPORT_L8 1 + #define LV_DRAW_SW_SUPPORT_AL88 1 + #define LV_DRAW_SW_SUPPORT_A8 1 + #define LV_DRAW_SW_SUPPORT_I1 1 + + /* Set the number of draw unit. + * > 1 requires an operating system enabled in `LV_USE_OS` + * > 1 means multiple threads will render the screen in parallel */ + #define LV_DRAW_SW_DRAW_UNIT_CNT 1 + + /* Use Arm-2D to accelerate the sw render */ + #define LV_USE_DRAW_ARM2D_SYNC 0 + + /* Enable native helium assembly to be compiled */ + #define LV_USE_NATIVE_HELIUM_ASM 0 + + /* 0: use a simple renderer capable of drawing only simple rectangles with gradient, images, texts, and straight lines only + * 1: use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too */ + #define LV_DRAW_SW_COMPLEX 1 + + #if LV_DRAW_SW_COMPLEX == 1 + /*Allow buffering some shadow calculation. + *LV_DRAW_SW_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` + *Caching has LV_DRAW_SW_SHADOW_CACHE_SIZE^2 RAM cost*/ + #define LV_DRAW_SW_SHADOW_CACHE_SIZE 0 + + /* Set number of maximally cached circle data. + * The circumference of 1/4 circle are saved for anti-aliasing + * radius * 4 bytes are used per circle (the most often used radiuses are saved) + * 0: to disable caching */ + #define LV_DRAW_SW_CIRCLE_CACHE_SIZE 4 + #endif + + #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE + + #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM + #define LV_DRAW_SW_ASM_CUSTOM_INCLUDE "" + #endif + + /* Enable drawing complex gradients in software: linear at an angle, radial or conical */ + #define LV_USE_DRAW_SW_COMPLEX_GRADIENTS 0 +#endif + +/* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */ +#define LV_USE_DRAW_VGLITE 0 + +#if LV_USE_DRAW_VGLITE + /* Enable blit quality degradation workaround recommended for screen's dimension > 352 pixels. */ + #define LV_USE_VGLITE_BLIT_SPLIT 0 + + #if LV_USE_OS + /* Use additional draw thread for VG-Lite processing.*/ + #define LV_USE_VGLITE_DRAW_THREAD 1 + + #if LV_USE_VGLITE_DRAW_THREAD + /* Enable VGLite draw async. Queue multiple tasks and flash them once to the GPU. */ + #define LV_USE_VGLITE_DRAW_ASYNC 1 + #endif + #endif + + /* Enable VGLite asserts. */ + #define LV_USE_VGLITE_ASSERT 0 +#endif + +/* Use NXP's PXP on iMX RTxxx platforms. */ +#define LV_USE_DRAW_PXP 0 + +#if LV_USE_DRAW_PXP + #if LV_USE_OS + /* Use additional draw thread for PXP processing.*/ + #define LV_USE_PXP_DRAW_THREAD 1 + #endif + + /* Enable PXP asserts. */ + #define LV_USE_PXP_ASSERT 0 +#endif + +/* Use Renesas Dave2D on RA platforms. */ +#define LV_USE_DRAW_DAVE2D 0 + +/* Draw using cached SDL textures*/ +#define LV_USE_DRAW_SDL 0 + +/* Use VG-Lite GPU. */ +#define LV_USE_DRAW_VG_LITE 0 + +#if LV_USE_DRAW_VG_LITE + /* Enable VG-Lite custom external 'gpu_init()' function */ + #define LV_VG_LITE_USE_GPU_INIT 0 + + /* Enable VG-Lite assert. */ + #define LV_VG_LITE_USE_ASSERT 0 + + /* VG-Lite flush commit trigger threshold. GPU will try to batch these many draw tasks. */ + #define LV_VG_LITE_FLUSH_MAX_COUNT 8 + + /* Enable border to simulate shadow + * NOTE: which usually improves performance, + * but does not guarantee the same rendering quality as the software. */ + #define LV_VG_LITE_USE_BOX_SHADOW 0 + + /* VG-Lite gradient maximum cache number. + * NOTE: The memory usage of a single gradient image is 4K bytes. + */ + #define LV_VG_LITE_GRAD_CACHE_CNT 32 + + /* VG-Lite stroke maximum cache number. + */ + #define LV_VG_LITE_STROKE_CACHE_CNT 32 + +#endif + +/*======================= + * FEATURE CONFIGURATION + *=======================*/ + +/*------------- + * Logging + *-----------*/ + +/*Enable the log module*/ +#define LV_USE_LOG 0 +#if LV_USE_LOG + + /*How important log should be added: + *LV_LOG_LEVEL_TRACE A lot of logs to give detailed information + *LV_LOG_LEVEL_INFO Log important events + *LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem + *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail + *LV_LOG_LEVEL_USER Only logs added by the user + *LV_LOG_LEVEL_NONE Do not log anything*/ + #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN + + /*1: Print the log with 'printf'; + *0: User need to register a callback with `lv_log_register_print_cb()`*/ + #define LV_LOG_PRINTF 0 + + /*Set callback to print the logs. + *E.g `my_print`. The prototype should be `void my_print(lv_log_level_t level, const char * buf)` + *Can be overwritten by `lv_log_register_print_cb`*/ + //#define LV_LOG_PRINT_CB + + /*1: Enable print timestamp; + *0: Disable print timestamp*/ + #define LV_LOG_USE_TIMESTAMP 1 + + /*1: Print file and line number of the log; + *0: Do not print file and line number of the log*/ + #define LV_LOG_USE_FILE_LINE 1 + + + /*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ + #define LV_LOG_TRACE_MEM 1 + #define LV_LOG_TRACE_TIMER 1 + #define LV_LOG_TRACE_INDEV 1 + #define LV_LOG_TRACE_DISP_REFR 1 + #define LV_LOG_TRACE_EVENT 1 + #define LV_LOG_TRACE_OBJ_CREATE 1 + #define LV_LOG_TRACE_LAYOUT 1 + #define LV_LOG_TRACE_ANIM 1 + #define LV_LOG_TRACE_CACHE 1 + +#endif /*LV_USE_LOG*/ + +/*------------- + * Asserts + *-----------*/ + +/*Enable asserts if an operation is failed or an invalid data is found. + *If LV_USE_LOG is enabled an error message will be printed on failure*/ +#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ +#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ +#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/ +#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ +#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ + +/*Add a custom handler when assert happens e.g. to restart the MCU*/ +#define LV_ASSERT_HANDLER_INCLUDE +#define LV_ASSERT_HANDLER while(1); /*Halt by default*/ + +/*------------- + * Debug + *-----------*/ + +/*1: Draw random colored rectangles over the redrawn areas*/ +#define LV_USE_REFR_DEBUG 0 + +/*1: Draw a red overlay for ARGB layers and a green overlay for RGB layers*/ +#define LV_USE_LAYER_DEBUG 0 + +/*1: Draw overlays with different colors for each draw_unit's tasks. + *Also add the index number of the draw unit on white background. + *For layers add the index number of the draw unit on black background.*/ +#define LV_USE_PARALLEL_DRAW_DEBUG 0 + +/*------------- + * Others + *-----------*/ + +#define LV_ENABLE_GLOBAL_CUSTOM 0 +#if LV_ENABLE_GLOBAL_CUSTOM + /*Header to include for the custom 'lv_global' function"*/ + #define LV_GLOBAL_CUSTOM_INCLUDE +#endif + +/*Default cache size in bytes. + *Used by image decoders such as `lv_lodepng` to keep the decoded image in the memory. + *If size is not set to 0, the decoder will fail to decode when the cache is full. + *If size is 0, the cache function is not enabled and the decoded mem will be released immediately after use.*/ +#define LV_CACHE_DEF_SIZE 0 + +/*Default number of image header cache entries. The cache is used to store the headers of images + *The main logic is like `LV_CACHE_DEF_SIZE` but for image headers.*/ +#define LV_IMAGE_HEADER_CACHE_DEF_CNT 0 + +/*Number of stops allowed per gradient. Increase this to allow more stops. + *This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/ +#define LV_GRADIENT_MAX_STOPS 2 + +/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. + * 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */ +#define LV_COLOR_MIX_ROUND_OFS 0 + +/* Add 2 x 32 bit variables to each lv_obj_t to speed up getting style properties */ +#define LV_OBJ_STYLE_CACHE 0 + +/* Add `id` field to `lv_obj_t` */ +#define LV_USE_OBJ_ID 0 + +/* Automatically assign an ID when obj is created */ +#define LV_OBJ_ID_AUTO_ASSIGN LV_USE_OBJ_ID + +/*Use the builtin obj ID handler functions: +* - lv_obj_assign_id: Called when a widget is created. Use a separate counter for each widget class as an ID. +* - lv_obj_id_compare: Compare the ID to decide if it matches with a requested value. +* - lv_obj_stringify_id: Return e.g. "button3" +* - lv_obj_free_id: Does nothing, as there is no memory allocation for the ID. +* When disabled these functions needs to be implemented by the user.*/ +#define LV_USE_OBJ_ID_BUILTIN 1 + +/*Use obj property set/get API*/ +#define LV_USE_OBJ_PROPERTY 0 + +/*Enable property name support*/ +#define LV_USE_OBJ_PROPERTY_NAME 1 + +/* VG-Lite Simulator */ +/*Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */ +#define LV_USE_VG_LITE_THORVG 0 + +#if LV_USE_VG_LITE_THORVG + + /*Enable LVGL's blend mode support*/ + #define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT 0 + + /*Enable YUV color format support*/ + #define LV_VG_LITE_THORVG_YUV_SUPPORT 0 + + /*Enable Linear gradient extension support*/ + #define LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT 0 + + /*Enable 16 pixels alignment*/ + #define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1 + + /*Buffer address alignment*/ + #define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN 64 + + /*Enable multi-thread render*/ + #define LV_VG_LITE_THORVG_THREAD_RENDER 0 + +#endif + +/*===================== + * COMPILER SETTINGS + *====================*/ + +/*For big endian systems set to 1*/ +#define LV_BIG_ENDIAN_SYSTEM 0 + +/*Define a custom attribute to `lv_tick_inc` function*/ +#define LV_ATTRIBUTE_TICK_INC + +/*Define a custom attribute to `lv_timer_handler` function*/ +#define LV_ATTRIBUTE_TIMER_HANDLER + +/*Define a custom attribute to `lv_display_flush_ready` function*/ +#define LV_ATTRIBUTE_FLUSH_READY + +/*Required alignment size for buffers*/ +#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 + +/*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 to mark large constant arrays for example font's bitmaps*/ +#define LV_ATTRIBUTE_LARGE_CONST + +/*Compiler prefix for a big array declaration in RAM*/ +#define LV_ATTRIBUTE_LARGE_RAM_ARRAY + +/*Place performance critical functions into a faster memory (e.g RAM)*/ +#define LV_ATTRIBUTE_FAST_MEM + +/*Export integer constant to binding. This macro is used with constants in the form of LV_ that + *should also appear on LVGL binding API such as MicroPython.*/ +#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/ + +/*Prefix all global extern data with this*/ +#define LV_ATTRIBUTE_EXTERN_DATA + +/* Use `float` as `lv_value_precise_t` */ +#define LV_USE_FLOAT 0 + +/*Enable matrix support + *Requires `LV_USE_FLOAT = 1`*/ +#define LV_USE_MATRIX 0 + +/*Include `lvgl_private.h` in `lvgl.h` to access internal data and functions by default*/ +#define LV_USE_PRIVATE_API 0 + +/*================== + * FONT USAGE + *===================*/ + +/*Montserrat fonts with ASCII range and some symbols using bpp = 4 + *https://fonts.google.com/specimen/Montserrat*/ +#define LV_FONT_MONTSERRAT_8 0 +#define LV_FONT_MONTSERRAT_10 0 +#define LV_FONT_MONTSERRAT_12 0 +#define LV_FONT_MONTSERRAT_14 1 +#define LV_FONT_MONTSERRAT_16 0 +#define LV_FONT_MONTSERRAT_18 0 +#define LV_FONT_MONTSERRAT_20 0 +#define LV_FONT_MONTSERRAT_22 0 +#define LV_FONT_MONTSERRAT_24 0 +#define LV_FONT_MONTSERRAT_26 0 +#define LV_FONT_MONTSERRAT_28 0 +#define LV_FONT_MONTSERRAT_30 0 +#define LV_FONT_MONTSERRAT_32 0 +#define LV_FONT_MONTSERRAT_34 0 +#define LV_FONT_MONTSERRAT_36 0 +#define LV_FONT_MONTSERRAT_38 0 +#define LV_FONT_MONTSERRAT_40 0 +#define LV_FONT_MONTSERRAT_42 0 +#define LV_FONT_MONTSERRAT_44 0 +#define LV_FONT_MONTSERRAT_46 0 +#define LV_FONT_MONTSERRAT_48 0 + +/*Demonstrate special features*/ +#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ +#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/ +#define LV_FONT_SIMSUN_14_CJK 0 /*1000 most common CJK radicals*/ +#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ + +/*Pixel perfect monospace fonts*/ +#define LV_FONT_UNSCII_8 0 +#define LV_FONT_UNSCII_16 0 + +/*Optionally declare custom fonts here. + *You can use these fonts as default font too and they will be available globally. + *E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/ +#define LV_FONT_CUSTOM_DECLARE + +/*Always set a default font*/ +#define LV_FONT_DEFAULT &lv_font_montserrat_14 + +/*Enable handling large font and/or fonts with a lot of characters. + *The limit depends on the font size, font face and bpp. + *Compiler error will be triggered if a font needs it.*/ +#define LV_FONT_FMT_TXT_LARGE 0 + +/*Enables/disables support for compressed fonts.*/ +#define LV_USE_FONT_COMPRESSED 0 + +/*Enable drawing placeholders when glyph dsc is not found*/ +#define LV_USE_FONT_PLACEHOLDER 1 + +/*================= + * TEXT SETTINGS + *=================*/ + +/** + * Select a character encoding for strings. + * Your IDE or editor should have the same character encoding + * - LV_TXT_ENC_UTF8 + * - LV_TXT_ENC_ASCII + */ +#define LV_TXT_ENC LV_TXT_ENC_UTF8 + +/*Can break (wrap) texts on these chars*/ +#define LV_TXT_BREAK_CHARS " ,.;:-_)]}" + +/*If a word is at least this long, will break wherever "prettiest" + *To disable, set to a value <= 0*/ +#define LV_TXT_LINE_BREAK_LONG_LEN 0 + +/*Minimum number of characters in a long word to put on a line before a break. + *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ +#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 + +/*Minimum number of characters in a long word to put on a line after a break. + *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ +#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 + +/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. + *The direction will be processed according to the Unicode Bidirectional Algorithm: + *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ +#define LV_USE_BIDI 0 +#if LV_USE_BIDI + /*Set the default direction. Supported values: + *`LV_BASE_DIR_LTR` Left-to-Right + *`LV_BASE_DIR_RTL` Right-to-Left + *`LV_BASE_DIR_AUTO` detect texts base direction*/ + #define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO +#endif + +/*Enable Arabic/Persian processing + *In these languages characters should be replaced with another form based on their position in the text*/ +#define LV_USE_ARABIC_PERSIAN_CHARS 0 + +/*================== + * WIDGETS + *================*/ + +/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ + +#define LV_WIDGETS_HAS_DEFAULT_VALUE 1 + +#define LV_USE_ANIMIMG 1 + +#define LV_USE_ARC 1 + +#define LV_USE_BAR 1 + +#define LV_USE_BUTTON 1 + +#define LV_USE_BUTTONMATRIX 1 + +#define LV_USE_CALENDAR 1 +#if LV_USE_CALENDAR + #define LV_CALENDAR_WEEK_STARTS_MONDAY 0 + #if LV_CALENDAR_WEEK_STARTS_MONDAY + #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"} + #else + #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} + #endif + + #define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} + #define LV_USE_CALENDAR_HEADER_ARROW 1 + #define LV_USE_CALENDAR_HEADER_DROPDOWN 1 + #define LV_USE_CALENDAR_CHINESE 0 +#endif /*LV_USE_CALENDAR*/ + +#define LV_USE_CANVAS 1 + +#define LV_USE_CHART 1 + +#define LV_USE_CHECKBOX 1 + +#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ + +#define LV_USE_IMAGE 1 /*Requires: lv_label*/ + +#define LV_USE_IMAGEBUTTON 1 + +#define LV_USE_KEYBOARD 1 + +#define LV_USE_LABEL 1 +#if LV_USE_LABEL + #define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ + #define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ + #define LV_LABEL_WAIT_CHAR_COUNT 3 /*The count of wait chart*/ +#endif + +#define LV_USE_LED 1 + +#define LV_USE_LINE 1 + +#define LV_USE_LIST 1 + +#define LV_USE_LOTTIE 0 /*Requires: lv_canvas, thorvg */ + +#define LV_USE_MENU 1 + +#define LV_USE_MSGBOX 1 + +#define LV_USE_ROLLER 1 /*Requires: lv_label*/ + +#define LV_USE_SCALE 1 + +#define LV_USE_SLIDER 1 /*Requires: lv_bar*/ + +#define LV_USE_SPAN 1 +#if LV_USE_SPAN + /*A line text can contain maximum num of span descriptor */ + #define LV_SPAN_SNIPPET_STACK_SIZE 64 +#endif + +#define LV_USE_SPINBOX 1 + +#define LV_USE_SPINNER 1 + +#define LV_USE_SWITCH 1 + +#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ +#if LV_USE_TEXTAREA != 0 + #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ +#endif + +#define LV_USE_TABLE 1 + +#define LV_USE_TABVIEW 1 + +#define LV_USE_TILEVIEW 1 + +#define LV_USE_WIN 1 + +/*================== + * THEMES + *==================*/ + +/*A simple, impressive and very complete theme*/ +#define LV_USE_THEME_DEFAULT 1 +#if LV_USE_THEME_DEFAULT + + /*0: Light mode; 1: Dark mode*/ + #define LV_THEME_DEFAULT_DARK 0 + + /*1: Enable grow on press*/ + #define LV_THEME_DEFAULT_GROW 1 + + /*Default transition time in [ms]*/ + #define LV_THEME_DEFAULT_TRANSITION_TIME 80 +#endif /*LV_USE_THEME_DEFAULT*/ + +/*A very simple theme that is a good starting point for a custom theme*/ +#define LV_USE_THEME_SIMPLE 1 + +/*A theme designed for monochrome displays*/ +#define LV_USE_THEME_MONO 1 + +/*================== + * LAYOUTS + *==================*/ + +/*A layout similar to Flexbox in CSS.*/ +#define LV_USE_FLEX 1 + +/*A layout similar to Grid in CSS.*/ +#define LV_USE_GRID 1 + +/*==================== + * 3RD PARTS LIBRARIES + *====================*/ + +/*File system interfaces for common APIs */ + +/*Setting a default driver letter allows skipping the driver prefix in filepaths*/ +#define LV_FS_DEFAULT_DRIVE_LETTER '\0' + +/*API for fopen, fread, etc*/ +#define LV_USE_FS_STDIO 0 +#if LV_USE_FS_STDIO + #define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ + #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ +#endif + +/*API for open, read, etc*/ +#define LV_USE_FS_POSIX 0 +#if LV_USE_FS_POSIX + #define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ + #define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ +#endif + +/*API for CreateFile, ReadFile, etc*/ +#define LV_USE_FS_WIN32 0 +#if LV_USE_FS_WIN32 + #define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ + #define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ +#endif + +/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/ +#define LV_USE_FS_FATFS 0 +#if LV_USE_FS_FATFS + #define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ +#endif + +/*API for memory-mapped file access. */ +#define LV_USE_FS_MEMFS 0 +#if LV_USE_FS_MEMFS + #define LV_FS_MEMFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ +#endif + +/*API for LittleFs. */ +#define LV_USE_FS_LITTLEFS 0 +#if LV_USE_FS_LITTLEFS + #define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ +#endif + +/*API for Arduino LittleFs. */ +#define LV_USE_FS_ARDUINO_ESP_LITTLEFS 0 +#if LV_USE_FS_ARDUINO_ESP_LITTLEFS + #define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ +#endif + +/*API for Arduino Sd. */ +#define LV_USE_FS_ARDUINO_SD 0 +#if LV_USE_FS_ARDUINO_SD + #define LV_FS_ARDUINO_SD_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ +#endif + +/*LODEPNG decoder library*/ +#define LV_USE_LODEPNG 0 + +/*PNG decoder(libpng) library*/ +#define LV_USE_LIBPNG 0 + +/*BMP decoder library*/ +#define LV_USE_BMP 0 + +/* JPG + split JPG decoder library. + * Split JPG is a custom format optimized for embedded systems. */ +#define LV_USE_TJPGD 0 + +/* libjpeg-turbo decoder library. + * Supports complete JPEG specifications and high-performance JPEG decoding. */ +#define LV_USE_LIBJPEG_TURBO 0 + +/*GIF decoder library*/ +#define LV_USE_GIF 0 +#if LV_USE_GIF + /*GIF decoder accelerate*/ + #define LV_GIF_CACHE_DECODE_DATA 0 +#endif + + +/*Decode bin images to RAM*/ +#define LV_BIN_DECODER_RAM_LOAD 0 + +/*RLE decompress library*/ +#define LV_USE_RLE 0 + +/*QR code library*/ +#define LV_USE_QRCODE 0 + +/*Barcode code library*/ +#define LV_USE_BARCODE 0 + +/*FreeType library*/ +#define LV_USE_FREETYPE 0 +#if LV_USE_FREETYPE + /*Let FreeType to use LVGL memory and file porting*/ + #define LV_FREETYPE_USE_LVGL_PORT 0 + + /*Cache count of the glyphs in FreeType. It means the number of glyphs that can be cached. + *The higher the value, the more memory will be used.*/ + #define LV_FREETYPE_CACHE_FT_GLYPH_CNT 256 +#endif + +/* Built-in TTF decoder */ +#define LV_USE_TINY_TTF 0 +#if LV_USE_TINY_TTF + /* Enable loading TTF data from files */ + #define LV_TINY_TTF_FILE_SUPPORT 0 + #define LV_TINY_TTF_CACHE_GLYPH_CNT 256 +#endif + +/*Rlottie library*/ +#define LV_USE_RLOTTIE 0 + +/*Enable Vector Graphic APIs + *Requires `LV_USE_MATRIX = 1`*/ +#define LV_USE_VECTOR_GRAPHIC 0 + +/* Enable ThorVG (vector graphics library) from the src/libs folder */ +#define LV_USE_THORVG_INTERNAL 0 + +/* Enable ThorVG by assuming that its installed and linked to the project */ +#define LV_USE_THORVG_EXTERNAL 0 + +/*Use lvgl built-in LZ4 lib*/ +#define LV_USE_LZ4_INTERNAL 0 + +/*Use external LZ4 library*/ +#define LV_USE_LZ4_EXTERNAL 0 + +/*FFmpeg library for image decoding and playing videos + *Supports all major image formats so do not enable other image decoder with it*/ +#define LV_USE_FFMPEG 0 +#if LV_USE_FFMPEG + /*Dump input information to stderr*/ + #define LV_FFMPEG_DUMP_FORMAT 0 +#endif + +/*================== + * OTHERS + *==================*/ + +/*1: Enable API to take snapshot for object*/ +#define LV_USE_SNAPSHOT 0 + +/*1: Enable system monitor component*/ +#define LV_USE_SYSMON 0 +#if LV_USE_SYSMON + /*Get the idle percentage. E.g. uint32_t my_get_idle(void);*/ + #define LV_SYSMON_GET_IDLE lv_timer_get_idle + + /*1: Show CPU usage and FPS count + * Requires `LV_USE_SYSMON = 1`*/ + #define LV_USE_PERF_MONITOR 0 + #if LV_USE_PERF_MONITOR + #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT + + /*0: Displays performance data on the screen, 1: Prints performance data using log.*/ + #define LV_USE_PERF_MONITOR_LOG_MODE 0 + #endif + + /*1: Show the used memory and the memory fragmentation + * Requires `LV_USE_STDLIB_MALLOC = LV_STDLIB_BUILTIN` + * Requires `LV_USE_SYSMON = 1`*/ + #define LV_USE_MEM_MONITOR 0 + #if LV_USE_MEM_MONITOR + #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT + #endif + +#endif /*LV_USE_SYSMON*/ + +/*1: Enable the runtime performance profiler*/ +#define LV_USE_PROFILER 0 +#if LV_USE_PROFILER + /*1: Enable the built-in profiler*/ + #define LV_USE_PROFILER_BUILTIN 1 + #if LV_USE_PROFILER_BUILTIN + /*Default profiler trace buffer size*/ + #define LV_PROFILER_BUILTIN_BUF_SIZE (16 * 1024) /*[bytes]*/ + #endif + + /*Header to include for the profiler*/ + #define LV_PROFILER_INCLUDE "lvgl/src/misc/lv_profiler_builtin.h" + + /*Profiler start point function*/ + #define LV_PROFILER_BEGIN LV_PROFILER_BUILTIN_BEGIN + + /*Profiler end point function*/ + #define LV_PROFILER_END LV_PROFILER_BUILTIN_END + + /*Profiler start point function with custom tag*/ + #define LV_PROFILER_BEGIN_TAG LV_PROFILER_BUILTIN_BEGIN_TAG + + /*Profiler end point function with custom tag*/ + #define LV_PROFILER_END_TAG LV_PROFILER_BUILTIN_END_TAG +#endif + +/*1: Enable Monkey test*/ +#define LV_USE_MONKEY 0 + +/*1: Enable grid navigation*/ +#define LV_USE_GRIDNAV 0 + +/*1: Enable lv_obj fragment*/ +#define LV_USE_FRAGMENT 0 + +/*1: Support using images as font in label or span widgets */ +#define LV_USE_IMGFONT 0 + +/*1: Enable an observer pattern implementation*/ +#define LV_USE_OBSERVER 1 + +/*1: Enable Pinyin input method*/ +/*Requires: lv_keyboard*/ +#define LV_USE_IME_PINYIN 0 +#if LV_USE_IME_PINYIN + /*1: Use default thesaurus*/ + /*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesaurus*/ + #define LV_IME_PINYIN_USE_DEFAULT_DICT 1 + /*Set the maximum number of candidate panels that can be displayed*/ + /*This needs to be adjusted according to the size of the screen*/ + #define LV_IME_PINYIN_CAND_TEXT_NUM 6 + + /*Use 9 key input(k9)*/ + #define LV_IME_PINYIN_USE_K9_MODE 1 + #if LV_IME_PINYIN_USE_K9_MODE == 1 + #define LV_IME_PINYIN_K9_CAND_TEXT_NUM 3 + #endif /*LV_IME_PINYIN_USE_K9_MODE*/ +#endif + +/*1: Enable file explorer*/ +/*Requires: lv_table*/ +#define LV_USE_FILE_EXPLORER 0 +#if LV_USE_FILE_EXPLORER + /*Maximum length of path*/ + #define LV_FILE_EXPLORER_PATH_MAX_LEN (128) + /*Quick access bar, 1:use, 0:not use*/ + /*Requires: lv_list*/ + #define LV_FILE_EXPLORER_QUICK_ACCESS 1 +#endif + +/*================== + * DEVICES + *==================*/ + +/*Use SDL to open window on PC and handle mouse and keyboard*/ +#define LV_USE_SDL 0 +#if LV_USE_SDL + #define LV_SDL_INCLUDE_PATH + #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /*LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance*/ + #define LV_SDL_BUF_COUNT 1 /*1 or 2*/ + #define LV_SDL_ACCELERATED 1 /*1: Use hardware acceleration*/ + #define LV_SDL_FULLSCREEN 0 /*1: Make the window full screen by default*/ + #define LV_SDL_DIRECT_EXIT 1 /*1: Exit the application when all SDL windows are closed*/ + #define LV_SDL_MOUSEWHEEL_MODE LV_SDL_MOUSEWHEEL_MODE_ENCODER /*LV_SDL_MOUSEWHEEL_MODE_ENCODER/CROWN*/ +#endif + +/*Use X11 to open window on Linux desktop and handle mouse and keyboard*/ +#define LV_USE_X11 0 +#if LV_USE_X11 + #define LV_X11_DIRECT_EXIT 1 /*Exit the application when all X11 windows have been closed*/ + #define LV_X11_DOUBLE_BUFFER 1 /*Use double buffers for rendering*/ + /*select only 1 of the following render modes (LV_X11_RENDER_MODE_PARTIAL preferred!)*/ + #define LV_X11_RENDER_MODE_PARTIAL 1 /*Partial render mode (preferred)*/ + #define LV_X11_RENDER_MODE_DIRECT 0 /*direct render mode*/ + #define LV_X11_RENDER_MODE_FULL 0 /*Full render mode*/ +#endif + +/*Use Wayland to open a window and handle input on Linux or BSD desktops */ +#define LV_USE_WAYLAND 0 +#if LV_USE_WAYLAND + #define LV_WAYLAND_WINDOW_DECORATIONS 0 /*Draw client side window decorations only necessary on Mutter/GNOME*/ + #define LV_WAYLAND_WL_SHELL 0 /*Use the legacy wl_shell protocol instead of the default XDG shell*/ +#endif + +/*Driver for /dev/fb*/ +#define LV_USE_LINUX_FBDEV 0 +#if LV_USE_LINUX_FBDEV + #define LV_LINUX_FBDEV_BSD 0 + #define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL + #define LV_LINUX_FBDEV_BUFFER_COUNT 0 + #define LV_LINUX_FBDEV_BUFFER_SIZE 60 +#endif + +/*Use Nuttx to open window and handle touchscreen*/ +#define LV_USE_NUTTX 0 + +#if LV_USE_NUTTX + #define LV_USE_NUTTX_LIBUV 0 + + /*Use Nuttx custom init API to open window and handle touchscreen*/ + #define LV_USE_NUTTX_CUSTOM_INIT 0 + + /*Driver for /dev/lcd*/ + #define LV_USE_NUTTX_LCD 0 + #if LV_USE_NUTTX_LCD + #define LV_NUTTX_LCD_BUFFER_COUNT 0 + #define LV_NUTTX_LCD_BUFFER_SIZE 60 + #endif + + /*Driver for /dev/input*/ + #define LV_USE_NUTTX_TOUCHSCREEN 0 + +#endif + +/*Driver for /dev/dri/card*/ +#define LV_USE_LINUX_DRM 0 + +/*Interface for TFT_eSPI*/ +#define LV_USE_TFT_ESPI 0 + +/*Driver for evdev input devices*/ +#define LV_USE_EVDEV 0 + +/*Driver for libinput input devices*/ +#define LV_USE_LIBINPUT 0 + +#if LV_USE_LIBINPUT + #define LV_LIBINPUT_BSD 0 + + /*Full keyboard support*/ + #define LV_LIBINPUT_XKB 0 + #if LV_LIBINPUT_XKB + /*"setxkbmap -query" can help find the right values for your keyboard*/ + #define LV_LIBINPUT_XKB_KEY_MAP { .rules = NULL, .model = "pc101", .layout = "us", .variant = NULL, .options = NULL } + #endif +#endif + +/*Drivers for LCD devices connected via SPI/parallel port*/ +#define LV_USE_ST7735 0 +#define LV_USE_ST7789 0 +#define LV_USE_ST7796 0 +#define LV_USE_ILI9341 0 + +#define LV_USE_GENERIC_MIPI (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341) + +/*Driver for Renesas GLCD*/ +#define LV_USE_RENESAS_GLCDC 0 + +/* LVGL Windows backend */ +#define LV_USE_WINDOWS 0 + +/* Use OpenGL to open window on PC and handle mouse and keyboard */ +#define LV_USE_OPENGLES 0 +#if LV_USE_OPENGLES + #define LV_USE_OPENGLES_DEBUG 1 /* Enable or disable debug for opengles */ +#endif + +/* QNX Screen display and input drivers */ +#define LV_USE_QNX 0 +#if LV_USE_QNX + #define LV_QNX_BUF_COUNT 1 /*1 or 2*/ +#endif + +/*================== +* EXAMPLES +*==================*/ + +/*Enable the examples to be built with the library*/ +#define LV_BUILD_EXAMPLES 1 + +/*=================== + * DEMO USAGE + ====================*/ + +/*Show some widget. It might be required to increase `LV_MEM_SIZE` */ +#define LV_USE_DEMO_WIDGETS 0 + +/*Demonstrate the usage of encoder and keyboard*/ +#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 + +/*Benchmark your system*/ +#define LV_USE_DEMO_BENCHMARK 0 + +/*Render test for each primitives. Requires at least 480x272 display*/ +#define LV_USE_DEMO_RENDER 0 + +/*Stress test for LVGL*/ +#define LV_USE_DEMO_STRESS 0 + +/*Music player demo*/ +#define LV_USE_DEMO_MUSIC 0 +#if LV_USE_DEMO_MUSIC + #define LV_DEMO_MUSIC_SQUARE 0 + #define LV_DEMO_MUSIC_LANDSCAPE 0 + #define LV_DEMO_MUSIC_ROUND 0 + #define LV_DEMO_MUSIC_LARGE 0 + #define LV_DEMO_MUSIC_AUTO_PLAY 0 +#endif + +/*Flex layout demo*/ +#define LV_USE_DEMO_FLEX_LAYOUT 0 + +/*Smart-phone like multi-language demo*/ +#define LV_USE_DEMO_MULTILANG 0 + +/*Widget transformation demo*/ +#define LV_USE_DEMO_TRANSFORM 0 + +/*Demonstrate scroll settings*/ +#define LV_USE_DEMO_SCROLL 0 + +/*Vector graphic demo*/ +#define LV_USE_DEMO_VECTOR_GRAPHIC 0 + +/*--END OF LV_CONF_H--*/ + +#endif /*LV_CONF_H*/ + +#endif /*End of "Content enable"*/ From cac89527409390d7cd336f19bdcff72842cb650c Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 6 Aug 2024 09:14:58 +0200 Subject: [PATCH 05/10] Restore the non-default configuration The previous commit replaced the customized options with the default values. Restore the relevant changes again. --- deps/lv_conf_device.h | 68 +++++++++++++++++++++---------------------- deps/lv_conf_sim.h | 66 ++++++++++++++++++++--------------------- 2 files changed, 67 insertions(+), 67 deletions(-) diff --git a/deps/lv_conf_device.h b/deps/lv_conf_device.h index 9d0ba1da..a0bb7c57 100644 --- a/deps/lv_conf_device.h +++ b/deps/lv_conf_device.h @@ -27,7 +27,7 @@ *====================*/ /*Color depth: 1 (I1), 8 (L8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888)*/ -#define LV_COLOR_DEPTH 16 +#define LV_COLOR_DEPTH 32 /*========================= STDLIB WRAPPER SETTINGS @@ -53,7 +53,7 @@ #if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN /*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/ - #define LV_MEM_SIZE (64 * 1024U) /*[bytes]*/ + #define LV_MEM_SIZE (4096 * 4096) /*[bytes]*/ /*Size of the memory expand for `lv_malloc()` in bytes*/ #define LV_MEM_POOL_EXPAND_SIZE 0 @@ -261,7 +261,7 @@ *-----------*/ /*Enable the log module*/ -#define LV_USE_LOG 0 +#define LV_USE_LOG 1 #if LV_USE_LOG /*How important log should be added: @@ -271,11 +271,11 @@ *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail *LV_LOG_LEVEL_USER Only logs added by the user *LV_LOG_LEVEL_NONE Do not log anything*/ - #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN + #define LV_LOG_LEVEL LV_LOG_LEVEL_USER /*1: Print the log with 'printf'; *0: User need to register a callback with `lv_log_register_print_cb()`*/ - #define LV_LOG_PRINTF 0 + #define LV_LOG_PRINTF 1 /*Set callback to print the logs. *E.g `my_print`. The prototype should be `void my_print(lv_log_level_t level, const char * buf)` @@ -312,9 +312,9 @@ *If LV_USE_LOG is enabled an error message will be printed on failure*/ #define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ #define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ -#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/ -#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ -#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ +#define LV_USE_ASSERT_STYLE 1 /*Check if the styles are properly initialized. (Very fast, recommended)*/ +#define LV_USE_ASSERT_MEM_INTEGRITY 1 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ +#define LV_USE_ASSERT_OBJ 1 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ /*Add a custom handler when assert happens e.g. to restart the MCU*/ #define LV_ASSERT_HANDLER_INCLUDE @@ -467,27 +467,27 @@ /*Montserrat fonts with ASCII range and some symbols using bpp = 4 *https://fonts.google.com/specimen/Montserrat*/ -#define LV_FONT_MONTSERRAT_8 0 -#define LV_FONT_MONTSERRAT_10 0 -#define LV_FONT_MONTSERRAT_12 0 +#define LV_FONT_MONTSERRAT_8 1 +#define LV_FONT_MONTSERRAT_10 1 +#define LV_FONT_MONTSERRAT_12 1 #define LV_FONT_MONTSERRAT_14 1 -#define LV_FONT_MONTSERRAT_16 0 -#define LV_FONT_MONTSERRAT_18 0 -#define LV_FONT_MONTSERRAT_20 0 -#define LV_FONT_MONTSERRAT_22 0 -#define LV_FONT_MONTSERRAT_24 0 -#define LV_FONT_MONTSERRAT_26 0 -#define LV_FONT_MONTSERRAT_28 0 -#define LV_FONT_MONTSERRAT_30 0 -#define LV_FONT_MONTSERRAT_32 0 -#define LV_FONT_MONTSERRAT_34 0 -#define LV_FONT_MONTSERRAT_36 0 -#define LV_FONT_MONTSERRAT_38 0 -#define LV_FONT_MONTSERRAT_40 0 -#define LV_FONT_MONTSERRAT_42 0 -#define LV_FONT_MONTSERRAT_44 0 -#define LV_FONT_MONTSERRAT_46 0 -#define LV_FONT_MONTSERRAT_48 0 +#define LV_FONT_MONTSERRAT_16 1 +#define LV_FONT_MONTSERRAT_18 1 +#define LV_FONT_MONTSERRAT_20 1 +#define LV_FONT_MONTSERRAT_22 1 +#define LV_FONT_MONTSERRAT_24 1 +#define LV_FONT_MONTSERRAT_26 1 +#define LV_FONT_MONTSERRAT_28 1 +#define LV_FONT_MONTSERRAT_30 1 +#define LV_FONT_MONTSERRAT_32 1 +#define LV_FONT_MONTSERRAT_34 1 +#define LV_FONT_MONTSERRAT_36 1 +#define LV_FONT_MONTSERRAT_38 1 +#define LV_FONT_MONTSERRAT_40 1 +#define LV_FONT_MONTSERRAT_42 1 +#define LV_FONT_MONTSERRAT_44 1 +#define LV_FONT_MONTSERRAT_46 1 +#define LV_FONT_MONTSERRAT_48 1 /*Demonstrate special features*/ #define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ @@ -774,7 +774,7 @@ #define LV_USE_LIBJPEG_TURBO 0 /*GIF decoder library*/ -#define LV_USE_GIF 0 +#define LV_USE_GIF 1 #if LV_USE_GIF /*GIF decoder accelerate*/ #define LV_GIF_CACHE_DECODE_DATA 0 @@ -847,14 +847,14 @@ #define LV_USE_SNAPSHOT 0 /*1: Enable system monitor component*/ -#define LV_USE_SYSMON 0 +#define LV_USE_SYSMON 1 #if LV_USE_SYSMON /*Get the idle percentage. E.g. uint32_t my_get_idle(void);*/ #define LV_SYSMON_GET_IDLE lv_timer_get_idle /*1: Show CPU usage and FPS count * Requires `LV_USE_SYSMON = 1`*/ - #define LV_USE_PERF_MONITOR 0 + #define LV_USE_PERF_MONITOR 1 #if LV_USE_PERF_MONITOR #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT @@ -865,7 +865,7 @@ /*1: Show the used memory and the memory fragmentation * Requires `LV_USE_STDLIB_MALLOC = LV_STDLIB_BUILTIN` * Requires `LV_USE_SYSMON = 1`*/ - #define LV_USE_MEM_MONITOR 0 + #define LV_USE_MEM_MONITOR 1 #if LV_USE_MEM_MONITOR #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT #endif @@ -977,7 +977,7 @@ #endif /*Driver for /dev/fb*/ -#define LV_USE_LINUX_FBDEV 0 +#define LV_USE_LINUX_FBDEV 1 #if LV_USE_LINUX_FBDEV #define LV_LINUX_FBDEV_BSD 0 #define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL @@ -1013,7 +1013,7 @@ #define LV_USE_TFT_ESPI 0 /*Driver for evdev input devices*/ -#define LV_USE_EVDEV 0 +#define LV_USE_EVDEV 1 /*Driver for libinput input devices*/ #define LV_USE_LIBINPUT 0 diff --git a/deps/lv_conf_sim.h b/deps/lv_conf_sim.h index 6fe867d7..a46c3d95 100644 --- a/deps/lv_conf_sim.h +++ b/deps/lv_conf_sim.h @@ -27,7 +27,7 @@ *====================*/ /*Color depth: 1 (I1), 8 (L8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888)*/ -#define LV_COLOR_DEPTH 16 +#define LV_COLOR_DEPTH 32 /*========================= STDLIB WRAPPER SETTINGS @@ -53,7 +53,7 @@ #if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN /*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/ - #define LV_MEM_SIZE (64 * 1024U) /*[bytes]*/ + #define LV_MEM_SIZE (4096 * 4096) /*[bytes]*/ /*Size of the memory expand for `lv_malloc()` in bytes*/ #define LV_MEM_POOL_EXPAND_SIZE 0 @@ -261,7 +261,7 @@ *-----------*/ /*Enable the log module*/ -#define LV_USE_LOG 0 +#define LV_USE_LOG 1 #if LV_USE_LOG /*How important log should be added: @@ -271,11 +271,11 @@ *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail *LV_LOG_LEVEL_USER Only logs added by the user *LV_LOG_LEVEL_NONE Do not log anything*/ - #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN + #define LV_LOG_LEVEL LV_LOG_LEVEL_USER /*1: Print the log with 'printf'; *0: User need to register a callback with `lv_log_register_print_cb()`*/ - #define LV_LOG_PRINTF 0 + #define LV_LOG_PRINTF 1 /*Set callback to print the logs. *E.g `my_print`. The prototype should be `void my_print(lv_log_level_t level, const char * buf)` @@ -312,9 +312,9 @@ *If LV_USE_LOG is enabled an error message will be printed on failure*/ #define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ #define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ -#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/ -#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ -#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ +#define LV_USE_ASSERT_STYLE 1 /*Check if the styles are properly initialized. (Very fast, recommended)*/ +#define LV_USE_ASSERT_MEM_INTEGRITY 1 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ +#define LV_USE_ASSERT_OBJ 1 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ /*Add a custom handler when assert happens e.g. to restart the MCU*/ #define LV_ASSERT_HANDLER_INCLUDE @@ -467,27 +467,27 @@ /*Montserrat fonts with ASCII range and some symbols using bpp = 4 *https://fonts.google.com/specimen/Montserrat*/ -#define LV_FONT_MONTSERRAT_8 0 -#define LV_FONT_MONTSERRAT_10 0 -#define LV_FONT_MONTSERRAT_12 0 +#define LV_FONT_MONTSERRAT_8 1 +#define LV_FONT_MONTSERRAT_10 1 +#define LV_FONT_MONTSERRAT_12 1 #define LV_FONT_MONTSERRAT_14 1 -#define LV_FONT_MONTSERRAT_16 0 -#define LV_FONT_MONTSERRAT_18 0 -#define LV_FONT_MONTSERRAT_20 0 -#define LV_FONT_MONTSERRAT_22 0 -#define LV_FONT_MONTSERRAT_24 0 -#define LV_FONT_MONTSERRAT_26 0 -#define LV_FONT_MONTSERRAT_28 0 -#define LV_FONT_MONTSERRAT_30 0 -#define LV_FONT_MONTSERRAT_32 0 -#define LV_FONT_MONTSERRAT_34 0 -#define LV_FONT_MONTSERRAT_36 0 -#define LV_FONT_MONTSERRAT_38 0 -#define LV_FONT_MONTSERRAT_40 0 -#define LV_FONT_MONTSERRAT_42 0 -#define LV_FONT_MONTSERRAT_44 0 -#define LV_FONT_MONTSERRAT_46 0 -#define LV_FONT_MONTSERRAT_48 0 +#define LV_FONT_MONTSERRAT_16 1 +#define LV_FONT_MONTSERRAT_18 1 +#define LV_FONT_MONTSERRAT_20 1 +#define LV_FONT_MONTSERRAT_22 1 +#define LV_FONT_MONTSERRAT_24 1 +#define LV_FONT_MONTSERRAT_26 1 +#define LV_FONT_MONTSERRAT_28 1 +#define LV_FONT_MONTSERRAT_30 1 +#define LV_FONT_MONTSERRAT_32 1 +#define LV_FONT_MONTSERRAT_34 1 +#define LV_FONT_MONTSERRAT_36 1 +#define LV_FONT_MONTSERRAT_38 1 +#define LV_FONT_MONTSERRAT_40 1 +#define LV_FONT_MONTSERRAT_42 1 +#define LV_FONT_MONTSERRAT_44 1 +#define LV_FONT_MONTSERRAT_46 1 +#define LV_FONT_MONTSERRAT_48 1 /*Demonstrate special features*/ #define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ @@ -774,7 +774,7 @@ #define LV_USE_LIBJPEG_TURBO 0 /*GIF decoder library*/ -#define LV_USE_GIF 0 +#define LV_USE_GIF 1 #if LV_USE_GIF /*GIF decoder accelerate*/ #define LV_GIF_CACHE_DECODE_DATA 0 @@ -847,14 +847,14 @@ #define LV_USE_SNAPSHOT 0 /*1: Enable system monitor component*/ -#define LV_USE_SYSMON 0 +#define LV_USE_SYSMON 1 #if LV_USE_SYSMON /*Get the idle percentage. E.g. uint32_t my_get_idle(void);*/ #define LV_SYSMON_GET_IDLE lv_timer_get_idle /*1: Show CPU usage and FPS count * Requires `LV_USE_SYSMON = 1`*/ - #define LV_USE_PERF_MONITOR 0 + #define LV_USE_PERF_MONITOR 1 #if LV_USE_PERF_MONITOR #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT @@ -865,7 +865,7 @@ /*1: Show the used memory and the memory fragmentation * Requires `LV_USE_STDLIB_MALLOC = LV_STDLIB_BUILTIN` * Requires `LV_USE_SYSMON = 1`*/ - #define LV_USE_MEM_MONITOR 0 + #define LV_USE_MEM_MONITOR 1 #if LV_USE_MEM_MONITOR #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT #endif @@ -947,7 +947,7 @@ *==================*/ /*Use SDL to open window on PC and handle mouse and keyboard*/ -#define LV_USE_SDL 0 +#define LV_USE_SDL 1 #if LV_USE_SDL #define LV_SDL_INCLUDE_PATH #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /*LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance*/ From e9a90feceafa2c85b6d98c125bf2ea2065280205 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 2 Aug 2024 09:01:49 +0200 Subject: [PATCH 06/10] Update to the new driver api Re-work the HAL code to the new LVGL driver api. --- src/engine/hal/device/device.cpp | 63 ++++++-------------------- src/engine/hal/device/device.hpp | 2 - src/engine/hal/simulator/simulator.cpp | 63 ++++---------------------- src/engine/hal/simulator/simulator.hpp | 15 ------ 4 files changed, 25 insertions(+), 118 deletions(-) diff --git a/src/engine/hal/device/device.cpp b/src/engine/hal/device/device.cpp index fd61193a..192afac4 100644 --- a/src/engine/hal/device/device.cpp +++ b/src/engine/hal/device/device.cpp @@ -1,56 +1,23 @@ #include "./device.hpp" -#define DISP_BUF_SIZE (1024 * 600) - void hal_init () { /*LittlevGL init*/ lv_init(); /*Linux frame buffer device init*/ - fbdev_init(); - - /*A small buffer for LittlevGL to draw the screen's content*/ - static lv_color_t buf[DISP_BUF_SIZE]; - - /*Initialize a descriptor for the buffer*/ - static lv_disp_draw_buf_t disp_buf; - lv_disp_draw_buf_init(&disp_buf, buf, NULL, DISP_BUF_SIZE); - - /*Initialize and register a display driver*/ - static lv_disp_drv_t disp_drv; - lv_disp_drv_init(&disp_drv); - disp_drv.draw_buf = &disp_buf; - disp_drv.flush_cb = fbdev_flush; - disp_drv.hor_res = 1024; - disp_drv.ver_res = 600; - lv_disp_drv_register(&disp_drv); - - /* Linux input device init */ - evdev_init(); - - /* Initialize and register a display input driver */ - static lv_indev_drv_t indev_drv; - lv_indev_drv_init(&indev_drv); /*Basic initialization*/ - - indev_drv.type = LV_INDEV_TYPE_POINTER; - indev_drv.read_cb = evdev_read; //lv_gesture_dir_t lv_indev_get_gesture_dir(const lv_indev_t * indev) - lv_indev_t * my_indev = lv_indev_drv_register(&indev_drv); + lv_display_t *disp = lv_linux_fbdev_create(); + lv_linux_fbdev_set_file(disp, "/dev/fb0"); + + /* Linux input device init */ + lv_indev_t *mouse = lv_evdev_create(LV_INDEV_TYPE_POINTER, "/dev/input/event0"); + lv_indev_set_group(mouse, lv_group_get_default()); + lv_indev_set_display(mouse, disp); + +#ifdef SHOW_CURSOR + /* Set a cursor for the mouse */ + LV_IMG_DECLARE(mouse_cursor_icon); /* Declare the image file */ + lv_obj_t *cursor_obj = lv_img_create(lv_scr_act()); /* Create an image object for the cursor */ + lv_img_set_src(cursor_obj, &mouse_cursor_icon); /* Set the image source */ + lv_indev_set_cursor(mouse, cursor_obj); /* Connect the image object to the driver */ +#endif }; - -uint32_t custom_tick_get(void) -{ - static uint64_t start_ms = 0; - if(start_ms == 0) { - struct timeval tv_start; - gettimeofday(&tv_start, NULL); - start_ms = (tv_start.tv_sec * 1000000 + tv_start.tv_usec) / 1000; - } - - struct timeval tv_now; - gettimeofday(&tv_now, NULL); - uint64_t now_ms; - now_ms = (tv_now.tv_sec * 1000000 + tv_now.tv_usec) / 1000; - - uint32_t time_ms = now_ms - start_ms; - return time_ms; -} \ No newline at end of file diff --git a/src/engine/hal/device/device.hpp b/src/engine/hal/device/device.hpp index ecaf406a..ba9e001e 100644 --- a/src/engine/hal/device/device.hpp +++ b/src/engine/hal/device/device.hpp @@ -1,5 +1,3 @@ #include "lvgl/lvgl.h" -#include "lv_drivers/display/fbdev.h" -#include "lv_drivers/indev/evdev.h" #include #include diff --git a/src/engine/hal/simulator/simulator.cpp b/src/engine/hal/simulator/simulator.cpp index 30a04720..7d9a36c8 100644 --- a/src/engine/hal/simulator/simulator.cpp +++ b/src/engine/hal/simulator/simulator.cpp @@ -1,67 +1,24 @@ #include "./simulator.hpp" void hal_init(void) { - hor_res = SDL_HOR_RES; - ver_res = SDL_VER_RES; - - static lv_color_t buf[SDL_HOR_RES * 100]; - - flush_cb = sdl_display_flush; - - read_cb1 = &sdl_mouse_read; - read_cb2 = &sdl_keyboard_read; - read_cb3 = &sdl_mousewheel_read; - - /* Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/ - sdl_init(); - - /*Create a display buffer*/ - static lv_disp_draw_buf_t disp_buf1; - lv_disp_draw_buf_init(&disp_buf1, buf, NULL, SDL_HOR_RES * 100); - - /*Create a display*/ - 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 = flush_cb; - disp_drv.hor_res = SDL_HOR_RES; - disp_drv.ver_res = SDL_VER_RES; - - lv_disp_t * disp = lv_disp_drv_register(&disp_drv); - - lv_theme_t * th = lv_theme_default_init(disp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), LV_THEME_DEFAULT_DARK, LV_FONT_DEFAULT); - lv_disp_set_theme(disp, th); + lv_display_t * disp = lv_sdl_window_create(640, 480); lv_group_t * g = lv_group_create(); lv_group_set_default(g); - /* Add the mouse as input device - * Use the 'mouse' driver which reads the PC's mouse*/ - 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; + lv_indev_t * mouse = lv_sdl_mouse_create(); + lv_indev_t * mousewheel = lv_sdl_mousewheel_create(); + lv_indev_set_group(mousewheel, lv_group_get_default()); - /*This function will be called periodically (by the library) to get the mouse position and state*/ - indev_drv_1.read_cb = read_cb1; - lv_indev_t *mouse_indev = lv_indev_drv_register(&indev_drv_1); + lv_indev_t * keyboard = lv_sdl_keyboard_create(); + lv_indev_set_group(keyboard, lv_group_get_default()); - 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 = read_cb2; - lv_indev_t *kb_indev = lv_indev_drv_register(&indev_drv_2); - lv_indev_set_group(kb_indev, g); - - 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 = read_cb3; - lv_indev_t * enc_indev = lv_indev_drv_register(&indev_drv_3); - lv_indev_set_group(enc_indev, g); + lv_theme_t * th = lv_theme_default_init(disp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), LV_THEME_DEFAULT_DARK, LV_FONT_DEFAULT); + lv_disp_set_theme(disp, th); /*Set a cursor for the mouse*/ LV_IMG_DECLARE(mouse_cursor_icon); /*Declare the image file.*/ lv_obj_t * cursor_obj = lv_img_create(lv_scr_act()); /*Create an image object for the cursor */ lv_img_set_src(cursor_obj, &mouse_cursor_icon); /*Set the image source*/ - lv_indev_set_cursor(mouse_indev, cursor_obj); /*Connect the image object to the driver*/ -} \ No newline at end of file + lv_indev_set_cursor(mouse, cursor_obj); /*Connect the image object to the driver*/ +} diff --git a/src/engine/hal/simulator/simulator.hpp b/src/engine/hal/simulator/simulator.hpp index 12713b80..9667d0be 100644 --- a/src/engine/hal/simulator/simulator.hpp +++ b/src/engine/hal/simulator/simulator.hpp @@ -1,18 +1,3 @@ #pragma once -#include #include "lvgl/lvgl.h" -#include "lv_drivers/sdl/sdl.h" - -static void* buf; - -static void (*flush_cb)(struct _lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p); - -static lv_coord_t hor_res; -static lv_coord_t ver_res; - -using read_cb = void (*)(struct _lv_indev_drv_t * indev_drv, lv_indev_data_t * data); - -static read_cb read_cb1; -static read_cb read_cb2; -static read_cb read_cb3; From 0e05accd305e3d0e80f84e4a729873d012109b1a Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 2 Aug 2024 09:01:49 +0200 Subject: [PATCH 07/10] Update to the new LVGL api In the new LVGL v9 api, the name of many symbols has changed, some structs are made opaque with helper functions to access their contents, some datatypes changed from 16 to 32bit, etc. --- src/engine/hal/device/device.cpp | 6 +- src/engine/hal/simulator/mouse_cursor_icon.c | 8 +- src/engine/hal/simulator/simulator.cpp | 8 +- src/render/native/components/arc/arc.cpp | 9 +- .../native/components/button/button.cpp | 4 +- .../native/components/calendar/calendar.cpp | 2 +- src/render/native/components/chart/chart.cpp | 14 ++-- .../native/components/checkbox/checkbox.cpp | 6 +- src/render/native/components/component.hpp | 32 ++++---- .../components/dropdownlist/dropdownlist.cpp | 2 +- src/render/native/components/gif/gif.cpp | 3 +- src/render/native/components/image/image.cpp | 8 +- .../native/components/keyboard/keyboard.cpp | 2 +- src/render/native/components/line/line.cpp | 4 +- src/render/native/components/line/line.hpp | 4 +- .../native/components/line/line_wrap.cpp | 4 +- src/render/native/components/list/list.cpp | 2 +- src/render/native/components/mask/mask.cpp | 8 +- .../components/progressbar/progressbar.cpp | 2 +- .../native/components/roller/roller.cpp | 2 +- .../native/components/slider/slider.cpp | 2 +- .../native/components/switch/switch.cpp | 6 +- .../native/components/tabview/tabview.cpp | 5 +- src/render/native/components/text/text.cpp | 2 +- .../native/components/textarea/textarea.cpp | 23 +++--- src/render/native/components/view/view.cpp | 2 +- .../native/components/window/window.cpp | 10 +-- src/render/native/core/animate/animate.cpp | 2 +- src/render/native/core/basic/comp.cpp | 22 ++--- src/render/native/core/basic/comp.hpp | 4 +- .../native/core/dimensions/dimensions.cpp | 6 +- src/render/native/core/event/click/click.cpp | 4 +- src/render/native/core/event/event.cpp | 8 +- src/render/native/core/event/event.hpp | 2 +- .../native/core/event/select/select.cpp | 2 +- .../core/event/value_change/value_change.cpp | 4 +- src/render/native/core/img/img.cpp | 6 +- src/render/native/core/img/img.hpp | 2 +- src/render/native/core/img/png/png.cpp | 22 ++--- src/render/native/core/style/style.cpp | 82 +++++++++---------- src/render/native/core/theme/theme.cpp | 17 ++-- src/render/native/core/theme/theme.hpp | 4 +- 42 files changed, 179 insertions(+), 188 deletions(-) diff --git a/src/engine/hal/device/device.cpp b/src/engine/hal/device/device.cpp index 192afac4..6c071925 100644 --- a/src/engine/hal/device/device.cpp +++ b/src/engine/hal/device/device.cpp @@ -15,9 +15,9 @@ void hal_init () { #ifdef SHOW_CURSOR /* Set a cursor for the mouse */ - LV_IMG_DECLARE(mouse_cursor_icon); /* Declare the image file */ - lv_obj_t *cursor_obj = lv_img_create(lv_scr_act()); /* Create an image object for the cursor */ - lv_img_set_src(cursor_obj, &mouse_cursor_icon); /* Set the image source */ + LV_IMAGE_DECLARE(mouse_cursor_icon); /* Declare the image file */ + lv_obj_t *cursor_obj = lv_image_create(lv_screen_active()); /* Create an image object for the cursor */ + lv_image_set_src(cursor_obj, &mouse_cursor_icon); /* Set the image source */ lv_indev_set_cursor(mouse, cursor_obj); /* Connect the image object to the driver */ #endif }; diff --git a/src/engine/hal/simulator/mouse_cursor_icon.c b/src/engine/hal/simulator/mouse_cursor_icon.c index cf82f010..67c0701f 100644 --- a/src/engine/hal/simulator/mouse_cursor_icon.c +++ b/src/engine/hal/simulator/mouse_cursor_icon.c @@ -94,11 +94,11 @@ const uint8_t mouse_cursor_icon_map[] = { #endif }; -lv_img_dsc_t mouse_cursor_icon = { - .header.always_zero = 0, +lv_image_dsc_t mouse_cursor_icon = { + .header.magic = LV_IMAGE_HEADER_MAGIC, .header.w = 14, .header.h = 20, - .data_size = 280 * LV_IMG_PX_SIZE_ALPHA_BYTE, - .header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA, + .data_size = 280 * LV_COLOR_NATIVE_WITH_ALPHA_SIZE, + .header.cf = LV_COLOR_FORMAT_NATIVE_WITH_ALPHA, .data = mouse_cursor_icon_map, }; diff --git a/src/engine/hal/simulator/simulator.cpp b/src/engine/hal/simulator/simulator.cpp index 7d9a36c8..e9558086 100644 --- a/src/engine/hal/simulator/simulator.cpp +++ b/src/engine/hal/simulator/simulator.cpp @@ -14,11 +14,11 @@ void hal_init(void) { lv_indev_set_group(keyboard, lv_group_get_default()); lv_theme_t * th = lv_theme_default_init(disp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), LV_THEME_DEFAULT_DARK, LV_FONT_DEFAULT); - lv_disp_set_theme(disp, th); + lv_display_set_theme(disp, th); /*Set a cursor for the mouse*/ - LV_IMG_DECLARE(mouse_cursor_icon); /*Declare the image file.*/ - lv_obj_t * cursor_obj = lv_img_create(lv_scr_act()); /*Create an image object for the cursor */ - lv_img_set_src(cursor_obj, &mouse_cursor_icon); /*Set the image source*/ + LV_IMAGE_DECLARE(mouse_cursor_icon); /*Declare the image file.*/ + lv_obj_t * cursor_obj = lv_image_create(lv_screen_active()); /*Create an image object for the cursor */ + lv_image_set_src(cursor_obj, &mouse_cursor_icon); /*Set the image source*/ lv_indev_set_cursor(mouse, cursor_obj); /*Connect the image object to the driver*/ } diff --git a/src/render/native/components/arc/arc.cpp b/src/render/native/components/arc/arc.cpp index 265c70ca..2d68e9f8 100644 --- a/src/render/native/components/arc/arc.cpp +++ b/src/render/native/components/arc/arc.cpp @@ -1,5 +1,4 @@ #include "arc.hpp" -#include "src/widgets/lv_arc.h" Arc::Arc(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->type = COMP_TYPE_ARC; @@ -8,7 +7,7 @@ Arc::Arc(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->instance = lv_arc_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); @@ -74,10 +73,10 @@ void Arc::setArcImage (uint8_t* buf, size_t buf_len, int32_t style_type, std::st uint8_t* img_data = GetImgDesc(buf, buf_len, img_desc); if (img_data != nullptr) { img_desc->data = img_data; - lv_style_set_arc_img_src(style, img_desc); + lv_style_set_arc_image_src(style, img_desc); } } else { - lv_style_set_arc_img_src(style, NULL); + lv_style_set_arc_image_src(style, NULL); } this->image_desc_map[style_type] = img_desc; @@ -94,7 +93,7 @@ void Arc::setArcImage (uint8_t* buf, size_t buf_len, int32_t style_type, std::st } this->symbol_map[style_type] = symbol; - lv_style_set_arc_img_src(style, this->symbol_map[style_type].c_str()); + lv_style_set_arc_image_src(style, this->symbol_map[style_type].c_str()); } lv_obj_invalidate(this->instance); diff --git a/src/render/native/components/button/button.cpp b/src/render/native/components/button/button.cpp index b0ef1b97..5bf21342 100644 --- a/src/render/native/components/button/button.cpp +++ b/src/render/native/components/button/button.cpp @@ -5,12 +5,12 @@ Button::Button(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->type = COMP_TYPE_BUTTON; this->uid = uid; - this->instance = lv_btn_create(parent != nullptr ? parent : GetWindowInstance()); + this->instance = lv_button_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); }; diff --git a/src/render/native/components/calendar/calendar.cpp b/src/render/native/components/calendar/calendar.cpp index 8f9329d5..6e468ada 100644 --- a/src/render/native/components/calendar/calendar.cpp +++ b/src/render/native/components/calendar/calendar.cpp @@ -11,7 +11,7 @@ Calendar::Calendar(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_set_user_data(this->instance, this); }; diff --git a/src/render/native/components/chart/chart.cpp b/src/render/native/components/chart/chart.cpp index b6d7ea45..3827b6d1 100644 --- a/src/render/native/components/chart/chart.cpp +++ b/src/render/native/components/chart/chart.cpp @@ -9,7 +9,7 @@ Chart::Chart(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); @@ -85,7 +85,7 @@ void Chart::setLeftAxisData (std::vector& data) { for (i=0; ileft_axis[i]->y_points[j] = (lv_coord_t)item.data[j]; + lv_chart_set_value_by_id(this->instance, this->left_axis[i], j, item.data[j]); } } }; @@ -111,7 +111,7 @@ void Chart::setRightAxisData (std::vector& data) { for (i=0; iright_axis[i]->y_points[j] = (lv_coord_t)item.data[j]; + lv_chart_set_value_by_id(this->instance, this->right_axis[i], j, item.data[j]); } } }; @@ -209,12 +209,8 @@ void Chart::setScatterData (std::vector& data) { for (i=0; ileft_axis[i]->x_points[j / 2] = (lv_coord_t)item.data[j]; - } else { - this->left_axis[i]->y_points[(j - 1) / 2] = (lv_coord_t)item.data[j]; - } + for (j=0; jinstance, this->left_axis[i], j / 2, item.data[j], item.data[j + 1]); } } }; diff --git a/src/render/native/components/checkbox/checkbox.cpp b/src/render/native/components/checkbox/checkbox.cpp index 9d4439ab..0bf36ec8 100644 --- a/src/render/native/components/checkbox/checkbox.cpp +++ b/src/render/native/components/checkbox/checkbox.cpp @@ -8,7 +8,7 @@ Checkbox::Checkbox(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); }; @@ -21,7 +21,7 @@ void Checkbox::setChecked (bool payload) { if (payload) { lv_obj_add_state(this->instance, LV_STATE_CHECKED); } else { - lv_obj_clear_state(this->instance, LV_STATE_CHECKED); + lv_obj_remove_state(this->instance, LV_STATE_CHECKED); } }; @@ -29,7 +29,7 @@ void Checkbox::setDisabled (bool payload) { if (payload) { lv_obj_add_state(this->instance, LV_STATE_DISABLED); } else { - lv_obj_clear_state(this->instance, LV_STATE_DISABLED); + lv_obj_remove_state(this->instance, LV_STATE_DISABLED); } }; diff --git a/src/render/native/components/component.hpp b/src/render/native/components/component.hpp index 2fb86339..dfcd41d2 100644 --- a/src/render/native/components/component.hpp +++ b/src/render/native/components/component.hpp @@ -294,47 +294,47 @@ void NativeComponentMaskInit (JSContext* ctx, JSValue ns); lv_refr_now(NULL); \ COMP_REF* s = (COMP_REF*)JS_GetOpaque(this_val, COMPONENT##ClassID); \ lv_obj_t* instance = static_cast(((COMPONENT*)(s->comp))->instance); \ - lv_coord_t left = lv_obj_get_x(instance); \ - return JS_NewInt32(ctx, static_cast(left)); \ + int32_t left = lv_obj_get_x(instance); \ + return JS_NewInt32(ctx, left); \ }; \ \ static JSValue GetStyleTop (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { \ lv_refr_now(NULL); \ COMP_REF* s = (COMP_REF*)JS_GetOpaque(this_val, COMPONENT##ClassID); \ lv_obj_t* instance = static_cast(((COMPONENT*)(s->comp))->instance); \ - lv_coord_t top = lv_obj_get_y(instance); \ - return JS_NewInt32(ctx, static_cast(top)); \ + int32_t top = lv_obj_get_y(instance); \ + return JS_NewInt32(ctx, top); \ }; \ \ static JSValue GetStyleWidth (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { \ lv_refr_now(NULL); \ COMP_REF* s = (COMP_REF*)JS_GetOpaque(this_val, COMPONENT##ClassID); \ lv_obj_t* instance = static_cast(((COMPONENT*)(s->comp))->instance); \ - lv_coord_t width = lv_obj_get_width(instance); \ - return JS_NewInt32(ctx, static_cast(width)); \ + int32_t width = lv_obj_get_width(instance); \ + return JS_NewInt32(ctx, width); \ }; \ \ static JSValue GetStyleHeight (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { \ lv_refr_now(NULL); \ COMP_REF* s = (COMP_REF*)JS_GetOpaque(this_val, COMPONENT##ClassID); \ lv_obj_t* instance = static_cast(((COMPONENT*)(s->comp))->instance); \ - lv_coord_t height = lv_obj_get_height(instance); \ - return JS_NewInt32(ctx, static_cast(height)); \ + int32_t height = lv_obj_get_height(instance); \ + return JS_NewInt32(ctx, height); \ }; \ \ static JSValue GetStyleBoundClinetRect (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { \ lv_refr_now(NULL); \ COMP_REF* s = (COMP_REF*)JS_GetOpaque(this_val, COMPONENT##ClassID); \ lv_obj_t* instance = static_cast(((COMPONENT*)(s->comp))->instance); \ - lv_coord_t width = lv_obj_get_width(instance); \ - lv_coord_t height = lv_obj_get_height(instance); \ - lv_coord_t left = lv_obj_get_x(instance); \ - lv_coord_t top = lv_obj_get_y(instance); \ + int32_t width = lv_obj_get_width(instance); \ + int32_t height = lv_obj_get_height(instance); \ + int32_t left = lv_obj_get_x(instance); \ + int32_t top = lv_obj_get_y(instance); \ JSValue obj = JS_NewObject(ctx); \ - JS_SetPropertyStr(ctx, obj, "width", JS_NewInt32(ctx, static_cast(width))); \ - JS_SetPropertyStr(ctx, obj, "height", JS_NewInt32(ctx, static_cast(height))); \ - JS_SetPropertyStr(ctx, obj, "left", JS_NewInt32(ctx, static_cast(left))); \ - JS_SetPropertyStr(ctx, obj, "top", JS_NewInt32(ctx, static_cast(top))); \ + JS_SetPropertyStr(ctx, obj, "width", JS_NewInt32(ctx, width)); \ + JS_SetPropertyStr(ctx, obj, "height", JS_NewInt32(ctx, height)); \ + JS_SetPropertyStr(ctx, obj, "left", JS_NewInt32(ctx, left)); \ + JS_SetPropertyStr(ctx, obj, "top", JS_NewInt32(ctx, top)); \ return obj; \ }; \ \ diff --git a/src/render/native/components/dropdownlist/dropdownlist.cpp b/src/render/native/components/dropdownlist/dropdownlist.cpp index b42b04d9..db105ea9 100644 --- a/src/render/native/components/dropdownlist/dropdownlist.cpp +++ b/src/render/native/components/dropdownlist/dropdownlist.cpp @@ -8,7 +8,7 @@ Dropdownlist::Dropdownlist(std::string uid, lv_obj_t* parent): BasicComponent(ui this->instance = lv_dropdown_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_set_user_data(this->instance, this); }; diff --git a/src/render/native/components/gif/gif.cpp b/src/render/native/components/gif/gif.cpp index d839f9e0..c85ee95d 100644 --- a/src/render/native/components/gif/gif.cpp +++ b/src/render/native/components/gif/gif.cpp @@ -8,9 +8,8 @@ GIF::GIF(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->instance = lv_gif_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICKABLE); - lv_img_set_size_mode(this->instance, LV_IMG_SIZE_MODE_REAL); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); }; diff --git a/src/render/native/components/image/image.cpp b/src/render/native/components/image/image.cpp index b7b73bc7..ab4b717b 100644 --- a/src/render/native/components/image/image.cpp +++ b/src/render/native/components/image/image.cpp @@ -5,11 +5,11 @@ Image::Image(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->type = COMP_TYPE_IMAGE; this->uid = uid; - this->instance = lv_img_create(parent != nullptr ? parent : GetWindowInstance()); + this->instance = lv_image_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICKABLE); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); }; @@ -22,7 +22,7 @@ void Image::setImageBinary(uint8_t* buf, size_t len) { this->image_buf = img_data; if (img_data != nullptr) { - lv_img_set_src(this->instance, this->image_desc); + lv_image_set_src(this->instance, this->image_desc); } if (prev_buf != nullptr) { @@ -46,7 +46,7 @@ Image::~Image () { void Image::setSymbol (std::string& str) { this->symbol = str; - lv_img_set_src(this->instance, this->symbol.c_str()); + lv_image_set_src(this->instance, this->symbol.c_str()); }; void Image::initCompStyle (int32_t type) { diff --git a/src/render/native/components/keyboard/keyboard.cpp b/src/render/native/components/keyboard/keyboard.cpp index c1f7c94d..371c6da0 100644 --- a/src/render/native/components/keyboard/keyboard.cpp +++ b/src/render/native/components/keyboard/keyboard.cpp @@ -7,7 +7,7 @@ Keyboard::Keyboard(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->instance = lv_keyboard_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_set_user_data(this->instance, this); }; diff --git a/src/render/native/components/line/line.cpp b/src/render/native/components/line/line.cpp index 27583ed2..83793978 100644 --- a/src/render/native/components/line/line.cpp +++ b/src/render/native/components/line/line.cpp @@ -8,12 +8,12 @@ Line::Line(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->instance = lv_line_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_set_user_data(this->instance, this); }; -void Line::setPoints (std::vector& points, int32_t nums) { +void Line::setPoints (std::vector& points, int32_t nums) { this->points.swap(points); lv_line_set_points(this->instance, this->points.data(), nums); diff --git a/src/render/native/components/line/line.hpp b/src/render/native/components/line/line.hpp index 85814f4f..1fb2998b 100644 --- a/src/render/native/components/line/line.hpp +++ b/src/render/native/components/line/line.hpp @@ -8,7 +8,7 @@ class Line final : public BasicComponent { public: Line(std::string uid, lv_obj_t* parent = nullptr); - std::vector points; + std::vector points; - void setPoints (std::vector& points, int32_t nums); + void setPoints (std::vector& points, int32_t nums); }; diff --git a/src/render/native/components/line/line_wrap.cpp b/src/render/native/components/line/line_wrap.cpp index 1711a6ce..e716d730 100644 --- a/src/render/native/components/line/line_wrap.cpp +++ b/src/render/native/components/line/line_wrap.cpp @@ -25,7 +25,7 @@ static JSValue NativeCompSetPoints(JSContext *ctx, JSValueConst this_val, int ar JSValue second_value; int32_t first; int32_t second; - std::vector points; + std::vector points; for (int i=0; i(first), .y = static_cast(second) }); + points.push_back({ .x = static_cast(first), .y = static_cast(second) }); } JS_FreeValue(ctx, first_value); diff --git a/src/render/native/components/list/list.cpp b/src/render/native/components/list/list.cpp index cb9964e6..e0dfad1b 100644 --- a/src/render/native/components/list/list.cpp +++ b/src/render/native/components/list/list.cpp @@ -8,6 +8,6 @@ List::List(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->instance = lv_list_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_set_user_data(this->instance, this); }; diff --git a/src/render/native/components/mask/mask.cpp b/src/render/native/components/mask/mask.cpp index cdc7d5f2..49236a87 100644 --- a/src/render/native/components/mask/mask.cpp +++ b/src/render/native/components/mask/mask.cpp @@ -10,7 +10,7 @@ Mask::Mask(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); }; @@ -20,9 +20,9 @@ void Mask::initCompStyle (int32_t type) { lv_style_t* style = this->style_map.at(type); uint32_t width, height; - lv_disp_t* disp_default = lv_disp_get_default(); - width = disp_default->driver->hor_res; - height = disp_default->driver->ver_res; + lv_display_t* disp_default = lv_display_get_default(); + width = lv_display_get_horizontal_resolution(disp_default); + height = lv_display_get_vertical_resolution(disp_default); lv_obj_set_style_height(this->instance, height, 0); lv_obj_set_style_width(this->instance, width, 0); diff --git a/src/render/native/components/progressbar/progressbar.cpp b/src/render/native/components/progressbar/progressbar.cpp index 3da5be5a..a570eac7 100644 --- a/src/render/native/components/progressbar/progressbar.cpp +++ b/src/render/native/components/progressbar/progressbar.cpp @@ -8,7 +8,7 @@ ProgressBar::ProgressBar(std::string uid, lv_obj_t* parent): BasicComponent(uid) this->instance = lv_bar_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_set_user_data(this->instance, this); }; diff --git a/src/render/native/components/roller/roller.cpp b/src/render/native/components/roller/roller.cpp index 3bfe2c83..add3e56b 100644 --- a/src/render/native/components/roller/roller.cpp +++ b/src/render/native/components/roller/roller.cpp @@ -7,7 +7,7 @@ Roller::Roller(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->instance = lv_roller_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_set_user_data(this->instance, this); }; diff --git a/src/render/native/components/slider/slider.cpp b/src/render/native/components/slider/slider.cpp index 976f404e..a3ee7859 100644 --- a/src/render/native/components/slider/slider.cpp +++ b/src/render/native/components/slider/slider.cpp @@ -8,7 +8,7 @@ Slider::Slider(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->instance = lv_slider_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); diff --git a/src/render/native/components/switch/switch.cpp b/src/render/native/components/switch/switch.cpp index 920b7b4c..c508753d 100644 --- a/src/render/native/components/switch/switch.cpp +++ b/src/render/native/components/switch/switch.cpp @@ -7,7 +7,7 @@ Switch::Switch(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->instance = lv_switch_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_set_user_data(this->instance, this); }; @@ -16,7 +16,7 @@ void Switch::setValue (bool value) { if (value) { lv_obj_add_state(this->instance, LV_STATE_CHECKED); } else { - lv_obj_clear_state(this->instance, LV_STATE_CHECKED); + lv_obj_remove_state(this->instance, LV_STATE_CHECKED); } }; @@ -24,7 +24,7 @@ void Switch::setDisabled (bool value) { if (value) { lv_obj_add_state(this->instance, LV_STATE_DISABLED); } else { - lv_obj_clear_state(this->instance, LV_STATE_DISABLED); + lv_obj_remove_state(this->instance, LV_STATE_DISABLED); } }; diff --git a/src/render/native/components/tabview/tabview.cpp b/src/render/native/components/tabview/tabview.cpp index 9fefd681..7b3bb21e 100644 --- a/src/render/native/components/tabview/tabview.cpp +++ b/src/render/native/components/tabview/tabview.cpp @@ -5,10 +5,11 @@ TabView::TabView(std::string uid, uint32_t pos, uint32_t size, lv_obj_t* parent) this->type = COMP_TYPE_TABVIEW; this->uid = uid; - this->instance = lv_tabview_create(parent != nullptr ? parent : GetWindowInstance(), pos, size); + this->instance = lv_tabview_create(parent != nullptr ? parent : GetWindowInstance()); + lv_tabview_set_tab_bar_size(this->instance, size); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); diff --git a/src/render/native/components/text/text.cpp b/src/render/native/components/text/text.cpp index 8cbf8728..aa61946b 100644 --- a/src/render/native/components/text/text.cpp +++ b/src/render/native/components/text/text.cpp @@ -8,7 +8,7 @@ Text::Text(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->instance = lv_label_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); diff --git a/src/render/native/components/textarea/textarea.cpp b/src/render/native/components/textarea/textarea.cpp index 4c05c392..c3449246 100644 --- a/src/render/native/components/textarea/textarea.cpp +++ b/src/render/native/components/textarea/textarea.cpp @@ -9,7 +9,7 @@ Textarea::Textarea(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_obj_set_user_data(this->instance, this); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_CLICK_FOCUSABLE); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); this->initStyle(LV_PART_MAIN); this->initStyle(LV_STATE_FOCUSED); @@ -18,15 +18,14 @@ Textarea::Textarea(std::string uid, lv_obj_t* parent): BasicComponent(uid) { }; void Textarea::raiseKeyboard (lv_event_t* event) { - Textarea* comp = static_cast(event->user_data); + Textarea* comp = static_cast(lv_event_get_user_data(event)); if (!comp->auto_raise_keyboard) return; lv_obj_t* keyboard = lv_keyboard_create(lv_layer_top()); comp->keyboard = keyboard; - uint32_t width, height; - lv_disp_t* disp_default = lv_disp_get_default(); - width = disp_default->driver->hor_res; - height = disp_default->driver->ver_res; + uint32_t height; + lv_display_t* disp_default = lv_display_get_default(); + height = lv_display_get_vertical_resolution(disp_default); lv_keyboard_set_textarea(keyboard, comp->instance); lv_obj_set_style_height(keyboard, height * 2 / 3, 0); @@ -40,16 +39,16 @@ void Textarea::raiseKeyboard (lv_event_t* event) { }; void Textarea::hideKeyboard (lv_event_t * event) { - Textarea* comp = static_cast(event->user_data); + Textarea* comp = static_cast(lv_event_get_user_data(event)); if (comp->keyboard == nullptr || !comp->auto_raise_keyboard) return; lv_keyboard_set_textarea(comp->keyboard, nullptr); - lv_obj_del_async(comp->keyboard); + lv_obj_delete_async(comp->keyboard); - lv_disp_t* disp_default = lv_disp_get_default(); - lv_obj_set_style_height(GetWindowInstance(), disp_default->driver->ver_res, 0); - lv_obj_update_layout(lv_scr_act()); - lv_obj_clear_state(comp->instance, LV_STATE_FOCUSED); + lv_display_t* disp_default = lv_display_get_default(); + lv_obj_set_style_height(GetWindowInstance(), lv_display_get_vertical_resolution(disp_default), 0); + lv_obj_update_layout(lv_screen_active()); + lv_obj_remove_state(comp->instance, LV_STATE_FOCUSED); lv_indev_reset(NULL, comp->instance); comp->keyboard = nullptr; }; diff --git a/src/render/native/components/view/view.cpp b/src/render/native/components/view/view.cpp index 91747540..3e475d07 100644 --- a/src/render/native/components/view/view.cpp +++ b/src/render/native/components/view/view.cpp @@ -7,7 +7,7 @@ View::View(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->instance = lv_obj_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_clear_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_set_user_data(this->instance, this); // this->initStyle(LV_PART_MAIN); diff --git a/src/render/native/components/window/window.cpp b/src/render/native/components/window/window.cpp index e83678d4..0a3678f3 100644 --- a/src/render/native/components/window/window.cpp +++ b/src/render/native/components/window/window.cpp @@ -7,7 +7,7 @@ lv_obj_t* GetWindowInstance () { // Window::Window(std::string uid): BasicComponent(uid) { // this->uid = uid; -// this->instance = lv_obj_create(lv_scr_act()); +// this->instance = lv_obj_create(lv_screen_active()); // window_instance = this->instance; // lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); // lv_obj_set_user_data(this->instance, this); @@ -15,11 +15,11 @@ lv_obj_t* GetWindowInstance () { // }; void WindowInit () { - lv_disp_t* disp_default = lv_disp_get_default(); - window_instance = lv_obj_create(lv_scr_act()); + lv_display_t* disp_default = lv_display_get_default(); + window_instance = lv_obj_create(lv_screen_active()); lv_group_add_obj(lv_group_get_default(), window_instance); - lv_obj_set_style_height(window_instance, disp_default->driver->ver_res, 0); - lv_obj_set_style_width(window_instance, disp_default->driver->hor_res, 0); + lv_obj_set_style_height(window_instance, lv_display_get_vertical_resolution(disp_default), 0); + lv_obj_set_style_width(window_instance, lv_display_get_horizontal_resolution(disp_default), 0); lv_obj_set_style_pad_all(window_instance, 0, 0); lv_obj_set_style_radius(window_instance, 0, 0); lv_obj_set_style_border_width(window_instance, 0, 0); diff --git a/src/render/native/core/animate/animate.cpp b/src/render/native/core/animate/animate.cpp index 07b8828c..1d07ed82 100644 --- a/src/render/native/core/animate/animate.cpp +++ b/src/render/native/core/animate/animate.cpp @@ -125,7 +125,7 @@ static JSValue NativeAnimateStart(JSContext *ctx, JSValueConst this_val, int arg if (JS_IsNumber(readycb_value)) { JS_ToInt32(ctx, &readycb_uid, readycb_value); ref->readycb_uid = readycb_uid; - lv_anim_set_ready_cb(animate, Animate_Ready_Callback); + lv_anim_set_completed_cb(animate, Animate_Ready_Callback); } if (JS_IsBool(use_native_value)) { use_native = JS_ToBool(ctx, use_native_value); diff --git a/src/render/native/core/basic/comp.cpp b/src/render/native/core/basic/comp.cpp index 7d26e20a..47181ec5 100644 --- a/src/render/native/core/basic/comp.cpp +++ b/src/render/native/core/basic/comp.cpp @@ -17,9 +17,9 @@ void BasicComponent::addEventListener (int eventType) { }; void BasicComponent::EventCallback (lv_event_t * event) { - BasicComponent* instance = static_cast(event->user_data); + BasicComponent* instance = static_cast(lv_event_get_user_data(event)); std::string uid = instance->uid; - lv_event_code_t code = event->code; + lv_event_code_t code = lv_event_get_code(event); if (instance->isEventRegist(static_cast(code))) { FireEventToJS(event, uid, code); } @@ -207,10 +207,10 @@ void BasicComponent::setBackgroundImage (uint8_t* buf, size_t buf_len, int32_t s uint8_t* img_data = GetImgDesc(buf, buf_len, img_desc); if (img_data != nullptr) { img_desc->data = img_data; - lv_style_set_bg_img_src(style, img_desc); + lv_style_set_bg_image_src(style, img_desc); } } else { - lv_style_set_bg_img_src(style, NULL); + lv_style_set_bg_image_src(style, NULL); } this->image_desc_map[style_type] = img_desc; @@ -227,7 +227,7 @@ void BasicComponent::setBackgroundImage (uint8_t* buf, size_t buf_len, int32_t s } this->symbol_map[style_type] = symbol; - lv_style_set_bg_img_src(style, this->symbol_map[style_type].c_str()); + lv_style_set_bg_image_src(style, this->symbol_map[style_type].c_str()); } lv_obj_invalidate(this->instance); @@ -236,9 +236,9 @@ void BasicComponent::setBackgroundImage (uint8_t* buf, size_t buf_len, int32_t s BasicComponent::~BasicComponent () { comp_map.erase(this->uid); - const lv_coord_t* ptr1 = this->grid_row_desc; - const lv_coord_t* ptr2 = this->grid_column_desc; - + const int32_t* ptr1 = this->grid_row_desc; + const int32_t* ptr2 = this->grid_column_desc; + for(auto& desc : this->image_desc_map) { if (desc.second != nullptr) { const uint8_t* buf = (static_cast(desc.second))->data; @@ -250,13 +250,13 @@ BasicComponent::~BasicComponent () { } if (ptr1) { - free((lv_coord_t*)(ptr1)); + free((int32_t*)(ptr1)); } if (ptr2) { - free((lv_coord_t*)(ptr2)); + free((int32_t*)(ptr2)); } // do not del here, remove child will do the action - // lv_obj_del(this->instance); + // lv_obj_delete(this->instance); }; void BasicComponent::setAlign (int32_t align_type, int32_t x, int32_t y) { diff --git a/src/render/native/core/basic/comp.hpp b/src/render/native/core/basic/comp.hpp index cc96f018..2132336d 100644 --- a/src/render/native/core/basic/comp.hpp +++ b/src/render/native/core/basic/comp.hpp @@ -57,8 +57,8 @@ class BasicComponent { bool listening = false; ECOMP_TYPE type; - lv_coord_t* grid_row_desc = nullptr; - lv_coord_t* grid_column_desc = nullptr; + int32_t* grid_row_desc = nullptr; + int32_t* grid_column_desc = nullptr; std::map registeEvents; diff --git a/src/render/native/core/dimensions/dimensions.cpp b/src/render/native/core/dimensions/dimensions.cpp index bd84c277..206110d5 100644 --- a/src/render/native/core/dimensions/dimensions.cpp +++ b/src/render/native/core/dimensions/dimensions.cpp @@ -2,10 +2,10 @@ static JSValue NativeCompGetDimensions(JSContext* ctx, JSValueConst this_val) { uint32_t width, height; - lv_disp_t* disp_default = lv_disp_get_default(); + lv_display_t* disp_default = lv_display_get_default(); - width = disp_default->driver->hor_res; - height = disp_default->driver->ver_res; + width = lv_display_get_horizontal_resolution(disp_default); + height = lv_display_get_vertical_resolution(disp_default); JSValue obj = JS_NewObject(ctx); JS_SetPropertyStr(ctx, obj, "width", JS_NewInt32(ctx, width)); diff --git a/src/render/native/core/event/click/click.cpp b/src/render/native/core/event/click/click.cpp index ca7c3cd8..e1e1813b 100644 --- a/src/render/native/core/event/click/click.cpp +++ b/src/render/native/core/event/click/click.cpp @@ -16,7 +16,7 @@ static JSClassDef ClickEventWrapClass = { static JSValue GetPressedPoint (JSContext* ctx, JSValueConst this_val) { lv_event_t* e = static_cast(JS_GetOpaque(this_val, WrapClickEventID)); - BasicComponent* comp = static_cast(e->user_data); + BasicComponent* comp = static_cast(lv_event_get_user_data(e)); ECOMP_TYPE comp_type = comp->type; int32_t value_num = 0; @@ -34,7 +34,7 @@ static JSValue GetPressedPoint (JSContext* ctx, JSValueConst this_val) { static JSValue GetPressedPointPos (JSContext* ctx, JSValueConst this_val) { lv_event_t* e = static_cast(JS_GetOpaque(this_val, WrapClickEventID)); - BasicComponent* comp = static_cast(e->user_data); + BasicComponent* comp = static_cast(lv_event_get_user_data(e)); ECOMP_TYPE comp_type = comp->type; int32_t id = 0; diff --git a/src/render/native/core/event/event.cpp b/src/render/native/core/event/event.cpp index 4ffba1d9..8777b6e3 100644 --- a/src/render/native/core/event/event.cpp +++ b/src/render/native/core/event/event.cpp @@ -12,10 +12,10 @@ void FireEventToJS(lv_event_t* event, std::string uid, lv_event_code_t eventType ctx = qrt->ctx; std::map::iterator iter = WrapEventDict.find(eventType); - struct _lv_obj_t *target = event->target; - struct _lv_obj_t *current_target = event->current_target; - BasicComponent* target_instance = static_cast(target->user_data); - BasicComponent* current_target_instance = static_cast(current_target->user_data); + lv_obj_t *target = (lv_obj_t*) lv_event_get_target(event); + lv_obj_t *current_target = (lv_obj_t*) lv_event_get_current_target(event); + BasicComponent* target_instance = static_cast(lv_obj_get_user_data(target)); + BasicComponent* current_target_instance = static_cast(lv_obj_get_user_data(current_target)); std::string target_uid; std::string current_target_uid; if (target_instance) { diff --git a/src/render/native/core/event/event.hpp b/src/render/native/core/event/event.hpp index 4c25065f..13efdb57 100644 --- a/src/render/native/core/event/event.hpp +++ b/src/render/native/core/event/event.hpp @@ -54,7 +54,7 @@ static std::map WrapEventDict { JSClassID _class_id; \ lv_event_t* ref = static_cast(JS_GetAnyOpaque(this_val, &_class_id)); \ if (ref) { \ - ref->stop_bubbling = 1; \ + lv_event_stop_bubbling(ref); \ } \ }; \ \ diff --git a/src/render/native/core/event/select/select.cpp b/src/render/native/core/event/select/select.cpp index 37aa3db0..7b95896b 100644 --- a/src/render/native/core/event/select/select.cpp +++ b/src/render/native/core/event/select/select.cpp @@ -16,7 +16,7 @@ static JSClassDef SelectEventWrapClass = { static JSValue GetValue (JSContext* ctx, JSValueConst this_val) { lv_event_t* e = static_cast(JS_GetOpaque(this_val, WrapSelectEventID)); - BasicComponent* comp = static_cast(e->user_data); + BasicComponent* comp = static_cast(lv_event_get_user_data(e)); ECOMP_TYPE comp_type = comp->type; int32_t value_num = 0; diff --git a/src/render/native/core/event/value_change/value_change.cpp b/src/render/native/core/event/value_change/value_change.cpp index a72056a8..43563b47 100644 --- a/src/render/native/core/event/value_change/value_change.cpp +++ b/src/render/native/core/event/value_change/value_change.cpp @@ -16,7 +16,7 @@ static JSClassDef ValueChangeEventWrapClass = { static JSValue GetChecked (JSContext* ctx, JSValueConst this_val) { lv_event_t* e = static_cast(JS_GetOpaque(this_val, WrapValueChangeEventID)); - BasicComponent* comp = static_cast(e->user_data); + BasicComponent* comp = static_cast(lv_event_get_user_data(e)); ECOMP_TYPE comp_type = comp->type; bool checked = false; @@ -40,7 +40,7 @@ static JSValue GetChecked (JSContext* ctx, JSValueConst this_val) { static JSValue GetValue (JSContext* ctx, JSValueConst this_val) { lv_event_t* e = static_cast(JS_GetOpaque(this_val, WrapValueChangeEventID)); - BasicComponent* comp = static_cast(e->user_data); + BasicComponent* comp = static_cast(lv_event_get_user_data(e)); ECOMP_TYPE comp_type = comp->type; int32_t value_num = 0; const char* value_str; diff --git a/src/render/native/core/img/img.cpp b/src/render/native/core/img/img.cpp index 326085d3..9ff223e6 100644 --- a/src/render/native/core/img/img.cpp +++ b/src/render/native/core/img/img.cpp @@ -32,11 +32,11 @@ uint8_t* GetImgDesc (uint8_t* buf, size_t len, lv_img_dsc_t_1* image_desc) { lv_img_dsc_t_1* prev_desc = image_desc; image_desc->type = image_type; - image_desc->header.always_zero = 0; + image_desc->header.magic = LV_IMAGE_HEADER_MAGIC; image_desc->header.w = width; image_desc->header.h = height; - image_desc->header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA; - image_desc->data_size = width * height * LV_IMG_PX_SIZE_ALPHA_BYTE; + image_desc->header.cf = LV_COLOR_FORMAT_NATIVE_WITH_ALPHA; + image_desc->data_size = width * height * LV_COLOR_NATIVE_WITH_ALPHA_SIZE; image_desc->data = img_data; return img_data; diff --git a/src/render/native/core/img/img.hpp b/src/render/native/core/img/img.hpp index 93234146..444f8768 100644 --- a/src/render/native/core/img/img.hpp +++ b/src/render/native/core/img/img.hpp @@ -11,7 +11,7 @@ typedef enum { } IMAGE_TYPE; typedef struct { - lv_img_header_t header; + lv_image_header_t header; uint32_t data_size; const uint8_t* data; IMAGE_TYPE type; diff --git a/src/render/native/core/img/png/png.cpp b/src/render/native/core/img/png/png.cpp index f6d8288b..0214b052 100644 --- a/src/render/native/core/img/png/png.cpp +++ b/src/render/native/core/img/png/png.cpp @@ -13,12 +13,12 @@ void convert_color_depth(uint8_t * img, uint32_t px_cnt) #if LV_COLOR_DEPTH == 32 lv_color32_t * img_argb = (lv_color32_t*)img; lv_color_t c; - lv_color_t * img_c = (lv_color_t *) img; + lv_color32_t * img_c = (lv_color32_t *) img; uint32_t i; for(i = 0; i < px_cnt; i++) { - c = lv_color_make(img_argb[i].ch.red, img_argb[i].ch.green, img_argb[i].ch.blue); - img_c[i].ch.red = c.ch.blue; - img_c[i].ch.blue = c.ch.red; + c = lv_color_make(img_argb[i].red, img_argb[i].green, img_argb[i].blue); + img_c[i].red = c.blue; + img_c[i].blue = c.red; } #elif LV_COLOR_DEPTH == 16 lv_color32_t * img_argb = (lv_color32_t*)img; @@ -42,21 +42,21 @@ void convert_color_depth(uint8_t * img, uint32_t px_cnt) #endif } -static lv_res_t decoder_info(struct _lv_img_decoder_t* decoder, const void* src, lv_img_header_t* header) { +static lv_result_t decoder_info(lv_image_decoder_t* decoder, lv_image_decoder_dsc_t* src, lv_image_header_t* header) { const lv_img_dsc_t_1* img_dsc = (const lv_img_dsc_t_1*)src; if(img_dsc->type == IMAGE_TYPE_PNG) { - header->always_zero = 0; + header->magic = LV_IMAGE_HEADER_MAGIC; header->cf = img_dsc->header.cf; /*Save the color format*/ header->w = img_dsc->header.w; /*Save the color width*/ header->h = img_dsc->header.h; /*Save the color height*/ - return LV_RES_OK; + return LV_RESULT_OK; } - return LV_RES_INV; + return LV_RESULT_INVALID; }; void lv_png_init(void) { - lv_img_decoder_t * dec = lv_img_decoder_create(); - lv_img_decoder_set_info_cb(dec, decoder_info); -}; \ No newline at end of file + lv_image_decoder_t * dec = lv_image_decoder_create(); + lv_image_decoder_set_info_cb(dec, decoder_info); +}; diff --git a/src/render/native/core/style/style.cpp b/src/render/native/core/style/style.cpp index b4836d10..9d693e03 100644 --- a/src/render/native/core/style/style.cpp +++ b/src/render/native/core/style/style.cpp @@ -14,97 +14,97 @@ static std::unordered_map transition_funcs = { static void CompSetWidth (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int width; JS_ToInt32(ctx, &width, obj); - lv_style_set_width(style, static_cast(width)); + lv_style_set_width(style, width); }; static void CompSetMaxWidth (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int width; JS_ToInt32(ctx, &width, obj); - lv_style_set_max_width(style, static_cast(width)); + lv_style_set_max_width(style, width); }; static void CompSetMinWidth (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int width; JS_ToInt32(ctx, &width, obj); - lv_style_set_min_width(style, static_cast(width)); + lv_style_set_min_width(style, width); }; static void CompSetMaxWidthPch (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int width; JS_ToInt32(ctx, &width, obj); - lv_style_set_max_width(style, lv_pct(static_cast(width))); + lv_style_set_max_width(style, lv_pct(width)); }; static void CompSetMinWidthPch (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int width; JS_ToInt32(ctx, &width, obj); - lv_style_set_min_width(style, lv_pct(static_cast(width))); + lv_style_set_min_width(style, lv_pct(width)); }; static void CompSetWidthPch (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int width; JS_ToInt32(ctx, &width, obj); - lv_style_set_width(style, lv_pct(static_cast(width))); + lv_style_set_width(style, lv_pct(width)); }; static void CompSetHeight (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int height; JS_ToInt32(ctx, &height, obj); - lv_style_set_height(style, static_cast(height)); + lv_style_set_height(style, height); }; static void CompSetHeightPch (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int height; JS_ToInt32(ctx, &height, obj); - lv_style_set_height(style, lv_pct(static_cast(height))); + lv_style_set_height(style, lv_pct(height)); }; static void CompSetMaxHeight (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int height; JS_ToInt32(ctx, &height, obj); - lv_style_set_max_height(style, static_cast(height)); + lv_style_set_max_height(style, height); }; static void CompSetMaxHeightPch (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int height; JS_ToInt32(ctx, &height, obj); - lv_style_set_max_height(style, lv_pct(static_cast(height))); + lv_style_set_max_height(style, lv_pct(height)); }; static void CompSetMinHeight (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int height; JS_ToInt32(ctx, &height, obj); - lv_style_set_min_height(style, static_cast(height)); + lv_style_set_min_height(style, height); }; static void CompSetMinHeightPch (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int height; JS_ToInt32(ctx, &height, obj); - lv_style_set_min_height(style, lv_pct(static_cast(height))); + lv_style_set_min_height(style, lv_pct(height)); }; static void CompSetX (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int x; JS_ToInt32(ctx, &x, obj); - lv_style_set_x(style, static_cast(x)); + lv_style_set_x(style, x); }; static void CompSetXPch (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int x; JS_ToInt32(ctx, &x, obj); - lv_style_set_x(style, lv_pct(static_cast(x))); + lv_style_set_x(style, lv_pct(x)); }; static void CompSetY (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int y; JS_ToInt32(ctx, &y, obj); - lv_style_set_y(style, static_cast(y)); + lv_style_set_y(style, y); }; static void CompSetYPch (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int y; JS_ToInt32(ctx, &y, obj); - lv_style_set_y(style, lv_pct(static_cast(y))); + lv_style_set_y(style, lv_pct(y)); }; static void CompSetBackgroundColor (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { @@ -138,7 +138,7 @@ static void CompSetBackgroundGradColorDir (lv_obj_t* comp, lv_style_t* style, JS static void CompSetArcWidth (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int width; JS_ToInt32(ctx, &width, obj); - lv_style_set_arc_width(style, static_cast(width)); + lv_style_set_arc_width(style, width); }; static void CompSetArcRounded (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { @@ -171,7 +171,7 @@ static void CompSetDisplay (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, J std::string value = str; value.resize(len); - lv_obj_clear_flag(comp, LV_OBJ_FLAG_HIDDEN); + lv_obj_remove_flag(comp, LV_OBJ_FLAG_HIDDEN); if (value == "flex") { lv_obj_set_layout(comp, LV_LAYOUT_FLEX); @@ -364,7 +364,7 @@ static void CompSetOverFlowScrolling (lv_obj_t* comp, lv_style_t* style, JSConte if (x) { lv_obj_add_flag(comp, LV_OBJ_FLAG_SCROLL_MOMENTUM); } else { - lv_obj_clear_flag(comp, LV_OBJ_FLAG_SCROLL_MOMENTUM); + lv_obj_remove_flag(comp, LV_OBJ_FLAG_SCROLL_MOMENTUM); } }; @@ -373,7 +373,7 @@ static void CompSetOverflow (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JS_ToInt32(ctx, &x, obj); if (x) { - lv_obj_clear_flag(comp, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_remove_flag(comp, LV_OBJ_FLAG_SCROLLABLE); } else { lv_obj_add_flag(comp, LV_OBJ_FLAG_SCROLLABLE); } @@ -398,7 +398,7 @@ static void CompScrollEnableSnap (lv_obj_t* comp, lv_style_t* style, JSContext* JS_ToInt32(ctx, &x, obj); if (!x) { - lv_obj_clear_flag(comp, LV_OBJ_FLAG_SNAPPABLE); + lv_obj_remove_flag(comp, LV_OBJ_FLAG_SNAPPABLE); } else { lv_obj_add_flag(comp, LV_OBJ_FLAG_SNAPPABLE); } @@ -415,14 +415,14 @@ static void CompSetImgOpacity (lv_obj_t* comp, lv_style_t* style, JSContext* ctx int x; JS_ToInt32(ctx, &x, obj); - lv_style_set_img_opa(style, x); + lv_style_set_image_opa(style, x); }; static void CompRecolorOpacity (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int x; JS_ToInt32(ctx, &x, obj); - lv_style_set_img_recolor_opa(style, x); + lv_style_set_image_recolor_opa(style, x); }; static void CompSetTranslateX (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { @@ -443,28 +443,28 @@ static void CompSetScale (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSV int x; JS_ToInt32(ctx, &x, obj); - lv_style_set_transform_zoom(style, x); + lv_style_set_transform_scale(style, x); }; static void CompSetRotate (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int x; JS_ToInt32(ctx, &x, obj); - lv_style_set_transform_angle(style, x); + lv_style_set_transform_rotation(style, x); }; static void CompSetImgScale (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int x; JS_ToInt32(ctx, &x, obj); - lv_img_set_zoom(comp, x); + lv_image_set_scale(comp, x); }; static void CompSetImgRotate (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int x; JS_ToInt32(ctx, &x, obj); - lv_img_set_angle(comp, x); + lv_image_set_rotation(comp, x); }; static void CompSetTransformOrigin (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { @@ -484,7 +484,7 @@ static void CompSetTransformOrigin (lv_obj_t* comp, lv_style_t* style, JSContext JS_FreeValue(ctx, x_value); JS_FreeValue(ctx, y_value); - lv_img_set_pivot(comp, x, y); + lv_image_set_pivot(comp, x, y); }; static void CompSetChartScaleX (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { @@ -519,7 +519,7 @@ static void CompSetStyleTransitionTime (lv_obj_t* comp, lv_style_t* style, JSCon int x; JS_ToInt32(ctx, &x, obj); - lv_style_set_anim_time(style, x); + lv_style_set_anim_duration(style, x); }; void CompSetTransition ( @@ -598,7 +598,7 @@ static void CompSetRecolor (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, J int y; JS_ToInt32(ctx, &y, obj); - lv_style_set_img_recolor(style, lv_color_hex(y)); + lv_style_set_image_recolor(style, lv_color_hex(y)); }; static void CompSetRowSpacing (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { @@ -668,14 +668,14 @@ static void CompSetOffsetX (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, J int x; JS_ToInt32(ctx, &x, obj); - lv_style_set_shadow_ofs_x(style, x); + lv_style_set_shadow_offset_x(style, x); }; static void CompSetOffsetY (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int x; JS_ToInt32(ctx, &x, obj); - lv_style_set_shadow_ofs_y(style, x); + lv_style_set_shadow_offset_y(style, x); }; static void CompSetPosition (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { @@ -684,8 +684,8 @@ static void CompSetPosition (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, std::string value = str; value.resize(len); - lv_obj_clear_flag(comp, LV_OBJ_FLAG_FLOATING); - BasicComponent* instance = static_cast(comp->user_data); + lv_obj_remove_flag(comp, LV_OBJ_FLAG_FLOATING); + BasicComponent* instance = static_cast(lv_obj_get_user_data(comp)); instance->is_fixed = false; if (instance->parent_instance != nullptr) { lv_obj_set_parent(comp, instance->parent_instance); @@ -695,7 +695,7 @@ static void CompSetPosition (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, lv_obj_add_flag(comp, LV_OBJ_FLAG_FLOATING); } else if (value == "fixed") { instance->is_fixed = true; - lv_obj_set_parent(comp, lv_scr_act()); + lv_obj_set_parent(comp, lv_screen_active()); } JS_FreeCString(ctx, str); @@ -704,8 +704,8 @@ static void CompSetPosition (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, static void CompGridColumnRow (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { if (JS_IsArray(ctx, obj)) { BasicComponent* instance = static_cast(lv_obj_get_user_data(comp)); - const lv_coord_t* old_ptr1 = instance->grid_column_desc; - const lv_coord_t* old_ptr2 = instance->grid_row_desc; + const int32_t* old_ptr1 = instance->grid_column_desc; + const int32_t* old_ptr2 = instance->grid_row_desc; JSValue column_value = JS_GetPropertyUint32(ctx, obj, 0); JSValue row_value = JS_GetPropertyUint32(ctx, obj, 1); @@ -716,7 +716,7 @@ static void CompGridColumnRow (lv_obj_t* comp, lv_style_t* style, JSContext* ctx JSValue column_len_value = JS_GetPropertyStr(ctx, column_value, "length"); JS_ToInt32(ctx, &len, column_len_value); - lv_coord_t* column_ptr = static_cast(malloc((len + 1) * sizeof(lv_coord_t))); + int32_t* column_ptr = static_cast(malloc((len + 1) * sizeof(int32_t))); for(int i=0; i < len; i++) { num_value = JS_GetPropertyUint32(ctx, column_value, i); JS_ToInt32(ctx, &num, num_value); @@ -729,7 +729,7 @@ static void CompGridColumnRow (lv_obj_t* comp, lv_style_t* style, JSContext* ctx JSValue row_len_value = JS_GetPropertyStr(ctx, row_value, "length"); JS_ToInt32(ctx, &len, row_len_value); - lv_coord_t* row_ptr = static_cast(malloc((len + 1) * sizeof(lv_coord_t))); + int32_t* row_ptr = static_cast(malloc((len + 1) * sizeof(int32_t))); for(int i=0; i < len; i++) { num_value = JS_GetPropertyUint32(ctx, row_value, i); JS_ToInt32(ctx, &num, num_value); @@ -745,10 +745,10 @@ static void CompGridColumnRow (lv_obj_t* comp, lv_style_t* style, JSContext* ctx lv_obj_set_grid_dsc_array(comp, column_ptr, row_ptr); if (old_ptr1) { - free((lv_coord_t*)(old_ptr1)); + free((int32_t*)(old_ptr1)); } if (old_ptr2) { - free((lv_coord_t*)(old_ptr2)); + free((int32_t*)(old_ptr2)); } } }; diff --git a/src/render/native/core/theme/theme.cpp b/src/render/native/core/theme/theme.cpp index 819d9b06..bd9c61a5 100644 --- a/src/render/native/core/theme/theme.cpp +++ b/src/render/native/core/theme/theme.cpp @@ -1,9 +1,8 @@ #include "./theme.hpp" static void ThemeDefaultInit () { - if (theme_default_init == false) { - theme_default_init = true; - memcpy(&theme_default, lv_theme_default_get(), sizeof(lv_theme_t)); + if (theme_default == NULL) { + theme_default = lv_theme_default_get(); } }; @@ -19,21 +18,21 @@ static JSValue SetTheme(JSContext* ctx, JSValueConst this_val, int argc, JSValue const lv_font_t* font_size; if (JS_IsUndefined(primary_color_value)) { - primary_color = theme_default.color_primary; + primary_color = lv_theme_get_color_primary(NULL); } else { JS_ToInt32(ctx, &primary_color_ori, primary_color_value); primary_color = lv_color_hex(primary_color_ori); } if (JS_IsUndefined(second_primary_value)) { - second_primary = theme_default.color_secondary; + second_primary = lv_theme_get_color_secondary(NULL); } else { JS_ToInt32(ctx, &second_primary_ori, second_primary_value); second_primary = lv_color_hex(second_primary_ori); } if (JS_IsUndefined(font_size_value)) { - font_size = theme_default.font_normal; + font_size = lv_theme_get_font_normal(NULL); } else { JS_ToInt32(ctx, &font_size_ori, font_size_value); font_size = &builtin_font_list[font_size_ori]; @@ -55,10 +54,10 @@ static JSValue ResetTheme(JSContext* ctx, JSValueConst this_val, int argc, JSVal lv_theme_default_init( NULL, - theme_default.color_primary, - theme_default.color_secondary, + lv_theme_get_color_primary(NULL), + lv_theme_get_color_secondary(NULL), LV_THEME_DEFAULT_DARK, - theme_default.font_normal + lv_theme_get_font_normal(NULL) ); return JS_UNDEFINED; }; diff --git a/src/render/native/core/theme/theme.hpp b/src/render/native/core/theme/theme.hpp index 09e0c32b..f76fd768 100644 --- a/src/render/native/core/theme/theme.hpp +++ b/src/render/native/core/theme/theme.hpp @@ -8,8 +8,6 @@ extern "C" { #include "native/core/style/font/font.hpp" -static lv_theme_t theme_default; - -static bool theme_default_init = false; +static lv_theme_t *theme_default = NULL; void NativeThemeInit (JSContext* ctx, JSValue& ns); \ No newline at end of file From 93eb27fa1ce4ed4bbf7d52c4573d4ae760c0e2e5 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 6 Aug 2024 09:05:24 +0200 Subject: [PATCH 08/10] Temporary disable the chart related api In LVGL v9, the axes of the chart component are a separate widget (lv_scale), and are no longer part of the chart widget itself. Since there is no direct replacement present, those chart related api calls have been disabled, until a better solution is available. The result is that charts will be drawn without any axes. Fixing this issue will require some future work. --- src/render/native/components/chart/chart.cpp | 12 +++++++----- src/render/native/core/style/style.cpp | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/render/native/components/chart/chart.cpp b/src/render/native/components/chart/chart.cpp index 3827b6d1..65e3bf63 100644 --- a/src/render/native/components/chart/chart.cpp +++ b/src/render/native/components/chart/chart.cpp @@ -13,7 +13,7 @@ Chart::Chart(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); - lv_obj_add_event_cb(this->instance, &Chart::draw_event_cb, LV_EVENT_DRAW_PART_BEGIN, this); + //lv_obj_add_event_cb(this->instance, &Chart::draw_event_cb, LV_EVENT_DRAW_PART_BEGIN, this); }; void Chart::setType (int32_t type) { @@ -31,7 +31,7 @@ void Chart::setLeftAxisOption ( int32_t minor_num, int32_t draw_size ) { - lv_chart_set_axis_tick(this->instance, LV_CHART_AXIS_PRIMARY_Y, major_len, minor_len, major_num, minor_num, true, draw_size); + //lv_chart_set_axis_tick(this->instance, LV_CHART_AXIS_PRIMARY_Y, major_len, minor_len, major_num, minor_num, true, draw_size); }; void Chart::setRightAxisOption ( @@ -41,7 +41,7 @@ void Chart::setRightAxisOption ( int32_t minor_num, int32_t draw_size ) { - lv_chart_set_axis_tick(this->instance, LV_CHART_AXIS_SECONDARY_Y, major_len, minor_len, major_num, minor_num, true, draw_size); + //lv_chart_set_axis_tick(this->instance, LV_CHART_AXIS_SECONDARY_Y, major_len, minor_len, major_num, minor_num, true, draw_size); }; void Chart::setTopAxisOption ( @@ -51,7 +51,7 @@ void Chart::setTopAxisOption ( int32_t minor_num, int32_t draw_size ) { - lv_chart_set_axis_tick(this->instance, LV_CHART_AXIS_SECONDARY_X, major_len, minor_len, major_num, minor_num, true, draw_size); + //lv_chart_set_axis_tick(this->instance, LV_CHART_AXIS_SECONDARY_X, major_len, minor_len, major_num, minor_num, true, draw_size); }; void Chart::setBottomAxisOption ( @@ -61,7 +61,7 @@ void Chart::setBottomAxisOption ( int32_t minor_num, int32_t draw_size ) { - lv_chart_set_axis_tick(this->instance, LV_CHART_AXIS_PRIMARY_X, major_len, minor_len, major_num, minor_num, true, draw_size); + //lv_chart_set_axis_tick(this->instance, LV_CHART_AXIS_PRIMARY_X, major_len, minor_len, major_num, minor_num, true, draw_size); }; void Chart::setLeftAxisData (std::vector& data) { @@ -156,6 +156,7 @@ void Chart::setBottomAxisLabels (std::vector& labels) { this->bottom_axis_labels = labels; }; +#if 0 void Chart::draw_event_cb (lv_event_t * e) { lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e); if(!lv_obj_draw_part_check_type(dsc, &lv_chart_class, LV_CHART_DRAW_PART_TICK_LABEL)) return; @@ -172,6 +173,7 @@ void Chart::draw_event_cb (lv_event_t * e) { lv_snprintf(dsc->text, dsc->text_length, "%s", comp->top_axis_labels[dsc->value].c_str()); } }; +#endif void Chart::setLeftAxisRange (int32_t min, int32_t max) { lv_chart_set_range(this->instance, LV_CHART_AXIS_PRIMARY_Y, min, max); diff --git a/src/render/native/core/style/style.cpp b/src/render/native/core/style/style.cpp index 9d693e03..b538c437 100644 --- a/src/render/native/core/style/style.cpp +++ b/src/render/native/core/style/style.cpp @@ -491,14 +491,14 @@ static void CompSetChartScaleX (lv_obj_t* comp, lv_style_t* style, JSContext* ct int x; JS_ToInt32(ctx, &x, obj); - lv_chart_set_zoom_x(comp, x); + //lv_chart_set_zoom_x(comp, x); }; static void CompSetChartScaleY (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int x; JS_ToInt32(ctx, &x, obj); - lv_chart_set_zoom_y(comp, x); + //lv_chart_set_zoom_y(comp, x); }; static void CompSetTransformWidth (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { From 263be665921ec4085864325bc61612f0cb31161e Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 23 Aug 2024 09:43:08 +0200 Subject: [PATCH 09/10] Use explicit cast to convert integers to enum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modern C++ compilers no longer allow implicit conversion from integer to enum values. Since the lv_obj_flag_t enum is intended to be used as a bit flag, combining several values with the OR operator results in an integer and not a enum value. Hence the compilation fails with an error: error: invalid conversion from ‘int’ to ‘lv_obj_flag_t’ [-fpermissive] --- src/render/native/components/arc/arc.cpp | 4 ++-- src/render/native/components/button/button.cpp | 2 +- src/render/native/components/chart/chart.cpp | 2 +- src/render/native/components/checkbox/checkbox.cpp | 2 +- .../components/dropdownlist/dropdownlist.cpp | 2 +- .../components/dropdownlist/dropdownlist_wrap.cpp | 2 +- src/render/native/components/gif/gif.cpp | 2 +- src/render/native/components/image/image.cpp | 2 +- src/render/native/components/keyboard/keyboard.cpp | 2 +- src/render/native/components/line/line.cpp | 2 +- src/render/native/components/mask/mask.cpp | 2 +- .../native/components/progressbar/progressbar.cpp | 2 +- src/render/native/components/roller/roller.cpp | 6 +++--- src/render/native/components/slider/slider.cpp | 2 +- src/render/native/components/switch/switch.cpp | 2 +- src/render/native/components/tabview/tabview.cpp | 2 +- src/render/native/components/text/text.cpp | 2 +- src/render/native/components/view/view.cpp | 2 +- src/render/native/core/style/style.cpp | 14 +++++++------- 19 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/render/native/components/arc/arc.cpp b/src/render/native/components/arc/arc.cpp index 2d68e9f8..8f613d81 100644 --- a/src/render/native/components/arc/arc.cpp +++ b/src/render/native/components/arc/arc.cpp @@ -8,7 +8,7 @@ Arc::Arc(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); }; @@ -42,7 +42,7 @@ void Arc::setRotation (int32_t value) { }; void Arc::setMode (int32_t mode) { - lv_arc_set_mode(this->instance, mode); + lv_arc_set_mode(this->instance, static_cast(mode)); }; void Arc::setChangeRate (int32_t value) { diff --git a/src/render/native/components/button/button.cpp b/src/render/native/components/button/button.cpp index 5bf21342..f79e7b5b 100644 --- a/src/render/native/components/button/button.cpp +++ b/src/render/native/components/button/button.cpp @@ -9,7 +9,7 @@ Button::Button(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); diff --git a/src/render/native/components/chart/chart.cpp b/src/render/native/components/chart/chart.cpp index 65e3bf63..9ed735f8 100644 --- a/src/render/native/components/chart/chart.cpp +++ b/src/render/native/components/chart/chart.cpp @@ -8,7 +8,7 @@ Chart::Chart(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); diff --git a/src/render/native/components/checkbox/checkbox.cpp b/src/render/native/components/checkbox/checkbox.cpp index 0bf36ec8..a620a4d2 100644 --- a/src/render/native/components/checkbox/checkbox.cpp +++ b/src/render/native/components/checkbox/checkbox.cpp @@ -7,7 +7,7 @@ Checkbox::Checkbox(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->instance = lv_checkbox_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); diff --git a/src/render/native/components/dropdownlist/dropdownlist.cpp b/src/render/native/components/dropdownlist/dropdownlist.cpp index db105ea9..79ea838a 100644 --- a/src/render/native/components/dropdownlist/dropdownlist.cpp +++ b/src/render/native/components/dropdownlist/dropdownlist.cpp @@ -9,7 +9,7 @@ Dropdownlist::Dropdownlist(std::string uid, lv_obj_t* parent): BasicComponent(ui lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_set_user_data(this->instance, this); }; diff --git a/src/render/native/components/dropdownlist/dropdownlist_wrap.cpp b/src/render/native/components/dropdownlist/dropdownlist_wrap.cpp index af9af40e..eab7cdfb 100644 --- a/src/render/native/components/dropdownlist/dropdownlist_wrap.cpp +++ b/src/render/native/components/dropdownlist/dropdownlist_wrap.cpp @@ -74,7 +74,7 @@ static JSValue NativeCompSetDir(JSContext *ctx, JSValueConst this_val, int argc, int32_t dir; JS_ToInt32(ctx, &dir, argv[0]); - ((Dropdownlist*)(ref->comp))->setDir(dir); + ((Dropdownlist*)(ref->comp))->setDir(static_cast(dir)); LV_LOG_USER("Dropdownlist %s setDir", ref->uid); } return JS_UNDEFINED; diff --git a/src/render/native/components/gif/gif.cpp b/src/render/native/components/gif/gif.cpp index c85ee95d..9607037d 100644 --- a/src/render/native/components/gif/gif.cpp +++ b/src/render/native/components/gif/gif.cpp @@ -9,7 +9,7 @@ GIF::GIF(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICKABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICKABLE)); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); }; diff --git a/src/render/native/components/image/image.cpp b/src/render/native/components/image/image.cpp index ab4b717b..ca9f1652 100644 --- a/src/render/native/components/image/image.cpp +++ b/src/render/native/components/image/image.cpp @@ -8,7 +8,7 @@ Image::Image(std::string uid, lv_obj_t* parent): BasicComponent(uid) { this->instance = lv_image_create(parent != nullptr ? parent : GetWindowInstance()); lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICKABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICKABLE)); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); diff --git a/src/render/native/components/keyboard/keyboard.cpp b/src/render/native/components/keyboard/keyboard.cpp index 371c6da0..b8fe64c2 100644 --- a/src/render/native/components/keyboard/keyboard.cpp +++ b/src/render/native/components/keyboard/keyboard.cpp @@ -8,7 +8,7 @@ Keyboard::Keyboard(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_set_user_data(this->instance, this); }; diff --git a/src/render/native/components/line/line.cpp b/src/render/native/components/line/line.cpp index 83793978..edd53e0a 100644 --- a/src/render/native/components/line/line.cpp +++ b/src/render/native/components/line/line.cpp @@ -9,7 +9,7 @@ Line::Line(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_set_user_data(this->instance, this); }; diff --git a/src/render/native/components/mask/mask.cpp b/src/render/native/components/mask/mask.cpp index 49236a87..6e1cfa04 100644 --- a/src/render/native/components/mask/mask.cpp +++ b/src/render/native/components/mask/mask.cpp @@ -9,7 +9,7 @@ Mask::Mask(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); diff --git a/src/render/native/components/progressbar/progressbar.cpp b/src/render/native/components/progressbar/progressbar.cpp index a570eac7..f4323c75 100644 --- a/src/render/native/components/progressbar/progressbar.cpp +++ b/src/render/native/components/progressbar/progressbar.cpp @@ -9,7 +9,7 @@ ProgressBar::ProgressBar(std::string uid, lv_obj_t* parent): BasicComponent(uid) lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_set_user_data(this->instance, this); }; diff --git a/src/render/native/components/roller/roller.cpp b/src/render/native/components/roller/roller.cpp index add3e56b..45e8ad68 100644 --- a/src/render/native/components/roller/roller.cpp +++ b/src/render/native/components/roller/roller.cpp @@ -8,13 +8,13 @@ Roller::Roller(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_set_user_data(this->instance, this); }; void Roller::setOptions (std::vector& options, uint32_t mode) { if (options.size() == 0) { - lv_roller_set_options(this->instance, "\0", mode); + lv_roller_set_options(this->instance, "\0", static_cast(mode)); } else { std::string str; for(int i=0; i < options.size(); i++) { @@ -24,7 +24,7 @@ void Roller::setOptions (std::vector& options, uint32_t mode) { str.append("\n"); } } - lv_roller_set_options(this->instance, str.c_str(), mode); + lv_roller_set_options(this->instance, str.c_str(), static_cast(mode)); } }; diff --git a/src/render/native/components/slider/slider.cpp b/src/render/native/components/slider/slider.cpp index a3ee7859..a00de2eb 100644 --- a/src/render/native/components/slider/slider.cpp +++ b/src/render/native/components/slider/slider.cpp @@ -9,7 +9,7 @@ Slider::Slider(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); }; diff --git a/src/render/native/components/switch/switch.cpp b/src/render/native/components/switch/switch.cpp index c508753d..450aa155 100644 --- a/src/render/native/components/switch/switch.cpp +++ b/src/render/native/components/switch/switch.cpp @@ -8,7 +8,7 @@ Switch::Switch(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_set_user_data(this->instance, this); }; diff --git a/src/render/native/components/tabview/tabview.cpp b/src/render/native/components/tabview/tabview.cpp index 7b3bb21e..9ec171c9 100644 --- a/src/render/native/components/tabview/tabview.cpp +++ b/src/render/native/components/tabview/tabview.cpp @@ -10,7 +10,7 @@ TabView::TabView(std::string uid, uint32_t pos, uint32_t size, lv_obj_t* parent) lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); }; diff --git a/src/render/native/components/text/text.cpp b/src/render/native/components/text/text.cpp index aa61946b..fa49ebbe 100644 --- a/src/render/native/components/text/text.cpp +++ b/src/render/native/components/text/text.cpp @@ -9,7 +9,7 @@ Text::Text(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_set_user_data(this->instance, this); this->initStyle(LV_PART_MAIN); }; diff --git a/src/render/native/components/view/view.cpp b/src/render/native/components/view/view.cpp index 3e475d07..62fcc20b 100644 --- a/src/render/native/components/view/view.cpp +++ b/src/render/native/components/view/view.cpp @@ -8,7 +8,7 @@ View::View(std::string uid, lv_obj_t* parent): BasicComponent(uid) { lv_group_add_obj(lv_group_get_default(), this->instance); lv_obj_remove_flag(this->instance, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_add_flag(this->instance, LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE); + lv_obj_add_flag(this->instance, static_cast(LV_OBJ_FLAG_EVENT_BUBBLE | LV_OBJ_FLAG_CLICK_FOCUSABLE)); lv_obj_set_user_data(this->instance, this); // this->initStyle(LV_PART_MAIN); }; diff --git a/src/render/native/core/style/style.cpp b/src/render/native/core/style/style.cpp index b538c437..20f531fe 100644 --- a/src/render/native/core/style/style.cpp +++ b/src/render/native/core/style/style.cpp @@ -132,7 +132,7 @@ static void CompSetBackgroundGradColorDir (lv_obj_t* comp, lv_style_t* style, JS int y; JS_ToInt32(ctx, &y, obj); - lv_style_set_bg_grad_dir(style, y); + lv_style_set_bg_grad_dir(style, static_cast(y)); }; static void CompSetArcWidth (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { @@ -291,7 +291,7 @@ static void CompSetBorderSide (lv_obj_t* comp, lv_style_t* style, JSContext* ctx int x; JS_ToInt32(ctx, &x, obj); - lv_style_set_border_side(style, x); + lv_style_set_border_side(style, static_cast(x)); }; static void CompSetOutlineWidth (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { @@ -326,7 +326,7 @@ static void CompSetTextOverFLow (lv_obj_t* comp, lv_style_t* style, JSContext* c int x; JS_ToInt32(ctx, &x, obj); - lv_label_set_long_mode(comp, x); + lv_label_set_long_mode(comp, static_cast(x)); }; static void CompSetLetterSpacing (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { @@ -347,14 +347,14 @@ static void CompSetTextAlign (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, int x; JS_ToInt32(ctx, &x, obj); - lv_style_set_text_align(style, x); + lv_style_set_text_align(style, static_cast(x)); }; static void CompSetDecoration (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int x; JS_ToInt32(ctx, &x, obj); - lv_style_set_text_decor(style, x); + lv_style_set_text_decor(style, static_cast(x)); }; static void CompSetOverFlowScrolling (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { @@ -383,14 +383,14 @@ static void CompSetScrollSnapX (lv_obj_t* comp, lv_style_t* style, JSContext* ct int x; JS_ToInt32(ctx, &x, obj); - lv_obj_set_scroll_snap_x(comp, x); + lv_obj_set_scroll_snap_x(comp, static_cast(x)); }; static void CompSetScrollSnapY (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { int x; JS_ToInt32(ctx, &x, obj); - lv_obj_set_scroll_snap_y(comp, x); + lv_obj_set_scroll_snap_y(comp, static_cast(x)); }; static void CompScrollEnableSnap (lv_obj_t* comp, lv_style_t* style, JSContext* ctx, JSValue obj) { From b54484760b3442f25591ac27c375c79a07adc549 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 11 Dec 2024 15:28:10 +0100 Subject: [PATCH 10/10] Fix some magic values in the javascript code Some of the magic values in the LVGL library changed from 16 to 32 bit values. This mismatch caused several rendering issues because the magic values were suddenly interpreted as (large) normal numbers. --- src/render/react/core/style/pipe/grid.ts | 8 +++++--- src/render/react/core/style/util.ts | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/render/react/core/style/pipe/grid.ts b/src/render/react/core/style/pipe/grid.ts index 86ab379d..91bbbb99 100644 --- a/src/render/react/core/style/pipe/grid.ts +++ b/src/render/react/core/style/pipe/grid.ts @@ -1,6 +1,8 @@ import { NormalizePx } from "../util"; -const GRID_CONTENT = (1 << 13) - 1 - 101; +const LV_COORD_MAX = ((1 << 29) - 1); + +const GRID_CONTENT = LV_COORD_MAX - 101; const FR_REG = /([\d]+)fr$/; const gridChildJustifySelfObj = { @@ -64,7 +66,7 @@ export function GridStyle(style: GridStyleType, result) { } const arr = column?.match(FR_REG); if (!isNaN(arr?.[1])) { - return (1 << 13) - 1 - 100 + Number(arr[1]); + return LV_COORD_MAX - 100 + Number(arr[1]); } return NormalizePx(column); }); @@ -74,7 +76,7 @@ export function GridStyle(style: GridStyleType, result) { } const arr = row?.match(FR_REG); if (!isNaN(arr?.[1])) { - return (1 << 13) - 1 - 100 + Number(arr[1]); + return LV_COORD_MAX - 100 + Number(arr[1]); } return NormalizePx(row); }); diff --git a/src/render/react/core/style/util.ts b/src/render/react/core/style/util.ts index c3692617..652f6095 100644 --- a/src/render/react/core/style/util.ts +++ b/src/render/react/core/style/util.ts @@ -1,5 +1,8 @@ import { colorTransform } from "./color"; +const LV_COORD_TYPE_SPEC = (1 << 29); +const LV_COORD_MAX = ((1 << 29) - 1); + export function NormalizePx(value) { if (value == void 0) return null; if (!isNaN(value)) { @@ -37,7 +40,7 @@ export type PixelOrPercent = number | `${number}%` | "auto"; export function ProcessPxOrPercent(key, value, result) { if (value === "auto") { - return (result[key] = 2001 | (1 << 13)); + return (result[key] = LV_COORD_MAX | LV_COORD_TYPE_SPEC); } if (!isNaN(value)) { return (result[key] = value);