X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/196724c62d8c09b30dabb9a8ff3246033d95315f..fc8e4837a936bb1b4bd19bdd54660878b3efe02c:/Demos/Device/ClassDriver/Keyboard/Keyboard.c diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c index 7e5834868..db30ac579 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c @@ -146,9 +146,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn uint8_t ButtonStatus_LCL = Buttons_GetStatus(); uint8_t UsedKeyCodes = 0; - - KeyboardReport->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT; - + if (JoyStatus_LCL & JOY_UP) KeyboardReport->KeyCode[UsedKeyCodes++] = 0x04; // A else if (JoyStatus_LCL & JOY_DOWN) @@ -165,6 +163,9 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn if (ButtonStatus_LCL & BUTTONS_BUTTON1) KeyboardReport->KeyCode[UsedKeyCodes++] = 0x09; // F + if (UsedKeyCodes) + KeyboardReport->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT; + *ReportSize = sizeof(USB_KeyboardReport_Data_t); return false; } @@ -182,13 +183,13 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI uint8_t LEDMask = LEDS_NO_LEDS; uint8_t* LEDReport = (uint8_t*)ReportData; - if (*LEDReport & 0x01) // NUM Lock + if (*LEDReport & HID_KEYBOARD_LED_NUMLOCK) LEDMask |= LEDS_LED1; - if (*LEDReport & 0x02) // CAPS Lock + if (*LEDReport & HID_KEYBOARD_LED_CAPSLOCK) LEDMask |= LEDS_LED3; - if (*LEDReport & 0x04) // SCROLL Lock + if (*LEDReport & HID_KEYBOARD_LED_SCROLLLOCK) LEDMask |= LEDS_LED4; LEDs_SetAllLEDs(LEDMask);