X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/7e74bd3ea2f8de6c6a78fc8e2527c806b2dd8476..f9c0357b731e5ca4a5456056bbbe2e4a8a2dc9fe:/Projects/Incomplete/AVRISP/Lib/V2ProtocolTarget.c?ds=sidebyside diff --git a/Projects/Incomplete/AVRISP/Lib/V2ProtocolTarget.c b/Projects/Incomplete/AVRISP/Lib/V2ProtocolTarget.c index 7bcf0bea4..caa7010ba 100644 --- a/Projects/Incomplete/AVRISP/Lib/V2ProtocolTarget.c +++ b/Projects/Incomplete/AVRISP/Lib/V2ProtocolTarget.c @@ -36,24 +36,22 @@ #include "V2ProtocolTarget.h" /** Current memory address for FLASH/EEPROM memory read/write commands */ -uint32_t CurrentAddress; +uint32_t CurrentAddress; -/** Table of masks for SPI_Init() from a given PARAM_SCK_DURATION value */ -static const uint8_t SPIMaskFromSCKDuration[] = +uint8_t V2Protocol_GetSPIPrescalerMask(void) +{ + static const uint8_t SPIMaskFromSCKDuration[] = { #if (F_CPU == 8000000) SPI_SPEED_FCPU_DIV_2, #endif SPI_SPEED_FCPU_DIV_2, SPI_SPEED_FCPU_DIV_4, SPI_SPEED_FCPU_DIV_8, SPI_SPEED_FCPU_DIV_16, SPI_SPEED_FCPU_DIV_32, SPI_SPEED_FCPU_DIV_64 - #if (F_CPU == 16000000) + #if (F_CPU == 16000000) , SPI_SPEED_FCPU_DIV_128 #endif }; - -uint8_t V2Protocol_GetSPIPrescalerMask(void) -{ uint8_t SCKDuration = V2Params_GetParameterValue(PARAM_SCK_DURATION); if (SCKDuration >= sizeof(SPIMaskFromSCKDuration)) @@ -73,7 +71,7 @@ void V2Protocol_ChangeTargetResetLine(bool ResetTarget) } else { - RESET_LINE_PORT &= ~RESET_LINE_MASK; + RESET_LINE_PORT &= ~RESET_LINE_MASK; RESET_LINE_DDR &= ~RESET_LINE_MASK; } } @@ -91,13 +89,13 @@ uint8_t V2Protocol_WaitWhileTargetBusy(void) do { - V2Protocol_DelayMS(1); - SPI_SendByte(0xF0); SPI_SendByte(0x00); SPI_SendByte(0x00); ResponseByte = SPI_ReceiveByte(); + + V2Protocol_DelayMS(1); } while ((ResponseByte & 0x01) && (TimeoutMS--));