Loading...
Searching...
No Matches
touch_dev_gestures.h
1/*
2 * Copyright (C) 2023 Gunar Schorcht
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
143#ifndef TOUCH_DEV_GESTURES_H
144#define TOUCH_DEV_GESTURES_H
145
146#ifdef __cplusplus
147extern "C" {
148#endif
149
150#include <stddef.h>
151#include <stdint.h>
152#include <stdbool.h>
153
154#include "touch_dev.h"
155
159#define TOUCH_DEV_TOUCHES_MAX_NUMOF 2
160
164#ifndef CONFIG_TOUCH_DEV_SWIPE_TRESH
165#define CONFIG_TOUCH_DEV_SWIPE_TRESH 5
166#endif
167
171#ifndef CONFIG_TOUCH_DEV_PRESS_TIME_MS
172#define CONFIG_TOUCH_DEV_PRESS_TIME_MS 600
173#endif
174
178#ifndef CONFIG_TOUCH_DEV_DOUBLE_TIME_MS
179#define CONFIG_TOUCH_DEV_DOUBLE_TIME_MS 400
180#endif
181
192
210
222
231
242 touch_t *pos);
243
244#ifdef __cplusplus
245}
246#endif
247
248#endif /* TOUCH_DEV_GESTURES_H */
touch_dev_gesture_t
Touch gesture events.
void touch_dev_init_gesture(touch_dev_t *dev, touch_dev_gesture_ctx_t *ctx)
Initialize gesture recognition.
#define TOUCH_DEV_TOUCHES_MAX_NUMOF
Maximum number of touches supported by gesture recognition.
touch_dev_gesture_t touch_dev_recognize_gesture(touch_dev_gesture_ctx_t *ctx, touch_t *pos)
Recognize gestures by handling next touch device event.
touch_dev_state_t
Touch device states used for gesture recognition.
@ TOUCH_DEV_GEST_PRESSED
Long press recognized at the given position.
@ TOUCH_DEV_GEST_ZOOM_OUT
Zoom out (pinch) recognized, no position is given.
@ TOUCH_DEV_GEST_DOUBLE_TAP
Double tap recognized at the given position.
@ TOUCH_DEV_GEST_NONE
No gesture recognized.
@ TOUCH_DEV_GEST_MOVE
Moving while pressed recognized, current position is given.
@ TOUCH_DEV_GEST_SINGLE_TAP
Single tap recognized at the given position.
@ TOUCH_DEV_GEST_SWIPE_RIGHT
Swipe right recognized, no position is given.
@ TOUCH_DEV_GEST_ZOOM_IN
Zoom in (spread) recognized, no position is given.
@ TOUCH_DEV_GEST_SWIPE_UP
Swipe up recognized, no position is given.
@ TOUCH_DEV_GEST_SWIPE_DOWN
Swipe down recognized, no position is given.
@ TOUCH_DEV_GEST_SWIPE_LEFT
Swipe left recognized, no position is given.
@ TOUCH_DEV_GEST_RELEASED
Release after a long press at given position.
@ TOUCH_DEV_STATE_WAIT_FOR_RELEASE
gesture detected, waiting for releasing touches
@ TOUCH_DEV_STATE_PRESSED
a long press is detected
@ TOUCH_DEV_STATE_RELEASED
no touches detected, default state
@ TOUCH_DEV_STATE_TAPPED_MULTIPLE
a second touch is detected
@ TOUCH_DEV_STATE_TAPPED_SINGLE
a single touch is detected
Context information for a touch device needed for gesture recognition.
uint8_t prev_num
Previous number of touches.
uint32_t t_prev_tap
Time of previous tap.
touch_dev_t * dev
Pointer to the touch device.
uint32_t t_changed
Time of last state change in ms.
touch_dev_state_t state
State of touch device.
Generic type for a touch device.
Definition touch_dev.h:116
Touch coordinates.
Definition touch_dev.h:44