Loading...
Searching...
No Matches
cst816s.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Koen Zandberg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
39
40#include <stdint.h>
41
42#include "periph/i2c.h"
43#include "periph/gpio.h"
44
45#ifdef MODULE_TOUCH_DEV
46#include "touch_dev.h"
47#endif
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
56typedef void (*cst816s_irq_cb_t)(void *arg);
57
66
80
84extern const char *cst816s_gesture_str[];
85
96
107
111typedef struct {
112#ifdef MODULE_TOUCH_DEV
113 touch_dev_t *dev;
114#endif
117 void *cb_arg;
118} cst816s_t;
119
123enum {
126};
127
140 cst816s_irq_cb_t cb, void *arg);
141
152
153#ifdef __cplusplus
154}
155#endif
156
gpio_flank_t
Definition periph_cpu.h:176
Low-level GPIO peripheral driver interface definitions.
cst816s_touch_t
cst816s touch event touch state
Definition cst816s.h:61
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:56
cst816s_gesture_t
CST816S Gesture types.
Definition cst816s.h:70
int cst816s_read(const cst816s_t *dev, cst816s_touch_data_t *data)
Read touch data from the cst816s device.
@ CST816S_ERR_IRQ
IRQ initialization error.
Definition cst816s.h:125
@ CST816S_OK
everything was fine
Definition cst816s.h:124
@ CST816S_TOUCH_DOWN
Touch press.
Definition cst816s.h:62
@ CST816S_TOUCH_CONTACT
Touch contact.
Definition cst816s.h:64
@ CST816S_TOUCH_UP
Touch release.
Definition cst816s.h:63
@ CST816S_GESTURE_LONG_PRESS
long press detected
Definition cst816s.h:78
@ CST816S_GESTURE_DOUBLE_CLICK
double click detected
Definition cst816s.h:77
@ CST816S_GESTURE_SLIDE_DOWN
downward slide detected
Definition cst816s.h:72
@ CST816S_GESTURE_NONE
no gesture detected
Definition cst816s.h:71
@ CST816S_GESTURE_SINGLE_CLICK
single click detected
Definition cst816s.h:76
@ CST816S_GESTURE_SLIDE_UP
upward slide detected
Definition cst816s.h:73
@ CST816S_GESTURE_SLIDE_LEFT
left slide detected
Definition cst816s.h:74
@ CST816S_GESTURE_SLIDE_RIGHT
right slide detected
Definition cst816s.h:75
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.
cst816s driver struct
Definition cst816s.h:100
uint8_t i2c_addr
I2C address.
Definition cst816s.h:102
i2c_t i2c_dev
I2C device which is used.
Definition cst816s.h:101
gpio_t irq
IRQ pin.
Definition cst816s.h:103
gpio_t reset
Device reset GPIO.
Definition cst816s.h:105
gpio_flank_t irq_flank
IRQ flank.
Definition cst816s.h:104
cst816s device descriptor
Definition cst816s.h:111
void * cb_arg
Extra argument for the callback.
Definition cst816s.h:117
cst816s_irq_cb_t cb
Configured IRQ event callback.
Definition cst816s.h:116
const cst816s_params_t * params
Device parameters.
Definition cst816s.h:115
cst816s touch event data
Definition cst816s.h:89
bool valid
Sample contains valid touch point.
Definition cst816s.h:90
cst816s_gesture_t gesture
Detected gesture.
Definition cst816s.h:91
cst816s_touch_t action
Press or release event.
Definition cst816s.h:92
uint16_t x
X coordinate.
Definition cst816s.h:93
uint16_t y
Y coordinate.
Definition cst816s.h:94