- /* Read bytes from the USART receive buffer into the USB IN endpoint */
- while (USARTtoUSB_Buffer.Elements)
- CDC_Device_SendByte(&VirtualSerial_CDC_Interface, Buffer_GetElement(&USARTtoUSB_Buffer));
-
- /* Load bytes from the USART transmit buffer into the USART */
- while (USBtoUSART_Buffer.Elements)
- Serial_TxByte(Buffer_GetElement(&USBtoUSART_Buffer));
+ /* Load the next byte from the USART transmit buffer into the USART */
+ if (USBtoUSART_Buffer.Count)
+ Serial_TxByte(RingBuffer_AtomicRemove(&USBtoUSART_Buffer));