Added compile time error to the AVRISP-MKII project when built for the U4 chips,...
[pub/USBasp.git] / Demos / Device / LowLevel / Mouse / Mouse.c
index 7e38e7a..1cc6d88 100644 (file)
@@ -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();