1 /** 2 * @file lv_indev.h 3 * 4 */ 5 6 #ifndef LV_INDEV_H 7 #define LV_INDEV_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "lv_obj.h" 17 #include "../lv_hal/lv_hal_indev.h" 18 #include "../lv_core/lv_group.h" 19 20 /********************* 21 * DEFINES 22 *********************/ 23 24 /********************** 25 * TYPEDEFS 26 **********************/ 27 28 /********************** 29 * GLOBAL PROTOTYPES 30 **********************/ 31 32 /** 33 * Initialize the display input device subsystem 34 */ 35 void lv_indev_init(void); 36 37 /** 38 * Called periodically to read the input devices 39 * @param task pointer to the task itself 40 */ 41 void lv_indev_read_task(lv_task_t * task); 42 43 /** 44 * Get the currently processed input device. Can be used in action functions too. 45 * @return pointer to the currently processed input device or NULL if no input device processing 46 * right now 47 */ 48 lv_indev_t * lv_indev_get_act(void); 49 50 /** 51 * Get the type of an input device 52 * @param indev pointer to an input device 53 * @return the type of the input device from `lv_hal_indev_type_t` (`LV_INDEV_TYPE_...`) 54 */ 55 lv_indev_type_t lv_indev_get_type(const lv_indev_t * indev); 56 57 /** 58 * Reset one or all input devices 59 * @param indev pointer to an input device to reset or NULL to reset all of them 60 */ 61 void lv_indev_reset(lv_indev_t * indev); 62 63 /** 64 * Reset the long press state of an input device 65 * @param indev_proc pointer to an input device 66 */ 67 void lv_indev_reset_long_press(lv_indev_t * indev); 68 69 /** 70 * Enable or disable an input devices 71 * @param indev pointer to an input device 72 * @param en true: enable; false: disable 73 */ 74 void lv_indev_enable(lv_indev_t * indev, bool en); 75 76 /** 77 * Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON) 78 * @param indev pointer to an input device 79 * @param cur_obj pointer to an object to be used as cursor 80 */ 81 void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj); 82 83 #if LV_USE_GROUP 84 /** 85 * Set a destination group for a keypad input device (for LV_INDEV_TYPE_KEYPAD) 86 * @param indev pointer to an input device 87 * @param group point to a group 88 */ 89 void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group); 90 #endif 91 92 /** 93 * Set the an array of points for LV_INDEV_TYPE_BUTTON. 94 * These points will be assigned to the buttons to press a specific point on the screen 95 * @param indev pointer to an input device 96 * @param group point to a group 97 */ 98 void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points); 99 100 /** 101 * Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON) 102 * @param indev pointer to an input device 103 * @param point pointer to a point to store the result 104 */ 105 void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point); 106 107 /** 108 * Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD) 109 * @param indev pointer to an input device 110 * @return the last pressed key (0 on error) 111 */ 112 uint32_t lv_indev_get_key(const lv_indev_t * indev); 113 114 /** 115 * Check if there is dragging with an input device or not (for LV_INDEV_TYPE_POINTER and 116 * LV_INDEV_TYPE_BUTTON) 117 * @param indev pointer to an input device 118 * @return true: drag is in progress 119 */ 120 bool lv_indev_is_dragging(const lv_indev_t * indev); 121 122 /** 123 * Get the vector of dragging of an input device (for LV_INDEV_TYPE_POINTER and 124 * LV_INDEV_TYPE_BUTTON) 125 * @param indev pointer to an input device 126 * @param point pointer to a point to store the vector 127 */ 128 void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point); 129 130 /** 131 * Do nothing until the next release 132 * @param indev pointer to an input device 133 */ 134 void lv_indev_wait_release(lv_indev_t * indev); 135 136 /** 137 * Get a pointer to the indev read task to 138 * modify its parameters with `lv_task_...` functions. 139 * @param indev pointer to an inout device 140 * @return pointer to the indev read refresher task. (NULL on error) 141 */ 142 lv_task_t * lv_indev_get_read_task(lv_disp_t * indev); 143 144 /** 145 * Gets a pointer to the currently active object in indev proc functions. 146 * NULL if no object is currently being handled or if groups aren't used. 147 * @return pointer to currently active object 148 */ 149 lv_obj_t * lv_indev_get_obj_act(void); 150 151 /********************** 152 * MACROS 153 **********************/ 154 155 #ifdef __cplusplus 156 } /* extern "C" */ 157 #endif 158 159 #endif /*LV_INDEV_H*/ 160