Loading...
Searching...
No Matches
cst816s.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Koen Zandberg
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
41#ifndef CST816S_H
42#define CST816S_H
43
44#include <stdint.h>
45
46#include "periph/i2c.h"
47#include "periph/gpio.h"
48
49#ifdef MODULE_TOUCH_DEV
50#include "touch_dev.h"
51#endif
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
60typedef void (*cst816s_irq_cb_t)(void *arg);
61
70
84
88extern const char *cst816s_gesture_str[];
89
99
110
114typedef struct {
115#ifdef MODULE_TOUCH_DEV
116 touch_dev_t *dev;
117#endif
120 void *cb_arg;
121} cst816s_t;
122
126enum {
129};
130
143 cst816s_irq_cb_t cb, void *arg);
144
155
156#ifdef __cplusplus
157}
158#endif
159
160#endif /* CST816S_H */
gpio_flank_t
Definition periph_cpu.h:180
Low-level GPIO peripheral driver interface definitions.
cst816s_touch_t
cst816s touch event touch state
Definition cst816s.h:65
const char * cst816s_gesture_str[]
string versions of the cst816 gestures
int cst816s_init(cst816s_t *dev, const cst816s_params_t *params, cst816s_irq_cb_t cb, void *arg)
Initialize the given cst816s device.
void(* cst816s_irq_cb_t)(void *arg)
callback definition
Definition cst816s.h:60
cst816s_gesture_t
CST816S Gesture types.
Definition cst816s.h:74
int cst816s_read(const cst816s_t *dev, cst816s_touch_data_t *data)
Read touch data from the cst816s device.
@ CST816S_TOUCH_DOWN
Touch press.
Definition cst816s.h:66
@ CST816S_TOUCH_CONTACT
Touch contact.
Definition cst816s.h:68
@ CST816S_TOUCH_UP
Touch release.
Definition cst816s.h:67
@ CST816S_ERR_IRQ
IRQ initialization error.
Definition cst816s.h:128
@ CST816S_OK
everything was fine
Definition cst816s.h:127
@ CST816S_GESTURE_LONG_PRESS
long press detected
Definition cst816s.h:82
@ CST816S_GESTURE_DOUBLE_CLICK
double click detected
Definition cst816s.h:81
@ CST816S_GESTURE_SLIDE_DOWN
downward slide detected
Definition cst816s.h:76
@ CST816S_GESTURE_NONE
no gesture detected
Definition cst816s.h:75
@ CST816S_GESTURE_SINGLE_CLICK
single click detected
Definition cst816s.h:80
@ CST816S_GESTURE_SLIDE_UP
upward slide detected
Definition cst816s.h:77
@ CST816S_GESTURE_SLIDE_LEFT
left slide detected
Definition cst816s.h:78
@ CST816S_GESTURE_SLIDE_RIGHT
right slide detected
Definition cst816s.h:79
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:151
Low-level I2C peripheral driver interface definition.
cst816s driver struct
Definition cst816s.h:103
uint8_t i2c_addr
I2C address.
Definition cst816s.h:105
i2c_t i2c_dev
I2C device which is used.
Definition cst816s.h:104
gpio_t irq
IRQ pin.
Definition cst816s.h:106
gpio_t reset
Device reset GPIO.
Definition cst816s.h:108
gpio_flank_t irq_flank
IRQ flank.
Definition cst816s.h:107
cst816s device descriptor
Definition cst816s.h:114
void * cb_arg
Extra argument for the callback.
Definition cst816s.h:120
cst816s_irq_cb_t cb
Configured IRQ event callback.
Definition cst816s.h:119
const cst816s_params_t * params
Device parameters.
Definition cst816s.h:118
cst816s touch event data
Definition cst816s.h:93
cst816s_gesture_t gesture
Detected gesture.
Definition cst816s.h:94
cst816s_touch_t action
Press or release event.
Definition cst816s.h:95
uint16_t x
X coordinate.
Definition cst816s.h:96
uint16_t y
Y coordinate.
Definition cst816s.h:97
Generic type for a touch device.
Definition touch_dev.h:116