Gesture Parameters
Last modified by Microchip on 2026/03/19 14:29
The Gesture module in the Capacitive Voltage Divider (CVD) library provides an easy-to-use interface for detecting and interpreting user gestures using capacitive touch sensors. This module is designed to help developers add intuitive gesture-based controls to their embedded applications, such as swipe, tap, and hold actions.
Gesture Enums and Structures
SWIPE_DIRECTION
typedef enum{ NO_DIRECTION = 0xf0u, RIGHT = 0x0u, LEFT = 0x2u, UP = 0x3u, DOWN = 0x1u, UP_RIGHT = 0x5u, UP_LEFT = 0x6u, DOWN_RIGHT = 0x7u, DOWN_LEFT = 0x8u, UP_RIGHT_EXTEND = 0x9u, UP_LEFT_EXTEND = 0xau, DOWN_RIGHT_EXTEND = 0xbu, DOWN_LEFT_EXTEND = 0xcu} SWIPE_DIRECTION;
Description: This enumeration lists the down the swipe directions applicable.
TOUCH_EVENT
typedef enum{ TOUCH_DOWN_EVENT = 0x10u, TOUCH_UP_EVENT = 0x20u, TAP_THRESH_EXCEEDED_EVENT = 0x30u, SEQ_TAP_DIST_THRESH_EXCEEDED_EVENT = 0x40u, SWIPE_THRESH_EXCEEDED_EVENT = 0x50u, SWIPE_HOLD_EVENT = 0x60u, SWIPE_HOLD_THRESH_EXCEEDED_EVENT = 0x70u, TAP_TIMEOUT_EVENT = 0x80u, TAP_HOLD_TIMEOUT_EVENT = 0x90u, SWIPE_TIMEOUT_EVENT = 0xa0u, DIRECTION_CHANGE_EVENT = 0xb0u, PINCH_ZOOM_EVENT = 0xc0u} TOUCH_EVENT;
Description: This enumeration lists the down the touch events applicable.
Gesture Item
typedef struct _GestureItem{ uint32_t pattern; uint32_t mask; uint8_t gestureID; uint8_t releaseRequired; uint8_t repeatSend;} GestureItem;
Description: This structure defines the required information that each gesture must contain.
A ROM array holds all the supported gesture pattern information.
mtouch_gesture_t
typedef struct { /* Gesture Configuration */ uint8_t tapReleaseTimeout; uint8_t tapHoldTimeout; uint8_t swipeTimeout; uint8_t xSwipeDistanceThreshold; uint8_t ySwipeDistanceThreshold; uint8_t edgeSwipeDistanceThreshold; uint8_t tapDistanceThreshold; uint8_t seqTapDistanceThreshold; uint8_t edgeBoundary; int8_t wheelPostscaler; int8_t wheelStartQuadrantCount; int8_t wheelReverseQuadrantCount; uint8_t pinchZoomThreshold;}mtouch_gesture_t;
Description: This structure lists down the gestures applicable.