X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/359fbfe14d00ab378f85a36664820ea9ba538c3f..c757acf1f7f3f45522024af7adf8df71a42a1dc1:/Demos/Device/LowLevel/Keyboard/Keyboard.c diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.c b/Demos/Device/LowLevel/Keyboard/Keyboard.c index 3755d09de..5ffe72f21 100644 --- a/Demos/Device/LowLevel/Keyboard/Keyboard.c +++ b/Demos/Device/LowLevel/Keyboard/Keyboard.c @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2012. + Copyright (C) Dean Camera, 2013. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com) Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com) Permission to use, copy, modify, distribute, and sell this @@ -19,7 +19,7 @@ advertising or publicity pertaining to distribution of the software without specific, written prior permission. - The author disclaim all warranties with regard to this + The author disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, indirect or consequential damages or any damages @@ -37,7 +37,7 @@ #include "Keyboard.h" -/** Indicates what report mode the host has requested, true for normal HID reporting mode, false for special boot +/** Indicates what report mode the host has requested, true for normal HID reporting mode, \c false for special boot * protocol reporting mode. */ static bool UsingReportProtocol = true; @@ -62,7 +62,7 @@ int main(void) SetupHardware(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); - sei(); + GlobalInterruptEnable(); for (;;) { @@ -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);