Seperated out parts of the PrinterHost incomplete demo into a seperate Lib subdirectory.
[pub/USBasp.git] / Demos / Device / LowLevel / USBtoSerial / USBtoSerial.c
index 3ed406d..c48c33c 100644 (file)
@@ -237,7 +237,7 @@ void CDC_Task(void)
                if (Endpoint_IsOUTReceived())\r
                {\r
                        /* Read the bytes in from the endpoint into the buffer while space is available */\r
-                       while (Endpoint_BytesInEndpoint() && (BUFF_STATICSIZE - Rx_Buffer.Elements))\r
+                       while (Endpoint_BytesInEndpoint() && (Rx_Buffer.Elements != BUFF_STATICSIZE))\r
                        {\r
                                /* Store each character from the endpoint */\r
                                Buffer_StoreElement(&Rx_Buffer, Endpoint_Read_Byte());\r
@@ -265,7 +265,7 @@ void CDC_Task(void)
                        while (!(Endpoint_IsReadWriteAllowed()));\r
                        \r
                        /* Write the bytes from the buffer to the endpoint while space is available */\r
-                       while (Tx_Buffer.Elements && (Endpoint_BytesInEndpoint() < CDC_TXRX_EPSIZE))\r
+                       while (Tx_Buffer.Elements && Endpoint_IsReadWriteAllowed())\r
                        {\r
                                /* Write each byte retreived from the buffer to the endpoint */\r
                                Endpoint_Write_Byte(Buffer_GetElement(&Tx_Buffer));\r