mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Fixed "error: variable-sized object buf may not be initialized" warning
This commit is contained in:
parent
2dfb767093
commit
4651acd2c6
1 changed files with 13 additions and 2 deletions
|
@ -89,15 +89,26 @@ protected:
|
||||||
setLedOn(LED1); // Turn on the LED1
|
setLedOn(LED1); // Turn on the LED1
|
||||||
setLedHomeOn(); // Turn on the home LED
|
setLedHomeOn(); // Turn on the home LED
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
/** @name SwitchProParser implementation */
|
/** @name SwitchProParser implementation */
|
||||||
virtual void sendOutputReport(uint8_t *data, uint8_t len) {
|
virtual void sendOutputReport(uint8_t *data, uint8_t len) {
|
||||||
|
// Based on: https://github.com/Dan611/hid-procon
|
||||||
// The first 8 bytes are always the same. The actual report follows
|
// The first 8 bytes are always the same. The actual report follows
|
||||||
uint8_t buf[8 + len] = { 0x80 /* PROCON_REPORT_SEND_USB */, 0x92 /*PROCON_USB_DO_CMD */, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00 };
|
uint8_t buf[8 + len];
|
||||||
|
buf[0] = 0x80; // PROCON_REPORT_SEND_USB
|
||||||
|
buf[1] = 0x92; // PROCON_USB_DO_CMD
|
||||||
|
buf[2] = 0x00;
|
||||||
|
buf[3] = 0x31;
|
||||||
|
buf[4] = 0x00;
|
||||||
|
buf[5] = 0x00;
|
||||||
|
buf[6] = 0x00;
|
||||||
|
buf[7] = 0x00;
|
||||||
|
|
||||||
|
// Cope over the report
|
||||||
memcpy(buf + 8, data, len);
|
memcpy(buf + 8, data, len);
|
||||||
|
|
||||||
// Endpoint (control endpoint), Interface (0x00), Report Type (Output 0x02), Report ID (0x80), nbytes, data
|
// Endpoint (control endpoint), Interface (0x00), Report Type (Output 0x02), Report ID (0x80), nbytes, data
|
||||||
|
|
Loading…
Reference in a new issue