projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ensure that the Keyboard and Mouse demos adhere to the boot protocol specification...
[pub/USBasp.git]
/
Demos
/
Keyboard
/
Keyboard.c
diff --git
a/Demos/Keyboard/Keyboard.c
b/Demos/Keyboard/Keyboard.c
index
a26f357
..
d6b254f
100644
(file)
--- a/
Demos/Keyboard/Keyboard.c
+++ b/
Demos/Keyboard/Keyboard.c
@@
-385,8
+385,9
@@
void ProcessLEDReport(uint8_t LEDReport)
/** Sends the next HID report to the host, via the keyboard data endpoint. */
\r
static inline void SendNextReport(void)
\r
{
\r
/** Sends the next HID report to the host, via the keyboard data endpoint. */
\r
static inline void SendNextReport(void)
\r
{
\r
- USB_KeyboardReport_Data_t KeyboardReportData;
\r
- bool SendReport = true;
\r
+ static USB_KeyboardReport_Data_t PrevKeyboardReportData;
\r
+ USB_KeyboardReport_Data_t KeyboardReportData;
\r
+ bool SendReport = true;
\r
\r
/* Create the next keyboard report for transmission to the host */
\r
CreateKeyboardReport(&KeyboardReportData);
\r
\r
/* Create the next keyboard report for transmission to the host */
\r
CreateKeyboardReport(&KeyboardReportData);
\r
@@
-402,11
+403,14
@@
static inline void SendNextReport(void)
}
\r
else
\r
{
\r
}
\r
else
\r
{
\r
- /* Idle period not elapsed, indicate that a report must not be sent */
\r
- SendReport =
false;
\r
+ /* Idle period not elapsed, indicate that a report must not be sent
unless the report has changed
*/
\r
+ SendReport =
(memcmp(&PrevKeyboardReportData, &KeyboardReportData, sizeof(USB_KeyboardReport_Data_t)) != 0);
\r
}
\r
}
\r
\r
}
\r
}
\r
\r
+ /* Save the current report data for later comparison to check for changes */
\r
+ PrevKeyboardReportData = KeyboardReportData;
\r
+
\r
/* Select the Keyboard Report Endpoint */
\r
Endpoint_SelectEndpoint(KEYBOARD_EPNUM);
\r
\r
/* Select the Keyboard Report Endpoint */
\r
Endpoint_SelectEndpoint(KEYBOARD_EPNUM);
\r
\r