Loading...
Searching...
No Matches
touch_dev_gestures.h
1/*
2 * SPDX-FileCopyrightText: 2023 Gunar Schorcht
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
141
142#ifdef __cplusplus
143extern "C" {
144#endif
145
146#include <stddef.h>
147#include <stdint.h>
148#include <stdbool.h>
149
150#include "touch_dev.h"
151
155#define TOUCH_DEV_TOUCHES_MAX_NUMOF 2
156
160#ifndef CONFIG_TOUCH_DEV_SWIPE_TRESH
161#define CONFIG_TOUCH_DEV_SWIPE_TRESH 5
162#endif
163
167#ifndef CONFIG_TOUCH_DEV_PRESS_TIME_MS
168#define CONFIG_TOUCH_DEV_PRESS_TIME_MS 600
169#endif
170
174#ifndef CONFIG_TOUCH_DEV_DOUBLE_TIME_MS
175#define CONFIG_TOUCH_DEV_DOUBLE_TIME_MS 400
176#endif
177
188
206
218
227
238 touch_t *pos);
239
240#ifdef __cplusplus
241}
242#endif
243
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
struct touch_dev touch_dev_t
Forward declaration for touch device struct.
Definition touch_dev.h:35
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.
touch_t prev[TOUCH_DEV_TOUCHES_MAX_NUMOF]
Previous set of touches.
uint32_t t_changed
Time of last state change in ms.
touch_dev_state_t state
State of touch device.
Touch coordinates.
Definition touch_dev.h:40