Skip to content

Commit dd7b68f

Browse files
authored
Update TestReceivingOutputReport.ino - formatting
1 parent 2a5e82e commit dd7b68f

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

examples/TestReceivingOutputReport/TestReceivingOutputReport.ino

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
* Here is a C# testing program for sending OutputReport from the host to the device
44
* https://github.com/Sab1e-GitHub/HIDOutputDemo_CSharp
55
*/
6+
67
#include <BleGamepad.h>
78

89
#define numOfButtons 16
910

1011
BleGamepad bleGamepad;
1112
BleGamepadConfiguration bleGamepadConfig;
1213

13-
void setup() {
14+
void setup()
15+
{
1416
Serial.begin(115200);
1517
Serial.println("Starting BLE work!");
1618

@@ -22,7 +24,7 @@ void setup() {
2224
// 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.
2325

2426
bleGamepadConfig.setHidReportId(0x05); // (Optional) Set ReportID to 0x05.
25-
//When you send data from the upper computer to ESP32, you must send the ReportID in the first byte! The default ReportID is 3.
27+
// When you send data from the upper computer to ESP32, you must send the ReportID in the first byte! The default ReportID is 3.
2628

2729
bleGamepadConfig.setButtonCount(numOfButtons);
2830

@@ -31,21 +33,28 @@ void setup() {
3133

3234
// Try NOT to modify VID, otherwise it may cause the host to be unable to send output reports to the device.
3335
bleGamepadConfig.setVid(0x1234);
36+
3437
// You can freely set the PID
3538
bleGamepadConfig.setPid(0x0001);
3639
bleGamepad.begin(&bleGamepadConfig);
3740

38-
// changing bleGamepadConfig after the begin function has no effect, unless you call the begin function again
41+
// Changing bleGamepadConfig after the begin function has no effect, unless you call the begin function again
3942
}
4043

41-
void loop() {
42-
if (bleGamepad.isConnected()) {
43-
if (bleGamepad.isOutputReceived()) {
44+
void loop()
45+
{
46+
if (bleGamepad.isConnected())
47+
{
48+
if (bleGamepad.isOutputReceived())
49+
{
4450
uint8_t* buffer = bleGamepad.getOutputBuffer();
4551
Serial.print("Receive: ");
46-
for (int i = 0; i < 64; i++) {
52+
53+
for (int i = 0; i < 64; i++)
54+
{
4755
Serial.printf("0x%X ",buffer[i]); // Print data from buffer
4856
}
57+
4958
Serial.println("");
5059
}
5160
}

0 commit comments

Comments
 (0)