From 0aa950c241d2751e25170bbafbabc67c66c9a5dc Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Mon, 13 Dec 2010 06:05:05 +0000
Subject: [PATCH] Fixed incorrect definition of the HID_KEYBOARD_SC_D constant
 in the HID class driver (thanks to Opendous Inc.).

Add extra comments to the ISPTarget.c source file in the AVRISP-MKII clone project.
---
 LUFA/Drivers/USB/Class/Common/HID.h      | 5 +++--
 LUFA/ManPages/ChangeLog.txt              | 1 +
 Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c | 3 +++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/LUFA/Drivers/USB/Class/Common/HID.h b/LUFA/Drivers/USB/Class/Common/HID.h
index d9824dbd1..024158aa3 100644
--- a/LUFA/Drivers/USB/Class/Common/HID.h
+++ b/LUFA/Drivers/USB/Class/Common/HID.h
@@ -111,7 +111,7 @@
 		#define HID_KEYBOARD_SC_A                                 0x04
 		#define HID_KEYBOARD_SC_B                                 0x05
 		#define HID_KEYBOARD_SC_C                                 0x06
-		#define HID_KEYBOARD_SC_D                                 0x04
+		#define HID_KEYBOARD_SC_D                                 0x07
 		#define HID_KEYBOARD_SC_E                                 0x08
 		#define HID_KEYBOARD_SC_F                                 0x09
 		#define HID_KEYBOARD_SC_G                                 0x0A
@@ -239,7 +239,8 @@
 		#define HID_KEYBOARD_SC_KEYPAD_EQUAL_SIGN                 0x86
 		#define HID_KEYBOARD_SC_INTERNATIONAL1                    0x87
 		#define HID_KEYBOARD_SC_INTERNATIONAL2                    0x88
-		#define HID_KEYBOARD_SC_INTERNATIONAL3                    0x8A
+		#define HID_KEYBOARD_SC_INTERNATIONAL3                    0x89
+		#define HID_KEYBOARD_SC_INTERNATIONAL4                    0x8A
 		#define HID_KEYBOARD_SC_INTERNATIONAL5                    0x8B
 		#define HID_KEYBOARD_SC_INTERNATIONAL6                    0x8C
 		#define HID_KEYBOARD_SC_INTERNATIONAL7                    0x8D
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt
index 4436727d9..6f38c102f 100644
--- a/LUFA/ManPages/ChangeLog.txt
+++ b/LUFA/ManPages/ChangeLog.txt
@@ -27,6 +27,7 @@
   *  - Core:
   *   - Fixed broken USBFOO board drivers due to missing BOARD_USBFOO define
   *   - Fixed HID host class driver incorrectly binding to HID devices that do not have an OUT endpoint
+  *   - Fixed incorrect definition of the HID_KEYBOARD_SC_D constant in the HID class driver (thanks to Opendous Inc.)
   *  - Library Applications:
   *   - Fixed Benito project discarding incoming data from the USB virtual serial port when the USART is busy
   *   - Fixed broken DFU bootloader, added XPLAIN support for bootloader start when XCK jumpered to ground
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
index 657c2c999..811e777cc 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
@@ -117,6 +117,7 @@ volatile uint8_t SoftSPI_BitsRemaining;
 /** ISR to handle software SPI transmission and reception */
 ISR(TIMER1_COMPA_vect, ISR_BLOCK)
 {
+	/* Check if rising edge (output next bit) or falling edge (read in next bit) */
 	if (!(PINB & (1 << 1)))
 	{
 		if (SoftSPI_Data & (1 << 7))
@@ -178,6 +179,8 @@ 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();
 	}
 }
-- 
GitLab