- /* Wait until the endpoint is ready for another packet */\r
- while (!(Endpoint_IsINReady()));\r
- \r
- /* Send an empty packet to ensure that the host does not buffer data sent to it */\r
- Endpoint_ClearIN();\r
+ /* If the last packet filled the endpoint, send an empty packet to release the buffer on \r
+ * the receiver (otherwise all data will be cached until a non-full packet is received) */\r
+ if (IsFull)\r
+ {\r
+ /* Wait until the endpoint is ready for another packet */\r
+ while (!(Endpoint_IsINReady()));\r
+ \r
+ /* Send an empty packet to ensure that the host does not buffer data sent to it */\r
+ Endpoint_ClearIN();\r
+ }\r