From e6dc95163094692d11715711d5c1aaa19841dd77 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 30 Jan 2011 14:14:04 +0000 Subject: Add new HID_DESCRIPTOR_VENDOR() macro, change over all projects and Device ClassDriver demos to use it. Fix reversed byte ordering of multi-byte HID data. Added support to the HID parser for extended USAGE items that contain the usage page as well as the usage index. Removed the HID_IOF_NON_VOLATILE and HID_IOF_VOLATILE flags from HID INPUT items where the flag is invalid. Changed over HID OUTPUT items to use HID_IOF_NON_VOLATILE. Change over MagStripe project to use HID_DESCRIPTOR_KEYBOARD() for its HID report. Change over MouseHostDevice demo to use HID_DESCRIPTOR_MOUSE() for its HID report. --- Projects/Benito/Benito.c | 37 +++++++++++++++++++------------------ Projects/Benito/makefile | 2 +- 2 files changed, 20 insertions(+), 19 deletions(-) (limited to 'Projects/Benito') diff --git a/Projects/Benito/Benito.c b/Projects/Benito/Benito.c index 4c964506c..26b5ad2b8 100644 --- a/Projects/Benito/Benito.c +++ b/Projects/Benito/Benito.c @@ -106,6 +106,9 @@ int main(void) /* Check if the millisecond timer has elapsed */ if (TIFR0 & (1 << OCF0A)) { + /* Clear flush timer expiry flag */ + TIFR0 |= (1 << TOV0); + /* Check if the reset pulse period has elapsed, if so tristate the target reset line */ if (PulseMSRemaining.ResetPulse && !(--PulseMSRemaining.ResetPulse)) { @@ -132,31 +135,29 @@ int main(void) uint16_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer); if (!(--FlushPeriodRemaining) || (BufferCount > 200)) { - /* Echo bytes from the target to the host via the virtual serial port */ + FlushPeriodRemaining = RECEIVE_BUFFER_FLUSH_MS; + + /* Start RX LED indicator pulse */ if (BufferCount) { - while (BufferCount--) - { - /* Try to send the next byte of data to the host, abort if there is an error without dequeuing */ - if (CDC_Device_SendByte(&VirtualSerial_CDC_Interface, - RingBuffer_Peek(&USARTtoUSB_Buffer)) != ENDPOINT_READYWAIT_NoError) - { - break; - } - - /* Dequeue the already sent byte from the buffer now we have confirmed that no transmission error occurred */ - RingBuffer_Remove(&USARTtoUSB_Buffer); - } - LEDs_TurnOnLEDs(LEDMASK_RX); PulseMSRemaining.RxLEDPulse = TX_RX_LED_PULSE_MS; } - FlushPeriodRemaining = RECEIVE_BUFFER_FLUSH_MS; + /* Echo bytes from the target to the host via the virtual serial port */ + while (BufferCount--) + { + /* Try to send the next byte of data to the host, abort if there is an error without dequeuing */ + if (CDC_Device_SendByte(&VirtualSerial_CDC_Interface, + RingBuffer_Peek(&USARTtoUSB_Buffer)) != ENDPOINT_READYWAIT_NoError) + { + break; + } + + /* Dequeue the already sent byte from the buffer now we have confirmed that no transmission error occurred */ + RingBuffer_Remove(&USARTtoUSB_Buffer); + } } - - /* Clear the millisecond timer CTC flag (cleared by writing logic one to the register) */ - TIFR0 |= (1 << OCF0A); } CDC_Device_USBTask(&VirtualSerial_CDC_Interface); diff --git a/Projects/Benito/makefile b/Projects/Benito/makefile index 839b7d731..1d306803d 100644 --- a/Projects/Benito/makefile +++ b/Projects/Benito/makefile @@ -131,7 +131,7 @@ LUFA_OPTS += -D AVR_RESET_LINE_MASK="(1 << 4)" LUFA_OPTS += -D AVR_RESET_PULSE_MS=10 LUFA_OPTS += -D TX_RX_LED_PULSE_MS=30 LUFA_OPTS += -D PING_PONG_LED_PULSE_MS=100 -LUFA_OPTS += -D RECEIVE_BUFFER_FLUSH_MS=20 +LUFA_OPTS += -D RECEIVE_BUFFER_FLUSH_MS=10 # Create the LUFA source path variables by including the LUFA root makefile -- cgit v1.2.3