diff --git a/LUFA/Drivers/USB/HighLevel/EndpointStream.h b/LUFA/Drivers/USB/HighLevel/EndpointStream.h index 5c3c957d013f90aee6a4d96a3d092ac185e87582..a8b9021abee9fd5e4cd75ac0a3dbbdbc307e4126 100644 --- a/LUFA/Drivers/USB/HighLevel/EndpointStream.h +++ b/LUFA/Drivers/USB/HighLevel/EndpointStream.h @@ -51,7 +51,6 @@ #define __ENDPOINT_STREAM_H__ /* Includes: */ - #include <avr/io.h> #include <avr/pgmspace.h> #include <avr/eeprom.h> #include <stdbool.h> diff --git a/LUFA/Drivers/USB/HighLevel/PipeStream.h b/LUFA/Drivers/USB/HighLevel/PipeStream.h index 1279a71c24e11a7e36c2ac6bb1432cf73d1c0ee9..730a338d1baafa404b06b3f3635f14ad70cd4a80 100644 --- a/LUFA/Drivers/USB/HighLevel/PipeStream.h +++ b/LUFA/Drivers/USB/HighLevel/PipeStream.h @@ -51,7 +51,6 @@ #define __PIPE_STREAM_H__ /* Includes: */ - #include <avr/io.h> #include <avr/pgmspace.h> #include <avr/eeprom.h> #include <stdbool.h> diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 69b129de529612cae53f0a0d33fb0b1d80ebfe58..86aac5c892ed601c85f4d048aa4e4ed55e62e8de 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -93,6 +93,7 @@ * - Fixed random enumeration failure while in device mode due to interrupts causing the Set Address request to exceed maximum timings * - Fixed MIDI_Host_Flush() not aborting early when the specified MIDI host interface was not configured * - Fixed MIDI class driver send routines silently discarding packets if the endpoint or pipe is busy (thanks to Robin Green) + * - Fixed USBtoSerial and XPLAINBridge demos discarding data from the PC if the send buffer becomes full * * \section Sec_ChangeLog100807 Version 100807 * <b>New:</b> diff --git a/LUFA/ManPages/LibraryResources.txt b/LUFA/ManPages/LibraryResources.txt index 062702bf6c8ac5364d20042f1273bce8c91bd205..7f67739ea2940f83ea87b7a1fbaff1cd5a80a35e 100644 --- a/LUFA/ManPages/LibraryResources.txt +++ b/LUFA/ManPages/LibraryResources.txt @@ -20,6 +20,7 @@ * * \section Sec_InDevelopment Latest In-Development Source Code * Issue Tracker: http://www.lufa-lib.org/tracker \n + * Bazaar Access: http://www.lufa-lib.org/bzr \n * SVN Access: http://www.lufa-lib.org/svn \n * Git Access: http://www.lufa-lib.org/git \n * Mercurial Access: http://www.lufa-lib.org/hg \n diff --git a/Projects/USBtoSerial/USBtoSerial.c b/Projects/USBtoSerial/USBtoSerial.c index 3f06acde93ab696126ab2cd11ca5113ac7be5ee3..c26667df979a63cc5b9defb7aa868a527c3883f3 100644 --- a/Projects/USBtoSerial/USBtoSerial.c +++ b/Projects/USBtoSerial/USBtoSerial.c @@ -81,15 +81,21 @@ int main(void) for (;;) { - /* Read bytes from the USB OUT endpoint into the USART transmit buffer */ - int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); - if (!(ReceivedByte < 0) && !(RingBuffer_IsFull(&USBtoUSART_Buffer))) - RingBuffer_Insert(&USBtoUSART_Buffer, ReceivedByte); + /* Only try to read in bytes from the CDC interface if the transmit buffer is not full */ + if (!(RingBuffer_IsFull(&USBtoUSART_Buffer))) + { + int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); + /* Read bytes from the USB OUT endpoint into the USART transmit buffer */ + if (!(ReceivedByte < 0)) + RingBuffer_Insert(&USBtoUSART_Buffer, ReceivedByte); + } + /* Check if the UART receive buffer flush timer has expired or the buffer is nearly full */ RingBuff_Count_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer); if ((TIFR0 & (1 << TOV0)) || (BufferCount > 200)) { + /* Clear flush timer expiry flag */ TIFR0 |= (1 << TOV0); /* Read bytes from the USART receive buffer into the USB IN endpoint */ diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c index 8cd1b2dd212fef074a4bc501ca9b192166b92966..d645ebead217184a41045deb588c03f1a52f2720 100644 --- a/Projects/XPLAINBridge/XPLAINBridge.c +++ b/Projects/XPLAINBridge/XPLAINBridge.c @@ -119,15 +119,21 @@ void UARTBridge_Task(void) if (USB_DeviceState != DEVICE_STATE_Configured) return; - /* Read bytes from the USB OUT endpoint into the UART transmit buffer */ - int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); - if (!(ReceivedByte < 0) && !(RingBuffer_IsFull(&USBtoUART_Buffer))) - RingBuffer_Insert(&USBtoUART_Buffer, ReceivedByte); + /* Only try to read in bytes from the CDC interface if the transmit buffer is not full */ + if (!(RingBuffer_IsFull(&USBtoUART_Buffer))) + { + int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); + /* Read bytes from the USB OUT endpoint into the UART transmit buffer */ + if (!(ReceivedByte < 0)) + RingBuffer_Insert(&USBtoUART_Buffer, ReceivedByte); + } + /* Check if the UART receive buffer flush timer has expired or buffer is nearly full */ RingBuff_Count_t BufferCount = RingBuffer_GetCount(&UARTtoUSB_Buffer); if ((TIFR0 & (1 << TOV0)) || (BufferCount > 200)) { + /* Clear flush timer expiry flag */ TIFR0 |= (1 << TOV0); /* Read bytes from the UART receive buffer into the USB IN endpoint */