X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/cb779e3d7d32d7c43e0a45bb526de0a04135b0c7..f555ad7ced743a19eb1eefaf5eaf536fcbe58d80:/Demos/Device/LowLevel/Keyboard/Keyboard.c diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.c b/Demos/Device/LowLevel/Keyboard/Keyboard.c index e490f517b..94f0f7deb 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, 2010. + Copyright (C) Dean Camera, 2011. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2011 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 @@ -129,11 +129,11 @@ void EVENT_USB_Device_ConfigurationChanged(void) LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } -/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific - * control requests that are not handled internally by the USB library (including the HID commands, which are - * all issued via the control endpoint), so that they can be handled appropriately for the application. +/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to + * the device from the USB host before passing along unhandled control requests to the library for processing + * internally. */ -void EVENT_USB_Device_UnhandledControlRequest(void) +void EVENT_USB_Device_ControlRequest(void) { /* Handle HID Class specific requests */ switch (USB_ControlRequest.bRequest) @@ -254,20 +254,20 @@ void CreateKeyboardReport(USB_KeyboardReport_Data_t* const ReportData) ReportData->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT; if (JoyStatus_LCL & JOY_UP) - ReportData->KeyCode[UsedKeyCodes++] = 0x04; // A + ReportData->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_A; else if (JoyStatus_LCL & JOY_DOWN) - ReportData->KeyCode[UsedKeyCodes++] = 0x05; // B + ReportData->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B; if (JoyStatus_LCL & JOY_LEFT) - ReportData->KeyCode[UsedKeyCodes++] = 0x06; // C + ReportData->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C; else if (JoyStatus_LCL & JOY_RIGHT) - ReportData->KeyCode[UsedKeyCodes++] = 0x07; // D + ReportData->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D; if (JoyStatus_LCL & JOY_PRESS) - ReportData->KeyCode[UsedKeyCodes++] = 0x08; // E + ReportData->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E; if (ButtonStatus_LCL & BUTTONS_BUTTON1) - ReportData->KeyCode[UsedKeyCodes++] = 0x09; // F + ReportData->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F; } /** Processes a received LED report, and updates the board LEDs states to match. @@ -324,7 +324,7 @@ void SendNextReport(void) PrevKeyboardReportData = KeyboardReportData; /* Write Keyboard Report Data */ - Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData)); + Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData), NULL); /* Finalize the stream transfer to send the last packet */ Endpoint_ClearIN();