├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── README.md ├── config └── FreeRTOSConfig.h ├── licence.txt ├── lv_conf.defaults ├── lv_conf.h ├── main └── src │ ├── FreeRTOS_Posix_Port.c │ ├── freertos_main.cpp │ ├── main.c │ └── mouse_cursor_icon.c ├── manifest.json └── simulator.code-workspace /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore build folder 2 | build/ 3 | bin/ 4 | 5 | # Ignore UI folder, this should be commited in its own repository 6 | ui/ 7 | 8 | # Ignore all dot folders, with below exceptions 9 | .*/ 10 | 11 | # VSCode 12 | .vscode 13 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lv_drivers"] 2 | path = lv_drivers 3 | url = https://github.com/lvgl/lv_drivers.git 4 | [submodule "lvgl"] 5 | path = lvgl 6 | url = https://github.com/lvgl/lvgl.git 7 | [submodule "FreeRTOS"] 8 | path = FreeRTOS 9 | url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git 10 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12.4) 2 | project(lvgl C CXX) 3 | 4 | # Set the correct FreeRTOS port for your system (e.g., Posix for WSL) 5 | set(FREERTOS_PORT GCC_POSIX CACHE STRING "Port for FreeRTOS on Posix environment") 6 | 7 | unset(USE_FREERTOS CACHE) 8 | 9 | option(USE_FREERTOS "Enable FreeRTOS" OFF) # Turn this on to enable FreeRTOS 10 | 11 | if(USE_FREERTOS) 12 | message(STATUS "FreeRTOS is enabled") 13 | 14 | # FreeRTOS integration when USE_FREERTOS is enabled 15 | add_library(freertos_config INTERFACE) 16 | target_include_directories(freertos_config SYSTEM INTERFACE ${PROJECT_SOURCE_DIR}/config) 17 | target_compile_definitions(freertos_config INTERFACE projCOVERAGE_TEST=0) 18 | 19 | # Add FreeRTOS as a subdirectory 20 | add_subdirectory(FreeRTOS) 21 | 22 | # FreeRTOS-specific include directories 23 | include_directories(${PROJECT_SOURCE_DIR}/FreeRTOS/include) 24 | include_directories(${PROJECT_SOURCE_DIR}/FreeRTOS/portable/ThirdParty/GCC/Posix) 25 | include_directories(${PROJECT_SOURCE_DIR}/config) 26 | 27 | # Add FreeRTOS sources 28 | file(GLOB FREERTOS_SOURCES 29 | "${PROJECT_SOURCE_DIR}/FreeRTOS/*.c" 30 | "${PROJECT_SOURCE_DIR}/FreeRTOS/portable/MemMang/heap_4.c" 31 | "${PROJECT_SOURCE_DIR}/FreeRTOS/portable/ThirdParty/GCC/Posix/*.c" 32 | ) 33 | else() 34 | message(STATUS "FreeRTOS is disabled") 35 | set(FREERTOS_SOURCES "") # No FreeRTOS sources if FreeRTOS is disabled 36 | endif() 37 | 38 | # Main include files of the project 39 | include_directories(${PROJECT_SOURCE_DIR}/main/inc) 40 | 41 | # Define options for LVGL with default values (OFF) 42 | option(LV_USE_DRAW_SDL "Use SDL draw unit" OFF) 43 | option(LV_USE_LIBPNG "Use libpng to decode PNG" OFF) 44 | option(LV_USE_LIBJPEG_TURBO "Use libjpeg turbo to decode JPEG" OFF) 45 | option(LV_USE_FFMPEG "Use libffmpeg to display video using lv_ffmpeg" OFF) 46 | option(LV_USE_FREETYPE "Use freetype library" OFF) 47 | 48 | # Set C and C++ standards 49 | set(CMAKE_C_STANDARD 99) 50 | set(CMAKE_CXX_STANDARD 17) 51 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 52 | 53 | # Set the output path for the executable 54 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 55 | set(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) 56 | 57 | # Find and include SDL2 library 58 | find_package(SDL2 REQUIRED) 59 | 60 | # Remove ARM-specific compile and linker options 61 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native") 62 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") 63 | 64 | # Add compile definitions based on the selected options 65 | add_compile_definitions($<$:LV_USE_DRAW_SDL=1>) 66 | add_compile_definitions($<$:LV_USE_LIBPNG=1>) 67 | add_compile_definitions($<$:LV_USE_LIBJPEG_TURBO=1>) 68 | add_compile_definitions($<$:LV_USE_FFMPEG=1>) 69 | 70 | # Add LVGL subdirectory 71 | add_subdirectory(lvgl) 72 | target_include_directories(lvgl PUBLIC ${PROJECT_SOURCE_DIR} ${SDL2_INCLUDE_DIRS}) 73 | 74 | # Create the main executable, depending on the FreeRTOS option 75 | if(USE_FREERTOS) 76 | add_executable(main 77 | ${PROJECT_SOURCE_DIR}/main/src/main.c 78 | ${PROJECT_SOURCE_DIR}/main/src/freertos_main.cpp 79 | ${PROJECT_SOURCE_DIR}/main/src/mouse_cursor_icon.c 80 | ${PROJECT_SOURCE_DIR}/main/src/FreeRTOS_Posix_Port.c 81 | ${FREERTOS_SOURCES} # Add only if USE_FREERTOS is enabled 82 | ) 83 | # Link FreeRTOS libraries 84 | target_link_libraries(main freertos_config FreeRTOS) 85 | else() 86 | add_executable(main 87 | ${PROJECT_SOURCE_DIR}/main/src/main.c 88 | ${PROJECT_SOURCE_DIR}/main/src/mouse_cursor_icon.c 89 | ) 90 | endif() 91 | 92 | # Define LVGL configuration as a simple include 93 | target_compile_definitions(main PRIVATE LV_CONF_INCLUDE_SIMPLE) 94 | 95 | if(MSVC) 96 | target_link_libraries(main lvgl lvgl::examples lvgl::demos lvgl::thorvg ${SDL2_LIBRARIES}) 97 | else() 98 | target_link_libraries(main lvgl lvgl::examples lvgl::demos lvgl::thorvg ${SDL2_LIBRARIES} m pthread) 99 | endif() 100 | 101 | # Only link freertos_config if the FreeRTOS directory exists 102 | if(USE_FREERTOS) 103 | target_link_libraries(main freertos_config) 104 | endif() 105 | 106 | # Custom target to run the executable 107 | add_custom_target(run COMMAND ${EXECUTABLE_OUTPUT_PATH}/main DEPENDS main) 108 | 109 | # Conditionally include and link SDL2_image if LV_USE_DRAW_SDL is enabled 110 | if(LV_USE_DRAW_SDL) 111 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") 112 | find_package(SDL2_image REQUIRED) 113 | target_include_directories(lvgl PUBLIC ${SDL2_IMAGE_INCLUDE_DIRS}) 114 | target_link_libraries(main ${SDL2_IMAGE_LIBRARIES}) 115 | endif() 116 | 117 | # Conditionally include and link libpng if LV_USE_LIBPNG is enabled 118 | if(LV_USE_LIBPNG) 119 | find_package(PNG REQUIRED) 120 | target_include_directories(lvgl PUBLIC ${PNG_INCLUDE_DIRS}) 121 | target_link_libraries(main ${PNG_LIBRARIES}) 122 | endif() 123 | 124 | # Conditionally include and link libjpeg-turbo if LV_USE_LIBJPEG_TURBO is enabled 125 | if(LV_USE_LIBJPEG_TURBO) 126 | find_package(JPEG REQUIRED) 127 | target_include_directories(lvgl PUBLIC ${JPEG_INCLUDE_DIRS}) 128 | target_link_libraries(main ${JPEG_LIBRARIES}) 129 | endif() 130 | 131 | # Conditionally include and link FFmpeg libraries if LV_USE_FFMPEG is enabled 132 | if(LV_USE_FFMPEG) 133 | target_link_libraries(main avformat avcodec avutil swscale z) 134 | endif() 135 | 136 | # Conditionally include and link FreeType if LV_USE_FREETYPE is enabled 137 | if(LV_USE_FREETYPE) 138 | find_package(Freetype REQUIRED) 139 | target_include_directories(lvgl PUBLIC ${FREETYPE_INCLUDE_DIRS}) 140 | target_link_libraries(main ${FREETYPE_LIBRARIES}) 141 | endif() 142 | 143 | # On Windows, GUI applications do not show a console by default, 144 | # which hides log output. This ensures a console is available for logging. 145 | if (WIN32) 146 | if (MSVC) 147 | target_link_options(main PRIVATE "/SUBSYSTEM:CONSOLE") 148 | else() 149 | target_link_options(main PRIVATE "-mconsole") 150 | endif() 151 | endif() 152 | 153 | # Apply additional compile options if the build type is Debug 154 | if(CMAKE_BUILD_TYPE STREQUAL "Debug") 155 | message(STATUS "Debug mode enabled") 156 | 157 | target_compile_options(lvgl PRIVATE 158 | -pedantic-errors 159 | -Wall 160 | -Wclobbered 161 | -Wdeprecated 162 | -Wdouble-promotion 163 | -Wempty-body 164 | -Wextra 165 | -Wformat-security 166 | -Wmaybe-uninitialized 167 | # -Wmissing-prototypes 168 | -Wpointer-arith 169 | -Wmultichar 170 | -Wno-pedantic # ignored for now, we convert functions to pointers for properties table. 171 | -Wreturn-type 172 | -Wshadow 173 | -Wshift-negative-value 174 | -Wsizeof-pointer-memaccess 175 | -Wtype-limits 176 | -Wundef 177 | -Wuninitialized 178 | -Wunreachable-code 179 | -Wfloat-conversion 180 | -Wstrict-aliasing 181 | ) 182 | 183 | if (ASAN) 184 | message(STATUS "AddressSanitizer enabled") 185 | 186 | # Add AddressSanitizer flags 187 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") 188 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer") 189 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") 190 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") 191 | else() 192 | message(STATUS "AddressSanitizer disabled") 193 | endif() 194 | endif() -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VSCode Simulator project for LVGL 2 | 3 | [LVGL](https://github.com/lvgl/lvgl) is written mainly for microcontrollers and embedded systems, however you can run the library **on your PC** as well without any embedded hardware. The code written on PC can be simply copied when your are using an embedded system. 4 | 5 | This project is pre-configured for VSCode and should work work on Windows, Linux and MacOs as well. FreeRTOS is also included and can be optionally enabled to better simulate embedded system's behavior. 6 | 7 | ## Get started 8 | 9 | ### Install SDL and the build tools 10 | 11 | - **Windows (vcpkg):** `vcpkg install sdl2` (`vcpkg` can be installed from [https://github.com/microsoft/vcpkg](https://github.com/microsoft/vcpkg)) Also install either MinGW or another compier and `cmake`. 12 | - **macOS (Homebrew):** `brew install sdl2 cmake make` 13 | - **Linux:** 14 | - **Debian/Ubuntu:** `sudo apt install build-essential cmake libsdl2-dev` 15 | - **Arch:** `sudo pacman -S base-devel cmake sdl2` 16 | - **Fedora:** `sudo dnf install @development-tools cmake SDL2-devel` 17 | - **Manual Installation of SDL:** Download from [SDL’s website](https://github.com/libsdl-org/SDL/releases) and place headers/libraries in your project. 18 | - **Verify Installation:** `sdl2-config --version`, `cmake --version`, `gcc --version`, `g++ --version` (should return the installed version). 19 | 20 | ### Get the PC project 21 | 22 | Clone the PC project and the related sub modules: 23 | 24 | ```bash 25 | git clone --recursive https://github.com/lvgl/lv_port_pc_vscode 26 | ``` 27 | 28 | ## Usage 29 | 30 | ### Visual Studio Code 31 | 32 | 1. Be sure you have installed [SDL and the build tools](#install-sdl-and-build-tools) 33 | 2. Open the project by double clicking on `simulator.code-workspace` or opening it with `File/Open Workspace from File` 34 | 3. Install the recommended plugins 35 | 4. Click the Run and Debug page on the left, and select `Debug LVGL demo with gdb` from the drop-down on the top. Like this: 36 | ![image](https://github.com/lvgl/lv_port_pc_vscode/assets/7599318/f527b235-5718-4949-b5f0-bd807b3a64ba) 37 | 5. Click the Play button or hit F5 to start debugging. 38 | 39 | #### ArchLinux User 40 | 41 | VSCode does not officially provide an installation package under Arch, you need to use the AUR manager `paru` to install it. 42 | The command is as follows: 43 | 44 | ```bash 45 | paru -S visual-studio-code-bin 46 | ``` 47 | 48 | #### macOS 49 | 50 | Apple's default clang does not support the `-fsanitize=leak` flag. 51 | 52 | to build using the latest version of clang from homebrew, do the following: 53 | 54 | 1. `brew install llvm` 55 | 56 | 2. cmd+shift+p and run `Cmake: select a kit`, then `[Scan for kits]` 57 | 58 | 3. then cmd+shift+p and run `Cmake: select a kit`, select the version of clang you just installed from homebrew (it should say `Using compilers C=/opt/homebrew/opt/llvm/bin/clang ...`) 59 | 60 | 4. reconfigure by running cmd+shift+p `Cmake: Configure` 61 | 62 | 5. build using [step 4 above](#visual-studio-code) 63 | 64 | ### FreeRTOS configuration 65 | To correctly configure the project, the RTOS (Real-Time Operating System) requires a significant amount of heap memory, especially when debugging an SDL (Simple DirectMedia Layer) window application. In this project, the heap memory has been experimentally set to **512 MB**. 66 | 67 | ```c 68 | #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 512 * 1024 * 1024 ) ) // 512 MB Heap 69 | ``` 70 | This configuration ensures that the SDL window is displayed in a timely manner. If this value is reduced, it may cause significant delays in the SDL window's appearance. If the allocated heap memory is too small, the window may fail to appear altogether. 71 | Therefore, it is crucial to allocate sufficient heap memory to ensure smooth execution and debugging experience. 72 | 73 | ### Enable FreeRTOS 74 | To enable the rtos part of this project select in lv_conf.h `#define LV_USE_OS LV_OS_NONE` to `#define LV_USE_OS LV_OS_FREERTOS` 75 | Additionaly you have to enable the compilation of all FreeRTOS Files by turn on `option(USE_FREERTOS "Enable FreeRTOS" OFF) ` in the CMakeLists.txt file. 76 | 77 | ### CMake 78 | 79 | This project uses CMake under the hood which can be used without Visula Studio Code too. Just type these in a Terminal when you are in the project's root folder: 80 | 81 | ```bash 82 | mkdir build 83 | cd build 84 | cmake .. 85 | make -j 86 | ``` 87 | 88 | ## Run demos and examples 89 | 90 | By default, the widgets demo (`lv_demo_widgets()`) will run. If you want to run a different demo or example from the LVGL library, 91 | simply replace the demo function call in the code with another one—such as `lv_demo_benchmark()` or `lv_example_label_1()`. 92 | 93 | ```c 94 | int main(int argc, char **argv) 95 | { 96 | /* ... */ 97 | /* Run the default demo */ 98 | /* To try a different demo or example, replace this with one of: */ 99 | /* - lv_demo_benchmark(); */ 100 | /* - lv_demo_stress(); */ 101 | /* - lv_example_label_1(); */ 102 | /* - etc. */ 103 | lv_demo_widgets(); 104 | 105 | while(1) { 106 | /* ... */ 107 | } 108 | return 0; 109 | } 110 | ``` 111 | 112 | ## Optional library 113 | 114 | There are also FreeType and FFmpeg support. You can install these according to the followings: 115 | 116 | ### Linux 117 | 118 | ```bash 119 | # FreeType support 120 | wget https://kumisystems.dl.sourceforge.net/project/freetype/freetype2/2.13.2/freetype-2.13.2.tar.xz 121 | tar -xf freetype-2.13.2.tar.xz 122 | cd freetype-2.13.2 123 | make 124 | make install 125 | ``` 126 | 127 | ```bash 128 | # FFmpeg support 129 | git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg 130 | cd ffmpeg 131 | git checkout release/6.0 132 | ./configure --disable-all --disable-autodetect --disable-podpages --disable-asm --enable-avcodec --enable-avformat --enable-decoders --enable-encoders --enable-demuxers --enable-parsers --enable-protocol='file' --enable-swscale --enable-zlib 133 | make 134 | sudo make install 135 | ``` 136 | ### (RT)OS support 137 | Works with any OS like pthred, Windows, FreeRTOS, etc. It has build in support for FreeRTOS. 138 | 139 | ## Test 140 | This project is configured for [VSCode](https://code.visualstudio.com) and is tested on: 141 | - Ubuntu Linux 142 | - Windows WSL (Ubuntu Linux) 143 | 144 | It requires a working version of GCC, GDB and make in your path. 145 | 146 | To allow debugging inside VSCode you will also require a GDB [extension](https://marketplace.visualstudio.com/items?itemName=webfreak.debug) or other suitable debugger. All the requirements, build and debug settings have been pre-configured in the [.workspace](simulator.code-workspace) file. 147 | 148 | The project can use **SDL** but it can be easily relaced by any other built-in LVGL dirvers. 149 | -------------------------------------------------------------------------------- /config/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef FREERTOS_CONFIG_H 2 | #define FREERTOS_CONFIG_H 3 | 4 | #include 5 | extern uint32_t SystemCoreClock; 6 | 7 | /*----------------------------------------------------------- 8 | * Application specific definitions. 9 | * 10 | * These definitions should be adjusted for your particular hardware and 11 | * application requirements. 12 | * 13 | * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE 14 | * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. 15 | *----------------------------------------------------------*/ 16 | 17 | #define configUSE_PREEMPTION 1 18 | #define configUSE_IDLE_HOOK 0 19 | #define configUSE_TICK_HOOK 0 20 | #define configCPU_CLOCK_HZ ( SystemCoreClock ) 21 | #define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) 22 | #define configMAX_PRIORITIES ( 5 ) 23 | #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 ) 24 | #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 512 * 1024 * 1024 ) ) // 512 MB Heap 25 | #define configMAX_TASK_NAME_LEN ( 10 ) 26 | #define configUSE_TRACE_FACILITY 1 27 | #define configUSE_16_BIT_TICKS 0 28 | #define configIDLE_SHOULD_YIELD 1 29 | #define configUSE_MUTEXES 1 30 | #define configQUEUE_REGISTRY_SIZE 8 31 | #define configCHECK_FOR_STACK_OVERFLOW 0 32 | #define configUSE_RECURSIVE_MUTEXES 1 33 | #define configUSE_MALLOC_FAILED_HOOK 1 34 | #define configUSE_APPLICATION_TASK_TAG 0 35 | #define configUSE_COUNTING_SEMAPHORES 1 36 | #define configGENERATE_RUN_TIME_STATS 0 37 | #define configUSE_TASK_NOTIFICATIONS 0 38 | #define configUSE_STREAM_BUFFERS 0 39 | 40 | /* Co-routine definitions. */ 41 | #define configUSE_CO_ROUTINES 0 42 | #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) 43 | 44 | /* Software timer definitions. */ 45 | #define configUSE_TIMERS 1 46 | #define configTIMER_TASK_PRIORITY ( 2 ) 47 | #define configTIMER_QUEUE_LENGTH 10 48 | #define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 ) 49 | 50 | /* Set the following definitions to 1 to include the API function, or zero 51 | to exclude the API function. */ 52 | 53 | #define INCLUDE_vTaskPrioritySet 1 54 | #define INCLUDE_uxTaskPriorityGet 1 55 | #define INCLUDE_vTaskDelete 1 56 | #define INCLUDE_vTaskCleanUpResources 0 57 | #define INCLUDE_vTaskSuspend 1 58 | #define INCLUDE_vTaskDelayUntil 1 59 | #define INCLUDE_vTaskDelay 1 60 | 61 | #endif /* FREERTOS_CONFIG_H */ 62 | -------------------------------------------------------------------------------- /licence.txt: -------------------------------------------------------------------------------- 1 | MIT licence 2 | Copyright (c) 2016 Gábor Kiss-Vámosi 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | -------------------------------------------------------------------------------- /lv_conf.defaults: -------------------------------------------------------------------------------- 1 | LV_COLOR_DEPTH 32 2 | LV_MEM_SIZE (1024 * 1024) 3 | LV_USE_MATRIX 1 4 | LV_USE_FLOAT 1 5 | LV_USE_LOTTIE 1 6 | 7 | LV_USE_DRAW_SW_COMPLEX_GRADIENTS 1 8 | LV_OBJ_STYLE_CACHE 1 9 | LV_USE_LOG 1 10 | LV_LOG_PRINTF 1 11 | LV_USE_ASSERT_MEM_INTEGRITY 1 12 | LV_USE_ASSERT_OBJ 1 13 | LV_USE_ASSERT_STYLE 1 14 | LV_FONT_MONTSERRAT_12 1 15 | LV_FONT_MONTSERRAT_14 1 16 | LV_FONT_MONTSERRAT_16 1 17 | LV_FONT_MONTSERRAT_18 1 18 | LV_FONT_MONTSERRAT_20 1 19 | LV_FONT_MONTSERRAT_22 1 20 | LV_FONT_MONTSERRAT_24 1 21 | LV_FONT_MONTSERRAT_26 1 22 | LV_FONT_MONTSERRAT_28 1 23 | LV_FONT_MONTSERRAT_30 1 24 | LV_FONT_MONTSERRAT_32 1 25 | LV_FONT_MONTSERRAT_34 1 26 | LV_FONT_MONTSERRAT_36 1 27 | LV_FONT_MONTSERRAT_38 1 28 | LV_FONT_MONTSERRAT_40 1 29 | LV_FONT_MONTSERRAT_42 1 30 | LV_FONT_MONTSERRAT_44 1 31 | LV_FONT_MONTSERRAT_46 1 32 | LV_FONT_MONTSERRAT_48 1 33 | LV_FONT_MONTSERRAT_28_COMPRESSED 1 34 | LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1 35 | LV_FONT_SIMSUN_16_CJK 1 36 | LV_FONT_UNSCII_8 1 37 | 38 | LV_USE_SYSMON 1 39 | LV_USE_IMGFONT 1 40 | LV_USE_FS_STDIO 1 41 | LV_FS_STDIO_LETTER 'A' 42 | LV_USE_THORVG_INTERNAL 1 43 | LV_USE_LZ4_INTERNAL 1 44 | LV_USE_VECTOR_GRAPHIC 1 45 | LV_USE_TINY_TTF 1 46 | LV_USE_BARCODE 1 47 | LV_USE_QRCODE 1 48 | LV_USE_RLE 1 49 | LV_BIN_DECODER_RAM_LOAD 1 50 | LV_USE_TJPGD 1 51 | LV_USE_BMP 1 52 | LV_USE_LODEPNG 1 53 | LV_USE_SDL 1 54 | 55 | LV_USE_DEMO_WIDGETS 1 56 | LV_USE_DEMO_KEYPAD_AND_ENCODER 1 57 | LV_USE_DEMO_BENCHMARK 1 58 | LV_USE_DEMO_RENDER 1 59 | LV_USE_DEMO_STRESS 1 60 | LV_USE_DEMO_MUSIC 1 61 | LV_USE_DEMO_FLEX_LAYOUT 1 62 | LV_USE_DEMO_MULTILANG 1 63 | LV_USE_DEMO_TRANSFORM 1 64 | LV_USE_DEMO_SCROLL 1 65 | 66 | -------------------------------------------------------------------------------- /lv_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_conf.h 3 | * Configuration file for v9.3.0-dev 4 | */ 5 | 6 | /* 7 | * Copy this file as `lv_conf.h` 8 | * 1. simply next to `lvgl` folder 9 | * 2. or to any other place and 10 | * - define `LV_CONF_INCLUDE_SIMPLE`; 11 | * - add the path as an include path. 12 | */ 13 | 14 | /* clang-format off */ 15 | #if 1 /* Enable content */ 16 | #ifndef LV_CONF_H 17 | #define LV_CONF_H 18 | 19 | /* If you need to include anything here, do it inside the `__ASSEMBLY__` guard */ 20 | #if 0 && defined(__ASSEMBLY__) 21 | #include "my_include.h" 22 | #endif 23 | 24 | /*==================== 25 | COLOR SETTINGS 26 | *====================*/ 27 | 28 | /** Color depth: 1 (I1), 8 (L8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888) */ 29 | #define LV_COLOR_DEPTH 32 30 | 31 | /*========================= 32 | STDLIB WRAPPER SETTINGS 33 | *=========================*/ 34 | 35 | /** Possible values 36 | * - LV_STDLIB_BUILTIN: LVGL's built in implementation 37 | * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc 38 | * - LV_STDLIB_MICROPYTHON: MicroPython implementation 39 | * - LV_STDLIB_RTTHREAD: RT-Thread implementation 40 | * - LV_STDLIB_CUSTOM: Implement the functions externally 41 | */ 42 | #define LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN 43 | 44 | /** Possible values 45 | * - LV_STDLIB_BUILTIN: LVGL's built in implementation 46 | * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc 47 | * - LV_STDLIB_MICROPYTHON: MicroPython implementation 48 | * - LV_STDLIB_RTTHREAD: RT-Thread implementation 49 | * - LV_STDLIB_CUSTOM: Implement the functions externally 50 | */ 51 | #define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN 52 | 53 | /** Possible values 54 | * - LV_STDLIB_BUILTIN: LVGL's built in implementation 55 | * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc 56 | * - LV_STDLIB_MICROPYTHON: MicroPython implementation 57 | * - LV_STDLIB_RTTHREAD: RT-Thread implementation 58 | * - LV_STDLIB_CUSTOM: Implement the functions externally 59 | */ 60 | #define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN 61 | 62 | #define LV_STDINT_INCLUDE 63 | #define LV_STDDEF_INCLUDE 64 | #define LV_STDBOOL_INCLUDE 65 | #define LV_INTTYPES_INCLUDE 66 | #define LV_LIMITS_INCLUDE 67 | #define LV_STDARG_INCLUDE 68 | 69 | #if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN 70 | /** Size of memory available for `lv_malloc()` in bytes (>= 2kB) */ 71 | #define LV_MEM_SIZE (1024 * 1024) 72 | 73 | /** Size of the memory expand for `lv_malloc()` in bytes */ 74 | #define LV_MEM_POOL_EXPAND_SIZE 0 75 | 76 | /** Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too. */ 77 | #define LV_MEM_ADR 0 /**< 0: unused*/ 78 | /* Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc */ 79 | #if LV_MEM_ADR == 0 80 | #undef LV_MEM_POOL_INCLUDE 81 | #undef LV_MEM_POOL_ALLOC 82 | #endif 83 | #endif /*LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN*/ 84 | 85 | /*==================== 86 | HAL SETTINGS 87 | *====================*/ 88 | 89 | /** Default display refresh, input device read and animation step period. */ 90 | #define LV_DEF_REFR_PERIOD 33 /**< [ms] */ 91 | 92 | /** Default Dots Per Inch. Used to initialize default sizes such as widgets sized, style paddings. 93 | * (Not so important, you can adjust it to modify default sizes and spaces.) */ 94 | #define LV_DPI_DEF 130 /**< [px/inch] */ 95 | 96 | /*================= 97 | * OPERATING SYSTEM 98 | *=================*/ 99 | /** Select operating system to use. Possible options: 100 | * - LV_OS_NONE 101 | * - LV_OS_PTHREAD 102 | * - LV_OS_FREERTOS 103 | * - LV_OS_CMSIS_RTOS2 104 | * - LV_OS_RTTHREAD 105 | * - LV_OS_WINDOWS 106 | * - LV_OS_MQX 107 | * - LV_OS_SDL2 108 | * - LV_OS_CUSTOM */ 109 | #define LV_USE_OS LV_OS_NONE 110 | 111 | #if LV_USE_OS == LV_OS_CUSTOM 112 | #define LV_OS_CUSTOM_INCLUDE 113 | #endif 114 | #if LV_USE_OS == LV_OS_FREERTOS 115 | /* 116 | * Unblocking an RTOS task with a direct notification is 45% faster and uses less RAM 117 | * than unblocking a task using an intermediary object such as a binary semaphore. 118 | * RTOS task notifications can only be used when there is only one task that can be the recipient of the event. 119 | */ 120 | #define LV_USE_FREERTOS_TASK_NOTIFY 1 121 | #endif 122 | 123 | /*======================== 124 | * RENDERING CONFIGURATION 125 | *========================*/ 126 | 127 | /** Align stride of all layers and images to this bytes */ 128 | #define LV_DRAW_BUF_STRIDE_ALIGN 1 129 | 130 | /** Align start address of draw_buf addresses to this bytes*/ 131 | #define LV_DRAW_BUF_ALIGN 4 132 | 133 | /** Using matrix for transformations. 134 | * Requirements: 135 | * - `LV_USE_MATRIX = 1`. 136 | * - Rendering engine needs to support 3x3 matrix transformations. */ 137 | #define LV_DRAW_TRANSFORM_USE_MATRIX 0 138 | 139 | /* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode 140 | * it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks. 141 | * "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers 142 | * and can't be drawn in chunks. */ 143 | 144 | /** The target buffer size for simple layer chunks. */ 145 | #define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /**< [bytes]*/ 146 | 147 | /* Limit the max allocated memory for simple and transformed layers. 148 | * It should be at least `LV_DRAW_LAYER_SIMPLE_BUF_SIZE` sized but if transformed layers are also used 149 | * it should be enough to store the largest widget too (width x height x 4 area). 150 | * Set it to 0 to have no limit. */ 151 | #define LV_DRAW_LAYER_MAX_MEMORY 0 /**< No limit by default [bytes]*/ 152 | 153 | /** Stack size of drawing thread. 154 | * NOTE: If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more. 155 | */ 156 | #define LV_DRAW_THREAD_STACK_SIZE (8 * 1024) /**< [bytes]*/ 157 | 158 | /** Thread priority of the drawing task. 159 | * Higher values mean higher priority. 160 | * Can use values from lv_thread_prio_t enum in lv_os.h: LV_THREAD_PRIO_LOWEST, 161 | * LV_THREAD_PRIO_LOW, LV_THREAD_PRIO_MID, LV_THREAD_PRIO_HIGH, LV_THREAD_PRIO_HIGHEST 162 | * Make sure the priority value aligns with the OS-specific priority levels. 163 | * On systems with limited priority levels (e.g., FreeRTOS), a higher value can improve 164 | * rendering performance but might cause other tasks to starve. */ 165 | #define LV_DRAW_THREAD_PRIO LV_THREAD_PRIO_HIGH 166 | 167 | #define LV_USE_DRAW_SW 1 168 | #if LV_USE_DRAW_SW == 1 169 | /* 170 | * Selectively disable color format support in order to reduce code size. 171 | * NOTE: some features use certain color formats internally, e.g. 172 | * - gradients use RGB888 173 | * - bitmaps with transparency may use ARGB8888 174 | */ 175 | #define LV_DRAW_SW_SUPPORT_RGB565 1 176 | #define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED 1 177 | #define LV_DRAW_SW_SUPPORT_RGB565A8 1 178 | #define LV_DRAW_SW_SUPPORT_RGB888 1 179 | #define LV_DRAW_SW_SUPPORT_XRGB8888 1 180 | #define LV_DRAW_SW_SUPPORT_ARGB8888 1 181 | #define LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED 1 182 | #define LV_DRAW_SW_SUPPORT_L8 1 183 | #define LV_DRAW_SW_SUPPORT_AL88 1 184 | #define LV_DRAW_SW_SUPPORT_A8 1 185 | #define LV_DRAW_SW_SUPPORT_I1 1 186 | 187 | /* The threshold of the luminance to consider a pixel as 188 | * active in indexed color format */ 189 | #define LV_DRAW_SW_I1_LUM_THRESHOLD 127 190 | 191 | /** Set number of draw units. 192 | * - > 1 requires operating system to be enabled in `LV_USE_OS`. 193 | * - > 1 means multiple threads will render the screen in parallel. */ 194 | #define LV_DRAW_SW_DRAW_UNIT_CNT 1 195 | 196 | /** Use Arm-2D to accelerate software (sw) rendering. */ 197 | #define LV_USE_DRAW_ARM2D_SYNC 0 198 | 199 | /** Enable native helium assembly to be compiled. */ 200 | #define LV_USE_NATIVE_HELIUM_ASM 0 201 | 202 | /** 203 | * - 0: Use a simple renderer capable of drawing only simple rectangles with gradient, images, text, and straight lines only. 204 | * - 1: Use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too. */ 205 | #define LV_DRAW_SW_COMPLEX 1 206 | 207 | #if LV_DRAW_SW_COMPLEX == 1 208 | /** Allow buffering some shadow calculation. 209 | * LV_DRAW_SW_SHADOW_CACHE_SIZE is the maximum shadow size to buffer, where shadow size is 210 | * `shadow_width + radius`. Caching has LV_DRAW_SW_SHADOW_CACHE_SIZE^2 RAM cost. */ 211 | #define LV_DRAW_SW_SHADOW_CACHE_SIZE 0 212 | 213 | /** Set number of maximally-cached circle data. 214 | * The circumference of 1/4 circle are saved for anti-aliasing. 215 | * `radius * 4` bytes are used per circle (the most often used radiuses are saved). 216 | * - 0: disables caching */ 217 | #define LV_DRAW_SW_CIRCLE_CACHE_SIZE 4 218 | #endif 219 | 220 | #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE 221 | 222 | #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM 223 | #define LV_DRAW_SW_ASM_CUSTOM_INCLUDE "" 224 | #endif 225 | 226 | /** Enable drawing complex gradients in software: linear at an angle, radial or conical */ 227 | #define LV_USE_DRAW_SW_COMPLEX_GRADIENTS 1 228 | 229 | #endif 230 | 231 | /*Use TSi's aka (Think Silicon) NemaGFX */ 232 | #define LV_USE_NEMA_GFX 0 233 | 234 | #if LV_USE_NEMA_GFX 235 | /** Select which NemaGFX HAL to use. Possible options: 236 | * - LV_NEMA_HAL_CUSTOM 237 | * - LV_NEMA_HAL_STM32 */ 238 | #define LV_USE_NEMA_HAL LV_NEMA_HAL_CUSTOM 239 | #if LV_USE_NEMA_HAL == LV_NEMA_HAL_STM32 240 | #define LV_NEMA_STM32_HAL_INCLUDE 241 | #endif 242 | 243 | /*Enable Vector Graphics Operations. Available only if NemaVG library is present*/ 244 | #define LV_USE_NEMA_VG 0 245 | #if LV_USE_NEMA_VG 246 | /*Define application's resolution used for VG related buffer allocation */ 247 | #define LV_NEMA_GFX_MAX_RESX 800 248 | #define LV_NEMA_GFX_MAX_RESY 600 249 | #endif 250 | #endif 251 | 252 | /** Use NXP's VG-Lite GPU on iMX RTxxx platforms. */ 253 | #define LV_USE_DRAW_VGLITE 0 254 | 255 | #if LV_USE_DRAW_VGLITE 256 | /** Enable blit quality degradation workaround recommended for screen's dimension > 352 pixels. */ 257 | #define LV_USE_VGLITE_BLIT_SPLIT 0 258 | 259 | #if LV_USE_OS 260 | /** Use additional draw thread for VG-Lite processing. */ 261 | #define LV_USE_VGLITE_DRAW_THREAD 1 262 | 263 | #if LV_USE_VGLITE_DRAW_THREAD 264 | /** Enable VGLite draw async. Queue multiple tasks and flash them once to the GPU. */ 265 | #define LV_USE_VGLITE_DRAW_ASYNC 1 266 | #endif 267 | #endif 268 | 269 | /** Enable VGLite asserts. */ 270 | #define LV_USE_VGLITE_ASSERT 0 271 | 272 | /** Enable VGLite error checks. */ 273 | #define LV_USE_VGLITE_CHECK_ERROR 0 274 | #endif 275 | 276 | /** Use NXP's PXP on iMX RTxxx platforms. */ 277 | #define LV_USE_PXP 0 278 | 279 | #if LV_USE_PXP 280 | /** Use PXP for drawing.*/ 281 | #define LV_USE_DRAW_PXP 1 282 | 283 | /** Use PXP to rotate display.*/ 284 | #define LV_USE_ROTATE_PXP 0 285 | 286 | #if LV_USE_DRAW_PXP && LV_USE_OS 287 | /** Use additional draw thread for PXP processing.*/ 288 | #define LV_USE_PXP_DRAW_THREAD 1 289 | #endif 290 | 291 | /** Enable PXP asserts. */ 292 | #define LV_USE_PXP_ASSERT 0 293 | #endif 294 | 295 | /** Use NXP's G2D on MPU platforms. */ 296 | #define LV_USE_DRAW_G2D 0 297 | 298 | #if LV_USE_DRAW_G2D 299 | /** Maximum number of buffers that can be stored for G2D draw unit. 300 | * Includes the frame buffers and assets. */ 301 | #define LV_G2D_HASH_TABLE_SIZE 50 302 | 303 | #if LV_USE_OS 304 | /** Use additional draw thread for G2D processing.*/ 305 | #define LV_USE_G2D_DRAW_THREAD 1 306 | #endif 307 | 308 | /** Enable G2D asserts. */ 309 | #define LV_USE_G2D_ASSERT 0 310 | #endif 311 | 312 | /** Use Renesas Dave2D on RA platforms. */ 313 | #define LV_USE_DRAW_DAVE2D 0 314 | 315 | /** Draw using cached SDL textures*/ 316 | #define LV_USE_DRAW_SDL 0 317 | 318 | /** Use VG-Lite GPU. */ 319 | #define LV_USE_DRAW_VG_LITE 0 320 | 321 | #if LV_USE_DRAW_VG_LITE 322 | /** Enable VG-Lite custom external 'gpu_init()' function */ 323 | #define LV_VG_LITE_USE_GPU_INIT 0 324 | 325 | /** Enable VG-Lite assert. */ 326 | #define LV_VG_LITE_USE_ASSERT 0 327 | 328 | /** VG-Lite flush commit trigger threshold. GPU will try to batch these many draw tasks. */ 329 | #define LV_VG_LITE_FLUSH_MAX_COUNT 8 330 | 331 | /** Enable border to simulate shadow. 332 | * NOTE: which usually improves performance, 333 | * but does not guarantee the same rendering quality as the software. */ 334 | #define LV_VG_LITE_USE_BOX_SHADOW 1 335 | 336 | /** VG-Lite gradient maximum cache number. 337 | * @note The memory usage of a single gradient image is 4K bytes. */ 338 | #define LV_VG_LITE_GRAD_CACHE_CNT 32 339 | 340 | /** VG-Lite stroke maximum cache number. */ 341 | #define LV_VG_LITE_STROKE_CACHE_CNT 32 342 | #endif 343 | 344 | /** Accelerate blends, fills, etc. with STM32 DMA2D */ 345 | #define LV_USE_DRAW_DMA2D 0 346 | 347 | #if LV_USE_DRAW_DMA2D 348 | #define LV_DRAW_DMA2D_HAL_INCLUDE "stm32h7xx_hal.h" 349 | 350 | /* if enabled, the user is required to call `lv_draw_dma2d_transfer_complete_interrupt_handler` 351 | * upon receiving the DMA2D global interrupt 352 | */ 353 | #define LV_USE_DRAW_DMA2D_INTERRUPT 0 354 | #endif 355 | 356 | /** Draw using cached OpenGLES textures */ 357 | #define LV_USE_DRAW_OPENGLES 0 358 | 359 | /*======================= 360 | * FEATURE CONFIGURATION 361 | *=======================*/ 362 | 363 | /*------------- 364 | * Logging 365 | *-----------*/ 366 | 367 | /** Enable log module */ 368 | #define LV_USE_LOG 1 369 | #if LV_USE_LOG 370 | /** Set value to one of the following levels of logging detail: 371 | * - LV_LOG_LEVEL_TRACE Log detailed information. 372 | * - LV_LOG_LEVEL_INFO Log important events. 373 | * - LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem. 374 | * - LV_LOG_LEVEL_ERROR Log only critical issues, when system may fail. 375 | * - LV_LOG_LEVEL_USER Log only custom log messages added by the user. 376 | * - LV_LOG_LEVEL_NONE Do not log anything. */ 377 | #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN 378 | 379 | /** - 1: Print log with 'printf'; 380 | * - 0: User needs to register a callback with `lv_log_register_print_cb()`. */ 381 | #define LV_LOG_PRINTF 1 382 | 383 | /** Set callback to print logs. 384 | * E.g `my_print`. The prototype should be `void my_print(lv_log_level_t level, const char * buf)`. 385 | * Can be overwritten by `lv_log_register_print_cb`. */ 386 | //#define LV_LOG_PRINT_CB 387 | 388 | /** - 1: Enable printing timestamp; 389 | * - 0: Disable printing timestamp. */ 390 | #define LV_LOG_USE_TIMESTAMP 1 391 | 392 | /** - 1: Print file and line number of the log; 393 | * - 0: Do not print file and line number of the log. */ 394 | #define LV_LOG_USE_FILE_LINE 1 395 | 396 | /* Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs. */ 397 | #define LV_LOG_TRACE_MEM 1 /**< Enable/disable trace logs in memory operations. */ 398 | #define LV_LOG_TRACE_TIMER 1 /**< Enable/disable trace logs in timer operations. */ 399 | #define LV_LOG_TRACE_INDEV 1 /**< Enable/disable trace logs in input device operations. */ 400 | #define LV_LOG_TRACE_DISP_REFR 1 /**< Enable/disable trace logs in display re-draw operations. */ 401 | #define LV_LOG_TRACE_EVENT 1 /**< Enable/disable trace logs in event dispatch logic. */ 402 | #define LV_LOG_TRACE_OBJ_CREATE 1 /**< Enable/disable trace logs in object creation (core `obj` creation plus every widget). */ 403 | #define LV_LOG_TRACE_LAYOUT 1 /**< Enable/disable trace logs in flex- and grid-layout operations. */ 404 | #define LV_LOG_TRACE_ANIM 1 /**< Enable/disable trace logs in animation logic. */ 405 | #define LV_LOG_TRACE_CACHE 1 /**< Enable/disable trace logs in cache operations. */ 406 | #endif /*LV_USE_LOG*/ 407 | 408 | /*------------- 409 | * Asserts 410 | *-----------*/ 411 | 412 | /* Enable assertion failures if an operation fails or invalid data is found. 413 | * If LV_USE_LOG is enabled, an error message will be printed on failure. */ 414 | #define LV_USE_ASSERT_NULL 1 /**< Check if the parameter is NULL. (Very fast, recommended) */ 415 | #define LV_USE_ASSERT_MALLOC 1 /**< Checks is the memory is successfully allocated or no. (Very fast, recommended) */ 416 | #define LV_USE_ASSERT_STYLE 1 417 | #define LV_USE_ASSERT_MEM_INTEGRITY 1 418 | #define LV_USE_ASSERT_OBJ 1 419 | 420 | /** Add a custom handler when assert happens e.g. to restart MCU. */ 421 | #define LV_ASSERT_HANDLER_INCLUDE 422 | #define LV_ASSERT_HANDLER while(1); /**< Halt by default */ 423 | 424 | /*------------- 425 | * Debug 426 | *-----------*/ 427 | 428 | /** 1: Draw random colored rectangles over the redrawn areas. */ 429 | #define LV_USE_REFR_DEBUG 0 430 | 431 | /** 1: Draw a red overlay for ARGB layers and a green overlay for RGB layers*/ 432 | #define LV_USE_LAYER_DEBUG 0 433 | 434 | /** 1: Adds the following behaviors for debugging: 435 | * - Draw overlays with different colors for each draw_unit's tasks. 436 | * - Draw index number of draw unit on white background. 437 | * - For layers, draws index number of draw unit on black background. */ 438 | #define LV_USE_PARALLEL_DRAW_DEBUG 0 439 | 440 | /*------------- 441 | * Others 442 | *-----------*/ 443 | 444 | #define LV_ENABLE_GLOBAL_CUSTOM 0 445 | #if LV_ENABLE_GLOBAL_CUSTOM 446 | /** Header to include for custom 'lv_global' function" */ 447 | #define LV_GLOBAL_CUSTOM_INCLUDE 448 | #endif 449 | 450 | /** Default cache size in bytes. 451 | * Used by image decoders such as `lv_lodepng` to keep the decoded image in memory. 452 | * If size is not set to 0, the decoder will fail to decode when the cache is full. 453 | * If size is 0, the cache function is not enabled and the decoded memory will be 454 | * released immediately after use. */ 455 | #define LV_CACHE_DEF_SIZE 0 456 | 457 | /** Default number of image header cache entries. The cache is used to store the headers of images 458 | * The main logic is like `LV_CACHE_DEF_SIZE` but for image headers. */ 459 | #define LV_IMAGE_HEADER_CACHE_DEF_CNT 0 460 | 461 | /** Number of stops allowed per gradient. Increase this to allow more stops. 462 | * This adds (sizeof(lv_color_t) + 1) bytes per additional stop. */ 463 | #define LV_GRADIENT_MAX_STOPS 2 464 | 465 | /** Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. 466 | * - 0: round down, 467 | * - 64: round up from x.75, 468 | * - 128: round up from half, 469 | * - 192: round up from x.25, 470 | * - 254: round up */ 471 | #define LV_COLOR_MIX_ROUND_OFS 0 472 | 473 | /** Add 2 x 32-bit variables to each `lv_obj_t` to speed up getting style properties */ 474 | #define LV_OBJ_STYLE_CACHE 1 475 | 476 | /** Add `id` field to `lv_obj_t` */ 477 | #define LV_USE_OBJ_ID 0 478 | 479 | /** Enable support widget names*/ 480 | #define LV_USE_OBJ_NAME 0 481 | 482 | /** Automatically assign an ID when obj is created */ 483 | #define LV_OBJ_ID_AUTO_ASSIGN LV_USE_OBJ_ID 484 | 485 | /** Use builtin obj ID handler functions: 486 | * - lv_obj_assign_id: Called when a widget is created. Use a separate counter for each widget class as an ID. 487 | * - lv_obj_id_compare: Compare the ID to decide if it matches with a requested value. 488 | * - lv_obj_stringify_id: Return string-ified identifier, e.g. "button3". 489 | * - lv_obj_free_id: Does nothing, as there is no memory allocation for the ID. 490 | * When disabled these functions needs to be implemented by the user.*/ 491 | #define LV_USE_OBJ_ID_BUILTIN 1 492 | 493 | /** Use obj property set/get API. */ 494 | #define LV_USE_OBJ_PROPERTY 0 495 | 496 | /** Enable property name support. */ 497 | #define LV_USE_OBJ_PROPERTY_NAME 1 498 | 499 | /* Use VG-Lite Simulator. 500 | * - Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */ 501 | #define LV_USE_VG_LITE_THORVG 0 502 | 503 | #if LV_USE_VG_LITE_THORVG 504 | /** Enable LVGL's blend mode support */ 505 | #define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT 0 506 | 507 | /** Enable YUV color format support */ 508 | #define LV_VG_LITE_THORVG_YUV_SUPPORT 0 509 | 510 | /** Enable Linear gradient extension support */ 511 | #define LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT 0 512 | 513 | /** Enable alignment on 16 pixels */ 514 | #define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1 515 | 516 | /** Buffer address alignment */ 517 | #define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN 64 518 | 519 | /** Enable multi-thread render */ 520 | #define LV_VG_LITE_THORVG_THREAD_RENDER 0 521 | #endif 522 | 523 | /* Enable the multi-touch gesture recognition feature */ 524 | /* Gesture recognition requires the use of floats */ 525 | #define LV_USE_GESTURE_RECOGNITION 0 526 | 527 | /*===================== 528 | * COMPILER SETTINGS 529 | *====================*/ 530 | 531 | /** For big endian systems set to 1 */ 532 | #define LV_BIG_ENDIAN_SYSTEM 0 533 | 534 | /** Define a custom attribute for `lv_tick_inc` function */ 535 | #define LV_ATTRIBUTE_TICK_INC 536 | 537 | /** Define a custom attribute for `lv_timer_handler` function */ 538 | #define LV_ATTRIBUTE_TIMER_HANDLER 539 | 540 | /** Define a custom attribute for `lv_display_flush_ready` function */ 541 | #define LV_ATTRIBUTE_FLUSH_READY 542 | 543 | /** Align VG_LITE buffers on this number of bytes. 544 | * @note vglite_src_buf_aligned() uses this value to validate alignment of passed buffer pointers. */ 545 | #define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 546 | 547 | /** Will be added where memory needs to be aligned (with -Os data might not be aligned to boundary by default). 548 | * E.g. __attribute__((aligned(4)))*/ 549 | #define LV_ATTRIBUTE_MEM_ALIGN 550 | 551 | /** Attribute to mark large constant arrays, for example for font bitmaps */ 552 | #define LV_ATTRIBUTE_LARGE_CONST 553 | 554 | /** Compiler prefix for a large array declaration in RAM */ 555 | #define LV_ATTRIBUTE_LARGE_RAM_ARRAY 556 | 557 | /** Place performance critical functions into a faster memory (e.g RAM) */ 558 | #define LV_ATTRIBUTE_FAST_MEM 559 | 560 | /** Export integer constant to binding. This macro is used with constants in the form of LV_ that 561 | * should also appear on LVGL binding API such as MicroPython. */ 562 | #define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /**< The default value just prevents GCC warning */ 563 | 564 | /** Prefix all global extern data with this */ 565 | #define LV_ATTRIBUTE_EXTERN_DATA 566 | 567 | /** Use `float` as `lv_value_precise_t` */ 568 | #define LV_USE_FLOAT 1 569 | 570 | /** Enable matrix support 571 | * - Requires `LV_USE_FLOAT = 1` */ 572 | #define LV_USE_MATRIX 1 573 | 574 | /** Include `lvgl_private.h` in `lvgl.h` to access internal data and functions by default */ 575 | #ifndef LV_USE_PRIVATE_API 576 | #define LV_USE_PRIVATE_API 0 577 | #endif 578 | 579 | /*================== 580 | * FONT USAGE 581 | *===================*/ 582 | 583 | /* Montserrat fonts with ASCII range and some symbols using bpp = 4 584 | * https://fonts.google.com/specimen/Montserrat */ 585 | #define LV_FONT_MONTSERRAT_8 0 586 | #define LV_FONT_MONTSERRAT_10 0 587 | #define LV_FONT_MONTSERRAT_12 1 588 | #define LV_FONT_MONTSERRAT_14 1 589 | #define LV_FONT_MONTSERRAT_16 1 590 | #define LV_FONT_MONTSERRAT_18 1 591 | #define LV_FONT_MONTSERRAT_20 1 592 | #define LV_FONT_MONTSERRAT_22 1 593 | #define LV_FONT_MONTSERRAT_24 1 594 | #define LV_FONT_MONTSERRAT_26 1 595 | #define LV_FONT_MONTSERRAT_28 1 596 | #define LV_FONT_MONTSERRAT_30 1 597 | #define LV_FONT_MONTSERRAT_32 1 598 | #define LV_FONT_MONTSERRAT_34 1 599 | #define LV_FONT_MONTSERRAT_36 1 600 | #define LV_FONT_MONTSERRAT_38 1 601 | #define LV_FONT_MONTSERRAT_40 1 602 | #define LV_FONT_MONTSERRAT_42 1 603 | #define LV_FONT_MONTSERRAT_44 1 604 | #define LV_FONT_MONTSERRAT_46 1 605 | #define LV_FONT_MONTSERRAT_48 1 606 | 607 | /* Demonstrate special features */ 608 | #define LV_FONT_MONTSERRAT_28_COMPRESSED 1 609 | #define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1 610 | #define LV_FONT_SIMSUN_14_CJK 0 /**< 1000 most common CJK radicals */ 611 | #define LV_FONT_SIMSUN_16_CJK 1 612 | #define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK 0 /**< 1338 most common CJK radicals */ 613 | #define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK 0 /**< 1338 most common CJK radicals */ 614 | 615 | /** Pixel perfect monospaced fonts */ 616 | #define LV_FONT_UNSCII_8 1 617 | #define LV_FONT_UNSCII_16 0 618 | 619 | /** Optionally declare custom fonts here. 620 | * 621 | * You can use any of these fonts as the default font too and they will be available 622 | * globally. Example: 623 | * 624 | * @code 625 | * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2) 626 | * @endcode 627 | */ 628 | #define LV_FONT_CUSTOM_DECLARE 629 | 630 | /** Always set a default font */ 631 | #define LV_FONT_DEFAULT &lv_font_montserrat_14 632 | 633 | /** Enable handling large font and/or fonts with a lot of characters. 634 | * The limit depends on the font size, font face and bpp. 635 | * A compiler error will be triggered if a font needs it. */ 636 | #define LV_FONT_FMT_TXT_LARGE 0 637 | 638 | /** Enables/disables support for compressed fonts. */ 639 | #define LV_USE_FONT_COMPRESSED 0 640 | 641 | /** Enable drawing placeholders when glyph dsc is not found. */ 642 | #define LV_USE_FONT_PLACEHOLDER 1 643 | 644 | /*================= 645 | * TEXT SETTINGS 646 | *=================*/ 647 | 648 | /** 649 | * Select a character encoding for strings. 650 | * Your IDE or editor should have the same character encoding. 651 | * - LV_TXT_ENC_UTF8 652 | * - LV_TXT_ENC_ASCII 653 | */ 654 | #define LV_TXT_ENC LV_TXT_ENC_UTF8 655 | 656 | /** While rendering text strings, break (wrap) text on these chars. */ 657 | #define LV_TXT_BREAK_CHARS " ,.;:-_)]}" 658 | 659 | /** If a word is at least this long, will break wherever "prettiest". 660 | * To disable, set to a value <= 0. */ 661 | #define LV_TXT_LINE_BREAK_LONG_LEN 0 662 | 663 | /** Minimum number of characters in a long word to put on a line before a break. 664 | * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ 665 | #define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 666 | 667 | /** Minimum number of characters in a long word to put on a line after a break. 668 | * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ 669 | #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 670 | 671 | /** Support bidirectional text. Allows mixing Left-to-Right and Right-to-Left text. 672 | * The direction will be processed according to the Unicode Bidirectional Algorithm: 673 | * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics */ 674 | #define LV_USE_BIDI 0 675 | #if LV_USE_BIDI 676 | /*Set the default direction. Supported values: 677 | *`LV_BASE_DIR_LTR` Left-to-Right 678 | *`LV_BASE_DIR_RTL` Right-to-Left 679 | *`LV_BASE_DIR_AUTO` detect text base direction*/ 680 | #define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO 681 | #endif 682 | 683 | /** Enable Arabic/Persian processing 684 | * In these languages characters should be replaced with another form based on their position in the text */ 685 | #define LV_USE_ARABIC_PERSIAN_CHARS 0 686 | 687 | /*The control character to use for signaling text recoloring*/ 688 | #define LV_TXT_COLOR_CMD "#" 689 | 690 | /*================== 691 | * WIDGETS 692 | *================*/ 693 | /* Documentation for widgets can be found here: https://docs.lvgl.io/master/details/widgets/index.html . */ 694 | 695 | /** 1: Causes these widgets to be given default values at creation time. 696 | * - lv_buttonmatrix_t: Get default maps: {"Btn1", "Btn2", "Btn3", "\n", "Btn4", "Btn5", ""}, else map not set. 697 | * - lv_checkbox_t : String label set to "Check box", else set to empty string. 698 | * - lv_dropdown_t : Options set to "Option 1", "Option 2", "Option 3", else no values are set. 699 | * - lv_roller_t : Options set to "Option 1", "Option 2", "Option 3", "Option 4", "Option 5", else no values are set. 700 | * - lv_label_t : Text set to "Text", else empty string. 701 | * */ 702 | #define LV_WIDGETS_HAS_DEFAULT_VALUE 1 703 | 704 | #define LV_USE_ANIMIMG 1 705 | 706 | #define LV_USE_ARC 1 707 | 708 | #define LV_USE_BAR 1 709 | 710 | #define LV_USE_BUTTON 1 711 | 712 | #define LV_USE_BUTTONMATRIX 1 713 | 714 | #define LV_USE_CALENDAR 1 715 | #if LV_USE_CALENDAR 716 | #define LV_CALENDAR_WEEK_STARTS_MONDAY 0 717 | #if LV_CALENDAR_WEEK_STARTS_MONDAY 718 | #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"} 719 | #else 720 | #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} 721 | #endif 722 | 723 | #define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} 724 | #define LV_USE_CALENDAR_HEADER_ARROW 1 725 | #define LV_USE_CALENDAR_HEADER_DROPDOWN 1 726 | #define LV_USE_CALENDAR_CHINESE 0 727 | #endif /*LV_USE_CALENDAR*/ 728 | 729 | #define LV_USE_CANVAS 1 730 | 731 | #define LV_USE_CHART 1 732 | 733 | #define LV_USE_CHECKBOX 1 734 | 735 | #define LV_USE_DROPDOWN 1 /**< Requires: lv_label */ 736 | 737 | #define LV_USE_IMAGE 1 /**< Requires: lv_label */ 738 | 739 | #define LV_USE_IMAGEBUTTON 1 740 | 741 | #define LV_USE_KEYBOARD 1 742 | 743 | #define LV_USE_LABEL 1 744 | #if LV_USE_LABEL 745 | #define LV_LABEL_TEXT_SELECTION 1 /**< Enable selecting text of the label */ 746 | #define LV_LABEL_LONG_TXT_HINT 1 /**< Store some extra info in labels to speed up drawing of very long text */ 747 | #define LV_LABEL_WAIT_CHAR_COUNT 3 /**< The count of wait chart */ 748 | #endif 749 | 750 | #define LV_USE_LED 1 751 | 752 | #define LV_USE_LINE 1 753 | 754 | #define LV_USE_LIST 1 755 | 756 | #define LV_USE_LOTTIE 1 757 | 758 | #define LV_USE_MENU 1 759 | 760 | #define LV_USE_MSGBOX 1 761 | 762 | #define LV_USE_ROLLER 1 /**< Requires: lv_label */ 763 | 764 | #define LV_USE_SCALE 1 765 | 766 | #define LV_USE_SLIDER 1 /**< Requires: lv_bar */ 767 | 768 | #define LV_USE_SPAN 1 769 | #if LV_USE_SPAN 770 | /** A line of text can contain this maximum number of span descriptors. */ 771 | #define LV_SPAN_SNIPPET_STACK_SIZE 64 772 | #endif 773 | 774 | #define LV_USE_SPINBOX 1 775 | 776 | #define LV_USE_SPINNER 1 777 | 778 | #define LV_USE_SWITCH 1 779 | 780 | #define LV_USE_TABLE 1 781 | 782 | #define LV_USE_TABVIEW 1 783 | 784 | #define LV_USE_TEXTAREA 1 /**< Requires: lv_label */ 785 | #if LV_USE_TEXTAREA != 0 786 | #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /**< [ms] */ 787 | #endif 788 | 789 | #define LV_USE_TILEVIEW 1 790 | 791 | #define LV_USE_WIN 1 792 | 793 | #define LV_USE_3DTEXTURE 0 794 | 795 | /*================== 796 | * THEMES 797 | *==================*/ 798 | /* Documentation for themes can be found here: https://docs.lvgl.io/master/details/common-widget-features/styles/style.html#themes . */ 799 | 800 | /** A simple, impressive and very complete theme */ 801 | #define LV_USE_THEME_DEFAULT 1 802 | #if LV_USE_THEME_DEFAULT 803 | /** 0: Light mode; 1: Dark mode */ 804 | #define LV_THEME_DEFAULT_DARK 0 805 | 806 | /** 1: Enable grow on press */ 807 | #define LV_THEME_DEFAULT_GROW 1 808 | 809 | /** Default transition time in ms. */ 810 | #define LV_THEME_DEFAULT_TRANSITION_TIME 80 811 | #endif /*LV_USE_THEME_DEFAULT*/ 812 | 813 | /** A very simple theme that is a good starting point for a custom theme */ 814 | #define LV_USE_THEME_SIMPLE 1 815 | 816 | /** A theme designed for monochrome displays */ 817 | #define LV_USE_THEME_MONO 1 818 | 819 | /*================== 820 | * LAYOUTS 821 | *==================*/ 822 | /* Documentation for layouts can be found here: https://docs.lvgl.io/master/details/common-widget-features/layouts/index.html . */ 823 | 824 | /** A layout similar to Flexbox in CSS. */ 825 | #define LV_USE_FLEX 1 826 | 827 | /** A layout similar to Grid in CSS. */ 828 | #define LV_USE_GRID 1 829 | 830 | /*==================== 831 | * 3RD PARTS LIBRARIES 832 | *====================*/ 833 | /* Documentation for libraries can be found here: https://docs.lvgl.io/master/details/libs/index.html . */ 834 | 835 | /* File system interfaces for common APIs */ 836 | 837 | /** Setting a default driver letter allows skipping the driver prefix in filepaths. 838 | * Documentation about how to use the below driver-identifier letters can be found at 839 | * https://docs.lvgl.io/master/details/main-modules/fs.html#lv-fs-identifier-letters . */ 840 | #define LV_FS_DEFAULT_DRIVER_LETTER '\0' 841 | 842 | /** API for fopen, fread, etc. */ 843 | #define LV_USE_FS_STDIO 1 844 | #if LV_USE_FS_STDIO 845 | #define LV_FS_STDIO_LETTER 'A' 846 | #define LV_FS_STDIO_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ 847 | #define LV_FS_STDIO_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ 848 | #endif 849 | 850 | /** API for open, read, etc. */ 851 | #define LV_USE_FS_POSIX 0 852 | #if LV_USE_FS_POSIX 853 | #define LV_FS_POSIX_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ 854 | #define LV_FS_POSIX_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ 855 | #define LV_FS_POSIX_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ 856 | #endif 857 | 858 | /** API for CreateFile, ReadFile, etc. */ 859 | #define LV_USE_FS_WIN32 0 860 | #if LV_USE_FS_WIN32 861 | #define LV_FS_WIN32_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ 862 | #define LV_FS_WIN32_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ 863 | #define LV_FS_WIN32_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ 864 | #endif 865 | 866 | /** API for FATFS (needs to be added separately). Uses f_open, f_read, etc. */ 867 | #define LV_USE_FS_FATFS 0 868 | #if LV_USE_FS_FATFS 869 | #define LV_FS_FATFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ 870 | #define LV_FS_FATFS_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ 871 | #define LV_FS_FATFS_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ 872 | #endif 873 | 874 | /** API for memory-mapped file access. */ 875 | #define LV_USE_FS_MEMFS 0 876 | #if LV_USE_FS_MEMFS 877 | #define LV_FS_MEMFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ 878 | #endif 879 | 880 | /** API for LittleFs. */ 881 | #define LV_USE_FS_LITTLEFS 0 882 | #if LV_USE_FS_LITTLEFS 883 | #define LV_FS_LITTLEFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ 884 | #define LV_FS_LITTLEFS_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ 885 | #endif 886 | 887 | /** API for Arduino LittleFs. */ 888 | #define LV_USE_FS_ARDUINO_ESP_LITTLEFS 0 889 | #if LV_USE_FS_ARDUINO_ESP_LITTLEFS 890 | #define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ 891 | #define LV_FS_ARDUINO_ESP_LITTLEFS_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ 892 | #endif 893 | 894 | /** API for Arduino Sd. */ 895 | #define LV_USE_FS_ARDUINO_SD 0 896 | #if LV_USE_FS_ARDUINO_SD 897 | #define LV_FS_ARDUINO_SD_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ 898 | #define LV_FS_ARDUINO_SD_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ 899 | #endif 900 | 901 | /** API for UEFI */ 902 | #define LV_USE_FS_UEFI 0 903 | #if LV_USE_FS_UEFI 904 | #define LV_FS_UEFI_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ 905 | #endif 906 | 907 | /** LODEPNG decoder library */ 908 | #define LV_USE_LODEPNG 1 909 | 910 | /** PNG decoder(libpng) library */ 911 | #define LV_USE_LIBPNG 0 912 | 913 | /** BMP decoder library */ 914 | #define LV_USE_BMP 1 915 | 916 | /** JPG + split JPG decoder library. 917 | * Split JPG is a custom format optimized for embedded systems. */ 918 | #define LV_USE_TJPGD 1 919 | 920 | /** libjpeg-turbo decoder library. 921 | * - Supports complete JPEG specifications and high-performance JPEG decoding. */ 922 | #define LV_USE_LIBJPEG_TURBO 0 923 | 924 | /** GIF decoder library */ 925 | #define LV_USE_GIF 0 926 | #if LV_USE_GIF 927 | /** GIF decoder accelerate */ 928 | #define LV_GIF_CACHE_DECODE_DATA 0 929 | #endif 930 | 931 | 932 | /** Decode bin images to RAM */ 933 | #define LV_BIN_DECODER_RAM_LOAD 1 934 | 935 | /** RLE decompress library */ 936 | #define LV_USE_RLE 1 937 | 938 | /** QR code library */ 939 | #define LV_USE_QRCODE 1 940 | 941 | /** Barcode code library */ 942 | #define LV_USE_BARCODE 1 943 | 944 | /** FreeType library */ 945 | #define LV_USE_FREETYPE 0 946 | #if LV_USE_FREETYPE 947 | /** Let FreeType use LVGL memory and file porting */ 948 | #define LV_FREETYPE_USE_LVGL_PORT 0 949 | 950 | /** Cache count of glyphs in FreeType, i.e. number of glyphs that can be cached. 951 | * The higher the value, the more memory will be used. */ 952 | #define LV_FREETYPE_CACHE_FT_GLYPH_CNT 256 953 | #endif 954 | 955 | /** Built-in TTF decoder */ 956 | #define LV_USE_TINY_TTF 1 957 | #if LV_USE_TINY_TTF 958 | /* Enable loading TTF data from files */ 959 | #define LV_TINY_TTF_FILE_SUPPORT 0 960 | #define LV_TINY_TTF_CACHE_GLYPH_CNT 256 961 | #endif 962 | 963 | /** Rlottie library */ 964 | #define LV_USE_RLOTTIE 0 965 | 966 | /** Enable Vector Graphic APIs 967 | * - Requires `LV_USE_MATRIX = 1` */ 968 | #define LV_USE_VECTOR_GRAPHIC 1 969 | 970 | /** Enable ThorVG (vector graphics library) from the src/libs folder */ 971 | #define LV_USE_THORVG_INTERNAL 1 972 | 973 | /** Enable ThorVG by assuming that its installed and linked to the project */ 974 | #define LV_USE_THORVG_EXTERNAL 0 975 | 976 | /** Use lvgl built-in LZ4 lib */ 977 | #define LV_USE_LZ4_INTERNAL 1 978 | 979 | /** Use external LZ4 library */ 980 | #define LV_USE_LZ4_EXTERNAL 0 981 | 982 | /*SVG library 983 | * - Requires `LV_USE_VECTOR_GRAPHIC = 1` */ 984 | #define LV_USE_SVG 0 985 | #define LV_USE_SVG_ANIMATION 0 986 | #define LV_USE_SVG_DEBUG 0 987 | 988 | /** FFmpeg library for image decoding and playing videos. 989 | * Supports all major image formats so do not enable other image decoder with it. */ 990 | #define LV_USE_FFMPEG 0 991 | #if LV_USE_FFMPEG 992 | /** Dump input information to stderr */ 993 | #define LV_FFMPEG_DUMP_FORMAT 0 994 | /** Use lvgl file path in FFmpeg Player widget 995 | * You won't be able to open URLs after enabling this feature. 996 | * Note that FFmpeg image decoder will always use lvgl file system. */ 997 | #define LV_FFMPEG_PLAYER_USE_LV_FS 0 998 | #endif 999 | 1000 | /*================== 1001 | * OTHERS 1002 | *==================*/ 1003 | /* Documentation for several of the below items can be found here: https://docs.lvgl.io/master/details/auxiliary-modules/index.html . */ 1004 | 1005 | /** 1: Enable API to take snapshot for object */ 1006 | #define LV_USE_SNAPSHOT 0 1007 | 1008 | /** 1: Enable system monitor component */ 1009 | #define LV_USE_SYSMON 1 1010 | #if LV_USE_SYSMON 1011 | /** Get the idle percentage. E.g. uint32_t my_get_idle(void); */ 1012 | #define LV_SYSMON_GET_IDLE lv_os_get_idle_percent 1013 | 1014 | /** 1: Show CPU usage and FPS count. 1015 | * - Requires `LV_USE_SYSMON = 1` */ 1016 | #define LV_USE_PERF_MONITOR 0 1017 | #if LV_USE_PERF_MONITOR 1018 | #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT 1019 | 1020 | /** 0: Displays performance data on the screen; 1: Prints performance data using log. */ 1021 | #define LV_USE_PERF_MONITOR_LOG_MODE 0 1022 | #endif 1023 | 1024 | /** 1: Show used memory and memory fragmentation. 1025 | * - Requires `LV_USE_STDLIB_MALLOC = LV_STDLIB_BUILTIN` 1026 | * - Requires `LV_USE_SYSMON = 1`*/ 1027 | #define LV_USE_MEM_MONITOR 0 1028 | #if LV_USE_MEM_MONITOR 1029 | #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT 1030 | #endif 1031 | #endif /*LV_USE_SYSMON*/ 1032 | 1033 | /** 1: Enable runtime performance profiler */ 1034 | #define LV_USE_PROFILER 0 1035 | #if LV_USE_PROFILER 1036 | /** 1: Enable the built-in profiler */ 1037 | #define LV_USE_PROFILER_BUILTIN 1 1038 | #if LV_USE_PROFILER_BUILTIN 1039 | /** Default profiler trace buffer size */ 1040 | #define LV_PROFILER_BUILTIN_BUF_SIZE (16 * 1024) /**< [bytes] */ 1041 | #define LV_PROFILER_BUILTIN_DEFAULT_ENABLE 1 1042 | #endif 1043 | 1044 | /** Header to include for profiler */ 1045 | #define LV_PROFILER_INCLUDE "lvgl/src/misc/lv_profiler_builtin.h" 1046 | 1047 | /** Profiler start point function */ 1048 | #define LV_PROFILER_BEGIN LV_PROFILER_BUILTIN_BEGIN 1049 | 1050 | /** Profiler end point function */ 1051 | #define LV_PROFILER_END LV_PROFILER_BUILTIN_END 1052 | 1053 | /** Profiler start point function with custom tag */ 1054 | #define LV_PROFILER_BEGIN_TAG LV_PROFILER_BUILTIN_BEGIN_TAG 1055 | 1056 | /** Profiler end point function with custom tag */ 1057 | #define LV_PROFILER_END_TAG LV_PROFILER_BUILTIN_END_TAG 1058 | 1059 | /*Enable layout profiler*/ 1060 | #define LV_PROFILER_LAYOUT 1 1061 | 1062 | /*Enable disp refr profiler*/ 1063 | #define LV_PROFILER_REFR 1 1064 | 1065 | /*Enable draw profiler*/ 1066 | #define LV_PROFILER_DRAW 1 1067 | 1068 | /*Enable indev profiler*/ 1069 | #define LV_PROFILER_INDEV 1 1070 | 1071 | /*Enable decoder profiler*/ 1072 | #define LV_PROFILER_DECODER 1 1073 | 1074 | /*Enable font profiler*/ 1075 | #define LV_PROFILER_FONT 1 1076 | 1077 | /*Enable fs profiler*/ 1078 | #define LV_PROFILER_FS 1 1079 | 1080 | /*Enable style profiler*/ 1081 | #define LV_PROFILER_STYLE 0 1082 | 1083 | /*Enable timer profiler*/ 1084 | #define LV_PROFILER_TIMER 1 1085 | 1086 | /*Enable cache profiler*/ 1087 | #define LV_PROFILER_CACHE 1 1088 | 1089 | /*Enable event profiler*/ 1090 | #define LV_PROFILER_EVENT 1 1091 | #endif 1092 | 1093 | /** 1: Enable Monkey test */ 1094 | #define LV_USE_MONKEY 0 1095 | 1096 | /** 1: Enable grid navigation */ 1097 | #define LV_USE_GRIDNAV 0 1098 | 1099 | /** 1: Enable `lv_obj` fragment logic */ 1100 | #define LV_USE_FRAGMENT 0 1101 | 1102 | /** 1: Support using images as font in label or span widgets */ 1103 | #define LV_USE_IMGFONT 1 1104 | 1105 | /** 1: Enable an observer pattern implementation */ 1106 | #define LV_USE_OBSERVER 1 1107 | 1108 | /** 1: Enable Pinyin input method 1109 | * - Requires: lv_keyboard */ 1110 | #define LV_USE_IME_PINYIN 0 1111 | #if LV_USE_IME_PINYIN 1112 | /** 1: Use default thesaurus. 1113 | * @note If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesaurus. */ 1114 | #define LV_IME_PINYIN_USE_DEFAULT_DICT 1 1115 | /** Set maximum number of candidate panels that can be displayed. 1116 | * @note This needs to be adjusted according to size of screen. */ 1117 | #define LV_IME_PINYIN_CAND_TEXT_NUM 6 1118 | 1119 | /** Use 9-key input (k9). */ 1120 | #define LV_IME_PINYIN_USE_K9_MODE 1 1121 | #if LV_IME_PINYIN_USE_K9_MODE == 1 1122 | #define LV_IME_PINYIN_K9_CAND_TEXT_NUM 3 1123 | #endif /*LV_IME_PINYIN_USE_K9_MODE*/ 1124 | #endif 1125 | 1126 | /** 1: Enable file explorer. 1127 | * - Requires: lv_table */ 1128 | #define LV_USE_FILE_EXPLORER 0 1129 | #if LV_USE_FILE_EXPLORER 1130 | /** Maximum length of path */ 1131 | #define LV_FILE_EXPLORER_PATH_MAX_LEN (128) 1132 | /** Quick access bar, 1:use, 0:do not use. 1133 | * - Requires: lv_list */ 1134 | #define LV_FILE_EXPLORER_QUICK_ACCESS 1 1135 | #endif 1136 | 1137 | /** 1: Enable Font manager */ 1138 | #define LV_USE_FONT_MANAGER 0 1139 | #if LV_USE_FONT_MANAGER 1140 | 1141 | /**Font manager name max length*/ 1142 | #define LV_FONT_MANAGER_NAME_MAX_LEN 32 1143 | 1144 | #endif 1145 | 1146 | /** Enable emulated input devices, time emulation, and screenshot compares. */ 1147 | #define LV_USE_TEST 0 1148 | #if LV_USE_TEST 1149 | 1150 | /** Enable `lv_test_screenshot_compare`. 1151 | * Requires libpng and a few MB of extra RAM. */ 1152 | #define LV_USE_TEST_SCREENSHOT_COMPARE 0 1153 | #endif /*LV_USE_TEST*/ 1154 | 1155 | /** Enable loading XML UIs runtime */ 1156 | #define LV_USE_XML 0 1157 | 1158 | /*1: Enable color filter style*/ 1159 | #define LV_USE_COLOR_FILTER 0 1160 | /*================== 1161 | * DEVICES 1162 | *==================*/ 1163 | 1164 | /** Use SDL to open window on PC and handle mouse and keyboard. */ 1165 | #define LV_USE_SDL 1 1166 | #if LV_USE_SDL 1167 | #define LV_SDL_INCLUDE_PATH 1168 | #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /**< LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance */ 1169 | #define LV_SDL_BUF_COUNT 1 /**< 1 or 2 */ 1170 | #define LV_SDL_ACCELERATED 1 /**< 1: Use hardware acceleration*/ 1171 | #define LV_SDL_FULLSCREEN 0 /**< 1: Make the window full screen by default */ 1172 | #define LV_SDL_DIRECT_EXIT 1 /**< 1: Exit the application when all SDL windows are closed */ 1173 | #define LV_SDL_MOUSEWHEEL_MODE LV_SDL_MOUSEWHEEL_MODE_ENCODER /*LV_SDL_MOUSEWHEEL_MODE_ENCODER/CROWN*/ 1174 | #endif 1175 | 1176 | /** Use X11 to open window on Linux desktop and handle mouse and keyboard */ 1177 | #define LV_USE_X11 0 1178 | #if LV_USE_X11 1179 | #define LV_X11_DIRECT_EXIT 1 /**< Exit application when all X11 windows have been closed */ 1180 | #define LV_X11_DOUBLE_BUFFER 1 /**< Use double buffers for rendering */ 1181 | /* Select only 1 of the following render modes (LV_X11_RENDER_MODE_PARTIAL preferred!). */ 1182 | #define LV_X11_RENDER_MODE_PARTIAL 1 /**< Partial render mode (preferred) */ 1183 | #define LV_X11_RENDER_MODE_DIRECT 0 /**< Direct render mode */ 1184 | #define LV_X11_RENDER_MODE_FULL 0 /**< Full render mode */ 1185 | #endif 1186 | 1187 | /** Use Wayland to open a window and handle input on Linux or BSD desktops */ 1188 | #define LV_USE_WAYLAND 0 1189 | #if LV_USE_WAYLAND 1190 | #define LV_WAYLAND_WINDOW_DECORATIONS 0 /**< Draw client side window decorations only necessary on Mutter/GNOME */ 1191 | #define LV_WAYLAND_WL_SHELL 0 /**< Use the legacy wl_shell protocol instead of the default XDG shell */ 1192 | #endif 1193 | 1194 | /** Driver for /dev/fb */ 1195 | #define LV_USE_LINUX_FBDEV 0 1196 | #if LV_USE_LINUX_FBDEV 1197 | #define LV_LINUX_FBDEV_BSD 0 1198 | #define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL 1199 | #define LV_LINUX_FBDEV_BUFFER_COUNT 0 1200 | #define LV_LINUX_FBDEV_BUFFER_SIZE 60 1201 | #define LV_LINUX_FBDEV_MMAP 1 1202 | #endif 1203 | 1204 | /** Use Nuttx to open window and handle touchscreen */ 1205 | #define LV_USE_NUTTX 0 1206 | 1207 | #if LV_USE_NUTTX 1208 | #define LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP 0 1209 | 1210 | /** Use independent image heap for default draw buffer */ 1211 | #define LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP 0 1212 | 1213 | #define LV_USE_NUTTX_LIBUV 0 1214 | 1215 | /** Use Nuttx custom init API to open window and handle touchscreen */ 1216 | #define LV_USE_NUTTX_CUSTOM_INIT 0 1217 | 1218 | /** Driver for /dev/lcd */ 1219 | #define LV_USE_NUTTX_LCD 0 1220 | #if LV_USE_NUTTX_LCD 1221 | #define LV_NUTTX_LCD_BUFFER_COUNT 0 1222 | #define LV_NUTTX_LCD_BUFFER_SIZE 60 1223 | #endif 1224 | 1225 | /** Driver for /dev/input */ 1226 | #define LV_USE_NUTTX_TOUCHSCREEN 0 1227 | 1228 | /*Touchscreen cursor size in pixels(<=0: disable cursor)*/ 1229 | #define LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE 0 1230 | #endif 1231 | 1232 | /** Driver for /dev/dri/card */ 1233 | #define LV_USE_LINUX_DRM 0 1234 | 1235 | #if LV_USE_LINUX_DRM 1236 | 1237 | /* Use the MESA GBM library to allocate DMA buffers that can be 1238 | * shared across sub-systems and libraries using the Linux DMA-BUF API. 1239 | * The GBM library aims to provide a platform independent memory management system 1240 | * it supports the major GPU vendors - This option requires linking with libgbm */ 1241 | #define LV_LINUX_DRM_GBM_BUFFERS 0 1242 | #endif 1243 | 1244 | /** Interface for TFT_eSPI */ 1245 | #define LV_USE_TFT_ESPI 0 1246 | 1247 | /** Driver for evdev input devices */ 1248 | #define LV_USE_EVDEV 0 1249 | 1250 | /** Driver for libinput input devices */ 1251 | #define LV_USE_LIBINPUT 0 1252 | 1253 | #if LV_USE_LIBINPUT 1254 | #define LV_LIBINPUT_BSD 0 1255 | 1256 | /** Full keyboard support */ 1257 | #define LV_LIBINPUT_XKB 0 1258 | #if LV_LIBINPUT_XKB 1259 | /** "setxkbmap -query" can help find the right values for your keyboard */ 1260 | #define LV_LIBINPUT_XKB_KEY_MAP { .rules = NULL, .model = "pc101", .layout = "us", .variant = NULL, .options = NULL } 1261 | #endif 1262 | #endif 1263 | 1264 | /* Drivers for LCD devices connected via SPI/parallel port */ 1265 | #define LV_USE_ST7735 0 1266 | #define LV_USE_ST7789 0 1267 | #define LV_USE_ST7796 0 1268 | #define LV_USE_ILI9341 0 1269 | #define LV_USE_FT81X 0 1270 | 1271 | #if (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341) 1272 | #define LV_USE_GENERIC_MIPI 1 1273 | #else 1274 | #define LV_USE_GENERIC_MIPI 0 1275 | #endif 1276 | 1277 | /** Driver for Renesas GLCD */ 1278 | #define LV_USE_RENESAS_GLCDC 0 1279 | 1280 | /** Driver for ST LTDC */ 1281 | #define LV_USE_ST_LTDC 0 1282 | #if LV_USE_ST_LTDC 1283 | /* Only used for partial. */ 1284 | #define LV_ST_LTDC_USE_DMA2D_FLUSH 0 1285 | #endif 1286 | 1287 | /** LVGL Windows backend */ 1288 | #define LV_USE_WINDOWS 0 1289 | 1290 | /** LVGL UEFI backend */ 1291 | #define LV_USE_UEFI 0 1292 | #if LV_USE_UEFI 1293 | #define LV_USE_UEFI_INCLUDE "myefi.h" /**< Header that hides the actual framework (EDK2, gnu-efi, ...) */ 1294 | #define LV_UEFI_USE_MEMORY_SERVICES 0 /**< Use the memory functions from the boot services table */ 1295 | #endif 1296 | 1297 | /** Use OpenGL to open window on PC and handle mouse and keyboard */ 1298 | #define LV_USE_OPENGLES 0 1299 | #if LV_USE_OPENGLES 1300 | #define LV_USE_OPENGLES_DEBUG 1 /**< Enable or disable debug for opengles */ 1301 | #endif 1302 | 1303 | /** QNX Screen display and input drivers */ 1304 | #define LV_USE_QNX 0 1305 | #if LV_USE_QNX 1306 | #define LV_QNX_BUF_COUNT 1 /**< 1 or 2 */ 1307 | #endif 1308 | 1309 | /*===================== 1310 | * BUILD OPTIONS 1311 | *======================*/ 1312 | 1313 | /** Enable examples to be built with the library. */ 1314 | #define LV_BUILD_EXAMPLES 1 1315 | 1316 | /** Build the demos */ 1317 | #define LV_BUILD_DEMOS 1 1318 | 1319 | /*=================== 1320 | * DEMO USAGE 1321 | ====================*/ 1322 | 1323 | #if LV_BUILD_DEMOS 1324 | /** Show some widgets. This might be required to increase `LV_MEM_SIZE`. */ 1325 | #define LV_USE_DEMO_WIDGETS 1 1326 | 1327 | /** Demonstrate usage of encoder and keyboard. */ 1328 | #define LV_USE_DEMO_KEYPAD_AND_ENCODER 1 1329 | 1330 | /** Benchmark your system */ 1331 | #define LV_USE_DEMO_BENCHMARK 1 1332 | 1333 | #if LV_USE_DEMO_BENCHMARK 1334 | /** Use fonts where bitmaps are aligned 16 byte and has Nx16 byte stride */ 1335 | #define LV_DEMO_BENCHMARK_ALIGNED_FONTS 0 1336 | #endif 1337 | 1338 | /** Render test for each primitive. 1339 | * - Requires at least 480x272 display. */ 1340 | #define LV_USE_DEMO_RENDER 1 1341 | 1342 | /** Stress test for LVGL */ 1343 | #define LV_USE_DEMO_STRESS 1 1344 | 1345 | /** Music player demo */ 1346 | #define LV_USE_DEMO_MUSIC 1 1347 | #if LV_USE_DEMO_MUSIC 1348 | #define LV_DEMO_MUSIC_SQUARE 0 1349 | #define LV_DEMO_MUSIC_LANDSCAPE 0 1350 | #define LV_DEMO_MUSIC_ROUND 0 1351 | #define LV_DEMO_MUSIC_LARGE 0 1352 | #define LV_DEMO_MUSIC_AUTO_PLAY 0 1353 | #endif 1354 | 1355 | /** Vector graphic demo */ 1356 | #define LV_USE_DEMO_VECTOR_GRAPHIC 0 1357 | 1358 | /*--------------------------- 1359 | * Demos from lvgl/lv_demos 1360 | ---------------------------*/ 1361 | 1362 | /** Flex layout demo */ 1363 | #define LV_USE_DEMO_FLEX_LAYOUT 1 1364 | 1365 | /** Smart-phone like multi-language demo */ 1366 | #define LV_USE_DEMO_MULTILANG 1 1367 | 1368 | /** Widget transformation demo */ 1369 | #define LV_USE_DEMO_TRANSFORM 1 1370 | 1371 | /** Demonstrate scroll settings */ 1372 | #define LV_USE_DEMO_SCROLL 1 1373 | 1374 | /*E-bike demo with Lottie animations (if LV_USE_LOTTIE is enabled)*/ 1375 | #define LV_USE_DEMO_EBIKE 0 1376 | #if LV_USE_DEMO_EBIKE 1377 | #define LV_DEMO_EBIKE_PORTRAIT 0 /*0: for 480x270..480x320, 1: for 480x800..720x1280*/ 1378 | #endif 1379 | 1380 | /** High-resolution demo */ 1381 | #define LV_USE_DEMO_HIGH_RES 0 1382 | 1383 | /* Smart watch demo */ 1384 | #define LV_USE_DEMO_SMARTWATCH 0 1385 | #endif /* LV_BUILD_DEMOS */ 1386 | 1387 | /*--END OF LV_CONF_H--*/ 1388 | 1389 | #endif /*LV_CONF_H*/ 1390 | 1391 | #endif /*End of "Content enable"*/ 1392 | -------------------------------------------------------------------------------- /main/src/FreeRTOS_Posix_Port.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Event management with pthreads 3 | * @brief Implementation of an event mechanism using POSIX threads. 4 | * @date 2024-09-03 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | /* Structure representing an event, consisting of a condition variable and a mutex */ 12 | typedef struct Event 13 | { 14 | pthread_cond_t cond; /* Condition variable used to signal the event */ 15 | pthread_mutex_t mutex; /* Mutex to protect access to the condition variable */ 16 | } Event_t; 17 | 18 | /** 19 | * @brief Create an event object 20 | * 21 | * Allocates memory for an Event_t structure and initializes its condition variable and mutex. 22 | * 23 | * @param None 24 | * @return Pointer to the created Event_t object, or NULL if memory allocation fails 25 | */ 26 | Event_t *event_create(void) 27 | { 28 | Event_t *event = (Event_t *)malloc(sizeof(Event_t)); /* Allocate memory for the event */ 29 | if (event) /* Check if allocation was successful */ 30 | { 31 | pthread_cond_init(&event->cond, NULL); /* Initialize the condition variable */ 32 | pthread_mutex_init(&event->mutex, NULL); /* Initialize the mutex */ 33 | } 34 | return event; /* Return the created event object */ 35 | } 36 | 37 | // ........................................................................................................ 38 | /** 39 | * @brief Delete an event object 40 | * 41 | * Destroys the condition variable and mutex associated with the event, then frees the memory. 42 | * 43 | * @param event Pointer to the Event_t object to be deleted 44 | * @return None 45 | */ 46 | void event_delete(Event_t *event) 47 | { 48 | if (event) /* Check if the event object is valid */ 49 | { 50 | pthread_cond_destroy(&event->cond); /* Destroy the condition variable */ 51 | pthread_mutex_destroy(&event->mutex); /* Destroy the mutex */ 52 | free(event); /* Free the memory allocated for the event object */ 53 | } 54 | } 55 | 56 | // ........................................................................................................ 57 | /** 58 | * @brief Signal an event 59 | * 60 | * Signals the condition variable associated with the event, waking up any waiting threads. 61 | * 62 | * @param event Pointer to the Event_t object to be signaled 63 | * @return None 64 | */ 65 | void event_signal(Event_t *event) 66 | { 67 | if (event) /* Check if the event object is valid */ 68 | { 69 | pthread_mutex_lock(&event->mutex); /* Lock the mutex before signaling */ 70 | pthread_cond_signal(&event->cond); /* Signal the condition variable */ 71 | pthread_mutex_unlock(&event->mutex); /* Unlock the mutex after signaling */ 72 | } 73 | } 74 | 75 | // ........................................................................................................ 76 | /** 77 | * @brief Wait for an event 78 | * 79 | * Waits for the condition variable associated with the event to be signaled. 80 | * 81 | * @param event Pointer to the Event_t object to wait for 82 | * @return None 83 | */ 84 | void event_wait(Event_t *event) 85 | { 86 | if (event) /* Check if the event object is valid */ 87 | { 88 | pthread_mutex_lock(&event->mutex); /* Lock the mutex before waiting */ 89 | pthread_cond_wait(&event->cond, &event->mutex); /* Wait for the condition variable to be signaled */ 90 | pthread_mutex_unlock(&event->mutex); /* Unlock the mutex after waiting */ 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /main/src/freertos_main.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Freertos main file 3 | * @author MootSeeker 4 | * @date 2024-09-02 5 | * @brief Main file for FreeRTOS tasks and hooks. 6 | * @license MIT License 7 | */ 8 | 9 | #include "lvgl/src/osal/lv_os.h" 10 | 11 | #if LV_USE_OS == LV_OS_FREERTOS 12 | 13 | #include "lvgl.h" 14 | #include // For printf in C++ 15 | 16 | // ........................................................................................................ 17 | /** 18 | * @brief Malloc failed hook 19 | * 20 | * This function is called when a memory allocation (malloc) fails. It logs the available heap size and enters 21 | * an infinite loop to halt the system. 22 | * 23 | * @param None 24 | * @return None 25 | */ 26 | extern "C" void vApplicationMallocFailedHook(void) 27 | { 28 | printf("Malloc failed! Available heap: %ld bytes\n", xPortGetFreeHeapSize()); 29 | for( ;; ); 30 | } 31 | 32 | // ........................................................................................................ 33 | /** 34 | * @brief Idle hook 35 | * 36 | * This function is called when the system is idle. It can be used for low-power mode operations or other 37 | * maintenance tasks that need to run when the CPU is not busy. 38 | * 39 | * @param None 40 | * @return None 41 | */ 42 | extern "C" void vApplicationIdleHook(void) {} 43 | 44 | // ........................................................................................................ 45 | /** 46 | * @brief Stack overflow hook 47 | * 48 | * This function is called when a stack overflow is detected in a task. It logs the task name and enters 49 | * an infinite loop to halt the system. 50 | * 51 | * @param xTask Handle of the task that caused the stack overflow 52 | * @param pcTaskName Name of the task that caused the stack overflow 53 | * @return None 54 | */ 55 | extern "C" void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName) 56 | { 57 | printf("Stack overflow in task %s\n", pcTaskName); 58 | for(;;); 59 | } 60 | 61 | // ........................................................................................................ 62 | /** 63 | * @brief Tick hook 64 | * 65 | * This function is called on each tick interrupt. It can be used to execute periodic operations 66 | * that need to occur at a fixed time interval. 67 | * 68 | * @param None 69 | * @return None 70 | */ 71 | extern "C" void vApplicationTickHook(void) {} 72 | 73 | // ........................................................................................................ 74 | /** 75 | * @brief Create Hello World screen 76 | * 77 | * This function creates a simple LVGL screen with a "Hello, World!" label centered on the screen. 78 | * 79 | * @param None 80 | * @return None 81 | */ 82 | void create_hello_world_screen() 83 | { 84 | /* Create a new screen object */ 85 | lv_obj_t *screen = lv_obj_create(NULL); 86 | if (screen == NULL){ 87 | printf("Error: Failed to create screen object\n"); 88 | /* Return if screen creation fails */ 89 | return; 90 | } 91 | 92 | /* Create a new label object on the screen */ 93 | lv_obj_t *label = lv_label_create(screen); 94 | if (label == NULL){ 95 | printf("Error: Failed to create label object\n"); 96 | /* Return if label creation fails */ 97 | return; 98 | } 99 | 100 | /* Set the text of the label to "Hello, World!" */ 101 | lv_label_set_text(label, "Hello, World!"); 102 | 103 | /* Align the label to the center of the screen */ 104 | lv_obj_align(label, LV_ALIGN_CENTER, 0, 0); 105 | 106 | /* Load the created screen and make it visible */ 107 | lv_scr_load(screen); 108 | } 109 | 110 | // ........................................................................................................ 111 | /** 112 | * @brief LVGL task 113 | * 114 | * This task initializes LVGL and runs the main loop, periodically calling the LVGL task handler. 115 | * It is responsible for managing the LVGL state and rendering updates. 116 | * 117 | * @param pvParameters Task parameters (not used in this example) 118 | * @return None 119 | */ 120 | void lvgl_task(void *pvParameters) 121 | { 122 | /* Show simple hello world screen */ 123 | create_hello_world_screen(); 124 | 125 | while (true){ 126 | lv_timer_handler(); /* Handle LVGL tasks */ 127 | vTaskDelay(pdMS_TO_TICKS(5)); /* Short delay for the RTOS scheduler */ 128 | } 129 | } 130 | 131 | // ........................................................................................................ 132 | /** 133 | * @brief Another task 134 | * 135 | * This task simulates some background work by periodically printing a message. 136 | * 137 | * @param pvParameters Task parameters (not used in this example) 138 | * @return None 139 | */ 140 | void another_task(void *pvParameters) 141 | { 142 | /* Create some load in an infinite loop */ 143 | while (true){ 144 | printf("Second Task is running :)\n"); 145 | /* Delay the task for 500 milliseconds */ 146 | vTaskDelay(pdMS_TO_TICKS(500)); 147 | } 148 | } 149 | 150 | // ........................................................................................................ 151 | /** 152 | * @brief FreeRTOS main function 153 | * 154 | * This function sets up and starts the FreeRTOS tasks, including the LVGL task and another demo task. 155 | * 156 | * @param None 157 | * @return None 158 | */ 159 | extern "C" void freertos_main() 160 | { 161 | /* Initialize LVGL (Light and Versatile Graphics Library) and other resources */ 162 | 163 | /* Create the LVGL task */ 164 | if (xTaskCreate(lvgl_task, "LVGL Task", 4096, nullptr, 1, nullptr) != pdPASS) { 165 | printf("Error creating LVGL task\n"); 166 | /* Error handling */ 167 | } 168 | 169 | /* Create another task */ 170 | if (xTaskCreate(another_task, "Another Task", 1024, nullptr, 1, nullptr) != pdPASS) { 171 | printf("Error creating another task\n"); 172 | /* Error handling */ 173 | } 174 | 175 | /* Start the scheduler */ 176 | vTaskStartScheduler(); 177 | } 178 | 179 | #endif 180 | -------------------------------------------------------------------------------- /main/src/main.c: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @file main 4 | * 5 | */ 6 | 7 | /********************* 8 | * INCLUDES 9 | *********************/ 10 | #ifndef _DEFAULT_SOURCE 11 | #define _DEFAULT_SOURCE /* needed for usleep() */ 12 | #endif 13 | 14 | #include 15 | #include 16 | #ifdef _MSC_VER 17 | #include 18 | #else 19 | #include 20 | #include 21 | #endif 22 | #include "lvgl/lvgl.h" 23 | #include "lvgl/examples/lv_examples.h" 24 | #include "lvgl/demos/lv_demos.h" 25 | 26 | /********************* 27 | * DEFINES 28 | *********************/ 29 | 30 | /********************** 31 | * TYPEDEFS 32 | **********************/ 33 | 34 | /********************** 35 | * STATIC PROTOTYPES 36 | **********************/ 37 | static lv_display_t * hal_init(int32_t w, int32_t h); 38 | 39 | /********************** 40 | * STATIC VARIABLES 41 | **********************/ 42 | 43 | /********************** 44 | * MACROS 45 | **********************/ 46 | 47 | /********************** 48 | * GLOBAL FUNCTIONS 49 | **********************/ 50 | 51 | extern void freertos_main(void); 52 | 53 | /********************* 54 | * DEFINES 55 | *********************/ 56 | 57 | /********************** 58 | * TYPEDEFS 59 | **********************/ 60 | 61 | /********************** 62 | * VARIABLES 63 | **********************/ 64 | 65 | /********************** 66 | * STATIC PROTOTYPES 67 | **********************/ 68 | 69 | /********************** 70 | * GLOBAL FUNCTIONS 71 | **********************/ 72 | 73 | int main(int argc, char **argv) 74 | { 75 | (void)argc; /*Unused*/ 76 | (void)argv; /*Unused*/ 77 | 78 | /*Initialize LVGL*/ 79 | lv_init(); 80 | 81 | /*Initialize the HAL (display, input devices, tick) for LVGL*/ 82 | hal_init(320, 480); 83 | 84 | #if LV_USE_OS == LV_OS_NONE 85 | 86 | /* Run the default demo */ 87 | /* To try a different demo or example, replace this with one of: */ 88 | /* - lv_demo_benchmark(); */ 89 | /* - lv_demo_stress(); */ 90 | /* - lv_example_label_1(); */ 91 | /* - etc. */ 92 | lv_demo_widgets(); 93 | 94 | while(1) { 95 | /* Periodically call the lv_task handler. 96 | * It could be done in a timer interrupt or an OS task too.*/ 97 | lv_timer_handler(); 98 | #ifdef _MSC_VER 99 | Sleep(5); 100 | #else 101 | usleep(5 * 1000); 102 | #endif 103 | } 104 | 105 | #elif LV_USE_OS == LV_OS_FREERTOS 106 | 107 | /* Run FreeRTOS and create lvgl task */ 108 | freertos_main(); 109 | 110 | #endif 111 | 112 | return 0; 113 | } 114 | 115 | /********************** 116 | * STATIC FUNCTIONS 117 | **********************/ 118 | 119 | /** 120 | * Initialize the Hardware Abstraction Layer (HAL) for the LVGL graphics 121 | * library 122 | */ 123 | static lv_display_t * hal_init(int32_t w, int32_t h) 124 | { 125 | 126 | lv_group_set_default(lv_group_create()); 127 | 128 | lv_display_t * disp = lv_sdl_window_create(w, h); 129 | 130 | lv_indev_t * mouse = lv_sdl_mouse_create(); 131 | lv_indev_set_group(mouse, lv_group_get_default()); 132 | lv_indev_set_display(mouse, disp); 133 | lv_display_set_default(disp); 134 | 135 | LV_IMAGE_DECLARE(mouse_cursor_icon); /*Declare the image file.*/ 136 | lv_obj_t * cursor_obj; 137 | cursor_obj = lv_image_create(lv_screen_active()); /*Create an image object for the cursor */ 138 | lv_image_set_src(cursor_obj, &mouse_cursor_icon); /*Set the image source*/ 139 | lv_indev_set_cursor(mouse, cursor_obj); /*Connect the image object to the driver*/ 140 | 141 | lv_indev_t * mousewheel = lv_sdl_mousewheel_create(); 142 | lv_indev_set_display(mousewheel, disp); 143 | lv_indev_set_group(mousewheel, lv_group_get_default()); 144 | 145 | lv_indev_t * kb = lv_sdl_keyboard_create(); 146 | lv_indev_set_display(kb, disp); 147 | lv_indev_set_group(kb, lv_group_get_default()); 148 | 149 | return disp; 150 | } 151 | -------------------------------------------------------------------------------- /main/src/mouse_cursor_icon.c: -------------------------------------------------------------------------------- 1 | #include "lvgl/lvgl.h" 2 | 3 | const uint8_t mouse_cursor_icon_map[] = { 4 | 0x19, 0x19, 0x19, 0xb8, 0x1e, 0x1e, 0x1e, 0xc8, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 5 | 0x48, 0x48, 0x48, 0xcc, 0xb2, 0xb2, 0xb2, 0xff, 0x3a, 0x3a, 0x3a, 0xcc, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 6 | 0x3b, 0x3b, 0x3b, 0xc8, 0xf6, 0xf6, 0xf6, 0xff, 0xdc, 0xdc, 0xdc, 0xff, 0x43, 0x43, 0x43, 0xe0, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 7 | 0x3b, 0x3b, 0x3b, 0xcb, 0xe6, 0xe6, 0xe6, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xe5, 0xe5, 0xe5, 0xff, 0x59, 0x59, 0x59, 0xf3, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 8 | 0x3c, 0x3c, 0x3c, 0xcb, 0xe9, 0xe9, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf5, 0xf5, 0xff, 0x72, 0x72, 0x72, 0xff, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 9 | 0x3d, 0x3d, 0x3d, 0xcb, 0xe9, 0xe9, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8a, 0x8a, 0x8a, 0xff, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x99, 0x99, 0x00, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 10 | 0x3e, 0x3e, 0x3e, 0xcb, 0xe9, 0xe9, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa2, 0xa2, 0xa2, 0xff, 0x13, 0x13, 0x13, 0xab, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 11 | 0x3f, 0x3f, 0x3f, 0xcb, 0xe9, 0xe9, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb7, 0xb7, 0xb7, 0xff, 0x1f, 0x1f, 0x1f, 0xbb, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 12 | 0x41, 0x41, 0x41, 0xcc, 0xea, 0xea, 0xea, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xca, 0xca, 0xca, 0xff, 0x3d, 0x3d, 0x3d, 0xd8, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 13 | 0x41, 0x41, 0x41, 0xcc, 0xea, 0xea, 0xea, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xde, 0xde, 0xde, 0xff, 0x56, 0x56, 0x56, 0xef, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 14 | 0x42, 0x42, 0x42, 0xcc, 0xea, 0xea, 0xea, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xf3, 0xf3, 0xff, 0x76, 0x76, 0x76, 0xff, 0x00, 0x00, 0x00, 0x6b, 15 | 0x43, 0x43, 0x43, 0xcc, 0xea, 0xea, 0xea, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xce, 0xce, 0xce, 0xff, 0x80, 0x80, 0x80, 0xf7, 0x74, 0x74, 0x74, 0xf8, 0x6d, 0x6d, 0x6d, 0xfb, 0x72, 0x72, 0x72, 0xf8, 0x57, 0x57, 0x57, 0xff, 0x0c, 0x0c, 0x0c, 0xb3, 16 | 0x44, 0x44, 0x44, 0xcc, 0xeb, 0xeb, 0xeb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xfb, 0xfb, 0xfb, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0xc9, 0xc9, 0xff, 0x13, 0x13, 0x13, 0xb7, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0c, 0x29, 0x29, 0x29, 0x07, 17 | 0x45, 0x45, 0x45, 0xcc, 0xe8, 0xe8, 0xe8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd9, 0xd9, 0xd9, 0xff, 0x5e, 0x5e, 0x5e, 0xff, 0xe2, 0xe2, 0xe2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x62, 0x62, 0x62, 0xf0, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 18 | 0x45, 0x45, 0x45, 0xcc, 0xf9, 0xf9, 0xf9, 0xff, 0xec, 0xec, 0xec, 0xff, 0x4a, 0x4a, 0x4a, 0xd8, 0x00, 0x00, 0x00, 0x78, 0x8a, 0x8a, 0x8a, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0xc3, 0xc3, 0xff, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 19 | 0x58, 0x58, 0x58, 0xd3, 0xd9, 0xd9, 0xd9, 0xff, 0x5e, 0x5e, 0x5e, 0xef, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x3b, 0x3b, 0xc7, 0xe9, 0xe9, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, 0xf4, 0xf4, 0xff, 0x54, 0x54, 0x54, 0xdc, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 20 | 0x3e, 0x3e, 0x3e, 0xe0, 0x54, 0x54, 0x54, 0xff, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x8e, 0x8e, 0x8e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb0, 0xb0, 0xb0, 0xff, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x00, 21 | 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x4c, 0x4c, 0x4c, 0xd0, 0xec, 0xec, 0xec, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xf4, 0xf4, 0xf4, 0xff, 0x53, 0x53, 0x53, 0xd8, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 22 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x1e, 0x1e, 0x00, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0xab, 0xab, 0xab, 0xff, 0xf6, 0xf6, 0xf6, 0xff, 0x80, 0x80, 0x80, 0xff, 0x31, 0x31, 0x31, 0xac, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 23 | 0x09, 0x09, 0x09, 0x03, 0x02, 0x02, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x2e, 0x2e, 0x2e, 0xd7, 0x38, 0x38, 0x38, 0xc7, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 24 | 25 | }; 26 | 27 | lv_img_dsc_t mouse_cursor_icon = { 28 | .header.magic = LV_IMAGE_HEADER_MAGIC, 29 | .header.w = 14, 30 | .header.h = 20, 31 | .data_size = 280 * 4, 32 | .header.cf = LV_COLOR_FORMAT_ARGB8888, 33 | .data = mouse_cursor_icon_map, 34 | }; 35 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Simulator project for LVGL embedded GUI Library", 3 | "maintainer": "LVGL", 4 | "hostOperatingsystem": [ 5 | "Linux", 6 | "Windows", 7 | "MacOS" 8 | ], 9 | "environment": [ 10 | "VSCode", 11 | "SDL" 12 | ], 13 | "description": "LVGL is written mainly for microcontrollers and embedded systems, however you can run the library on your PC as well without any embedded hardware. The code written on PC can be simply copied when you are using an embedded system. The project can use SDL but it can be easily replaced by any other built-in LVGL drivers.", 14 | "shortDescription": "VSCode-based project to run LVGL on PC.", 15 | "urlToClone": "https://github.com/lvgl/lv_port_pc_vscode", 16 | "logos": [ 17 | "https://raw.githubusercontent.com/lvgl/project-creator/master/meta/images/vscode/logo.svg" 18 | ], 19 | "image": "https://raw.githubusercontent.com/lvgl/project-creator/master/meta/images/vscode/logo.svg", 20 | "branches": [ 21 | "release/v9.2" 22 | ], 23 | "settings": [ 24 | { 25 | "type": "dropdown", 26 | "label": "Color Depth", 27 | "options": [ 28 | { 29 | "name": "16 (RGB565)", 30 | "value": "16" 31 | }, 32 | { 33 | "name": "24 (RGB565)", 34 | "value": "24" 35 | }, 36 | { 37 | "name": "32 (RGB565)", 38 | "value": "32" 39 | } 40 | ], 41 | "actions": [ 42 | { 43 | "toReplace": "#define LV_COLOR_DEPTH \\d+", 44 | "newContent": "#define LV_COLOR_DEPTH {value}", 45 | "filePath": "lv_conf.h" 46 | } 47 | ] 48 | }, 49 | { 50 | "type": "dropdown", 51 | "label": "Show performance monitor", 52 | "options": [ 53 | { 54 | "name": "Yes", 55 | "value": "1", 56 | "default": "true" 57 | }, 58 | { 59 | "name": "No", 60 | "value": "0" 61 | } 62 | ], 63 | "actions": [ 64 | { 65 | "toReplace": "#define LV_USE_PERF_MONITOR .*", 66 | "newContent": "#define LV_USE_PERF_MONITOR {value}", 67 | "filePath": "lv_conf.h" 68 | } 69 | ] 70 | } 71 | ] 72 | } 73 | -------------------------------------------------------------------------------- /simulator.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | // https://code.visualstudio.com/docs/editor/workspaces 3 | // https://code.visualstudio.com/docs/editor/multi-root-workspaces 4 | // https://code.visualstudio.com/docs/editor/variables-reference 5 | 6 | "folders": [ 7 | { 8 | "path": "." 9 | }, 10 | ], 11 | // extensions.json section 12 | "extensions": { 13 | "recommendations": [ 14 | "ms-vscode.cpptools", // common C/C++ support 15 | "ms-vscode.cpptools-themes", // general C/C++ theme 16 | "ms-vscode.cmake-tools" // cmake support 17 | ], 18 | "unwantedRecommendations": [ 19 | ] 20 | }, 21 | // settings.json section 22 | "settings": { 23 | "files.trimTrailingWhitespace": true, 24 | "files.insertFinalNewline": true, 25 | "files.trimFinalNewlines": true, 26 | "cmake.configureOnOpen": true, 27 | "files.associations": { 28 | "glob.h": "c", 29 | "lvgl.h": "c" 30 | }, 31 | }, 32 | // tasks.json section 33 | "tasks": { 34 | "version": "2.0.0", 35 | "tasks": [ 36 | { 37 | "label": "Build", 38 | "command": "cmake", 39 | "args": [ 40 | "--build", "${command:cmake.buildDirectory}" 41 | ], 42 | "group": { 43 | "kind": "build", 44 | "isDefault": true 45 | }, 46 | "problemMatcher": { 47 | "owner": "cpp", 48 | "fileLocation": ["relative", "${workspaceFolder}"], 49 | "pattern": { 50 | "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 51 | "file": 1, 52 | "line": 2, 53 | "column": 3, 54 | "severity": 4, 55 | "message": 5 56 | } 57 | } 58 | }, 59 | { 60 | "label": "Build and Run", 61 | "type": "shell", 62 | "command": "${workspaceFolder}/bin/main", 63 | "group": { 64 | "kind": "test", 65 | "isDefault": true 66 | }, 67 | "dependsOn": "Build" 68 | } 69 | ], 70 | }, 71 | // launch.json section 72 | "launch": { 73 | "version": "0.2.0", 74 | "configurations": [ 75 | { 76 | "name": "Debug LVGL demo with gdb", 77 | "type": "cppdbg", 78 | "request": "launch", 79 | "program": "${workspaceFolder}/bin/main", 80 | "args": [], 81 | "cwd": "${workspaceFolder}", 82 | "preLaunchTask": "Build", 83 | "stopAtEntry": false, 84 | "linux": { 85 | "MIMode": "gdb", 86 | "miDebuggerPath": "/usr/bin/gdb" 87 | }, 88 | "osx": { 89 | "MIMode": "lldb" 90 | }, 91 | "windows": { 92 | "MIMode": "gdb", 93 | "miDebuggerPath": "C:\\MinGw\\bin\\gdb.exe" 94 | } 95 | }, 96 | { 97 | "name": "Debug LVGL demo with LLVM", 98 | "type": "cppdbg", 99 | "request": "launch", 100 | "program": "${workspaceFolder}/bin/main", 101 | "args": [], 102 | "cwd": "${workspaceFolder}", 103 | "preLaunchTask": "Build", 104 | "stopAtEntry": false, 105 | "MIMode": "lldb" 106 | }, 107 | ], 108 | }, 109 | } 110 | --------------------------------------------------------------------------------