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