mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
8a2c670be4
* fix(Kconfig) remove duplicate LV_BUILD_EXAMPLES configuration * feat(refr) add reset of FPS statistics * fix(conf) mismatched macro judgment * feat(others) add monkey test Signed-off-by: FASTSHIFT <vifextech@foxmail.com> Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> * fix(monkey) use lv_memset_00 to initialize monkey config * fix(monkey) random upper limit value Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> * feat(examples) add monkey test example * feat(docs) add monkey test description * feat(monkey) add user_data Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> * docs(monkey) add instructions Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> * fix(monkey) EX -> EXAMPLE Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> * feat(monkey) add comments to monkey config * docs(monkey) update usage * feat(Kconfig) add monkey test configuration * fix(monkey) rand() -> lv_rand() * feat(example) add button monkey test * docs(monkey) add button introduction Signed-off-by: FASTSHIFT <vifextech@foxmail.com> * fix(monkey) obj -> monkey Signed-off-by: FASTSHIFT <vifextech@foxmail.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
40 lines
1.4 KiB
Markdown
40 lines
1.4 KiB
Markdown
```eval_rst
|
||
.. include:: /header.rst
|
||
:github_url: |github_link_base|/others/monkey.md
|
||
```
|
||
# Monkey
|
||
|
||
A simple monkey test. Use random input to stress test the application.
|
||
|
||
## Usage
|
||
|
||
Enable `LV_USE_MONKEY` in `lv_conf.h`.
|
||
|
||
First configure monkey, use `lv_monkey_config_t` to define the configuration structure, set the `type` (check [input devices](/overview/indev) for the supported types), and then set the range of `period_range` and `input_range`, the monkey will output random operations at random times within this range. Call `lv_monkey_create` to create monkey. Finally call `lv_monkey_set_enable(monkey, true)` to enable monkey.
|
||
|
||
If you want to pause the monkey, call `lv_monkey_set_enable(monkey, false)`. To delete the monkey, call `lv_monkey_del(monkey)`.
|
||
|
||
Note that `input_range` has different meanings in different `type`:
|
||
|
||
- `LV_INDEV_TYPE_POINTER` No effect, click randomly within the pixels of the screen resolution.
|
||
- `LV_INDEV_TYPE_ENCODER` The minimum and maximum values of `enc_diff`.
|
||
- `LV_INDEV_TYPE_BUTTON` The minimum and maximum values of `btn_id`. Use `lv_monkey_get_indev()` to get the input device, and use `lv_indev_set_button_points()` to map the key ID to the coordinates.
|
||
- `LV_INDEV_TYPE_KEYPAD` No effect, Send random [Keys](/overview/indev).
|
||
|
||
## Example
|
||
|
||
```eval_rst
|
||
|
||
.. include:: ../../examples/others/monkey/index.rst
|
||
|
||
```
|
||
## API
|
||
|
||
|
||
```eval_rst
|
||
|
||
.. doxygenfile:: lv_monkey.h
|
||
:project: lvgl
|
||
|
||
```
|