Don't fail Doxygen on versions built without various features.
[pub/USBasp.git] / Projects / USBtoSerial / USBtoSerial.c
index 1c791d9..343b51b 100644 (file)
@@ -133,8 +133,8 @@ int main(void)
                        }
                }
 
-               /* Load the next byte from the USART transmit buffer into the USART */
-               if (!(RingBuffer_IsEmpty(&USBtoUSART_Buffer)))
+               /* Load the next byte from the USART transmit buffer into the USART if transmit buffer space is available */
+               if (Serial_IsSendReady() && !(RingBuffer_IsEmpty(&USBtoUSART_Buffer)))
                  Serial_SendByte(RingBuffer_Remove(&USBtoUSART_Buffer));
 
                CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
@@ -194,7 +194,7 @@ ISR(USART1_RX_vect, ISR_BLOCK)
 {
        uint8_t ReceivedByte = UDR1;
 
-       if (USB_DeviceState == DEVICE_STATE_Configured)
+       if ((USB_DeviceState == DEVICE_STATE_Configured) && !(RingBuffer_IsFull(&USARTtoUSB_Buffer)))
          RingBuffer_Insert(&USARTtoUSB_Buffer, ReceivedByte);
 }