Changed over manual loops waiting for endpoints to be ready to use the library Endpoi...
[pub/USBasp.git] / Demos / Device / LowLevel / DualCDC / DualCDC.c
index c49a1ad..7a84c8d 100644 (file)
@@ -274,11 +274,7 @@ void CDC1_Task(void)
                Endpoint_ClearIN();\r
 \r
                /* Wait until the endpoint is ready for another packet */\r
-               while (!(Endpoint_IsINReady()))\r
-               {\r
-                       if (USB_DeviceState == DEVICE_STATE_Unattached)\r
-                         return;\r
-               }\r
+               Endpoint_WaitUntilReady();\r
                \r
                /* Send an empty packet to ensure that the host does not buffer data sent to it */\r
                Endpoint_ClearIN();\r
@@ -329,11 +325,7 @@ void CDC2_Task(void)
                Endpoint_ClearIN();\r
 \r
                /* Wait until the endpoint is ready for the next packet */\r
-               while (!(Endpoint_IsINReady()))\r
-               {\r
-                       if (USB_DeviceState == DEVICE_STATE_Unattached)\r
-                         return;\r
-               }\r
+               Endpoint_WaitUntilReady();\r
 \r
                /* Send an empty packet to prevent host buffering */\r
                Endpoint_ClearIN();\r