diff --git a/demos/README.md b/demos/README.md index 2198ad69a3..14218c1c79 100644 --- a/demos/README.md +++ b/demos/README.md @@ -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 diff --git a/demos/benchmark/README.md b/demos/benchmark/README.md index f7fccf9d66..7e7c07637e 100644 --- a/demos/benchmark/README.md +++ b/demos/benchmark/README.md @@ -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 diff --git a/demos/keypad_encoder/README.md b/demos/keypad_encoder/README.md index f330c26f07..3d4ce482c7 100644 --- a/demos/keypad_encoder/README.md +++ b/demos/keypad_encoder/README.md @@ -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()` diff --git a/demos/music/README.md b/demos/music/README.md index 1fa3cd3d3b..b9f8b27031 100644 --- a/demos/music/README.md +++ b/demos/music/README.md @@ -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()` diff --git a/demos/stress/README.md b/demos/stress/README.md index 9b85af9a68..321d14a38e 100644 --- a/demos/stress/README.md +++ b/demos/stress/README.md @@ -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()`