1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

docs(demos) update information to reflect new layout (#3029)

This commit is contained in:
Gabriel Wang 2022-01-20 18:52:52 +00:00 committed by GitHub
parent 79d0ec092d
commit 101d09276f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 11 deletions

View File

@ -1,14 +1,54 @@
# Demos for LVGL
## Add the examples to your projects
1. Clone this repository: `git clone https://github.com/lvgl/lv_demos.git`.
2. The `lv_demos` directory should be next to the `lvgl` directory in your project.
1. demos can be found in the 'demos' folder once you clone the lvgl.
2. In the ***lv_conf.h*** or equivalent places, you can find demo related macros, change its value to enable or disable specified demos:
```c
...
/*===================
* DEMO USAGE
====================*/
/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 0
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
/*Demonstrate the usage of encoder and keyboard*/
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
/*Benchmark your system*/
#define LV_USE_DEMO_BENCHMARK 0
/*Stress test for LVGL*/
#define LV_USE_DEMO_STRESS 0
/*Music player demo*/
#define LV_USE_DEMO_MUSIC 0
#if LV_USE_DEMO_MUSIC
# define LV_DEMO_MUSIC_SQUARE 0
# define LV_DEMO_MUSIC_LANDSCAPE 0
# define LV_DEMO_MUSIC_ROUND 0
# define LV_DEMO_MUSIC_LARGE 0
# define LV_DEMO_MUSIC_AUTO_PLAY 0
#endif
...
```
3. If your development environment or toolchain does not add source files inside '***lvgl***' folder automatically, ensure the `demos` folder is included for compilation.
4. Include "***demos/lv_demos.h***" in your application source file, for example:
```c
//! main.c
#include "lvgl.h"
#include "demos/lv_demos.h"
...
```
Similarly to `lv_conf.h` there is a configuration file for the examples too. It is called `lv_demo_conf.h`.
1. Copy `lv_demos/lv_demo_conf_template.h` next to `lv_demos` directory
2. Rename it to `lv_demo_conf.h`
3. Change the first `#if 0` to `#if 1` to enable the file's content
4. Enable or Disable demos
## Demos

View File

@ -11,7 +11,7 @@ The size and position of the objects during testing are set with a pseudo random
On to top of the screen the title of the current test step, and the result of the previous step is displayed.
## Run the benchmark
- In `lv_ex_conf.h` set `LV_USE_DEMO_BENCHMARK 1`
- In `lv_conf.h` or equivalent places set `LV_USE_DEMO_BENCHMARK 1`
- After `lv_init()` and initializing the drivers call `lv_demo_benchmark()`
## Interpret the result

View File

@ -9,5 +9,5 @@ Learn more about the touchpad-less usage of LVGL [here](https://docs.lvgl.io/mas
![Keypad and encoder navigation in LVGL embedded GUI library](screenshot1.gif)
## Run the demo
- In `lv_ex_conf.h` set `LV_USE_DEMO_KEYPAD_AND_ENCODER 1`
- In `lv_conf.h` or equivalent places set `LV_USE_DEMO_KEYPAD_AND_ENCODER 1`
- After `lv_init()` and initializing the drivers call `lv_demo_keypad_encoder()`

View File

@ -7,7 +7,7 @@ The music player demo shows what kind of modern, smartphone-like user interfaces
![Music player demo with LVGL embedded GUI library](https://github.com/lvgl/lv_examples/blob/master/src/lv_demo_music/screenshot1.gif?raw=true)
## Run the demo
- In `lv_ex_conf.h` set `LV_USE_DEMO_MUSIC 1`
- In `lv_conf.h` or equivalent places set `LV_USE_DEMO_MUSIC 1`
- With `LV_DEMO_MUSIC_AUTO_PLAY` enabled a ~60 sec demo will be played.
- After `lv_init()` and initializing the drivers call `lv_demo_music()`

View File

@ -8,6 +8,6 @@ It contains a lot of object creation, deletion, animations, styles usage, and so
![Printer demo with LVGL embedded GUI library](https://github.com/lvgl/lv_examples/blob/master/src/lv_demo_stress/screenshot1.gif?raw=true)
## Run the demo
- In `lv_ex_conf.h` set `LV_USE_DEMO_STRESS 1`
- In `lv_conf.h` or equivalent places set `LV_USE_DEMO_STRESS 1`
- In `lv_conf.h` enable all the widgets (`LV_USE_BTN 1`) and the animations (`LV_USE_ANIMATION 1`)
- After `lv_init()` and initializing the drivers call `lv_demo_stress()`