aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2012-09-13 20:30:00 +0000
committerDean Camera <dean@fourwalledcubicle.com>2012-09-13 20:30:00 +0000
commitdf14c97519f52f14fcc5b4aaadb504342ae9c696 (patch)
treebcddd7629d2958aff44794cbc4a43fd06a84cb61 /Demos/Device
parentc93259fbdbfec154b37fd4c3a4e1b43f5b7265e5 (diff)
downloadlufa-df14c97519f52f14fcc5b4aaadb504342ae9c696.tar.gz
lufa-df14c97519f52f14fcc5b4aaadb504342ae9c696.tar.bz2
lufa-df14c97519f52f14fcc5b4aaadb504342ae9c696.zip
Make CPPCheck tool happy by altering the program flow in the low level keyboard example, so that the SendReport variable is not overwritten before its first read access.
Diffstat (limited to 'Demos/Device')
-rw-r--r--Demos/Device/LowLevel/Keyboard/Keyboard.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.c b/Demos/Device/LowLevel/Keyboard/Keyboard.c
index 3755d09de..aeaa045de 100644
--- a/Demos/Device/LowLevel/Keyboard/Keyboard.c
+++ b/Demos/Device/LowLevel/Keyboard/Keyboard.c
@@ -294,14 +294,11 @@ void SendNextReport(void)
{
static USB_KeyboardReport_Data_t PrevKeyboardReportData;
USB_KeyboardReport_Data_t KeyboardReportData;
- bool SendReport = true;
+ bool SendReport = false;
/* Create the next keyboard report for transmission to the host */
CreateKeyboardReport(&KeyboardReportData);
- /* Check to see if the report data has changed - if so a report MUST be sent */
- SendReport = (memcmp(&PrevKeyboardReportData, &KeyboardReportData, sizeof(USB_KeyboardReport_Data_t)) != 0);
-
/* Check if the idle period is set and has elapsed */
if (IdleCount && (!(IdleMSRemaining)))
{
@@ -311,6 +308,11 @@ void SendNextReport(void)
/* Idle period is set and has elapsed, must send a report to the host */
SendReport = true;
}
+ else
+ {
+ /* Check to see if the report data has changed - if so a report MUST be sent */
+ SendReport = (memcmp(&PrevKeyboardReportData, &KeyboardReportData, sizeof(USB_KeyboardReport_Data_t)) != 0);
+ }
/* Select the Keyboard Report Endpoint */
Endpoint_SelectEndpoint(KEYBOARD_IN_EPADDR);