Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
   advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
   advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
   software, including all implied warranties of merchantability
   and fitness.  In no event shall the author be liable for any
   special, indirect or consequential damages or any damages
   software, including all implied warranties of merchantability
   and fitness.  In no event shall the author be liable for any
   special, indirect or consequential damages or any damages
        RingBuffer_InitBuffer(&USARTtoUSB_Buffer, USARTtoUSB_Buffer_Data, sizeof(USARTtoUSB_Buffer_Data));
 
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
        RingBuffer_InitBuffer(&USARTtoUSB_Buffer, USARTtoUSB_Buffer_Data, sizeof(USARTtoUSB_Buffer_Data));
 
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
                        /* Check if a packet is already enqueued to the host - if so, we shouldn't try to send more data
                         * until it completes as there is a chance nothing is listening and a lengthy timeout could occur */
                        if (Endpoint_IsINReady())
                        {
                        /* Check if a packet is already enqueued to the host - if so, we shouldn't try to send more data
                         * until it completes as there is a chance nothing is listening and a lengthy timeout could occur */
                        if (Endpoint_IsINReady())
                        {
                                /* Never send more than one bank size less one byte to the host at a time, so that we don't block
                                 * while a Zero Length Packet (ZLP) to terminate the transfer is sent if the host isn't listening */
                                uint8_t BytesToSend = MIN(BufferCount, (CDC_TXRX_EPSIZE - 1));
                                /* Never send more than one bank size less one byte to the host at a time, so that we don't block
                                 * while a Zero Length Packet (ZLP) to terminate the transfer is sent if the host isn't listening */
                                uint8_t BytesToSend = MIN(BufferCount, (CDC_TXRX_EPSIZE - 1));
-               /* 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);
                  Serial_SendByte(RingBuffer_Remove(&USBtoUSART_Buffer));
 
                CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
        /* Disable watchdog if enabled by bootloader/fuses */
        MCUSR &= ~(1 << WDRF);
        wdt_disable();
 
        /* Disable clock division */
        clock_prescale_set(clock_div_1);
        /* Disable watchdog if enabled by bootloader/fuses */
        MCUSR &= ~(1 << WDRF);
        wdt_disable();
 
        /* Disable clock division */
        clock_prescale_set(clock_div_1);