-       /* Setup Keyboard Keycode Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(KEYBOARD_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, KEYBOARD_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       #if defined(INTERRUPT_DATA_ENDPOINT)\r
-       /* Enable the endpoint IN interrupt ISR for the report endpoint */\r
-       USB_INT_Enable(ENDPOINT_INT_IN);\r
-       #endif\r
-\r
-       /* Setup Keyboard LED Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(KEYBOARD_LEDS_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_OUT, KEYBOARD_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       #if defined(INTERRUPT_DATA_ENDPOINT)\r
-       /* Enable the endpoint OUT interrupt ISR for the LED report endpoint */\r
-       USB_INT_Enable(ENDPOINT_INT_OUT);\r
-       #endif\r
-\r
-       /* Indicate USB connected and ready */\r
-       UpdateStatus(Status_USBReady);\r
-\r
-       #if !defined(INTERRUPT_DATA_ENDPOINT)\r
-       /* Start running keyboard reporting task */\r
-       Scheduler_SetTaskMode(USB_Keyboard_Report, TASK_RUN);\r
-       #endif\r
-}\r
-\r
-/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
- *  control requests that are not handled internally by the USB library (including the HID commands, which are\r
- *  all issued via the control endpoint), so that they can be handled appropriately for the application.\r
- */\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
-{\r
-       /* Handle HID Class specific requests */\r
-       switch (bRequest)\r
-       {\r
-               case REQ_GetReport:\r
-                       if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
-                       {\r
-                               USB_KeyboardReport_Data_t KeyboardReportData;\r
-\r
-                               /* Create the next keyboard report for transmission to the host */\r
-                               CreateKeyboardReport(&KeyboardReportData);\r
-\r
-                               /* Ignore report type and ID number value */\r
-                               Endpoint_Discard_Word();\r
-                               \r
-                               /* Ignore unused Interface number value */\r
-                               Endpoint_Discard_Word();\r
-\r
-                               /* Read in the number of bytes in the report to send to the host */\r
-                               uint16_t wLength = Endpoint_Read_Word_LE();\r
-                               \r
-                               /* If trying to send more bytes than exist to the host, clamp the value at the report size */\r
-                               if (wLength > sizeof(KeyboardReportData))\r
-                                 wLength = sizeof(KeyboardReportData);\r
-\r
-                               Endpoint_ClearSetupReceived();\r
-       \r
-                               /* Write the report data to the control endpoint */\r
-                               Endpoint_Write_Control_Stream_LE(&KeyboardReportData, wLength);\r
-                               \r
-                               /* Finalize the stream transfer to send the last packet or clear the host abort */\r
-                               Endpoint_ClearSetupOUT();\r
-                       }\r
-               \r
-                       break;\r
-               case REQ_SetReport:\r
-                       if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
-                       {\r
-                               Endpoint_ClearSetupReceived();\r
-                               \r
-                               /* Wait until the LED report has been sent by the host */\r
-                               while (!(Endpoint_IsSetupOUTReceived()));\r
-\r
-                               /* Read in the LED report from the host */\r
-                               uint8_t LEDStatus = Endpoint_Read_Byte();\r
-\r
-                               /* Process the incoming LED report */\r
-                               ProcessLEDReport(LEDStatus);\r
-                       \r
-                               /* Clear the endpoint data */\r
-                               Endpoint_ClearSetupOUT();\r
-\r
-                               /* Acknowledge status stage */\r
-                               while (!(Endpoint_IsSetupINReady()));\r
-                               Endpoint_ClearSetupIN();\r
-                       }\r
-                       \r
-                       break;\r
-               case REQ_GetProtocol:\r
-                       if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
-                       {\r
-                               Endpoint_ClearSetupReceived();\r
-                               \r
-                               /* Write the current protocol flag to the host */\r
-                               Endpoint_Write_Byte(UsingReportProtocol);\r
-                               \r
-                               /* Send the flag to the host */\r
-                               Endpoint_ClearSetupIN();\r
-\r
-                               /* Acknowledge status stage */\r
-                               while (!(Endpoint_IsSetupOUTReceived()));\r
-                               Endpoint_ClearSetupOUT();\r
-                       }\r
-                       \r
-                       break;\r
-               case REQ_SetProtocol:\r
-                       if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
-                       {\r
-                               /* Read in the wValue parameter containing the new protocol mode */\r
-                               uint16_t wValue = Endpoint_Read_Word_LE();\r
-                                                               \r
-                               Endpoint_ClearSetupReceived();\r
-\r
-                               /* Set or clear the flag depending on what the host indicates that the current Protocol should be */\r
-                               UsingReportProtocol = (wValue != 0x0000);\r
-\r
-                               /* Acknowledge status stage */\r
-                               while (!(Endpoint_IsSetupINReady()));\r
-                               Endpoint_ClearSetupIN();\r
-                       }\r
-                       \r
-                       break;\r
-               case REQ_SetIdle:\r
-                       if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
-                       {\r
-                               /* Read in the wValue parameter containing the idle period */\r
-                               uint16_t wValue = Endpoint_Read_Word_LE();\r
-                               \r
-                               Endpoint_ClearSetupReceived();\r
-                               \r
-                               /* Get idle period in MSB */\r
-                               IdleCount = (wValue >> 8);\r
-                               \r
-                               /* Acknowledge status stage */\r
-                               while (!(Endpoint_IsSetupINReady()));\r
-                               Endpoint_ClearSetupIN();\r
-                       }\r
-                       \r
-                       break;\r
-               case REQ_GetIdle:\r
-                       if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
-                       {               \r
-                               Endpoint_ClearSetupReceived();\r
-                               \r
-                               /* Write the current idle duration to the host */\r
-                               Endpoint_Write_Byte(IdleCount);\r
-                               \r
-                               /* Send the flag to the host */\r
-                               Endpoint_ClearSetupIN();\r
-\r
-                               /* Acknowledge status stage */\r
-                               while (!(Endpoint_IsSetupOUTReceived()));\r
-                               Endpoint_ClearSetupOUT();\r
-                       }\r
-\r
-                       break;\r
-       }\r