1 /**
2  * @file lv_monkey.h
3  *
4  */
5 #ifndef LV_MONKEY_H
6 #define LV_MONKEY_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 /*********************
13  *      INCLUDES
14  *********************/
15 #include "../../lv_conf_internal.h"
16 #include "../../indev/lv_indev.h"
17 
18 #if LV_USE_MONKEY != 0
19 
20 /*********************
21  *      DEFINES
22  *********************/
23 
24 /**********************
25  *      TYPEDEFS
26  **********************/
27 
28 typedef struct _lv_monkey_t lv_monkey_t;
29 
30 struct _lv_monkey_config_t {
31     /**< Input device type*/
32     lv_indev_type_t type;
33 
34     /**< Monkey execution period*/
35     struct {
36         //! @cond Doxygen_Suppress
37         uint32_t min;
38         uint32_t max;
39         //! @endcond
40     } period_range;
41 
42     /**< The range of input value*/
43     struct {
44         int32_t min;
45         int32_t max;
46     } input_range;
47 };
48 
49 /**********************
50  * GLOBAL PROTOTYPES
51  **********************/
52 
53 /**
54  * Initialize a monkey config with default values
55  * @param config pointer to 'lv_monkey_config_t' variable to initialize
56  */
57 void lv_monkey_config_init(lv_monkey_config_t * config);
58 
59 /**
60  * Create monkey for test
61  * @param config pointer to 'lv_monkey_config_t' variable
62  * @return pointer to the created monkey
63  */
64 lv_monkey_t * lv_monkey_create(const lv_monkey_config_t * config);
65 
66 /**
67  * Get monkey input device
68  * @param monkey pointer to a monkey
69  * @return pointer to the input device
70  */
71 lv_indev_t * lv_monkey_get_indev(lv_monkey_t * monkey);
72 
73 /**
74  * Enable monkey
75  * @param monkey pointer to a monkey
76  * @param en set to true to enable
77  */
78 void lv_monkey_set_enable(lv_monkey_t * monkey, bool en);
79 
80 /**
81  * Get whether monkey is enabled
82  * @param monkey pointer to a monkey
83  * @return return true if monkey enabled
84  */
85 bool lv_monkey_get_enable(lv_monkey_t * monkey);
86 
87 /**
88  * Set the user_data field of the monkey
89  * @param monkey   pointer to a monkey
90  * @param user_data   pointer to the new user_data.
91  */
92 void lv_monkey_set_user_data(lv_monkey_t * monkey, void * user_data);
93 
94 /**
95  * Get the user_data field of the monkey
96  * @param monkey pointer to a monkey
97  * @return the pointer to the user_data of the monkey
98  */
99 void * lv_monkey_get_user_data(lv_monkey_t * monkey);
100 
101 /**
102  * Delete monkey
103  * @param monkey pointer to monkey
104  */
105 void lv_monkey_delete(lv_monkey_t * monkey);
106 
107 /**********************
108  *      MACROS
109  **********************/
110 
111 #endif /*LV_USE_MONKEY*/
112 
113 #ifdef __cplusplus
114 } /*extern "C"*/
115 #endif
116 
117 #endif /*LV_MONKEY_H*/
118