mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-09 20:27:41 +08:00
docs: replace extraneous .rst code-block directives (#10054)
This commit is contained in:
@@ -30,39 +30,40 @@ To enable the profiler, set <ApiLink name="LV_USE_PROFILER" /> in `lv_conf.h` an
|
||||
|
||||
- Recommended configuration in **Arduino** environments:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
static uint64_t my_get_tick_cb(void)
|
||||
\{
|
||||
/* Use the microsecond time stamp provided by Arduino */
|
||||
return micros();
|
||||
\}
|
||||
|
||||
void my_profiler_init(void)
|
||||
\{
|
||||
lv_profiler_builtin_config_t config;
|
||||
lv_profiler_builtin_config_init(&config);
|
||||
config.tick_per_sec = 1000000; /* One second is equal to 1000000 microseconds */
|
||||
config.tick_get_cb = my_get_tick_cb;
|
||||
lv_profiler_builtin_init(&config);
|
||||
\}
|
||||
```c
|
||||
static uint64_t my_get_tick_cb(void)
|
||||
{
|
||||
/* Use the microsecond time stamp provided by Arduino */
|
||||
return micros();
|
||||
}
|
||||
|
||||
void my_profiler_init(void)
|
||||
{
|
||||
lv_profiler_builtin_config_t config;
|
||||
lv_profiler_builtin_config_init(&config);
|
||||
config.tick_per_sec = 1000000; /* One second is equal to 1000000 microseconds */
|
||||
config.tick_get_cb = my_get_tick_cb;
|
||||
lv_profiler_builtin_init(&config);
|
||||
}
|
||||
```
|
||||
|
||||
4. Log output configuration: LVGL uses the <ApiLink name="LV_LOG" /> interface by default to output trace information. If you want to use another interface to output log information (e.g. stdout), you can redirect the log output using the following code:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
static void my_log_print_cb(const char * buf)
|
||||
\{
|
||||
printf("%s", buf);
|
||||
\}
|
||||
|
||||
void my_profiler_init(void)
|
||||
\{
|
||||
lv_profiler_builtin_config_t config;
|
||||
lv_profiler_builtin_config_init(&config);
|
||||
... /* other configurations */
|
||||
config.flush_cb = my_log_print_cb;
|
||||
lv_profiler_builtin_init(&config);
|
||||
\}
|
||||
```c
|
||||
static void my_log_print_cb(const char * buf)
|
||||
{
|
||||
printf("%s", buf);
|
||||
}
|
||||
|
||||
void my_profiler_init(void)
|
||||
{
|
||||
lv_profiler_builtin_config_t config;
|
||||
lv_profiler_builtin_config_init(&config);
|
||||
/* other configurations ... */
|
||||
config.flush_cb = my_log_print_cb;
|
||||
lv_profiler_builtin_init(&config);
|
||||
}
|
||||
```
|
||||
|
||||
### Run the test scenario
|
||||
|
||||
|
||||
@@ -290,10 +290,11 @@ VGLite draw unit for processing.
|
||||
Set <ApiLink name="LV_USE_VGLITE_BLIT_SPLIT" /> to `1`.
|
||||
Enabling the blit split workaround will mitigate any quality degradation issue
|
||||
on screen's dimension > 352 pixels.
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
#define VGLITE_BLIT_SPLIT_THR 352
|
||||
|
||||
```c
|
||||
#define VGLITE_BLIT_SPLIT_THR 352
|
||||
```
|
||||
|
||||
- By default, the blit split threshold is set to 352. Blits with width or height
|
||||
higher than this value will be done in multiple steps. Value must be multiple
|
||||
of stride alignment in px. For most color formats, the alignment is 16px
|
||||
|
||||
@@ -26,16 +26,18 @@ Supported boards in the RA Family:
|
||||
- JLink is used for debugging, it can be downloaded [here](https://www.segger.com/downloads/jlink/).
|
||||
- Clone the ready-to-use repository for your selected board, for FSP version prior to 6.0:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
git clone https://github.com/lvgl/lv_port_renesas_ek-ra8d1_gcc.git --recurse-submodules
|
||||
```bash
|
||||
git clone https://github.com/lvgl/lv_port_renesas_ek-ra8d1_gcc.git --recurse-submodules
|
||||
```
|
||||
|
||||
Downloading the `.zip` from GitHub doesn't work as it doesn't download the submodules.
|
||||
|
||||
- Clone the ready-to-use repository for your selected board, for FSP version from 6.0 and above:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
git clone https://github.com/lvgl/lv_port_renesas_ek-ra8d1_gcc.git
|
||||
|
||||
```bash
|
||||
git clone https://github.com/lvgl/lv_port_renesas_ek-ra8d1_gcc.git
|
||||
```
|
||||
|
||||
- Open e² studio, go to `File` -> `Import project` and select
|
||||
`General` / `Existing projects into workspace`.
|
||||
- Select the cloned folder and press `Finish`.
|
||||
|
||||
@@ -33,9 +33,9 @@ Supported boards in the RX Family:
|
||||
:alt: Toolchains
|
||||
- Clone the ready-to-use [lv_port_renesas_rx72n-envision-kit](https://github.com/lvgl/lv_port_renesas_rx72n-envision-kit.git) repository:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
git clone https://github.com/lvgl/lv_port_renesas_rx72n-envision-kit.git --recurse-submodules
|
||||
```bash
|
||||
git clone https://github.com/lvgl/lv_port_renesas_rx72n-envision-kit.git --recurse-submodules
|
||||
```
|
||||
|
||||
Downloading the `.zip` from GitHub doesn't work as it doesn't download the submodules.
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ Supported boards in the RZ/A Family:
|
||||
- The RZ/A boards are MPUs with a focus on bare metal and RTOS applications. Projects are built for them using e² Studio IDE, available for Windows, Mac, and Linux.
|
||||
- Clone the ready-to-use repository for your board:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
```bash
|
||||
git clone https://github.com/lvgl/lv_port_renesas-ek-rz_a3m --recurse-submodules
|
||||
```
|
||||
|
||||
Downloading the `.zip` from GitHub doesn't work as it doesn't download the submodules.
|
||||
|
||||
|
||||
@@ -23,9 +23,10 @@ Supported boards in the RZ/G Family:
|
||||
See the [v8-to-v9 Migration Guide](https://docs.lvgl.io/9.0/CHANGELOG.html#migration-guide) for things you will need to address.
|
||||
- Clone the ready-to-use repository for your selected board:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
git clone https://github.com/lvgl/lv_port_renesas_rz-g2l-evkit --recurse-submodules
|
||||
```bash
|
||||
git clone https://github.com/lvgl/lv_port_renesas_rz-g2l-evkit --recurse-submodules
|
||||
```
|
||||
|
||||
Downloading the `.zip` from GitHub doesn't work as it doesn't download the submodules.
|
||||
|
||||
@@ -34,9 +35,9 @@ Downloading the `.zip` from GitHub doesn't work as it doesn't download the submo
|
||||
- Stop any automatically started demos (on G2UL run `systemctl stop demo-launcher` in the terminal).
|
||||
- Run the project:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
./lvgl_demo_benchmark
|
||||
```bash
|
||||
./lvgl_demo_benchmark
|
||||
```
|
||||
|
||||
### Modify the project
|
||||
|
||||
@@ -67,9 +68,9 @@ LVGL statically for customizability and to port the LVGL v9 benchmark from LVGL
|
||||
versions of LVGL include the optimal OpenGL driver.
|
||||
- Clone the ready-to-use repository:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
git clone https://github.com/lvgl/lv_port_renesas_rz-g3e-evkit --recurse-submodules
|
||||
```bash
|
||||
git clone https://github.com/lvgl/lv_port_renesas_rz-g3e-evkit --recurse-submodules
|
||||
```
|
||||
|
||||
Downloading the `.zip` from GitHub doesn't work as it doesn't download the submodules.
|
||||
|
||||
@@ -78,9 +79,9 @@ Downloading the `.zip` from GitHub doesn't work as it doesn't download the submo
|
||||
- Stop the Wayland desktop if using the OpenGL, DRM, or fbdev drivers. Run `systemctl stop weston` in the terminal.
|
||||
- Run the project:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
./lvglsim
|
||||
```bash
|
||||
./lvglsim
|
||||
```
|
||||
|
||||
### Modify the project
|
||||
|
||||
|
||||
@@ -88,54 +88,56 @@ Follow the official GStreamer documentation to install its development libraries
|
||||
|
||||
**Option 1: Direct linking with LVGL (Recommended)**
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
# Find GStreamer packages
|
||||
pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
|
||||
pkg_check_modules(GSTREAMER_VIDEO REQUIRED gstreamer-video-1.0)
|
||||
pkg_check_modules(GSTREAMER_APP REQUIRED gstreamer-app-1.0)
|
||||
|
||||
# Link with LVGL
|
||||
target_include_directories(lvgl PUBLIC
|
||||
$\{GSTREAMER_INCLUDE_DIRS\}
|
||||
$\{GSTREAMER_VIDEO_INCLUDE_DIRS\}
|
||||
$\{GSTREAMER_APP_INCLUDE_DIRS\})
|
||||
target_link_libraries(lvgl PUBLIC
|
||||
$\{GSTREAMER_LIBRARIES\}
|
||||
$\{GSTREAMER_VIDEO_LIBRARIES\}
|
||||
$\{GSTREAMER_APP_LIBRARIES\})
|
||||
```cmake
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
# Find GStreamer packages
|
||||
pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
|
||||
pkg_check_modules(GSTREAMER_VIDEO REQUIRED gstreamer-video-1.0)
|
||||
pkg_check_modules(GSTREAMER_APP REQUIRED gstreamer-app-1.0)
|
||||
|
||||
# Link with LVGL
|
||||
target_include_directories(lvgl PUBLIC
|
||||
$\{GSTREAMER_INCLUDE_DIRS\}
|
||||
$\{GSTREAMER_VIDEO_INCLUDE_DIRS\}
|
||||
$\{GSTREAMER_APP_INCLUDE_DIRS\})
|
||||
target_link_libraries(lvgl PUBLIC
|
||||
$\{GSTREAMER_LIBRARIES\}
|
||||
$\{GSTREAMER_VIDEO_LIBRARIES\}
|
||||
$\{GSTREAMER_APP_LIBRARIES\})
|
||||
```
|
||||
|
||||
4. **Manual Compilation with pkg-config**
|
||||
|
||||
You can also compile manually using pkg-config to query the necessary flags:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Get compilation flags
|
||||
gcc $(pkg-config --cflags --libs gstreamer-1.0 gstreamer-video-1.0 gstreamer-app-1.0) -o your_app your_app.c lvgl.a
|
||||
```bash
|
||||
# Get compilation flags
|
||||
gcc $(pkg-config --cflags --libs gstreamer-1.0 gstreamer-video-1.0 gstreamer-app-1.0) -o your_app your_app.c lvgl.a
|
||||
```
|
||||
|
||||
5. **Basic Setup Example**
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
int main(void)
|
||||
\{
|
||||
/* Initialize LVGL */
|
||||
lv_init();
|
||||
|
||||
/* Setup display driver */
|
||||
lv_display_t *display = lv_display_create(800, 480);
|
||||
/* ... configure display driver ... */
|
||||
|
||||
/* Create and run your GStreamer application */
|
||||
lv_example_gstreamer_1();
|
||||
|
||||
while (1) \{
|
||||
lv_timer_handler();
|
||||
\}
|
||||
|
||||
return 0;
|
||||
\}
|
||||
```c
|
||||
int main(void)
|
||||
{
|
||||
/* Initialize LVGL */
|
||||
lv_init();
|
||||
|
||||
/* Setup display driver */
|
||||
lv_display_t *display = lv_display_create(800, 480);
|
||||
/* ... configure display driver ... */
|
||||
|
||||
/* Create and run your GStreamer application */
|
||||
lv_example_gstreamer_1();
|
||||
|
||||
while (1) {
|
||||
lv_timer_handler();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -130,27 +130,28 @@ in each case:
|
||||
|
||||
The current layer can be read from the `base` draw descriptor. For example:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
/* In LV_EVENT_DRAW_TASK_ADDED */
|
||||
lv_draw_task_t * t = lv_event_get_draw_task(e);
|
||||
lv_draw_base_dsc_t * draw_dsc = lv_draw_task_get_draw_dsc(t);
|
||||
|
||||
lv_layer_t * current_layer = draw_dsc.layer;
|
||||
```c
|
||||
/* In LV_EVENT_DRAW_TASK_ADDED */
|
||||
lv_draw_task_t * t = lv_event_get_draw_task(e);
|
||||
lv_draw_base_dsc_t * draw_dsc = lv_draw_task_get_draw_dsc(t);
|
||||
|
||||
lv_layer_t * current_layer = draw_dsc.layer;
|
||||
```
|
||||
|
||||
3. **Draw to the Canvas Widget**:
|
||||
The canvas itself doesn't store a layer, but one can be easily created and used
|
||||
like this:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
/* Initialize a layer */
|
||||
lv_layer_t layer;
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
|
||||
/* Draw something here */
|
||||
|
||||
/* Wait until the rendering is ready */
|
||||
lv_canvas_finish_layer(canvas, &layer);
|
||||
|
||||
```c
|
||||
/* Initialize a layer */
|
||||
lv_layer_t layer;
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
|
||||
/* Draw something here */
|
||||
|
||||
/* Wait until the rendering is ready */
|
||||
lv_canvas_finish_layer(canvas, &layer);
|
||||
```
|
||||
|
||||
## Creating a New Layer
|
||||
|
||||
|
||||
@@ -43,7 +43,23 @@ All of the below format names are used in code by prefixing them with
|
||||
| NATIVE [^3] | LV_COLOR_DEPTH | No | See below |
|
||||
| NATIVE_WITH_ALPHA [^3] | LV_COLOR_DEPTH | No | See below |
|
||||
|
||||
[^3]: What they mean (from `lv_color.h`): .. code-block:: #if LV_COLOR_DEPTH == 1 LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_I1, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_I1, #elif LV_COLOR_DEPTH == 8 LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_L8, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_AL88, #elif LV_COLOR_DEPTH == 16 LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_RGB565, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_RGB565A8, #elif LV_COLOR_DEPTH == 24 LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_RGB888, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_ARGB8888, #elif LV_COLOR_DEPTH == 32 LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_XRGB8888, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_ARGB8888, #else #error "LV_COLOR_DEPTH should be 1, 8, 16, 24 or 32" #endif
|
||||
[^3]: What they mean (from `lv_color.h`):
|
||||
|
||||
```c
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_I1, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_I1,
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_L8, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_AL88,
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_RGB565, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_RGB565A8,
|
||||
#elif LV_COLOR_DEPTH == 24
|
||||
LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_RGB888, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_ARGB8888,
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_XRGB8888, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_ARGB8888,
|
||||
#else
|
||||
#error "LV_COLOR_DEPTH should be 1, 8, 16, 24 or 32"
|
||||
#endif
|
||||
```
|
||||
|
||||
## GPU Input Formats
|
||||
|
||||
|
||||
@@ -48,10 +48,19 @@ it executable (`chmod +x LVGL_Pro_Editor.AppImage`), and running it.
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `Problem` | If you double click the `.AppImage` file and nothing happens, try running it from the terminal. If you see this error: .. code-block:: bash (process:3943): Gtk-ERROR **: 11:45:01.301: GTK 2/3 symbols detected. Using GTK 2/3 and GTK 4 in the same process is not supported Trace/breakpoint trap (core dumped) |
|
||||
| `Solution` | Specify the GTK version for the application with `--gtk-version=3`. .. code-block:: bash ./path/to/editor.AppImage --gtk-version=3 |
|
||||
#### 1. Nothing happens when I click the `.AppImage`
|
||||
|
||||
If you double click the `.AppImage` file and nothing happens, try running it from the terminal. If you see this error:
|
||||
|
||||
```bash
|
||||
(process:3943): Gtk-ERROR **: 11:45:01.301: GTK 2/3 symbols detected. Using GTK 2/3 and GTK 4 in the same process is not supported Trace/breakpoint trap (core dumped)
|
||||
```
|
||||
|
||||
Specify the GTK version for the application with `--gtk-version=3`.
|
||||
|
||||
```bash
|
||||
./path/to/editor.AppImage --gtk-version=3
|
||||
```
|
||||
|
||||
## MacOS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user