- /* Start USB management task */\r
- Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
-\r
- /* Indicate USB enumerating */\r
- UpdateStatus(Status_USBEnumerating);\r
-}\r
-\r
-/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
- * the status LEDs and stops the USB management and CDC management tasks.\r
- */\r
-EVENT_HANDLER(USB_Disconnect)\r
-{\r
- /* Stop running CDC and USB management tasks */\r
- Scheduler_SetTaskMode(CDC1_Task, TASK_STOP);\r
- Scheduler_SetTaskMode(CDC2_Task, TASK_STOP);\r
- Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
-\r
- /* Indicate USB not ready */\r
- UpdateStatus(Status_USBNotReady);\r
-}\r
-\r
-/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
- * of the USB device after enumeration - the device endpoints are configured and the CDC management tasks are started.\r
- */\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
-{\r
- /* Setup CDC Notification, Rx and Tx Endpoints for the first CDC */\r
- Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
- ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,\r
- ENDPOINT_BANK_SINGLE);\r
-\r
- Endpoint_ConfigureEndpoint(CDC1_TX_EPNUM, EP_TYPE_BULK,\r
- ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,\r
- ENDPOINT_BANK_SINGLE);\r
-\r
- Endpoint_ConfigureEndpoint(CDC1_RX_EPNUM, EP_TYPE_BULK,\r
- ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,\r
- ENDPOINT_BANK_SINGLE);\r
-\r
- /* Setup CDC Notification, Rx and Tx Endpoints for the second CDC */\r
- Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
- ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,\r
- ENDPOINT_BANK_SINGLE);\r
-\r
- Endpoint_ConfigureEndpoint(CDC2_TX_EPNUM, EP_TYPE_BULK,\r
- ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,\r
- ENDPOINT_BANK_SINGLE);\r
-\r
- Endpoint_ConfigureEndpoint(CDC2_RX_EPNUM, EP_TYPE_BULK,\r
- ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,\r
- ENDPOINT_BANK_SINGLE);\r
- \r
- /* Indicate USB connected and ready */\r
- UpdateStatus(Status_USBReady);\r
- \r
- /* Start CDC tasks */\r
- Scheduler_SetTaskMode(CDC1_Task, TASK_RUN);\r
- Scheduler_SetTaskMode(CDC2_Task, TASK_RUN);\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 CDC control commands,\r
- * which are all issued via the control endpoint), so that they can be handled appropriately for the application.\r
- */\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
-{\r
- uint8_t* LineCodingData;\r
-\r
- /* Discard the unused wValue parameter */\r
- Endpoint_Ignore_Word();\r
-\r
- /* wIndex indicates the interface being controlled */\r
- uint16_t wIndex = Endpoint_Read_Word_LE();\r