Fixed GenericHID demo not starting USB and HID management tasks when not using interr...
[pub/lufa.git] / Demos / Device / GenericHID / GenericHID.c
index 2d98699..3b5f972 100644 (file)
@@ -103,6 +103,11 @@ EVENT_HANDLER(USB_Reset)
  */\r
 EVENT_HANDLER(USB_Connect)\r
 {\r
+       #if !defined(INTERRUPT_CONTROL_ENDPOINT)\r
+       /* Start USB management task */\r
+       Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
+       #endif\r
+\r
        /* Indicate USB enumerating */\r
        UpdateStatus(Status_USBEnumerating);\r
 }\r
@@ -112,6 +117,15 @@ EVENT_HANDLER(USB_Connect)
  */\r
 EVENT_HANDLER(USB_Disconnect)\r
 {\r
+       /* Stop running HID reporting and USB management tasks */\r
+       #if !defined(INTERRUPT_DATA_ENDPOINT)\r
+       Scheduler_SetTaskMode(USB_HID_Report, TASK_STOP);\r
+       #endif\r
+\r
+       #if !defined(INTERRUPT_CONTROL_ENDPOINT)\r
+       Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
+       #endif\r
+\r
        /* Indicate USB not ready */\r
        UpdateStatus(Status_USBNotReady);\r
 }\r