- /* 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));
-
- /* Load bytes from the USART transmit buffer into the USART */
- while (USBtoUSART_Buffer.Count)
- Serial_TxByte(RingBuffer_Remove(&USBtoUSART_Buffer));
+ /* Load the next byte from the USART transmit buffer into the USART */
+ if (USBtoUSART_Buffer.Count)
+ Serial_TxByte(RingBuffer_AtomicRemove(&USBtoUSART_Buffer));