docs(pc): add the missing PC simulator docs (#8824)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Victor Wheeler <vwheeler63@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
Gabor Kiss-Vamosi
2025-10-01 12:35:28 +02:00
committed by GitHub
parent efd4570aea
commit 061240ad83
8 changed files with 321 additions and 256 deletions
+48 -8
View File
@@ -2,11 +2,51 @@
Browser
=======
.. develop in browser or run the UI in browser
emscripten
overview: how it works, advantages, see lvgl.io/demos
usage
github codespace
why, how
Editor's online preview
what is it, why, how
Overview
********
There are multiple ways to view LVGL UIs in a browser or even develop UIs directly in a browser environment:
- Compile UI to HTML using **Emscripten**
- Develop in online VSCode using **GitHub Codespaces**
- Preview UIs in the **LVGL UI Editors online preview**
Compile UIs to HTML (Emscripten)
********************************
`Emscripten <https://emscripten.org/>`__ can compile C source files into a single HTML output that runs in a browser. This is a convenient way to share developed UIs with stakeholders, as they can test the interface without needing a developer setup.
Instead of producing a binary, Emscripten produces WebAssembly, which is supported across modern browsers.
The `lv_web_emscripten <https://github.com/lvgl/lv_web_emscripten>`__ project provides a ready-to-use setup for compiling any LVGL UI into a browser-capable HTML file.
It uses a specialized, :ref:`build_cmake`based build system—check the README for full setup details.
Develop in Online VSCode (GitHub Codespaces)
********************************************
GitHub Codespaces offer a cloud-hosted VSCode environment that runs entirely in the browser.
LVGL provides a preconfigured Codespace environment, which you can launch with just a few clicks. Its especially beneficial if:
- You're having issues setting up a local development environment
- Your machine is slow or underpowered
- You're working from a device without a local IDE
To get started:
1. Navigate to `https://github.com/lvgl/lvgl <https://github.com/lvgl/lvgl>`__.
2. Click the green **Code** button.
3. Select the **Codespaces** tab.
4. Click **Create Codespace on master**.
5. Wait briefly for the workspace to launch.
6. Open the terminal and run `./build_all.sh`.
This will build LVGL and render the UI in a VSCode tab. You can continue writing and rebuilding simply by running the script again.
Note: The Codespaces setup also uses Emscripten for browser rendering.
LVGLs UI Editor Online Share
*****************************
Coming soon.
+9 -3
View File
@@ -1,16 +1,22 @@
.. _running_on_pc:
.. _simulator:
=============
Running on PC
=============
You can try out LVGL **using only your PC** (i.e. without any
development boards).
Many ready-to-use projects are available to get started easily on
Windows, Linux, macOS, and in a web browser. Even developing a UEFI BIOS is
an option.
.. toctree::
:class: toctree-1-deep
:maxdepth: 1
:maxdepth: 2
overview
linux
windows
macos
+47 -4
View File
@@ -2,7 +2,50 @@
Linux
=====
.. intro: there are many repos, it's easy to install dependencies via terminal
lv_port_linux: cmake based, also good for embedded linux, suppots many display backends
lv_port_pc_eclipse: many chip vendor IDEs are Eclips based too, needs sdl
lv_port_pc_vscode: modern, needs SDL
Overview
********
LVGL comes with a lot of built-in Linux-related drivers and support:
- Wayland, DRM, SDL, and fbdev display drivers
- ``pthread`` integration
- :ref:`build_cmake` support
Multiple repositories are available to help you get started easily.
Just follow the README of the repositories listed below.
Ready-to-Use Projects
*********************
VSCode
------
LVGL is available for `VSCode <https://code.visualstudio.com/>`__, a well-known cross-platform code editor.
It uses `SDL <https://www.libsdl.org/>`__ to open a window, show the rendered content, and manage mouse and keyboard.
A ready-to-use LVGL project for VSCode is available at
`https://github.com/lvgl/lv_port_pc_vscode <https://github.com/lvgl/lv_port_pc_vscode>`__.
The project uses :ref:`build_cmake` to compile LVGL, so it also serves as a CMake example.
This repository also has built-in FreeRTOS integration, making it easy to test the UI
with an embedded OS.
Generic Linux Port
------------------
The `lv_port_linux <https://github.com/lvgl/lv_port_linux>`__ project is typically meant to
be used for embedded hardware, but it runs perfectly on PC as well.
It supports all the built-in LVGL drivers in a preconfigured :ref:`build_cmake` build system,
making it easy to integrate into any platform or environment.
Eclipse
-------
The project for `Eclipse CDT <https://projects.eclipse.org/projects/tools.cdt>`__ also uses `SDL <https://www.libsdl.org/>`__.
It can be found at
`https://github.com/lvgl/lv_port_pc_eclipse <https://github.com/lvgl/lv_port_pc_eclipse>`__.
The project uses CMake to compile LVGL, so it also serves as a :ref:`build_cmake` example.
+32 -3
View File
@@ -1,7 +1,36 @@
=====
MacOS
macOS
=====
.. lv_port_pc_vscode
lv_port_pc_eclipse
Overview
********
Ready-to-use projects are available to run LVGL on macOS as well.
These projects use the :ref:`sdl_driver`.
Ready-to-Use Projects
*********************
VSCode
------
LVGL is available for `VSCode <https://code.visualstudio.com/>`__, a well-known cross-platform code editor.
It uses `SDL <https://www.libsdl.org/>`__ to open a window, show the rendered content, and manage mouse and keyboard.
A ready-to-use LVGL project for VSCode is available at
`https://github.com/lvgl/lv_port_pc_vscode <https://github.com/lvgl/lv_port_pc_vscode>`__.
The project uses :ref:`build_cmake` to compile LVGL, so it also serves as a CMake example.
This repository also has built-in FreeRTOS integration, making it easy to test the UI
with an embedded OS as well.
Eclipse
-------
The project for `Eclipse CDT <https://projects.eclipse.org/projects/tools.cdt>`__ also uses `SDL <https://www.libsdl.org/>`__.
It can be found at
`https://github.com/lvgl/lv_port_pc_eclipse <https://github.com/lvgl/lv_port_pc_eclipse>`__.
The project uses CMake to compile LVGL, so it also serves as a :ref:`build_cmake` example.
@@ -1,55 +0,0 @@
.. _simulator:
========
Overview
========
You can try out LVGL **using only your PC** (i.e. without any
development boards). LVGL will run on a simulator environment on the PC
where anyone can write and experiment with real LVGL applications.
Using the simulator on a PC has the following advantages:
- Hardware independent: Write code, run it on the PC and see the result on a monitor.
- Cross-platform: Any Windows, Linux or macOS system can run the PC simulator.
- Portability: The written code is portable, which means you can simply copy it when migrating to embedded hardware.
- Easy Validation: The simulator is also very useful to report bugs because it
provides a common platform for every user.
- Better developer experience: On PC Debuggers are usually faster and better, you can log to files,
add a lot of ``printf`` s, do profiling, and so on.
Select an IDE
-------------
The simulator is ported to various IDEs (Integrated Development Environments).
Choose your favorite IDE, read its README on GitHub, download the project, and load it to the IDE.
- `Eclipse with SDL driver <https://github.com/lvgl/lv_sim_eclipse_sdl>`__: Recommended on Linux and Mac, supports CMake as well
- `VisualStudio <https://github.com/lvgl/lv_port_pc_visual_studio>`__: Recommended on Windows
- `VSCode with SDL driver <https://github.com/lvgl/lv_port_pc_vscode>`__: Recommended on Linux (SDL) and Mac (SDL)
- `CodeBlocks <https://github.com/lvgl/lv_sim_codeblocks_win>`__: Recommended on Windows
- `PlatformIO with SDL driver <https://github.com/lvgl/lv_platformio>`__: Recommended on Linux and Mac but has an STM32 environment as well
- `Generic Linux <https://github.com/lvgl/lv_port_linux>`__: CMake based project where you can easily switch between fbdev, DRM, and SDL.
- `MDK with FastModel <https://github.com/lvgl/lv_port_an547_cm55_sim>`__: For Windows
External project not maintained by the LVGL organization:
- `QT Creator <https://github.com/Varanda-Labs/lvgl-qt-sim>`__: Cross platform
Built-in drivers
----------------
LVGL comes with several built-in drivers, operating system and GPU support.
See :ref:`integration_index`.
Even if a simulator project comes with e.g. SDL, you can easily replace it by enabling
another driver in ``lv_conf.h`` and calling its ``create`` function.
For example to use the Linux frame buffer device instead of SDL just enable ``LV_USE_LINUX_FBDEV``
and call
.. code-block:: c
lv_display_t *display = lv_linux_fbdev_create();
lv_linux_fbdev_set_file(display, "/dev/fb0")
+47 -77
View File
@@ -4,111 +4,81 @@
SDL Driver
==========
.. almost good just review
metnion the SDL renderer too
Overview
--------
********
SDL (Simple DirectMedia Layer) provides a cross-platform way to handle graphics,
`SDL <https://www.libsdl.org/>`__ (Simple DirectMedia Layer) provides a cross-platform way to handle graphics,
input, and multimedia, making it an excellent choice for running LVGL applications on
a PC.
The `Eclipse <https://github.com/lvgl/lv_port_pc_eclipse>`__,
`VSCode <https://github.com/lvgl/lv_port_pc_vscode>`__, and `Generic Linux <https://github.com/lvgl/lv_port_linux>`__
projects of LVGL use SDL to open a window and manage input devices.
As SDL is fully cross-platform, it is easy to integrate into any environment.
Prerequisites
-------------
*************
Install SDL according to your platform.
Install SDL according to your platform:
- Linux ``sudo apt install libsdl2-dev``
- MacOS ``brew install sdl2``
- Windows https://github.com/libsdl-org/SDL/releases
- Linux: ``sudo apt install libsdl2-dev``
- macOS: ``brew install sdl2``
- Windows: Recommended: ``vcpkg install sdl2``
Alternatively, you can download prebuilt SDL2 binaries from the `SDL website <https://www.libsdl.org/download-2.0.php>`__ and follow their installation instructions.
Configuration
*************
Configure SDL Driver
-----------------------
1. Required linked libraries: -lSDL2
2. Enable SDL driver support in lv_conf.h, CMake compiler definitions or KConfig.
.. code-block:: c
#define LV_USE_SDL 1
#define LV_SDL_INCLUDE_PATH <SDL2/SDL.h>
#define SDL_HOR_RES 400
#define SDL_VER_RES 400
Basic Usage
-----------
1. Required linked libraries: ``-lSDL2``
2. Enable SDL driver support in ``lv_conf.h``, via CMake compiler definitions, or by using KConfig.
.. code-block:: c
#include <unistd.h>
#define SDL_MAIN_HANDLED /*To fix SDL's "undefined reference to WinMain" issue*/
#include <SDL2/SDL.h>
#include "drivers/sdl/lv_sdl_mouse.h"
#include "drivers/sdl/lv_sdl_mousewheel.h"
#include "drivers/sdl/lv_sdl_keyboard.h"
#define LV_USE_SDL 1
static lv_display_t *lvDisplay;
static lv_indev_t *lvMouse;
static lv_indev_t *lvMouseWheel;
static lv_indev_t *lvKeyboard;
Feel free to adjust the other options as needed, but the default values are usually sufficient.
#if LV_USE_LOG != 0
static void lv_log_print_g_cb(lv_log_level_t level, const char * buf)
{
LV_UNUSED(level);
LV_UNUSED(buf);
}
#endif
Usage
*****
.. code-block:: c
#define SDL_MAIN_HANDLED /* To fix SDL's "undefined reference to WinMain" issue */
#include "lvgl/lvgl.h"
static lv_display_t *display;
static lv_indev_t *mouse;
static lv_indev_t *mouse_wheel;
static lv_indev_t *keyboard;
int main()
{
/* initialize lvgl */
/* Initialize LVGL */
lv_init();
// Workaround for sdl2 `-m32` crash
// https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/1775067/comments/7
#ifndef WIN32
setenv("DBUS_FATAL_WARNINGS", "0", 1);
#endif
display = lv_sdl_window_create(SDL_HOR_RES, SDL_VER_RES);
mouse = lv_sdl_mouse_create();
mouse_wheel = lv_sdl_mousewheel_create();
keyboard = lv_sdl_keyboard_create();
/* Register the log print callback */
#if LV_USE_LOG != 0
lv_log_register_print_cb(lv_log_print_g_cb);
#endif
/* Add a display
* Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/
lvDisplay = lv_sdl_window_create(SDL_HOR_RES, SDL_VER_RES);
lvMouse = lv_sdl_mouse_create();
lvMouseWheel = lv_sdl_mousewheel_create();
lvKeyboard = lv_sdl_keyboard_create();
/* create Widgets on the screen */
/* Create widgets on the screen */
lv_demo_widgets();
Uint32 lastTick = SDL_GetTicks();
while(1) {
SDL_Delay(5);
Uint32 current = SDL_GetTicks();
lv_tick_inc(current - lastTick); // Update the tick timer. Tick is new for LVGL 9
lastTick = current;
lv_timer_handler(); // Update the UI-
while (1) {
lv_timer_handler();
lv_delay_ms(5);
}
return 0;
}
Using an IDE
------------
When building for 32-bit architecture, add the following workaround at the beginning of ``main``:
LVGL with SDL has been ported to various IDEs.
.. code-block:: c
- `Eclipse with SDL driver <https://github.com/lvgl/lv_sim_eclipse_sdl>`__: Recommended on Linux and Mac, supports CMake as well
- `VSCode with SDL driver <https://github.com/lvgl/lv_port_pc_vscode>`__: Recommended on Linux (SDL) and Mac (SDL)
- `Generic Linux <https://github.com/lvgl/lv_port_linux>`__: CMake based project where you can easily switch between fbdev, DRM, and SDL.
// Workaround for SDL2 `-m32` crash
// https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/1775067/comments/7
#ifndef WIN32
setenv("DBUS_FATAL_WARNINGS", "0", 1);
#endif
+38 -48
View File
@@ -1,47 +1,48 @@
==========================
UEFI Display/Inputs driver
==========================
====
UEFI
====
Overview
--------
********
The **UEFI** display/input `driver <https://github.com/lvgl/lvgl/src/drivers/uefi>`__ offers support for using LVGL with UEFI.
The **UEFI** display/input `driver <https://github.com/lvgl/lvgl/src/drivers/uefi>`__ offers support
for using LVGL to create UIs in UEFI environments.
Prerequisites
-------------
*************
You need the following protocols available:
You need the following UEFI protocols available:
* *EFI_LOADED_IMAGE_PROTOCOL_GUID*, for file system support (used to determine the file system that was used to load the application)
* *EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID*, for file system support
* *EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID*, for keyboard support
* *EFI_SIMPLE_POINTER_PROTOCOL_GUID*, for mouse support
* *EFI_ABSOLUTE_POINTER_PROTOCOL_GUID*, for touch support
* *EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID*, for drawing
* *EFI_EDID_ACTIVE_PROTOCOL_GUID*, for drawing (optional)
- ``EFI_LOADED_IMAGE_PROTOCOL_GUID``: for file system support (used to determine the file system used to load the application)
- ``EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID``: for file system support
- ``EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID``: for keyboard support
- ``EFI_SIMPLE_POINTER_PROTOCOL_GUID``: for mouse support
- ``EFI_ABSOLUTE_POINTER_PROTOCOL_GUID``: for touch support
- ``EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID``: for drawing
- ``EFI_EDID_ACTIVE_PROTOCOL_GUID``: for drawing (optional)
Configure UEFI driver
------------------------
Configuration
*************
- Enable the UEFI driver support in lv_conf.h
1. Enable the UEFI driver support in ``lv_conf.h``:
.. code-block:: c
#define LV_USE_UEFI 1
- Enable the memory core functions, which are wrappers around AllocatePool and FreePool (using memory of type *EfiBootServicesData*) if you do not wan't to use your own implementations
- Enable the memory core functions, which are wrappers around ``AllocatePool`` and ``FreePool`` (using memory of type *EfiBootServicesData*) if you do not wan't to use your own implementations
.. code-block:: c
#define LV_UEFI_USE_MEMORY_SERVICES 1
- You can enable file system support for the file system from which the application got loaded (default letter 'E')
3. Enable file system support for the volume the application was loaded from (defaults to drive letter ``E``):
.. code-block:: c
#define LV_USE_FS_UEFI 1
- You need to define an include file which contains the basic UEFI definitions (protocols and types), there are 2 predefined files which can be used for EDK2 and gnu-efi
4. Include UEFI type definitions. There are predefined includes for EDK2 and GNU-EFI:
.. code-block:: c
@@ -50,7 +51,9 @@ Configure UEFI driver
#define LV_USE_UEFI_INCLUDE <lvgl/src/drivers/uefi/lv_uefi_gnu_efi.h>
Usage
-----
*****
A minimal example:
.. code-block:: c
@@ -58,45 +61,33 @@ Usage
#include "lvgl/examples/lv_examples.h"
#include "lvgl/demos/lv_demos.h"
EFI_STATUS EFIAPI EfiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE * SystemTable)
EFI_STATUS EFIAPI EfiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
lv_uefi_init(ImageHandle, SystemTable);
lv_init();
if(!lv_is_initialized()) return EFI_NOT_READY;
if (!lv_is_initialized()) return EFI_NOT_READY;
EFI_HANDLE handle = NULL;
lv_display_t* display = NULL;
lv_indev_t* indev = NULL;
lv_group_t* group = NULL;
lv_obj_t* cursor = NULL;
// used to get out of the main loop
size_t counter;
// Init the display
handle = lv_uefi_display_get_active();
if(handle == NULL) {
handle = lv_uefi_display_get_any();
}
if(handle == NULL) {
EFI_HANDLE handle = lv_uefi_display_get_active();
if (!handle) handle = lv_uefi_display_get_any();
if (!handle) {
lv_deinit();
return EFI_UNSUPPORTED;
}
display = lv_uefi_display_create(handle);
lv_display_t *display = lv_uefi_display_create(handle);
lv_display_set_default(display);
// Create the group
group = lv_group_create();
lv_group_t *group = lv_group_create();
lv_group_set_default(group);
// Create an image that can be used as cursor
cursor = lv_image_create(lv_layer_top());
lv_obj_t *cursor = lv_image_create(lv_layer_top());
lv_image_set_src(cursor, "E:cursor.png");
// Create the input devices
lv_indev_t *indev;
indev = lv_uefi_simple_text_input_indev_create();
lv_indev_set_group(indev, lv_group_get_default());
lv_indev_set_group(indev, group);
lv_uefi_simple_text_input_indev_add_all(indev);
indev = lv_uefi_simple_pointer_indev_create(NULL);
@@ -108,10 +99,9 @@ Usage
lv_demo_widgets();
// Run main loop for ~ 10 seconds
counter = 0;
while(counter < 10000) {
counter ++;
size_t counter = 0;
while (counter < 10000) {
counter++;
gBS->Stall(1000);
lv_tick_inc(1);
lv_timer_handler();
+100 -58
View File
@@ -2,65 +2,120 @@
Windows
=======
.. https://github.com/lvgl/lv_port_pc_visual_studio
native windows driver (same as now just make it shorter)
Overview
********
The **Windows** display/input `driver <https://github.com/lvgl/lvgl/src/drivers/windows>`__ offers support for simulating the LVGL display and keyboard/mouse inputs in a Windows Win32 window.
LVGL comes with built-in drivers for Windows, covering:
The main purpose for this driver is for testing/debugging the LVGL application in a **Windows** simulation window via **simulator mode**, or developing a standard **Windows** desktop application with LVGL via **application mode**.
- Display, mouse, and keyboard support
- Operating system drivers
These are the **similarities** between simulator mode and application mode.
Using these or other drivers, multiple repositories are available to help you get started easily.
Just follow the README of the repositories listed below.
- Support LVGL pointer, keypad and encoder devices integration.
- Support Windows touch input.
- Support Windows input method integration input.
- Support Per-monitor DPI Aware (both V1 and V2).
- Provide HWND-based interoperability for other Windows UI infrastructures.
Ready-to-Use Projects
*********************
These are the **differences** between simulator mode and application mode.
VSCode
------
Simulator Mode
--------------
LVGL is available for `VSCode <https://code.visualstudio.com/>`__, a well-known cross-platform code editor.
- Designed for LVGL device-simulation scenario --- simulates LVGL rendering to a hardware display panel.
- Keeps LVGL display resolution constant in order to best simulate UI layout which will will be seen in production devices.
- When Windows DPI scaling setting is changed, Windows backend will stretch display content.
It uses `SDL <https://www.libsdl.org/>`__ to open a window, show the rendered content, and manage mouse and keyboard.
Application Mode
----------------
A ready-to-use LVGL project for VSCode is available at
https://github.com/lvgl/lv_port_pc_vscode\ .
- Designed for Windows desktop application-development scenario.
- Has Window resizing support and LVGL display resolution is changed dynamically.
- When Windows DPI scaling setting is changed, LVGL display DPI value is also changed.
- The resolution you set for lv_windows_create_display is the window size instead of window client size for following the convention of other Windows desktop UI infrastructures.
- The applications based on this mode should adapt the LVGL display resolution changing for supporting window resizing properly.
The project uses :ref:`build_cmake` to compile LVGL, so it also serves as a CMake example.
This repository also includes built-in FreeRTOS integration, making it easy to test the UI
with an embedded OS.
Visual Studio
-------------
`Visual Studio <https://visualstudio.microsoft.com/>`__ is a comprehensive IDE from Microsoft
containing all the tools required for development out of the box.
To use LVGL in Visual Studio, visit the
`lvgl/lv_port_pc_visual_studio <https://github.com/lvgl/lv_port_pc_visual_studio>`__ repository.
It uses LVGL's built-in Windows drivers to open a window where you can see the LVGL-rendered UI,
and use your mouse as a touch input replacement.
Eclipse
-------
The project for `Eclipse CDT <https://projects.eclipse.org/projects/tools.cdt>`__ also uses `SDL <https://www.libsdl.org/>`__.
It can be found at
`https://github.com/lvgl/lv_port_pc_eclipse <https://github.com/lvgl/lv_port_pc_eclipse>`__.
The project uses :ref:`build_cmake` to compile LVGL and serves as a CMake example.
Windows Driver
**************
It's also easy to port LVGL to any Windows IDEs or toolchains using either the built-in SDL driver or
the Windows driver.
To learn more about the SDL driver, visit :ref:`sdl_driver`.
Details of the Windows driver are provided below.
The **Windows** display/input `driver <https://github.com/lvgl/lvgl/tree/master/src/drivers/windows>`__
offers support for simulating the LVGL display and keyboard/mouse inputs in a Windows Win32 window.
Modes
-----
The main purpose of this driver is for testing/debugging LVGL applications in
a **Windows** simulation window via **simulator mode**, or developing standard **Windows** desktop
applications with LVGL via **application mode**.
Both simulator mode and application mode:
- Support LVGL pointer, keypad, and encoder device integration
- Support Windows touch input
- Support Windows input method integration
- Support per-monitor DPI awareness (both V1 and V2)
- Provide HWND-based interoperability for other Windows UI infrastructures
However, **Simulator Mode**:
- is designed for simulating LVGL rendering on hardware-like displays,
- keeps LVGL display resolution constant to simulate production UI layouts, and
- uses Windows DPI scaling to stretch content,
whereas **Application Mode**:
- is designed for native Windows desktop application development,
- supports dynamic window resizing with corresponding changes to LVGL display resolution,
- updates LVGL display DPI when Windows DPI changes,
- uses window size (not client area) when setting resolution via :cpp:func:`lv_windows_create_display`, and
- requires apps to handle display resolution changes properly.
The mode can be selected by calling :cpp:func:`lv_windows_create_display`.
Prerequisites
*************
-------------
The minimum Windows OS requirement for this driver is Windows Vista RTM.
If you use Windows API shim libraries like `YY-Thunks
<https://github.com/Chuyu-Team/YY-Thunks>`__, the tested minimum Windows OS
requirement for this driver is Windows XP RTM.
If you use Windows API shim libraries like `YY-Thunks <https://github.com/Chuyu-Team/YY-Thunks>`__,
the tested minimum OS version is Windows XP RTM.
According to the Windows GDI API this driver used, it is possible the minimum Windows OS
requirement limitation for this driver is Windows 2000 RTM.
Due to the use of Windows GDI APIs, the theoretical minimum may be Windows 2000 RTM.
Configure Windows Driver
************************
Usage
-----
Enable the Windows driver support in lv_conf.h, by cmake compiler define or by KConfig
Enable Windows driver support in ``lv_conf.h``, via CMake compiler define, or KConfig:
.. code-block:: c
#define LV_USE_WINDOWS 1
Usage
*****
Once enabled, the Windows driver can be used like this:
.. code-block:: c
@@ -78,35 +133,21 @@ Usage
bool simulator_mode = false;
lv_display_t* display = lv_windows_create_display(
L"LVGL Display Window",
800,
480,
zoom_level,
allow_dpi_override,
simulator_mode);
if (!display)
{
return -1;
}
800, 480,
zoom_level, allow_dpi_override, simulator_mode);
if (!display) return -1;
lv_lock();
lv_indev_t* pointer_device = lv_windows_acquire_pointer_indev(display);
if (!pointer_device)
{
return -1;
}
if (!pointer_device) return -1;
lv_indev_t* keypad_device = lv_windows_acquire_keypad_indev(display);
if (!keypad_device)
{
return -1;
}
if (!keypad_device) return -1;
lv_indev_t* encoder_device = lv_windows_acquire_encoder_indev(display);
if (!encoder_device)
{
return -1;
}
if (!encoder_device) return -1;
lv_demo_widgets();
@@ -115,8 +156,9 @@ Usage
while (1)
{
uint32_t time_till_next = lv_timer_handler();
if(time_till_next == LV_NO_TIMER_READY) time_till_next = LV_DEF_REFR_PERIOD; /*handle LV_NO_TIMER_READY. Another option is to `sleep` for longer*/
lv_delay_ms(time_till_next);
// handle LV_NO_TIMER_READY. Another option is to always sleep a few milliseconds
if(time_till_next == LV_NO_TIMER_READY) time_till_next = LV_DEF_REFR_PERIOD;
lv_sleep_ms(time_till_next);
}
return 0;