Added ENABLE_TELNET_SERVER compile time option to the Webserver project to disable...
[pub/USBasp.git] / Projects / AVRISP-MKII / Lib / ISP / ISPProtocol.c
index e0eb441..85b31fb 100644 (file)
@@ -75,7 +75,7 @@ void ISPProtocol_EnterISPMode(void)
 \r
        /* Continuously attempt to synchronize with the target until either the number of attempts specified\r
         * by the host has exceeded, or the the device sends back the expected response values */\r
 \r
        /* Continuously attempt to synchronize with the target until either the number of attempts specified\r
         * by the host has exceeded, or the the device sends back the expected response values */\r
-       while (Enter_ISP_Params.SynchLoops-- && (ResponseStatus == STATUS_CMD_FAILED))\r
+       while (Enter_ISP_Params.SynchLoops-- && (ResponseStatus == STATUS_CMD_FAILED) && TimeoutMSRemaining)\r
        {\r
                uint8_t ResponseBytes[4];\r
 \r
        {\r
                uint8_t ResponseBytes[4];\r
 \r
@@ -518,4 +518,19 @@ void ISPProtocol_SPIMulti(void)
        }\r
 }\r
 \r
        }\r
 }\r
 \r
+/** Blocking delay for a given number of milliseconds.\r
+ *\r
+ *  \param[in] DelayMS  Number of milliseconds to delay for\r
+ */\r
+void ISPProtocol_DelayMS(uint8_t DelayMS)\r
+{\r
+       while (DelayMS-- && TimeoutMSRemaining)\r
+       {\r
+               if (TimeoutMSRemaining)\r
+                 TimeoutMSRemaining--;\r
+                 \r
+               _delay_ms(1);\r
+       }\r
+}\r
+\r
 #endif
\ No newline at end of file
 #endif
\ No newline at end of file