aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-01-22 17:48:06 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-01-22 17:48:06 +0000
commit26017b68b0632c91e71eb29e87ca94670425e081 (patch)
tree111734f4a05e27e4cfb33779ab8d949388aaee4c /Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
parentef44b8c036daf4806a369dfdcd5adf72cf85b824 (diff)
downloadlufa-26017b68b0632c91e71eb29e87ca94670425e081.tar.gz
lufa-26017b68b0632c91e71eb29e87ca94670425e081.tar.bz2
lufa-26017b68b0632c91e71eb29e87ca94670425e081.zip
Changed AVRISP-MKII project to use the Watchdog interrupt for command timeouts, to reduce CPU usage and free timer 0 for other uses in the future.
Diffstat (limited to 'Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c')
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
index 9a732dea2..27e1cc96c 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
@@ -68,15 +68,14 @@ void ISPProtocol_EnterISPMode(void)
ISPProtocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS);
ISPTarget_EnableTargetISP();
+ ISPTarget_ChangeTargetResetLine(true);
+
/* Continuously attempt to synchronize with the target until either the number of attempts specified
* by the host has exceeded, or the the device sends back the expected response values */
- while (Enter_ISP_Params.SynchLoops-- && (ResponseStatus != STATUS_CMD_OK) && TimeoutTicksRemaining)
+ while (Enter_ISP_Params.SynchLoops-- && (ResponseStatus != STATUS_CMD_OK) && !(TimeoutExpired))
{
uint8_t ResponseBytes[4];
- ISPTarget_ChangeTargetResetLine(true);
- ISPProtocol_DelayMS(Enter_ISP_Params.PinStabDelayMS);
-
for (uint8_t RByte = 0; RByte < sizeof(ResponseBytes); RByte++)
{
ISPProtocol_DelayMS(Enter_ISP_Params.ByteDelay);
@@ -92,6 +91,7 @@ void ISPProtocol_EnterISPMode(void)
{
ISPTarget_ChangeTargetResetLine(false);
ISPProtocol_DelayMS(Enter_ISP_Params.PinStabDelayMS);
+ ISPTarget_ChangeTargetResetLine(true);
}
}
@@ -509,7 +509,7 @@ void ISPProtocol_SPIMulti(void)
*/
void ISPProtocol_DelayMS(uint8_t DelayMS)
{
- while (DelayMS-- && TimeoutTicksRemaining)
+ while (DelayMS-- && !(TimeoutExpired))
_delay_ms(1);
}