Loading...
Searching...
No Matches
ft5x06.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021 Inria
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
22
23#include <stdint.h>
24
25#include "periph/gpio.h"
26#include "periph/i2c.h"
27
28#include "ft5x06_constants.h"
29
30#ifdef MODULE_TOUCH_DEV
31#include "touch_dev.h"
32#endif
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
41typedef struct {
42 uint16_t x;
43 uint16_t y;
45
58
75
95
101typedef void (*ft5x06_event_cb_t)(void *arg);
102
120
124typedef struct {
125#ifdef MODULE_TOUCH_DEV
126 touch_dev_t *dev;
127#endif
129} ft5x06_t;
130
143int ft5x06_init(ft5x06_t *dev, const ft5x06_params_t *params,
144 ft5x06_event_cb_t cb, void *arg);
145
156int ft5x06_read_touch_positions(const ft5x06_t *dev, ft5x06_touch_position_t *positions, size_t len);
157
167int ft5x06_read_touch_count(const ft5x06_t *dev, uint8_t *count);
168
179
180#ifdef __cplusplus
181}
182#endif
183
Internal register addresses, bitfields and constants.
Low-level GPIO peripheral driver interface definitions.
ft5x06_touch_conv_t
Touch screen coordinate conversions.
Definition ft5x06.h:89
int ft5x06_read_touch_gesture(const ft5x06_t *dev, ft5x06_touch_gesture_t *gesture)
Read the gesture detected.
ft5x06_type_t
Device type.
Definition ft5x06.h:62
void(* ft5x06_event_cb_t)(void *arg)
Signature of the touch event callback triggered from interrupt.
Definition ft5x06.h:101
int ft5x06_read_touch_positions(const ft5x06_t *dev, ft5x06_touch_position_t *positions, size_t len)
Read the touch positions.
int ft5x06_read_touch_count(const ft5x06_t *dev, uint8_t *count)
Read the number of touch.
int ft5x06_init(ft5x06_t *dev, const ft5x06_params_t *params, ft5x06_event_cb_t cb, void *arg)
Initialize the given device.
ft5x06_touch_gesture_t
Touch gesture.
Definition ft5x06.h:49
@ FT5X06_SWAP_XY
Swap XY, applied before optional mirroring.
Definition ft5x06.h:93
@ FT5X06_MIRROR_X
Mirror X, applied after optional swapping.
Definition ft5x06.h:91
@ FT5X06_NO_CONV
No conversion.
Definition ft5x06.h:90
@ FT5X06_MIRROR_Y
Mirror Y, applied after optional swapping.
Definition ft5x06.h:92
@ FT5X06_TYPE_FT5X06
FT5X06.
Definition ft5x06.h:63
@ FT5X06_TYPE_FT5X46
FT5X46.
Definition ft5x06.h:73
@ FT5X06_TYPE_FT3316
FT3316.
Definition ft5x06.h:70
@ FT5X06_TYPE_FT6X36
FT6X36.
Definition ft5x06.h:67
@ FT5X06_TYPE_FT5606
FT5606.
Definition ft5x06.h:64
@ FT5X06_TYPE_FT5336
FT5336.
Definition ft5x06.h:69
@ FT5X06_TYPE_FT6X06
FT6X06.
Definition ft5x06.h:66
@ FT5X06_TYPE_FT5X16
FT5X16.
Definition ft5x06.h:65
@ FT5X06_TYPE_FT5436I
FT5436I.
Definition ft5x06.h:71
@ FT5X06_TYPE_FT5X06I
FT5X06I.
Definition ft5x06.h:68
@ FT5X06_TYPE_FT5336I
FT5336I.
Definition ft5x06.h:72
@ FT5X06_TOUCH_ZOOM_OUT
Zoom out gesture detected.
Definition ft5x06.h:56
@ FT5X06_TOUCH_MOVE_RIGHT
Move right gesture detected.
Definition ft5x06.h:54
@ FT5X06_TOUCH_MOVE_LEFT
Move left gesture detected.
Definition ft5x06.h:52
@ FT5X06_TOUCH_NO_GESTURE
No gesture detected.
Definition ft5x06.h:50
@ FT5X06_TOUCH_ZOOM_IN
Zoom int gesture detected.
Definition ft5x06.h:55
@ FT5X06_TOUCH_MOVE_DOWN
Move down gesture detected.
Definition ft5x06.h:53
@ FT5X06_TOUCH_MOVE_UP
Move up gesture detected.
Definition ft5x06.h:51
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:155
struct touch_dev touch_dev_t
Forward declaration for touch device struct.
Definition touch_dev.h:35
Low-level I2C peripheral driver interface definition.
Device initialization parameters.
Definition ft5x06.h:110
uint16_t ymax
Touch screen max Y position.
Definition ft5x06.h:115
ft5x06_type_t type
Device type.
Definition ft5x06.h:118
uint8_t addr
Device I2C address.
Definition ft5x06.h:112
i2c_t i2c
I2C device which is used.
Definition ft5x06.h:111
uint16_t xmax
Touch screen max X position.
Definition ft5x06.h:114
ft5x06_touch_conv_t xyconv
Touch screen coordinates conversion, swapping is performed before mirroring.
Definition ft5x06.h:116
gpio_t int_pin
Touch screen interrupt pin.
Definition ft5x06.h:113
Device descriptor for the driver.
Definition ft5x06.h:124
const ft5x06_params_t * params
Initialization parameters.
Definition ft5x06.h:128
Touch position structure.
Definition ft5x06.h:41
uint16_t x
X position.
Definition ft5x06.h:42
uint16_t y
Y position.
Definition ft5x06.h:43