1 /******************************************************************* 2 * 3 * @file lv_indev_gesture_private.h 4 * 5 * Contains declarations and definition that are internal 6 * to the gesture detection logic 7 * 8 * Copyright (c) 2024 EDGEMTech Ltd. 9 * 10 * Author EDGEMTech Ltd, (erik.tagirov@edgemtech.ch) 11 * 12 ******************************************************************/ 13 14 #ifndef LV_INDEV_GESTURE_PRIVATE_H 15 #define LV_INDEV_GESTURE_PRIVATE_H 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 /********************* 22 * INCLUDES 23 *********************/ 24 #include "../core/lv_obj.h" 25 26 #if LV_USE_GESTURE_RECOGNITION 27 28 /********************* 29 * DEFINES 30 *********************/ 31 32 #define LV_GESTURE_MAX_POINTS 2 33 34 35 /********************** 36 * TYPEDEFS 37 **********************/ 38 39 /* Represent the motion of a finger */ 40 struct lv_indev_gesture_motion { 41 int8_t finger; /* The ID of the tracked finger */ 42 lv_point_t start_point; /* The coordinates where the DOWN event occurred */ 43 lv_point_t point; /* The current coordinates */ 44 lv_indev_state_t state; /* DEBUG: The state i.e PRESSED or RELEASED */ 45 }; 46 47 typedef struct lv_indev_gesture_motion lv_indev_gesture_motion_t; 48 49 /* General descriptor for a gesture, used by recognizer state machines to track 50 * the scale, rotation, and translation NOTE: (this will likely become private) */ 51 struct lv_indev_gesture { 52 53 /* Motion descriptor, stores the coordinates and velocity of a contact point */ 54 lv_indev_gesture_motion_t motions[LV_GESTURE_MAX_POINTS]; 55 56 lv_point_t center; /* Center point */ 57 float scale; /* Scale factor & previous scale factor */ 58 float p_scale; 59 float scale_factors_x[LV_GESTURE_MAX_POINTS]; /* Scale factor relative to center for each point */ 60 float scale_factors_y[LV_GESTURE_MAX_POINTS]; 61 62 float delta_x; /* Translation & previous translation */ 63 float delta_y; 64 float p_delta_x; 65 float p_delta_y; 66 float rotation; /* Rotation & previous rotation*/ 67 float p_rotation; 68 uint8_t finger_cnt; /* Current number of contact points */ 69 70 }; 71 72 struct lv_indev_gesture_configuration { 73 74 float pinch_up_threshold; /* When the gesture reaches the threshold - start sending events */ 75 float pinch_down_threshold; /* When the gesture reaches the threshold - start sending events */ 76 77 }; 78 79 /********************** 80 * GLOBAL PROTOTYPES 81 **********************/ 82 83 /********************** 84 * MACROS 85 **********************/ 86 87 #endif /* END LV_USE_RECOGNITION */ 88 89 #ifdef __cplusplus 90 } /*extern "C"*/ 91 #endif 92 93 #endif /* END LV_INDEV_GESTURE_PRIVATE_H */ 94