if (!(LineEncoding.BaudRateBPS))\r
return -1;\r
\r
- while (!(Endpoint_IsReadWriteAllowed()))\r
- {\r
- if (USB_DeviceState != DEVICE_STATE_Configured)\r
- return -1;\r
- }\r
+ if (Endpoint_WaitUntilReady())\r
+ return -1;\r
\r
Endpoint_Write_Byte(c);\r
Endpoint_ClearIN();\r
\r
for (;;)\r
{\r
- while (!(Endpoint_IsReadWriteAllowed()))\r
- {\r
- if (USB_DeviceState != DEVICE_STATE_Configured)\r
- return -1;\r
- }\r
+ if (Endpoint_WaitUntilReady())\r
+ return -1;\r
\r
if (!(Endpoint_BytesInEndpoint()))\r
{\r
if (IsFull)\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