aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/AVRISP/Lib/XPROG/XPROGTarget.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-12-26 04:13:55 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-12-26 04:13:55 +0000
commitd1608d4af321529f0ddef9defcd97669ae9018c3 (patch)
tree79a2ba0fe2bfa14670a489e77f4c201f380de4f0 /Projects/AVRISP/Lib/XPROG/XPROGTarget.c
parent35dac470f243d234d72f34cbaeb1d6c8a15bc435 (diff)
downloadlufa-d1608d4af321529f0ddef9defcd97669ae9018c3.tar.gz
lufa-d1608d4af321529f0ddef9defcd97669ae9018c3.tar.bz2
lufa-d1608d4af321529f0ddef9defcd97669ae9018c3.zip
Added const where possible to the source functions in the Projects directory.
Added command timeout to the AVRISP project so that incorrectly connected targets no longer freeze the device. Removed string descriptors from the TeensyHID bootloader to reduce its size.
Diffstat (limited to 'Projects/AVRISP/Lib/XPROG/XPROGTarget.c')
-rw-r--r--Projects/AVRISP/Lib/XPROG/XPROGTarget.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Projects/AVRISP/Lib/XPROG/XPROGTarget.c b/Projects/AVRISP/Lib/XPROG/XPROGTarget.c
index 708b237ef..59c85f382 100644
--- a/Projects/AVRISP/Lib/XPROG/XPROGTarget.c
+++ b/Projects/AVRISP/Lib/XPROG/XPROGTarget.c
@@ -174,7 +174,7 @@ void XPROGTarget_EnableTargetTPI(void)
BITBANG_TPIDATA_PORT |= BITBANG_TPIDATA_MASK;
/* Fire timer capture ISR every 100 cycles to manage the software USART */
- OCR1A = 80;
+ OCR1A = 100;
TCCR1B = (1 << WGM13) | (1 << WGM12) | (1 << CS10);
TIMSK1 = (1 << ICIE1);
@@ -217,7 +217,7 @@ void XPROGTarget_EnableTargetPDI(void)
asm volatile ("NOP"::);
/* Fire timer compare ISR every 100 cycles to manage the software USART */
- OCR1A = 80;
+ OCR1A = 100;
TCCR1B = (1 << WGM12) | (1 << CS10);
TIMSK1 = (1 << OCIE1A);
@@ -353,7 +353,7 @@ uint8_t XPROGTarget_ReceiveByte(void)
}
/* Wait until a byte has been received before reading */
- while (!(UCSR1A & (1 << RXC1)));
+ while (!(UCSR1A & (1 << RXC1)) && TimeoutMSRemaining);
return UDR1;
#else
/* Switch to Rx mode if currently in Tx mode */
@@ -369,8 +369,8 @@ uint8_t XPROGTarget_ReceiveByte(void)
/* Wait until a byte has been received before reading */
SoftUSART_BitCount = BITS_IN_USART_FRAME;
- while (SoftUSART_BitCount);
-
+ while (SoftUSART_BitCount && TimeoutMSRemaining);
+
/* Throw away the parity and stop bits to leave only the data (start bit is already discarded) */
return (uint8_t)SoftUSART_Data;
#endif