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
9#pragma once
10
42
43#include <stdint.h>
44
45#include "periph/i2c.h"
46#include "periph/gpio.h"
47
48#ifdef MODULE_TOUCH_DEV
49#include "touch_dev.h"
50#endif
51
52#ifdef __cplusplus
53extern "C" {
54#endif
55
59typedef void (*cst816s_irq_cb_t)(void *arg);
60
69
83
87extern const char *cst816s_gesture_str[];
88
98
109
113typedef struct {
114#ifdef MODULE_TOUCH_DEV
115 touch_dev_t *dev;
116#endif
119 void *cb_arg;
120} cst816s_t;
121
125enum {
128};
129
142 cst816s_irq_cb_t cb, void *arg);
143
154
155#ifdef __cplusplus
156}
157#endif
158
gpio_flank_t
Definition periph_cpu.h:179
Low-level GPIO peripheral driver interface definitions.
cst816s_touch_t
cst816s touch event touch state
Definition cst816s.h:64
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:59
cst816s_gesture_t
CST816S Gesture types.
Definition cst816s.h:73
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:127
@ CST816S_OK
everything was fine
Definition cst816s.h:126
@ CST816S_TOUCH_DOWN
Touch press.
Definition cst816s.h:65
@ CST816S_TOUCH_CONTACT
Touch contact.
Definition cst816s.h:67
@ CST816S_TOUCH_UP
Touch release.
Definition cst816s.h:66
@ CST816S_GESTURE_LONG_PRESS
long press detected
Definition cst816s.h:81
@ CST816S_GESTURE_DOUBLE_CLICK
double click detected
Definition cst816s.h:80
@ CST816S_GESTURE_SLIDE_DOWN
downward slide detected
Definition cst816s.h:75
@ CST816S_GESTURE_NONE
no gesture detected
Definition cst816s.h:74
@ CST816S_GESTURE_SINGLE_CLICK
single click detected
Definition cst816s.h:79
@ CST816S_GESTURE_SLIDE_UP
upward slide detected
Definition cst816s.h:76
@ CST816S_GESTURE_SLIDE_LEFT
left slide detected
Definition cst816s.h:77
@ CST816S_GESTURE_SLIDE_RIGHT
right slide detected
Definition cst816s.h:78
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.
cst816s driver struct
Definition cst816s.h:102
uint8_t i2c_addr
I2C address.
Definition cst816s.h:104
i2c_t i2c_dev
I2C device which is used.
Definition cst816s.h:103
gpio_t irq
IRQ pin.
Definition cst816s.h:105
gpio_t reset
Device reset GPIO.
Definition cst816s.h:107
gpio_flank_t irq_flank
IRQ flank.
Definition cst816s.h:106
cst816s device descriptor
Definition cst816s.h:113
void * cb_arg
Extra argument for the callback.
Definition cst816s.h:119
cst816s_irq_cb_t cb
Configured IRQ event callback.
Definition cst816s.h:118
const cst816s_params_t * params
Device parameters.
Definition cst816s.h:117
cst816s touch event data
Definition cst816s.h:92
cst816s_gesture_t gesture
Detected gesture.
Definition cst816s.h:93
cst816s_touch_t action
Press or release event.
Definition cst816s.h:94
uint16_t x
X coordinate.
Definition cst816s.h:95
uint16_t y
Y coordinate.
Definition cst816s.h:96