X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/aae59857a2ee47aecbec75cd2c28de2c9b8cf3c7..a147cee95f5373902242e7b34b92f7103fc05ae4:/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c index 2158f4de2..04bfcb5f8 100644 --- a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c +++ b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c @@ -178,7 +178,7 @@ void ISPTarget_DisableTargetISP(void) { DDRB &= ~((1 << 1) | (1 << 2)); PORTB &= ~((1 << 0) | (1 << 3)); - + /* Must re-enable rescue clock once software ISP has exited, as the timer for the rescue clock is * re-purposed for software SPI */ ISPTarget_ConfigureRescueClock(); @@ -195,7 +195,7 @@ void ISPTarget_ConfigureRescueClock(void) #if defined(XCK_RESCUE_CLOCK_ENABLE) /* Configure XCK as an output for the specified AVR model */ DDRD |= (1 << 5); - + /* Start USART to generate a 4MHz clock on the XCK pin */ UBRR1 = ((F_CPU / 2 / ISP_RESCUE_CLOCK_SPEED) - 1); UCSR1B = (1 << TXEN1); @@ -243,7 +243,8 @@ uint8_t ISPTarget_TransferSoftSPIByte(const uint8_t Byte) SoftSPI_Data = Byte; SoftSPI_BitsRemaining = 8; - if (SoftSPI_Data & 0x01) + /* Set initial MOSI pin state according to the byte to be transferred */ + if (SoftSPI_Data & (1 << 7)) PORTB |= (1 << 2); else PORTB &= ~(1 << 2);