1 #include "../../lv_examples.h"
2 #if LV_USE_MONKEY && LV_BUILD_EXAMPLES
3 
lv_example_monkey_3(void)4 void lv_example_monkey_3(void)
5 {
6     static lv_point_t btn_points[3];
7     lv_coord_t hor_res = LV_HOR_RES;
8 
9     /*Create button monkey test*/
10     lv_monkey_config_t config;
11     lv_monkey_config_init(&config);
12     config.type = LV_INDEV_TYPE_BUTTON;
13     config.period_range.min = 50;
14     config.period_range.max = 500;
15     config.input_range.min = 0;
16     config.input_range.max = sizeof(btn_points) / sizeof(lv_point_t) - 1;
17     lv_monkey_t * monkey = lv_monkey_create(&config);
18 
19     /*Set the coordinates bound to the button*/
20     btn_points[0].x = hor_res / 4;
21     btn_points[0].y = 10;
22     btn_points[1].x = hor_res / 2;
23     btn_points[1].y = 10;
24     btn_points[2].x = hor_res * 3 / 4;
25     btn_points[2].y = 10;
26 
27     lv_indev_set_button_points(lv_monkey_get_indev(monkey), btn_points);
28 
29     /*Start monkey test*/
30     lv_monkey_set_enable(monkey, true);
31 }
32 
33 #endif
34