diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2012-10-20 11:31:24 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2012-10-20 11:31:24 +0000 |
commit | fe49fd51b289bdc8ac3a3a1817763c509ce90426 (patch) | |
tree | 77a93e3e4e25c4e9f4a875a57233851dd8aebe1b | |
parent | 1f33bc2fd3515c22669b6d37988399d287a9ba1c (diff) | |
download | lufa-fe49fd51b289bdc8ac3a3a1817763c509ce90426.tar.gz lufa-fe49fd51b289bdc8ac3a3a1817763c509ce90426.tar.bz2 lufa-fe49fd51b289bdc8ac3a3a1817763c509ce90426.zip |
Increased throughput in the USBtoSerial project now that data transmission is non-blocking (thanks to Joseph Lacerte).
-rw-r--r-- | LUFA/DoxygenPages/ChangeLog.txt | 2 | ||||
-rw-r--r-- | Projects/USBtoSerial/USBtoSerial.c | 10 |
2 files changed, 3 insertions, 9 deletions
diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt index bf2903936..ed68a1d28 100644 --- a/LUFA/DoxygenPages/ChangeLog.txt +++ b/LUFA/DoxygenPages/ChangeLog.txt @@ -22,7 +22,7 @@ * - Added workaround for broken VBUS detection on AVR8 devices when a bootloader starts the application * via a software jump without first turning off the OTG pad (thanks to Simon Inns) * - Library Applications: - * - <i>None</i> + * - Increased throughput in the USBtoSerial project now that data transmission is non-blocking (thanks to Joseph Lacerte) * * <b>Fixed:</b> * - Core: diff --git a/Projects/USBtoSerial/USBtoSerial.c b/Projects/USBtoSerial/USBtoSerial.c index 5fd719224..233a9af54 100644 --- a/Projects/USBtoSerial/USBtoSerial.c +++ b/Projects/USBtoSerial/USBtoSerial.c @@ -106,17 +106,14 @@ int main(void) /* Check if the UART receive buffer flush timer has expired or the buffer is nearly full */ uint16_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer); - if ((TIFR0 & (1 << TOV0)) || (BufferCount > (uint8_t)(sizeof(USARTtoUSB_Buffer_Data) * .75))) + if (BufferCount) { Endpoint_SelectEndpoint(VirtualSerial_CDC_Interface.Config.DataINEndpoint.Address); - + /* 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()) { - /* Clear flush timer expiry flag */ - TIFR0 |= (1 << TOV0); - /* 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)); @@ -159,9 +156,6 @@ void SetupHardware(void) /* Hardware Initialization */ LEDs_Init(); USB_Init(); - - /* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */ - TCCR0B = (1 << CS02); } /** Event handler for the library USB Connection event. */ |