Fixed CDC demo not sending an empty packet after each transfer to prevent the host...
[pub/USBasp.git] / Demos / Device / CDC / CDC.c
index 6e933d5..d4eecc8 100644 (file)
@@ -308,6 +308,12 @@ TASK(CDC_Task)
                \r
                /* Finalize the stream transfer to send the last packet */\r
                Endpoint_ClearCurrentBank();\r
+\r
+               /* Wait until the endpoint is ready for another packet */\r
+               while (!(Endpoint_ReadWriteAllowed()));\r
+               \r
+               /* Send an empty packet to ensure that the host does not buffer data sent to it */\r
+               Endpoint_ClearCurrentBank();\r
        }\r
 \r
        /* Select the Serial Rx Endpoint */\r