X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/de0df8b16259458c78c742b5dbedd4ac90856285..f429975e01c4a7b76e5bafccf4e8e41489c58340:/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h index 34c40d677..72ec0b1ec 100644 --- a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h +++ b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h @@ -47,7 +47,7 @@ #include "../V2Protocol.h" #include "ISPProtocol.h" #include "Config/AppConfig.h" - + /* Preprocessor Checks: */ #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1)) #undef ENABLE_ISP_PROTOCOL @@ -106,16 +106,17 @@ */ static inline uint8_t ISPTarget_ReceiveByte(void) { - #if !defined(INVERTED_ISP_MISO) + uint8_t ReceivedByte; + if (HardwareSPIMode) - return SPI_ReceiveByte(); + ReceivedByte = SPI_ReceiveByte(); else - return ISPTarget_TransferSoftSPIByte(0x00); + ReceivedByte = ISPTarget_TransferSoftSPIByte(0x00); + + #if defined(INVERTED_ISP_MISO) + return ~ReceivedByte; #else - if (HardwareSPIMode) - return ~SPI_ReceiveByte(); - else - return ~ISPTarget_TransferSoftSPIByte(0x00); + return ReceivedByte; #endif } @@ -128,16 +129,17 @@ */ static inline uint8_t ISPTarget_TransferByte(const uint8_t Byte) { - #if !defined(INVERTED_ISP_MISO) + uint8_t ReceivedByte; + if (HardwareSPIMode) - return SPI_TransferByte(Byte); + ReceivedByte = SPI_TransferByte(Byte); else - return ISPTarget_TransferSoftSPIByte(Byte); + ReceivedByte = ISPTarget_TransferSoftSPIByte(Byte); + + #if defined(INVERTED_ISP_MISO) + return ~ReceivedByte; #else - if (HardwareSPIMode) - return ~SPI_TransferByte(Byte); - else - return ~ISPTarget_TransferSoftSPIByte(Byte); + return ReceivedByte; #endif }