Bit-bang ISP in the AVRISP-MKII clone project needs to set MOSI pin to the MSB of...
authorDean Camera <dean@fourwalledcubicle.com>
Tue, 29 Nov 2011 11:30:25 +0000 (11:30 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Tue, 29 Nov 2011 11:30:25 +0000 (11:30 +0000)
Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c

index 2158f4d..a6ec536 100644 (file)
@@ -243,7 +243,8 @@ uint8_t ISPTarget_TransferSoftSPIByte(const uint8_t Byte)
        SoftSPI_Data          = Byte;
        SoftSPI_BitsRemaining = 8;
 
        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);
          PORTB |=  (1 << 2);
        else
          PORTB &= ~(1 << 2);