File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
libraries/USB/examples/HIDGamepad Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,29 @@ int8_t readAxis(uint8_t pin) {
187
187
return (int8_t )mapped;
188
188
};
189
189
190
+ // REPORT BREAKDOWN
191
+ void printReport (const GamepadReport &r) {
192
+ Serial.print (" Axes: " );
193
+ for (int i = 0 ; i < 6 ; i++) {
194
+ Serial.print (r.axis [i]);
195
+ Serial.print (" " );
196
+ }
197
+
198
+ Serial.print (" | Hat: " );
199
+ Serial.print (r.hat );
200
+
201
+ Serial.print (" | Buttons: " );
202
+ for (int i = 0 ; i < 3 ; i++) {
203
+ Serial.print (" 0b" );
204
+ for (int b = 7 ; b >= 0 ; b--) {
205
+ Serial.print ((r.buttons [i] >> b) & 0x01 );
206
+ }
207
+ Serial.print (" " );
208
+ }
209
+
210
+ Serial.println ();
211
+ }
212
+
190
213
void setup () {
191
214
Serial.begin (115200 );
192
215
Serial.setDebugOutput (true );
@@ -235,6 +258,9 @@ void loop() {
235
258
report.padding = 0 ;
236
259
memcpy (report.buttons , buttons, 3 );
237
260
261
+ // debug and test line
262
+ printReport (report);
263
+
238
264
// Send to host
239
265
if (HID.ready ()) {
240
266
Device.send (report);
You can’t perform that action at this time.
0 commit comments