-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTPL-ARD-GIGADT-001-PointsPolling.ino
187 lines (141 loc) · 4.74 KB
/
TPL-ARD-GIGADT-001-PointsPolling.ino
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/**
* Test Scenario ID : TPL-ARD-GIGADT-001-PointsPolling
*
* This sketch checks that correct number of touch points are detected by the touch controller.
*
* Test Case IDs :
* TPL-ARD-GIGADT-001-PointsPolling-1 -> Touch screen with one finger
* TPL-ARD-GIGADT-001-PointsPolling-2 -> Touch screen with two fingers
* TPL-ARD-GIGADT-001-PointsPolling-3 -> Touch screen with three fingers
* TPL-ARD-GIGADT-001-PointsPolling-4 -> Touch screen with four fingers
* TPL-ARD-GIGADT-001-PointsPolling-5 -> Touch screen with five fingers
* TPL-ARD-GIGADT-001-PointsPolling-6 -> Touch screen with six fingers
*
* Test Setup: Arduino GIGA R1 WiFi (ABX00063) with GIGA Display Touch Shield (ASX00039)
*
* Initial author: Ali Jahangiri @aliphys
*/
#include "Arduino_GigaDisplayTouch.h"
const char testScenarioID[] = "TPL-ARD-GIGADT-001-ValuePolling";
Arduino_GigaDisplayTouch touchDetector;
bool isTouchDetected = false;
void setup() {
Serial.begin(115200);
while (!Serial){}
Serial.println();
Serial.println("---------");
Serial.print("Test Scenario ID: ");
Serial.println(testScenarioID);
Serial.println("---------");
Serial.println();
if (touchDetector.begin()) {
Serial.print("Touch controller init - OK");
}
else {
Serial.print("Touch controller init - FAILED");
while (1);
}
Serial.println("---");
Serial.print("Test Case ID: ");
Serial.println("TPL-ARD-GIGADT-001-PointsPolling-1");
Serial.println("Touch screen with one finger...");
isTouchDetected = false;
while(!isTouchDetected) {
uint8_t contacts;
GDTpoint_t points[5];
contacts = touchDetector.getTouchPoints(points);
if (contacts == 1) {
Serial.print("Single Touch Detected!: ");
Serial.print(points[0].x);
Serial.print(" ");
Serial.println(points[0].y);
isTouchDetected = true;
}
delay(1);
}
delay(2000);
Serial.println("---");
Serial.print("Test Case ID: ");
Serial.println("TPL-ARD-GIGADT-001-PointsPolling-2");
Serial.println("Touch screen with two fingers...");
isTouchDetected = false;
while(!isTouchDetected) {
uint8_t contacts;
GDTpoint_t points[5];
contacts = touchDetector.getTouchPoints(points);
if (contacts == 2) {
Serial.print("Two Fingers Detected!: ");
Serial.print(points[0].x);
Serial.print(" ");
Serial.println(points[0].y);
isTouchDetected = true;
}
delay(1);
}
delay(2000);
Serial.println("---");
Serial.print("Test Case ID: ");
Serial.println("TPL-ARD-GIGADT-001-PointsPolling-3");
Serial.println("Touch screen with three fingers...");
isTouchDetected = false;
while(!isTouchDetected) {
uint8_t contacts;
GDTpoint_t points[5];
contacts = touchDetector.getTouchPoints(points);
if (contacts == 3) {
Serial.print("Three Fingers Detected!: ");
Serial.print(points[0].x);
Serial.print(" ");
Serial.println(points[0].y);
isTouchDetected = true;
}
delay(1);
}
delay(2000);
Serial.println("---");
Serial.print("Test Case ID: ");
Serial.println("TPL-ARD-GIGADT-001-PointsPolling-4");
Serial.println("Touch screen with four fingers...");
isTouchDetected = false;
while(!isTouchDetected) {
uint8_t contacts;
GDTpoint_t points[5];
contacts = touchDetector.getTouchPoints(points);
if (contacts == 4) {
Serial.print("Four Fingers Detected!: ");
Serial.print(points[0].x);
Serial.print(" ");
Serial.println(points[0].y);
isTouchDetected = true;
}
delay(1);
}
delay(2000);
Serial.println("---");
Serial.print("Test Case ID: ");
Serial.println("TPL-ARD-GIGADT-001-PointsPolling-5");
Serial.println("Touch screen with five fingers...");
isTouchDetected = false;
while(!isTouchDetected) {
uint8_t contacts;
GDTpoint_t points[5];
contacts = touchDetector.getTouchPoints(points);
if (contacts == 5) {
Serial.print("Five Fingers Detected!: ");
Serial.print(points[0].x);
Serial.print(" ");
Serial.println(points[0].y);
isTouchDetected = true;
}
delay(1);
}
delay(2000);
Serial.println();
Serial.println("---------");
Serial.print("End of Test Scenario ID: ");
Serial.println(testScenarioID);
Serial.println("---------");
Serial.println();
}
void loop() {
}