mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-10 04:37:55 +08:00
feat(drivers): initial implementation of a QNX screen driver (#6507)
Co-authored-by: Elad Lahav <elahav@qnx.com>
This commit is contained in:
@@ -1724,6 +1724,15 @@ menu "LVGL configuration"
|
||||
bool "Enable debug mode for OpenGL"
|
||||
depends on LV_USE_OPENGLES
|
||||
default n
|
||||
|
||||
config LV_USE_QNX
|
||||
bool "Use a QNX Screen window as a display"
|
||||
default n
|
||||
|
||||
config LV_QNX_BUF_COUNT
|
||||
int
|
||||
depends on LV_USE_QNX
|
||||
default 1
|
||||
endmenu
|
||||
|
||||
menu "Examples"
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
===
|
||||
QNX
|
||||
===
|
||||
|
||||
What is QNX?
|
||||
------------
|
||||
|
||||
QNX is a commercial operating system first released in 1980. The operating
|
||||
system is based on a micro-kernel design, with the file system(s), network
|
||||
stack, and various other drivers each running in its own process with a separate
|
||||
address space.
|
||||
|
||||
See www.qnx.com for more details.
|
||||
|
||||
Highlight of QNX
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
- 64-bit only, runs on x86_64 and ARMv8
|
||||
- Requires an MMU as the design mandates separation among processes
|
||||
- Support for thousands of processes and millions of threads
|
||||
- Up to 64 cores, up to 16TB of RAM
|
||||
- Virtualization support (as host and guest)
|
||||
- Full POSIX compatibility
|
||||
- Safety certification to various automotive, industrial and medical standards
|
||||
|
||||
How to run LVGL on QNX?
|
||||
-----------------------
|
||||
|
||||
Build LVGL
|
||||
~~~~~~~~~~
|
||||
|
||||
The top-level `qnx` directory includes a recursive make file for building LVGL,
|
||||
both as a shared library and as a static library for the supported
|
||||
architectures. To build all libraries, simply invoke `make` in this directory:
|
||||
|
||||
.. code:: shell
|
||||
|
||||
# cd $(LVGL_ROOT)/qnx
|
||||
# make
|
||||
|
||||
If you prefer to build for a specific architecture and variant, go to the
|
||||
appropriate directory and run `make` there. For example, to build a shared
|
||||
library for ARMv8:
|
||||
|
||||
.. code:: shell
|
||||
|
||||
# cd $(LVGL_ROOT)/qnx/aarch64/so.le
|
||||
# make
|
||||
|
||||
As a general rule, if you only want to have one LVGL application in your system
|
||||
then it is better to use a static library. If you have more than one, and
|
||||
especially if they run concurrently, it is better to use the shared library.
|
||||
|
||||
Before building the library, you may wish to edit `$(LVGL_ROOT)/qnx/lv_conf.h`,
|
||||
e.g. to enable double-buffering.
|
||||
|
||||
Writing a LVGL Application
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To create a LVGL application for QNX, follow these steps in your code:
|
||||
|
||||
1. Initialize the library.
|
||||
2. Create a window.
|
||||
3. Add the input devices.
|
||||
4. Create the UI.
|
||||
5. Run the event loop.
|
||||
|
||||
Steps 2, 3 and 5 use QNX-specific calls, but the rest of the code should be
|
||||
identical to that of a LVGL application written for any other platform.
|
||||
|
||||
The following code shows how to create a "Hello World" application:
|
||||
|
||||
.. code:: c
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
/* Initialize the library. */
|
||||
lv_init();
|
||||
|
||||
/* Create a 800x480 window. */
|
||||
lv_display_t *disp = lv_qnx_window_create(800, 480);
|
||||
lv_qnx_window_set_title(disp, "LVGL Example");
|
||||
|
||||
/* Add a keyboard and mouse devices. */
|
||||
lv_qnx_add_keyboard_device(disp);
|
||||
lv_qnx_add_pointer_device(disp);
|
||||
|
||||
/* Generate the UI. */
|
||||
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);
|
||||
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(label, "Hello world");
|
||||
lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xffffff), LV_PART_MAIN);
|
||||
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
/* Run the event loop until it exits. */
|
||||
return lv_qnx_event_loop(disp);
|
||||
}
|
||||
|
||||
Build the Application
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Building the application consists of compiling the source with the LVGL headers,
|
||||
and then linking against the library. This can be done in many ways, using
|
||||
different build systems. The following is a simple make file for the example
|
||||
above, which builds for ARMv8 with the shared library:
|
||||
|
||||
.. code:: makefile
|
||||
|
||||
CC=qcc -Vgcc_ntoaarch64le
|
||||
|
||||
LVGL_DIR=$(HOME)/src/lvgl
|
||||
CCFLAGS=-I$(LVGL_DIR)/qnx -I$(LVGL_DIR)
|
||||
LDFLAGS=-lscreen -llvgl -L$(LVGL_DIR)/qnx/aarch64/so.le
|
||||
|
||||
lvgl_example: lvgl_example.c
|
||||
$(CC) $(CCFLAGS) -Wall -o $@ $< $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ lvgl_example
|
||||
@@ -0,0 +1,2 @@
|
||||
LIST=CPU
|
||||
include recurse.mk
|
||||
@@ -0,0 +1,2 @@
|
||||
LIST=VARIANT
|
||||
include recurse.mk
|
||||
@@ -0,0 +1 @@
|
||||
include ../../common.mk
|
||||
@@ -0,0 +1 @@
|
||||
include ../../common.mk
|
||||
@@ -0,0 +1,113 @@
|
||||
ifndef QCONFIG
|
||||
QCONFIG=qconfig.mk
|
||||
endif
|
||||
include $(QCONFIG)
|
||||
|
||||
define PINFO
|
||||
PINFO DESCRIPTION = Light and Versatile Graphics Library
|
||||
endef
|
||||
INSTALLDIR=
|
||||
NAME=lvgl
|
||||
USEFILE=
|
||||
|
||||
SRC_ROOT=$(PROJECT_ROOT)/../../src
|
||||
EXTRA_SRCVPATH=$(SRC_ROOT) \
|
||||
$(SRC_ROOT)/libs \
|
||||
$(SRC_ROOT)/libs/bmp \
|
||||
$(SRC_ROOT)/libs/libjpeg_turbo \
|
||||
$(SRC_ROOT)/libs/fsdrv \
|
||||
$(SRC_ROOT)/libs/libpng \
|
||||
$(SRC_ROOT)/libs/bin_decoder \
|
||||
$(SRC_ROOT)/libs/tiny_ttf \
|
||||
$(SRC_ROOT)/libs/barcode \
|
||||
$(SRC_ROOT)/libs/rlottie \
|
||||
$(SRC_ROOT)/libs/qrcode \
|
||||
$(SRC_ROOT)/libs/lz4 \
|
||||
$(SRC_ROOT)/libs/ffmpeg \
|
||||
$(SRC_ROOT)/libs/tjpgd \
|
||||
$(SRC_ROOT)/libs/thorvg \
|
||||
$(SRC_ROOT)/libs/thorvg/rapidjson \
|
||||
$(SRC_ROOT)/libs/thorvg/rapidjson/internal \
|
||||
$(SRC_ROOT)/libs/thorvg/rapidjson/error \
|
||||
$(SRC_ROOT)/libs/lodepng \
|
||||
$(SRC_ROOT)/libs/rle \
|
||||
$(SRC_ROOT)/libs/gif \
|
||||
$(SRC_ROOT)/libs/freetype \
|
||||
$(SRC_ROOT)/draw \
|
||||
$(SRC_ROOT)/draw/vg_lite \
|
||||
$(SRC_ROOT)/draw/sw \
|
||||
$(SRC_ROOT)/draw/sw/arm2d \
|
||||
$(SRC_ROOT)/draw/sw/blend \
|
||||
$(SRC_ROOT)/draw/sw/blend/helium \
|
||||
$(SRC_ROOT)/draw/sw/blend/arm2d \
|
||||
$(SRC_ROOT)/draw/sw/blend/neon \
|
||||
$(SRC_ROOT)/misc \
|
||||
$(SRC_ROOT)/misc/cache \
|
||||
$(SRC_ROOT)/font \
|
||||
$(SRC_ROOT)/stdlib \
|
||||
$(SRC_ROOT)/stdlib/builtin \
|
||||
$(SRC_ROOT)/stdlib/rtthread \
|
||||
$(SRC_ROOT)/stdlib/clib \
|
||||
$(SRC_ROOT)/stdlib/micropython \
|
||||
$(SRC_ROOT)/drivers \
|
||||
$(SRC_ROOT)/drivers/qnx \
|
||||
$(SRC_ROOT)/themes \
|
||||
$(SRC_ROOT)/themes/simple \
|
||||
$(SRC_ROOT)/themes/mono \
|
||||
$(SRC_ROOT)/themes/default \
|
||||
$(SRC_ROOT)/display \
|
||||
$(SRC_ROOT)/indev \
|
||||
$(SRC_ROOT)/core \
|
||||
$(SRC_ROOT)/tick \
|
||||
$(SRC_ROOT)/others \
|
||||
$(SRC_ROOT)/others/monkey \
|
||||
$(SRC_ROOT)/others/ime \
|
||||
$(SRC_ROOT)/others/snapshot \
|
||||
$(SRC_ROOT)/others/file_explorer \
|
||||
$(SRC_ROOT)/others/imgfont \
|
||||
$(SRC_ROOT)/others/fragment \
|
||||
$(SRC_ROOT)/others/observer \
|
||||
$(SRC_ROOT)/others/vg_lite_tvg \
|
||||
$(SRC_ROOT)/others/sysmon \
|
||||
$(SRC_ROOT)/others/gridnav \
|
||||
$(SRC_ROOT)/widgets \
|
||||
$(SRC_ROOT)/widgets/objx_templ \
|
||||
$(SRC_ROOT)/widgets/tabview \
|
||||
$(SRC_ROOT)/widgets/scale \
|
||||
$(SRC_ROOT)/widgets/checkbox \
|
||||
$(SRC_ROOT)/widgets/slider \
|
||||
$(SRC_ROOT)/widgets/calendar \
|
||||
$(SRC_ROOT)/widgets/bar \
|
||||
$(SRC_ROOT)/widgets/win \
|
||||
$(SRC_ROOT)/widgets/dropdown \
|
||||
$(SRC_ROOT)/widgets/switch \
|
||||
$(SRC_ROOT)/widgets/span \
|
||||
$(SRC_ROOT)/widgets/canvas \
|
||||
$(SRC_ROOT)/widgets/lottie \
|
||||
$(SRC_ROOT)/widgets/textarea \
|
||||
$(SRC_ROOT)/widgets/arc \
|
||||
$(SRC_ROOT)/widgets/msgbox \
|
||||
$(SRC_ROOT)/widgets/property \
|
||||
$(SRC_ROOT)/widgets/chart \
|
||||
$(SRC_ROOT)/widgets/table \
|
||||
$(SRC_ROOT)/widgets/list \
|
||||
$(SRC_ROOT)/widgets/button \
|
||||
$(SRC_ROOT)/widgets/image \
|
||||
$(SRC_ROOT)/widgets/line \
|
||||
$(SRC_ROOT)/widgets/animimage \
|
||||
$(SRC_ROOT)/widgets/roller \
|
||||
$(SRC_ROOT)/widgets/spinner \
|
||||
$(SRC_ROOT)/widgets/imagebutton \
|
||||
$(SRC_ROOT)/widgets/led \
|
||||
$(SRC_ROOT)/widgets/spinbox \
|
||||
$(SRC_ROOT)/widgets/keyboard \
|
||||
$(SRC_ROOT)/widgets/buttonmatrix \
|
||||
$(SRC_ROOT)/widgets/menu \
|
||||
$(SRC_ROOT)/widgets/label \
|
||||
$(SRC_ROOT)/widgets/tileview \
|
||||
$(SRC_ROOT)/layouts \
|
||||
$(SRC_ROOT)/layouts/grid \
|
||||
$(SRC_ROOT)/layouts/flex \
|
||||
$(SRC_ROOT)/osal
|
||||
|
||||
include $(MKFILES_ROOT)/qtargets.mk
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
LIST=VARIANT
|
||||
include recurse.mk
|
||||
@@ -0,0 +1 @@
|
||||
include ../../common.mk
|
||||
@@ -0,0 +1 @@
|
||||
include ../../common.mk
|
||||
@@ -1016,6 +1016,12 @@
|
||||
#define LV_USE_OPENGLES_DEBUG 1 /* Enable or disable debug for opengles */
|
||||
#endif
|
||||
|
||||
/* QNX Screen display and input drivers */
|
||||
#define LV_USE_QNX 0
|
||||
#if LV_USE_QNX
|
||||
#define LV_QNX_BUF_COUNT 1 /*1 or 2*/
|
||||
#endif
|
||||
|
||||
/*==================
|
||||
* EXAMPLES
|
||||
*==================*/
|
||||
|
||||
@@ -40,6 +40,8 @@ extern "C" {
|
||||
#include "glfw/lv_glfw_window.h"
|
||||
#include "glfw/lv_glfw_mouse.h"
|
||||
|
||||
#include "qnx/lv_qnx.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* @file lv_qnx_window.h
|
||||
* @brief LVGL driver for the QNX Screen compositing window manager
|
||||
*/
|
||||
|
||||
#ifndef LV_QNX_DISP_H
|
||||
#define LV_QNX_DISP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../display/lv_display.h"
|
||||
#include "../../indev/lv_indev.h"
|
||||
|
||||
#if LV_USE_QNX
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <screen/screen.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create a window to use as a display for LVGL.
|
||||
* @param hor_res The horizontal resolution (size) of the window
|
||||
* @param ver_res The vertical resolution (size) of the window
|
||||
* @return A pointer to a new display object if successful, NULL otherwise
|
||||
*/
|
||||
lv_display_t * lv_qnx_window_create(int32_t hor_res, int32_t ver_res);
|
||||
|
||||
/**
|
||||
* Set the title of the window identified by the given display.
|
||||
* @param disp The display object for the window
|
||||
* @param title The new title to set
|
||||
*/
|
||||
void lv_qnx_window_set_title(lv_display_t * disp, const char * title);
|
||||
|
||||
/**
|
||||
* Create a pointer input device for the display.
|
||||
* Only one pointer object is currently supported.
|
||||
* @param disp The display object associated with the device
|
||||
* @return true if successful, false otherwise
|
||||
*/
|
||||
bool lv_qnx_add_pointer_device(lv_display_t * disp);
|
||||
|
||||
/**
|
||||
* Create a keyboard input device for the display.
|
||||
* Only one keyboard object is currently supported.
|
||||
* @param disp The display object associated with the device
|
||||
* @return true if successful, false otherwise
|
||||
*/
|
||||
bool lv_qnx_add_keyboard_device(lv_display_t * disp);
|
||||
|
||||
/**
|
||||
* Runs the event loop for the display.
|
||||
* The function only returns in response to a close event.
|
||||
* @param disp The display for the event loop
|
||||
* @return Exit code
|
||||
*/
|
||||
int lv_qnx_event_loop(lv_display_t * disp);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /* LV_DRV_QNX */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* LV_QNX_DISP_H */
|
||||
@@ -3367,6 +3367,28 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* QNX Screen display and input drivers */
|
||||
#ifndef LV_USE_QNX
|
||||
#ifdef CONFIG_LV_USE_QNX
|
||||
#define LV_USE_QNX CONFIG_LV_USE_QNX
|
||||
#else
|
||||
#define LV_USE_QNX 0
|
||||
#endif
|
||||
#endif
|
||||
#if LV_USE_QNX
|
||||
#ifndef LV_QNX_BUF_COUNT
|
||||
#ifdef _LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_QNX_BUF_COUNT
|
||||
#define LV_QNX_BUF_COUNT CONFIG_LV_QNX_BUF_COUNT
|
||||
#else
|
||||
#define LV_QNX_BUF_COUNT 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_QNX_BUF_COUNT 1 /*1 or 2*/
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*==================
|
||||
* EXAMPLES
|
||||
*==================*/
|
||||
|
||||
Reference in New Issue
Block a user