You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this->outputReceiver->outputFlag=false; // Clear Flag
1411
+
returntrue;
1412
+
}
1413
+
}
1414
+
returnfalse;
1415
+
}
1416
+
uint8_t* BleGamepad::getOutputBuffer(){
1417
+
if(enableOutputReport && outputReceiver){
1418
+
memcpy(outputBackupBuffer, outputReceiver->outputBuffer, outputReportLength); // Creating a backup to avoid buffer being overwritten while processing data
bleGamepadConfig.setEnableOutputReport(true); // (Necessary) Enable Output Report. Default is false.
19
+
bleGamepadConfig.setOutputReportLength(128); // (Optional) Set Report Length 128(Bytes). The default value is 64 bytes.
20
+
// Do not set the OutputReportLength too large, otherwise it will be truncated. For example, if the hexadecimal value of 10000 in decimal is 0x2710, it will be truncated to 0x710.
21
+
22
+
bleGamepadConfig.setHidReportId(0x05); // (Optional) Set ReportID to 0x05.
23
+
//When you send data from the upper computer to ESP32, you must send the ReportID in the first byte! The default ReportID is 3.
24
+
25
+
bleGamepadConfig.setButtonCount(numOfButtons);
26
+
27
+
bleGamepadConfig.setAxesMin(0x0000); // 0 --> int16_t - 16 bit signed integer - Can be in decimal or hexadecimal
28
+
bleGamepadConfig.setAxesMax(0x7FFF); // 32767 --> int16_t - 16 bit signed integer - Can be in decimal or hexadecimal
29
+
30
+
// Try NOT to modify VID, otherwise it may cause the host to be unable to send output reports to the device.
31
+
bleGamepadConfig.setVid(0x3412);
32
+
// You can freely set the PID
33
+
bleGamepadConfig.setPid(0x0100);
34
+
bleGamepad.begin(&bleGamepadConfig);
35
+
36
+
// changing bleGamepadConfig after the begin function has no effect, unless you call the begin function again
37
+
}
38
+
39
+
voidloop() {
40
+
if (bleGamepad.isConnected()) {
41
+
if (bleGamepad.isOutputReceived()) {
42
+
uint8_t* buffer = bleGamepad.getOutputBuffer();
43
+
Serial.print("Receive: ");
44
+
for (int i = 0; i < 64; i++) {
45
+
Serial.printf("0x%X ",buffer[i]); // Print data from buffer
0 commit comments