X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/071e02c6b6b4837fa9cf0b6d4c749994e02638d7..81998ce297fd9959f505e96a69337f3548db0d71:/Demos/Device/LowLevel/Mouse/Mouse.c diff --git a/Demos/Device/LowLevel/Mouse/Mouse.c b/Demos/Device/LowLevel/Mouse/Mouse.c index 7e38e7afd..1cc6d8849 100644 --- a/Demos/Device/LowLevel/Mouse/Mouse.c +++ b/Demos/Device/LowLevel/Mouse/Mouse.c @@ -113,18 +113,17 @@ void EVENT_USB_Device_Disconnect(void) */ void EVENT_USB_Device_ConfigurationChanged(void) { - /* Indicate USB connected and ready */ - LEDs_SetAllLEDs(LEDMASK_USB_READY); - - /* Setup Mouse Report Endpoint */ - if (!(Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, MOUSE_EPSIZE, - ENDPOINT_BANK_SINGLE))) - { - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - } + bool ConfigSuccess = true; + /* Setup HID Report Endpoint */ + ConfigSuccess &= Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, + MOUSE_EPSIZE, ENDPOINT_BANK_SINGLE); + + /* Turn on Start-of-Frame events for tracking HID report period exiry */ USB_Device_EnableSOFEvents(); + + /* Indicate endpoint configuration success or failure */ + 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 @@ -226,7 +225,7 @@ void EVENT_USB_Device_StartOfFrame(void) * * \param[out] ReportData Pointer to a HID report data structure to be filled */ -void CreateMouseReport(USB_MouseReport_Data_t* ReportData) +void CreateMouseReport(USB_MouseReport_Data_t* const ReportData) { uint8_t JoyStatus_LCL = Joystick_GetStatus(); uint8_t ButtonStatus_LCL = Buttons_GetStatus();