aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/AVRISP-MKII/Lib/V2Protocol.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-05-02 05:16:34 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-05-02 05:16:34 +0000
commit3d28d53c3e2ae529933283e63a8b05f2ab1ce2be (patch)
treef395bb297884750d54614b941f2bda0727cc2796 /Projects/AVRISP-MKII/Lib/V2Protocol.c
parent9a1560dc050f79fd189838a87ce623e79ff48677 (diff)
downloadlufa-3d28d53c3e2ae529933283e63a8b05f2ab1ce2be.tar.gz
lufa-3d28d53c3e2ae529933283e63a8b05f2ab1ce2be.tar.bz2
lufa-3d28d53c3e2ae529933283e63a8b05f2ab1ce2be.zip
Change AVRISP project's timeout to be interrupt based again, but make the interrupt itself interruptable and use a seperate assembly file to hand-optimize the ISR code.
Removed the cast to uint16_t on the set baud rate in the USBtoSerial project, so that the higher >1M baud rates can be selected (thanks to Steffan).
Diffstat (limited to 'Projects/AVRISP-MKII/Lib/V2Protocol.c')
-rw-r--r--Projects/AVRISP-MKII/Lib/V2Protocol.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Projects/AVRISP-MKII/Lib/V2Protocol.c b/Projects/AVRISP-MKII/Lib/V2Protocol.c
index 431f9c2d5..63b7294c0 100644
--- a/Projects/AVRISP-MKII/Lib/V2Protocol.c
+++ b/Projects/AVRISP-MKII/Lib/V2Protocol.c
@@ -42,6 +42,7 @@ uint32_t CurrentAddress;
/** Flag to indicate that the next read/write operation must update the device's current address */
bool MustSetAddress;
+
/** Initializes the hardware and software associated with the V2 protocol command handling. */
void V2Protocol_Init(void)
{
@@ -55,7 +56,7 @@ void V2Protocol_Init(void)
/* Millisecond timer initialization for managing the command timeout counter */
OCR0A = ((F_CPU / 64) / 1000);
TCCR0A = (1 << WGM01);
- TCCR0B = ((1 << CS01) | (1 << CS00));
+ TIMSK0 = (1 << OCIE0A);
V2Params_LoadNonVolatileParamValues();
}
@@ -68,7 +69,9 @@ void V2Protocol_ProcessCommand(void)
{
uint8_t V2Command = Endpoint_Read_Byte();
+ /* Start the timeout management timer */
TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+ TCCR0B = ((1 << CS01) | (1 << CS00));
switch (V2Command)
{
@@ -129,6 +132,9 @@ void V2Protocol_ProcessCommand(void)
V2Protocol_UnknownCommand(V2Command);
break;
}
+
+ /* Disable the timeout management timer */
+ TCCR0B = 0;
Endpoint_WaitUntilReady();
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);