Loading...
Searching...
No Matches
ft5x06.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Inria
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
9#pragma once
10
25
26#include <stdint.h>
27
28#include "periph/gpio.h"
29#include "periph/i2c.h"
30
31#include "ft5x06_constants.h"
32
33#ifdef MODULE_TOUCH_DEV
34#include "touch_dev.h"
35#endif
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
44typedef struct {
45 uint16_t x;
46 uint16_t y;
48
61
78
98
104typedef void (*ft5x06_event_cb_t)(void *arg);
105
123
127typedef struct {
128#ifdef MODULE_TOUCH_DEV
129 touch_dev_t *dev;
130#endif
132} ft5x06_t;
133
146int ft5x06_init(ft5x06_t *dev, const ft5x06_params_t *params,
147 ft5x06_event_cb_t cb, void *arg);
148
159int ft5x06_read_touch_positions(const ft5x06_t *dev, ft5x06_touch_position_t *positions, size_t len);
160
170int ft5x06_read_touch_count(const ft5x06_t *dev, uint8_t *count);
171
182
183#ifdef __cplusplus
184}
185#endif
186
Internal register addresses, bitfields and constants.
Low-level GPIO peripheral driver interface definitions.
ft5x06_touch_conv_t
Touch screen coordinate conversions.
Definition ft5x06.h:92
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:65
void(* ft5x06_event_cb_t)(void *arg)
Signature of the touch event callback triggered from interrupt.
Definition ft5x06.h:104
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:52
@ FT5X06_SWAP_XY
Swap XY, applied before optional mirroring.
Definition ft5x06.h:96
@ FT5X06_MIRROR_X
Mirror X, applied after optional swapping.
Definition ft5x06.h:94
@ FT5X06_NO_CONV
No conversion.
Definition ft5x06.h:93
@ FT5X06_MIRROR_Y
Mirror Y, applied after optional swapping.
Definition ft5x06.h:95
@ FT5X06_TYPE_FT5X06
FT5X06.
Definition ft5x06.h:66
@ FT5X06_TYPE_FT5X46
FT5X46.
Definition ft5x06.h:76
@ FT5X06_TYPE_FT3316
FT3316.
Definition ft5x06.h:73
@ FT5X06_TYPE_FT6X36
FT6X36.
Definition ft5x06.h:70
@ FT5X06_TYPE_FT5606
FT5606.
Definition ft5x06.h:67
@ FT5X06_TYPE_FT5336
FT5336.
Definition ft5x06.h:72
@ FT5X06_TYPE_FT6X06
FT6X06.
Definition ft5x06.h:69
@ FT5X06_TYPE_FT5X16
FT5X16.
Definition ft5x06.h:68
@ FT5X06_TYPE_FT5436I
FT5436I.
Definition ft5x06.h:74
@ FT5X06_TYPE_FT5X06I
FT5X06I.
Definition ft5x06.h:71
@ FT5X06_TYPE_FT5336I
FT5336I.
Definition ft5x06.h:75
@ FT5X06_TOUCH_ZOOM_OUT
Zoom out gesture detected.
Definition ft5x06.h:59
@ FT5X06_TOUCH_MOVE_RIGHT
Move right gesture detected.
Definition ft5x06.h:57
@ FT5X06_TOUCH_MOVE_LEFT
Move left gesture detected.
Definition ft5x06.h:55
@ FT5X06_TOUCH_NO_GESTURE
No gesture detected.
Definition ft5x06.h:53
@ FT5X06_TOUCH_ZOOM_IN
Zoom int gesture detected.
Definition ft5x06.h:58
@ FT5X06_TOUCH_MOVE_DOWN
Move down gesture detected.
Definition ft5x06.h:56
@ FT5X06_TOUCH_MOVE_UP
Move up gesture detected.
Definition ft5x06.h:54
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:144
struct touch_dev touch_dev_t
Forward declaration for touch device struct.
Definition touch_dev.h:38
Low-level I2C peripheral driver interface definition.
Device initialization parameters.
Definition ft5x06.h:113
uint16_t ymax
Touch screen max Y position.
Definition ft5x06.h:118
ft5x06_type_t type
Device type.
Definition ft5x06.h:121
uint8_t addr
Device I2C address.
Definition ft5x06.h:115
i2c_t i2c
I2C device which is used.
Definition ft5x06.h:114
uint16_t xmax
Touch screen max X position.
Definition ft5x06.h:117
ft5x06_touch_conv_t xyconv
Touch screen coordinates conversion, swapping is performed before mirroring.
Definition ft5x06.h:119
gpio_t int_pin
Touch screen interrupt pin.
Definition ft5x06.h:116
Device descriptor for the driver.
Definition ft5x06.h:127
const ft5x06_params_t * params
Initialization parameters.
Definition ft5x06.h:131
Touch position structure.
Definition ft5x06.h:44
uint16_t x
X position.
Definition ft5x06.h:45
uint16_t y
Y position.
Definition ft5x06.h:46