forked from Boldie/lv_drv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xpt2046.h
68 lines (56 loc) · 1.41 KB
/
xpt2046.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* @file XPT2046.h
*
*/
#ifndef XPT2046_H
#define XPT2046_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
#include "lvgl/lvgl.h"
/**
* Initialize the XPT2046
*/
void xpt2046_init(void);
/**
* Get the current position and state of the touchpad
*
* @param data store the read data here
* @return false: because no more data to be read
*/
bool xpt2046_read(lv_indev_drv_t * drv, lv_indev_data_t * data);
/**
* Sets the read function to raw mode which returns the raw and
* uncorrected points from the touch screen.
*
* @param on: Set to true to turn this mode on.
*/
void xpt2046_setRawMode( bool on );
/**
* This struct holds a calibration point.
*/
typedef struct{
/// Point in touch screen coordinates from drivers raw mode.
lv_point_t raw;
/// Point from screen coordinates the user touched.
lv_point_t screen;
} CalibPoint;
/**
* Calculate a new calibration from the given points. It needs at least
* 3 points from the user, more are possible.
*
* @param points Array of point pairs with the length of count.
* @param count The number of points within the points array.
* @return True if calibration was successful, otherwise false.
*/
bool xpt2046_calculateCalibration( CalibPoint* points, uint8_t count );
/**
* Retrieve if the calibration is valid.
*/
bool xpt2046_hasValidCalbiration();
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* XPT2046_H */