30
30
31
31
/* Includes ------------------------------------------------------------------*/
32
32
#include " Wire.h"
33
+ #include < Arduino.h>
34
+ #ifdef __MBED__
33
35
#include " mbed.h"
34
36
#include " pinDefinitions.h"
35
- #include < Arduino.h >
37
+ #endif
36
38
37
39
/* Exported defines ----------------------------------------------------------*/
38
40
#define GT911_I2C_ADDR_BA_BB (0x5D | 0x80 ) // 0xBA/0xBB - 0x5D (7bit address)
@@ -70,28 +72,31 @@ struct GDTpoint_s {
70
72
class Arduino_GigaDisplayTouch {
71
73
public:
72
74
/* *
73
- * @brief Construct a new touch controller for Giga Display Shield.
74
- *
75
- * @param wire A reference to the Wire interface to be used for communication
76
- * with the touch controller.
77
- * @param intPin The interrupt pin number for the touch controller.
78
- * @param rstPin The reset pin number for the touch controller.
79
- * @param addr The device address for the touch controller.
80
- */
81
- #if defined(ARDUINO_GIGA)
82
- Arduino_GigaDisplayTouch (TwoWire &wire = Wire1,
83
- uint8_t intPin = PinNameToIndex(PI_1),
84
- uint8_t rstPin = PinNameToIndex(PI_2),
85
- uint8_t addr = GT911_I2C_ADDR_BA_BB);
86
- #elif defined(ARDUINO_PORTENTA_H7_M7)
87
- Arduino_GigaDisplayTouch (TwoWire &wire = Wire,
88
- uint8_t intPin = PinNameToIndex(PD_4),
89
- uint8_t rstPin = PinNameToIndex(PD_5),
90
- uint8_t addr = GT911_I2C_ADDR_BA_BB);
91
- #else
92
- Arduino_GigaDisplayTouch (TwoWire &wire, uint8_t intPin, uint8_t rstPin,
93
- uint8_t addr);
94
- #endif
75
+ * @brief Construct a new touch controller for Giga Display Shield.
76
+ *
77
+ * @param wire A reference to the Wire interface to be used for communication
78
+ * with the touch controller.
79
+ * @param intPin The interrupt pin number for the touch controller.
80
+ * @param rstPin The reset pin number for the touch controller.
81
+ * @param addr The device address for the touch controller.
82
+ */
83
+ #if defined(__ZEPHYR__)
84
+ Arduino_GigaDisplayTouch ();
85
+ #elif defined(ARDUINO_GIGA)
86
+ Arduino_GigaDisplayTouch (TwoWire &wire = Wire1,
87
+ uint8_t intPin = PinNameToIndex(PI_1),
88
+ uint8_t rstPin = PinNameToIndex(PI_2),
89
+ uint8_t addr = GT911_I2C_ADDR_BA_BB);
90
+ #elif defined(ARDUINO_PORTENTA_H7_M7)
91
+ Arduino_GigaDisplayTouch (TwoWire &wire = Wire,
92
+ uint8_t intPin = PinNameToIndex(PD_4),
93
+ uint8_t rstPin = PinNameToIndex(PD_5),
94
+ uint8_t addr = GT911_I2C_ADDR_BA_BB);
95
+ #else
96
+ Arduino_GigaDisplayTouch (TwoWire &wire, uint8_t intPin, uint8_t rstPin,
97
+ uint8_t addr);
98
+ #endif
99
+
95
100
~Arduino_GigaDisplayTouch ();
96
101
97
102
/* *
@@ -107,12 +112,12 @@ class Arduino_GigaDisplayTouch {
107
112
*/
108
113
void end ();
109
114
110
- /* *
111
- * @brief Check if a touch event is detected and get the touch points.
112
- * @param points The array containing the coordinates of the touch points.
113
- * @return uint8_t The number of detected touch points.
114
- */
115
- uint8_t getTouchPoints (GDTpoint_t *points);
115
+ /* *
116
+ * @brief Check if a touch event is detected and get the touch points.
117
+ * @param points The array containing the coordinates of the touch points.
118
+ * @return uint8_t The number of detected touch points.
119
+ */
120
+ uint8_t getTouchPoints (GDTpoint_t *points);
116
121
117
122
/* *
118
123
* @brief Attach an interrupt handler function for touch detection callbacks.
@@ -121,11 +126,12 @@ class Arduino_GigaDisplayTouch {
121
126
void onDetect (void (*handler)(uint8_t , GDTpoint_t *));
122
127
123
128
private:
129
+ #if defined(__MBED__)
124
130
TwoWire &_wire;
125
131
uint8_t _intPin;
126
- mbed::InterruptIn _irqInt;
127
132
uint8_t _rstPin;
128
133
uint8_t _addr;
134
+ mbed::InterruptIn _irqInt;
129
135
GDTpoint_t _points[GT911_MAX_CONTACTS];
130
136
void (*_gt911TouchHandler)(uint8_t , GDTpoint_t *);
131
137
@@ -134,6 +140,8 @@ class Arduino_GigaDisplayTouch {
134
140
uint8_t _gt911ReadOp (uint16_t reg, uint8_t *data, uint8_t len);
135
141
void _gt911onIrq ();
136
142
uint8_t _gt911ReadInputCoord (uint8_t *pointsbuf, uint8_t &contacts);
143
+
144
+ #endif
137
145
};
138
146
139
- #endif /* __ARDUINO_GIGADISPLAYTOUCH_H */
147
+ #endif /* __ARDUINO_GIGADISPLAYTOUCH_H */
0 commit comments