X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/ed031c1df2f5b053b9cd9f48c63e66a42b7c049e..7d4cccc22d60125fac111819df48af1873d11018:/Demos/Device/CDC/CDC.c diff --git a/Demos/Device/CDC/CDC.c b/Demos/Device/CDC/CDC.c index 6e933d581..5e153f652 100644 --- a/Demos/Device/CDC/CDC.c +++ b/Demos/Device/CDC/CDC.c @@ -56,7 +56,7 @@ TASK_LIST * * These values are set by the host via a class-specific request, however they are not required to be used accurately. * It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical - * serial link characteristics and instead sends and recieves data in endpoint streams. + * serial link characteristics and instead sends and receives data in endpoint streams. */ CDC_Line_Coding_t LineCoding = { BaudRateBPS: 9600, CharFormat: OneStopBit, @@ -66,7 +66,7 @@ CDC_Line_Coding_t LineCoding = { BaudRateBPS: 9600, /** String to print through the virtual serial port when the joystick is pressed upwards. */ char JoystickUpString[] = "Joystick Up\r\n"; -/** String to print through the virtual serial port when the joystick is pressed downwards. */ +/** String to print through the virtual serial port when the joystick is pressed downward. */ char JoystickDownString[] = "Joystick Down\r\n"; /** String to print through the virtual serial port when the joystick is pressed left. */ @@ -308,6 +308,12 @@ TASK(CDC_Task) /* Finalize the stream transfer to send the last packet */ Endpoint_ClearCurrentBank(); + + /* Wait until the endpoint is ready for another packet */ + while (!(Endpoint_ReadWriteAllowed())); + + /* Send an empty packet to ensure that the host does not buffer data sent to it */ + Endpoint_ClearCurrentBank(); } /* Select the Serial Rx Endpoint */