Combined Mouse, MouseViaInt and MouseFullInt demos into a single unified demo.
[pub/USBasp.git] / Demos / Keyboard / Keyboard.c
index 3884eeb..f506070 100644 (file)
@@ -140,6 +140,15 @@ EVENT_HANDLER(USB_Reset)
  */\r
 EVENT_HANDLER(USB_Disconnect)\r
 {\r
+       /* Stop running keyboard reporting and USB management tasks */\r
+       #if !defined(INTERRUPT_DATA_ENDPOINT)\r
+       Scheduler_SetTaskMode(USB_Keyboard_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
@@ -171,6 +180,11 @@ EVENT_HANDLER(USB_ConfigurationChanged)
 \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