Added INVERTED_ISP_MISO compile time option to the AVRISP-MKII clone project (thanks to Chuck Rohs).

pull/1469/head
Dean Camera 13 years ago
parent 1e0c3bc69a
commit eb5b8a32e4

@ -12,6 +12,7 @@
* - None * - None
* - Library Applications: * - Library Applications:
* - Added User Application APIs to the CDC and DFU class bootloaders * - Added User Application APIs to the CDC and DFU class bootloaders
* - Added INVERTED_ISP_MISO compile time option to the AVRISP-MKII clone project (thanks to Chuck Rohs)
* *
* <b>Changed:</b> * <b>Changed:</b>
* - Core: * - Core:

@ -293,6 +293,12 @@
* <td>Define to move the ISP rescue clock to the AVR's XCK pin instead of the OCR1A output pin. This is useful for existing programming * <td>Define to move the ISP rescue clock to the AVR's XCK pin instead of the OCR1A output pin. This is useful for existing programming
* hardware that does not expose the OCR1A pin of the AVR, but *may* cause some issues with PDI programming mode. * hardware that does not expose the OCR1A pin of the AVR, but *may* cause some issues with PDI programming mode.
* </tr> * </tr>
* <tr>
* <td>INVERTED_ISP_MISO</td>
* <td>Makefile LUFA_OPTS</td>
* <td>Define to invert the received data on the ISP MISO line. This is sometimes needed depending on the level translation hardware used,
* if the translator hardware inverts the received logic level.
* </tr>
* </table> * </table>
*/ */

@ -104,10 +104,17 @@
*/ */
static inline uint8_t ISPTarget_ReceiveByte(void) static inline uint8_t ISPTarget_ReceiveByte(void)
{ {
#if !defined(INVERTED_ISP_MISO)
if (HardwareSPIMode) if (HardwareSPIMode)
return SPI_ReceiveByte(); return SPI_ReceiveByte();
else else
return ISPTarget_TransferSoftSPIByte(0x00); return ISPTarget_TransferSoftSPIByte(0x00);
#else
if (HardwareSPIMode)
return ~SPI_ReceiveByte();
else
return ~ISPTarget_TransferSoftSPIByte(0x00);
#endif
} }
/** Sends and receives a byte of ISP data to and from the attached target, using the /** Sends and receives a byte of ISP data to and from the attached target, using the
@ -119,10 +126,17 @@
*/ */
static inline uint8_t ISPTarget_TransferByte(const uint8_t Byte) static inline uint8_t ISPTarget_TransferByte(const uint8_t Byte)
{ {
#if !defined(INVERTED_ISP_MISO)
if (HardwareSPIMode) if (HardwareSPIMode)
return SPI_TransferByte(Byte); return SPI_TransferByte(Byte);
else else
return ISPTarget_TransferSoftSPIByte(Byte); return ISPTarget_TransferSoftSPIByte(Byte);
#else
if (HardwareSPIMode)
return ~SPI_TransferByte(Byte);
else
return ~ISPTarget_TransferSoftSPIByte(Byte);
#endif
} }
#endif #endif

@ -144,6 +144,7 @@ LUFA_OPTS += -D VTARGET_SCALE_FACTOR=1
#LUFA_OPTS += -D NO_VTARGET_DETECT #LUFA_OPTS += -D NO_VTARGET_DETECT
#LUFA_OPTS += -D LIBUSB_DRIVER_COMPAT #LUFA_OPTS += -D LIBUSB_DRIVER_COMPAT
#LUFA_OPTS += -D XCK_RESCUE_CLOCK_ENABLE #LUFA_OPTS += -D XCK_RESCUE_CLOCK_ENABLE
#LUFA_OPTS += -D INVERTED_ISP_MISO
# Create the LUFA source path variables by including the LUFA root makefile # Create the LUFA source path variables by including the LUFA root makefile

Loading…
Cancel
Save