Error status LEDs shown when device endpoint configuration fails to complete.
[pub/USBasp.git] / Demos / Device / LowLevel / KeyboardMouse / KeyboardMouse.c
index 9127fea..ddfe05a 100644 (file)
@@ -100,23 +100,32 @@ void EVENT_USB_Disconnect(void)
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
-       /* Setup Keyboard Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, HID_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
+       /* Indicate USB connected and ready */\r
+       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
 \r
 \r
+       /* Setup Keyboard Report Endpoint */\r
+       if (!(Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, HID_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
        /* Setup Keyboard LED Report Endpoint */\r
        /* Setup Keyboard LED Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_OUT, HID_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
+       if (!(Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_OUT, HID_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 \r
        /* Setup Mouse Report Endpoint */\r
 \r
        /* Setup Mouse Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, HID_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       /* Indicate USB connected and ready */\r
-       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+       if (!(Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, HID_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r