1
+ /*
2
+ * Copyright 2023 Arduino SA
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify
5
+ * it under the terms of the GNU Lesser General Public License as published by
6
+ * the Free Software Foundation, either version 3 of the License, or
7
+ * (at your option) any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ * GNU Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public License
15
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ */
18
+
1
19
/* *
2
- ******************************************************************************
3
- * @file Arduino_GigaDisplayTouch.h
4
- * @author Leonardo Cavagnis
5
- * @version
6
- * @date
7
- * @brief
8
- ******************************************************************************
9
- */
10
-
11
- #ifndef _ARDUINO_GIGADISPLAYTOUCH_H
12
- #define _ARDUINO_GIGADISPLAYTOUCH_H
20
+ * @file Arduino_GigaDisplayTouch.h
21
+ * @author Leonardo Cavagnis
22
+ * @brief Header file for the Arduino Giga Display Touch library.
23
+ *
24
+ * This library allows to capture up to 5 concurrent touch points on Arduino Giga Display Shield.
25
+ * Supported controller: Goodix GT911
26
+ */
27
+
28
+ #ifndef __ARDUINO_GIGADISPLAYTOUCH_H
29
+ #define __ARDUINO_GIGADISPLAYTOUCH_H
13
30
14
31
/* Includes ------------------------------------------------------------------*/
15
32
#include < Arduino.h>
@@ -40,8 +57,21 @@ struct GDTpoint_s {
40
57
};
41
58
42
59
/* Class ----------------------------------------------------------------------*/
60
+
61
+ /* *
62
+ * @class Arduino_GigaDisplayTouch
63
+ * @brief Class for Giga Display Touch controller driver.
64
+ */
43
65
class Arduino_GigaDisplayTouch {
44
66
public:
67
+ /* *
68
+ * @brief Construct a new touch controller for Giga Display Shield.
69
+ *
70
+ * @param wire A reference to the Wire interface to be used for communication with the touch controller.
71
+ * @param intPin The interrupt pin number for the touch controller.
72
+ * @param rstPin The reset pin number for the touch controller.
73
+ * @param addr The device address for the touch controller.
74
+ */
45
75
#if defined(ARDUINO_GIGA)
46
76
Arduino_GigaDisplayTouch (TwoWire& wire = Wire1,
47
77
uint8_t intPin = PinNameToIndex(PI_1),
@@ -60,10 +90,33 @@ class Arduino_GigaDisplayTouch {
60
90
#endif
61
91
~Arduino_GigaDisplayTouch ();
62
92
93
+
94
+ /* *
95
+ * @brief Initialize the touch controller.
96
+ *
97
+ * @return true If the controller is correctly configured
98
+ * @return false Otherwise
99
+ */
63
100
bool begin ();
101
+
102
+ /* *
103
+ * @brief De-initialize the touch controller.
104
+ */
64
105
void end ();
65
106
107
+ /* *
108
+ * @brief Check if a touch event is detected and get the touch points.
109
+ * @param contacts The number of detected touch points.
110
+ * @param points The array containing the coordinates of the touch points.
111
+ * @return true If a touch event is detected
112
+ * @return false Otherwise
113
+ */
66
114
bool detect (uint8_t & contacts, GDTpoint_t* points);
115
+
116
+ /* *
117
+ * @brief Attach an interrupt handler function for touch detection callbacks.
118
+ * @param handler The pointer to the user-defined handler function.
119
+ */
67
120
void attach (void (*handler)(uint8_t , GDTpoint_t*));
68
121
private:
69
122
TwoWire& _wire;
@@ -81,4 +134,4 @@ class Arduino_GigaDisplayTouch {
81
134
uint8_t _gt911ReadInputCoord (uint8_t * pointsbuf, uint8_t & contacts);
82
135
};
83
136
84
- #endif /* _ARDUINO_GIGADISPLAYTOUCH_H */
137
+ #endif /* __ARDUINO_GIGADISPLAYTOUCH_H */
0 commit comments