1 /** 2 * @file lv_indev_private.h 3 * 4 */ 5 6 #ifndef LV_INDEV_PRIVATE_H 7 #define LV_INDEV_PRIVATE_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "lv_indev.h" 17 #include "../misc/lv_anim.h" 18 #include "lv_indev_scroll.h" 19 20 /********************* 21 * DEFINES 22 *********************/ 23 24 /********************** 25 * TYPEDEFS 26 **********************/ 27 28 struct _lv_indev_t { 29 /** Input device type*/ 30 lv_indev_type_t type; 31 32 /** Function pointer to read input device data.*/ 33 lv_indev_read_cb_t read_cb; 34 35 lv_indev_state_t state; /**< Current state of the input device.*/ 36 lv_indev_mode_t mode; 37 38 /*Flags*/ 39 uint8_t long_pr_sent : 1; 40 uint8_t reset_query : 1; 41 uint8_t enabled : 1; 42 uint8_t wait_until_release : 1; 43 uint8_t stop_processing_query : 1; 44 45 uint32_t pr_timestamp; /**< Pressed time stamp*/ 46 uint32_t longpr_rep_timestamp; /**< Long press repeat time stamp*/ 47 48 void * driver_data; 49 void * user_data; 50 51 /**< Pointer to the assigned display*/ 52 lv_display_t * disp; 53 54 /**< Timer to periodically read the input device*/ 55 lv_timer_t * read_timer; 56 57 /**< Number of pixels to slide before actually drag the object*/ 58 uint8_t scroll_limit; 59 60 /**< Drag throw slow-down in [%]. Greater value means faster slow-down*/ 61 uint8_t scroll_throw; 62 63 /**< At least this difference should be between two points to evaluate as gesture*/ 64 uint8_t gesture_min_velocity; 65 66 /**< At least this difference should be to send a gesture*/ 67 uint8_t gesture_limit; 68 69 /**< Long press time in milliseconds*/ 70 uint16_t long_press_time; 71 72 /**< Repeated trigger period in long press [ms]*/ 73 uint16_t long_press_repeat_time; 74 75 /**< Rotary diff count will be multiplied by this value and divided by 256*/ 76 int32_t rotary_sensitivity; 77 78 struct { 79 /*Pointer and button data*/ 80 lv_point_t act_point; /**< Current point of input device.*/ 81 lv_point_t last_point; /**< Last point of input device.*/ 82 lv_point_t last_raw_point; /**< Last point read from read_cb. */ 83 lv_point_t vect; /**< Difference between `act_point` and `last_point`.*/ 84 lv_point_t scroll_sum; /*Count the dragged pixels to check LV_INDEV_DEF_SCROLL_LIMIT*/ 85 lv_point_t scroll_throw_vect; 86 lv_point_t scroll_throw_vect_ori; 87 lv_obj_t * act_obj; /*The object being pressed*/ 88 lv_obj_t * last_obj; /*The last object which was pressed*/ 89 lv_obj_t * scroll_obj; /*The object being scrolled*/ 90 lv_obj_t * last_pressed; /*The lastly pressed object*/ 91 lv_obj_t * last_hovered; /*The lastly hovered object*/ 92 lv_area_t scroll_area; 93 lv_point_t gesture_sum; /*Count the gesture pixels to check LV_INDEV_DEF_GESTURE_LIMIT*/ 94 int32_t diff; 95 /*Short click streaks*/ 96 uint8_t short_click_streak; 97 lv_point_t last_short_click_point; 98 uint32_t last_short_click_timestamp; 99 /*Flags*/ 100 uint8_t scroll_dir : 4; 101 uint8_t gesture_dir : 4; 102 uint8_t gesture_sent : 1; 103 uint8_t press_moved : 1; 104 } pointer; 105 struct { 106 /*Keypad data*/ 107 lv_indev_state_t last_state; 108 uint32_t last_key; 109 } keypad; 110 111 lv_obj_t * cursor; /**< Cursor for LV_INPUT_TYPE_POINTER*/ 112 lv_group_t * group; /**< Keypad destination group*/ 113 const lv_point_t * btn_points; /**< Array points assigned to the button ()screen will be pressed 114 here by the buttons*/ 115 lv_event_list_t event_list; 116 lv_anim_t * scroll_throw_anim; 117 118 lv_indev_gesture_type_t gesture_type; 119 void * gesture_data; 120 }; 121 122 /********************** 123 * GLOBAL PROTOTYPES 124 **********************/ 125 126 /** 127 * Find a scrollable object based on the current scroll vector in the indev. 128 * In handles scroll propagation to the parent if needed, and scroll directions too. 129 * @param indev pointer to an indev 130 * @return the found scrollable object or NULL if not found. 131 */ 132 lv_obj_t * lv_indev_find_scroll_obj(lv_indev_t * indev); 133 134 /********************** 135 * MACROS 136 **********************/ 137 138 #ifdef __cplusplus 139 } /*extern "C"*/ 140 #endif 141 142 #endif /*LV_INDEV_PRIVATE_H*/ 143