Switch to hardware delays and timeouts via a hardware timer in the V2 Protocol handler.
[pub/USBasp.git] / Projects / Incomplete / AVRISP / AVRISP.c
index f3634fd..32919ef 100644 (file)
@@ -37,6 +37,7 @@
 // TODO: Add reversed target connector checks\r
 // TODO: Add in software SPI for lower programming speeds below 125KHz\r
 // TODO: Add in VTARGET detection\r
+// TODO: Add in software SPI for lower programming speeds\r
 \r
 #include "AVRISP.h"\r
 \r
@@ -72,6 +73,11 @@ void SetupHardware(void)
        /* Hardware Initialization */\r
        LEDs_Init();\r
        USB_Init();\r
+\r
+       /* Millisecond timer initialization for timeout checking */\r
+       OCR0A  = ((F_CPU / 64) / 1000);\r
+       TCCR0A = (1 << WGM01);\r
+       TCCR0B = ((1 << CS01) | (1 << CS00));\r
 }\r
 \r
 /** Event handler for the library USB Connection event. */\r