Changed over manual loops waiting for endpoints to be ready to use the library Endpoi...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Device / CDC.c
index 9da0ed1..0d6b378 100644 (file)
@@ -126,12 +126,7 @@ void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)
        if (!(Endpoint_IsReadWriteAllowed()))\r
        {\r
                Endpoint_ClearIN();\r
-\r
-               while (!(Endpoint_IsReadWriteAllowed()))\r
-               {\r
-                       if (USB_DeviceState == DEVICE_STATE_Unattached)\r
-                         return;\r
-               }\r
+               Endpoint_WaitUntilReady();\r
        }       \r
        \r
        Endpoint_ClearIN();\r
@@ -156,12 +151,7 @@ void CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, con
        if (!(Endpoint_IsReadWriteAllowed()))\r
        {\r
                Endpoint_ClearIN();\r
-               \r
-               while (!(Endpoint_IsReadWriteAllowed()))\r
-               {\r
-                       if (USB_DeviceState == DEVICE_STATE_Unattached)\r
-                         return;               \r
-               }\r
+               Endpoint_WaitUntilReady();\r
        }\r
 \r
        Endpoint_Write_Byte(Data);      \r