X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/7f9f97c792dee6875fbca9806422bdd7d6c5a657..a9e0935a90346beb0c981924becc1f55d969a08b:/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c index ec17bf69a..94f27bd1b 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c @@ -8,7 +8,6 @@ /* Copyright 2010 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 software and its documentation for any purpose is hereby granted @@ -72,13 +71,13 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = 1, - .ReportINEndpointNumber = MOUSE_IN_EPNUM, - .ReportINEndpointSize = HID_EPSIZE, + .ReportINEndpointNumber = MOUSE_IN_EPNUM, + .ReportINEndpointSize = HID_EPSIZE, - .PrevReportINBuffer = PrevMouseHIDReportBuffer, - .PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer), + .PrevReportINBuffer = PrevMouseHIDReportBuffer, + .PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer), }, }; @@ -90,6 +89,7 @@ int main(void) SetupHardware(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); + sei(); for (;;) { @@ -180,6 +180,8 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn if (!(ButtonStatus_LCL & BUTTONS_BUTTON1)) return 0; + KeyboardReport->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT; + if (JoyStatus_LCL & JOY_UP) KeyboardReport->KeyCode[0] = 0x04; // A else if (JoyStatus_LCL & JOY_DOWN) @@ -215,7 +217,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn MouseReport->X = 1; if (JoyStatus_LCL & JOY_PRESS) - MouseReport->Button = (1 << 0); + MouseReport->Button |= (1 << 0); *ReportSize = sizeof(USB_MouseReport_Data_t); return true; @@ -237,13 +239,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);