- /* Read bytes from the USART receive buffer into the USB IN endpoint */
- while (USARTtoUSB_Buffer.Count)
- CDC_Device_SendByte(&VirtualSerial_CDC_Interface, RingBuffer_Remove(&USARTtoUSB_Buffer));
+ /* Check if the software USART flush timer has expired */
+ if (TIFR0 & (1 << TOV0))
+ {
+ TIFR0 |= (1 << TOV0);
+
+ /* Read bytes from the USART receive buffer into the USB IN endpoint */
+ while (USARTtoUSB_Buffer.Count)
+ CDC_Device_SendByte(&VirtualSerial_CDC_Interface, RingBuffer_AtomicRemove(&USARTtoUSB_Buffer));
+ }