From 9207e8b2fde713e39cd42a417decf5421d856b95 Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Sun, 6 May 2012 12:19:03 +0000
Subject: [PATCH] Changed board LED driver implementations of LEDs_ToggleLEDs()
 for the AVR8 architecture to use the fast PIN register toggle alternative
 function for speed.

---
 LUFA/DoxygenPages/ChangeLog.txt             | 1 +
 LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h   | 2 +-
 LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h | 2 +-
 LUFA/Drivers/Board/AVR8/BENITO/LEDs.h       | 2 +-
 LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h    | 4 ++--
 LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h     | 2 +-
 LUFA/Drivers/Board/AVR8/BUI/LEDs.h          | 2 +-
 LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h      | 2 +-
 LUFA/Drivers/Board/AVR8/CULV3/LEDs.h        | 2 +-
 LUFA/Drivers/Board/AVR8/DUCE/LEDs.h         | 2 +-
 LUFA/Drivers/Board/AVR8/EVK527/LEDs.h       | 2 +-
 LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h       | 2 +-
 LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h      | 2 +-
 LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h | 3 ++-
 LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h  | 2 +-
 LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h      | 2 +-
 LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h       | 4 ++--
 LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h    | 2 +-
 LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h   | 6 +++---
 LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h  | 6 +++---
 LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h   | 4 ++--
 LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h  | 2 +-
 LUFA/Drivers/Board/AVR8/STK525/LEDs.h       | 2 +-
 LUFA/Drivers/Board/AVR8/STK526/LEDs.h       | 2 +-
 LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h       | 2 +-
 LUFA/Drivers/Board/AVR8/TUL/LEDs.h          | 2 +-
 LUFA/Drivers/Board/AVR8/UDIP/LEDs.h         | 4 ++--
 LUFA/Drivers/Board/AVR8/UNO/LEDs.h          | 2 +-
 LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h       | 4 ++--
 LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h       | 2 +-
 LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h       | 2 +-
 LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h  | 2 +-
 LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h       | 2 +-
 33 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt
index 4621e8ed3..f8e1b8f48 100644
--- a/LUFA/DoxygenPages/ChangeLog.txt
+++ b/LUFA/DoxygenPages/ChangeLog.txt
@@ -38,6 +38,7 @@
   *   - Added support for various assert and debugging macros for the UC3 devices
   *   - Changed MIDI event structure MIDI_EventPacket_t to use a single field for the combined virtual cable index and command ID, to prevent bitfield packing issues
   *     on some architectures (thanks to Darren Gibbs)
+  *   - Changed board LED driver implementations of LEDs_ToggleLEDs() for the AVR8 architecture to use the fast PIN register toggle alternative function for speed
   *  - Library Applications:
   *   - Raised the guard bits in the AVRISP-MKII clone project when in PDI and TPI to 32, to prevent communication errors on low quality connections to a target
   *   - Added additional bootloader API data to expose the bootloader start address and class to the DFU and CDC class bootloaders
diff --git a/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h b/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h
index f13b75624..661749beb 100644
--- a/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h
@@ -114,7 +114,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTE ^= LEDMask;
+				PINE   = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h b/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h
index 06dcada7d..2cc953b03 100644
--- a/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h
@@ -118,7 +118,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h b/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h
index 429f33e25..875130fbf 100644
--- a/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h
@@ -118,7 +118,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTC ^= LEDMask;
+				PINC  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h b/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h
index 4c749618a..89516dca0 100644
--- a/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h
@@ -139,8 +139,8 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTF ^= (LEDMask & LEDS_PORTF_LEDS);
-				PORTE ^= (LEDMask & LEDS_PORTE_LEDS);
+				PINF  = (LEDMask & LEDS_PORTF_LEDS);
+				PINE  = (LEDMask & LEDS_PORTE_LEDS);
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h b/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h
index 7bfef87dc..12124209d 100644
--- a/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h
@@ -118,7 +118,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/BUI/LEDs.h b/LUFA/Drivers/Board/AVR8/BUI/LEDs.h
index 043a2a72c..039e9efa7 100644
--- a/LUFA/Drivers/Board/AVR8/BUI/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/BUI/LEDs.h
@@ -122,7 +122,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTC ^= LEDMask;
+				PINC  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h b/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h
index 24a1fb209..a09ab9698 100644
--- a/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h
@@ -128,7 +128,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTB ^= LEDMask;
+				PINB  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h b/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h
index 8888a0586..617291204 100644
--- a/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h
@@ -114,7 +114,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTE ^= LEDMask;
+				PINE  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h b/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h
index 4c86ed478..1063d752d 100644
--- a/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h
@@ -126,7 +126,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTC ^= LEDMask;
+				PINC  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h b/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h
index ade2b268a..7e3dc4f5b 100644
--- a/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h
@@ -122,7 +122,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h b/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h
index 6c4934193..adca2dee4 100644
--- a/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h
@@ -114,7 +114,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h b/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h
index 460c94e09..815fc29b2 100644
--- a/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h
@@ -118,7 +118,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTB ^= LEDMask;
+				PINB  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h b/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h
index 71a8049f6..963c15ae4 100644
--- a/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h
@@ -104,6 +104,7 @@
 		#define _BOARD_LED_CONCAT(Reg, Letter)      _BOARD_LED_CONCAT2(Reg, Letter)
 
 		#define _BOARD_LED_PORT                     _BOARD_LED_CONCAT(PORT, _BOARD_LED_PORTLETTER)
+		#define _BOARD_LED_PIN                      _BOARD_LED_CONCAT(PIN,  _BOARD_LED_PORTLETTER)
 		#define _BOARD_LED_DDR                      _BOARD_LED_CONCAT(DDR,  _BOARD_LED_PORTLETTER)
 	#endif
 
@@ -155,7 +156,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				_BOARD_LED_PORT ^= LEDMask;
+				_BOARD_LED_PIN  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h b/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h
index 8b28d3045..31aaa6707 100644
--- a/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h
@@ -114,7 +114,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h b/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h
index c689a3154..f23317d1c 100644
--- a/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h
@@ -122,7 +122,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h b/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h
index c5f07b9ac..64f68a53d 100644
--- a/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h
@@ -139,8 +139,8 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= (LEDMask & LEDS_PORTD_LEDS);
-				PORTC ^= (LEDMask & LEDS_PORTC_LEDS);
+				PIND  = (LEDMask & LEDS_PORTD_LEDS);
+				PINC  = (LEDMask & LEDS_PORTC_LEDS);
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h b/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h
index cc34daac3..21fb500cc 100644
--- a/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h
@@ -114,7 +114,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h b/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h
index fd468c79f..62b7c7829 100644
--- a/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h
@@ -154,9 +154,9 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTB ^= (LEDMask & LEDS_PORTB_LEDS);
-				PORTD ^= ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
-				PORTE ^= (LEDMask & LEDS_PORTE_LEDS);
+				PINB  = (LEDMask & LEDS_PORTB_LEDS);
+				PIND  = ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
+				PINE  = (LEDMask & LEDS_PORTE_LEDS);
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h b/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h
index 029707e4c..1602af842 100644
--- a/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h
@@ -146,9 +146,9 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTB ^= (LEDMask & LEDS_PORTB_LEDS);
-				PORTD ^= (LEDMask & LEDS_PORTD_LEDS);
-				PORTE ^= (LEDMask & LEDS_PORTE_LEDS);
+				PINB  = (LEDMask & LEDS_PORTB_LEDS);
+				PIND  = (LEDMask & LEDS_PORTD_LEDS);
+				PINE  = (LEDMask & LEDS_PORTE_LEDS);
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h b/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h
index 3bc45b9e7..7be9b378f 100644
--- a/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h
@@ -152,8 +152,8 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= (LEDMask & LEDS_PORTD_LEDS);
-				PORTE ^= ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT);
+				PIND  = (LEDMask & LEDS_PORTD_LEDS);
+				PINE  = ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT);
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h b/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h
index a838bed53..6998fd3f3 100644
--- a/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h
@@ -114,7 +114,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTB ^= LEDMask;
+				PINB  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/STK525/LEDs.h b/LUFA/Drivers/Board/AVR8/STK525/LEDs.h
index 881010c62..04d566204 100644
--- a/LUFA/Drivers/Board/AVR8/STK525/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/STK525/LEDs.h
@@ -126,7 +126,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/STK526/LEDs.h b/LUFA/Drivers/Board/AVR8/STK526/LEDs.h
index b19abdc6b..d254a69b4 100644
--- a/LUFA/Drivers/Board/AVR8/STK526/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/STK526/LEDs.h
@@ -126,7 +126,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h b/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h
index f3a577a76..7149923ea 100644
--- a/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h
@@ -151,7 +151,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/TUL/LEDs.h b/LUFA/Drivers/Board/AVR8/TUL/LEDs.h
index 82ccb0ff4..e659a9a9c 100644
--- a/LUFA/Drivers/Board/AVR8/TUL/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/TUL/LEDs.h
@@ -114,7 +114,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTF ^= LEDMask;
+				PINF  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h b/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h
index 83cb1fbeb..7ad6c44b3 100644
--- a/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h
@@ -141,8 +141,8 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTB ^= (LEDMask & LEDS_PORTB_LEDS);
-				PORTD ^= ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
+				PINB  = (LEDMask & LEDS_PORTB_LEDS);
+				PIND  = ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/UNO/LEDs.h b/LUFA/Drivers/Board/AVR8/UNO/LEDs.h
index 5ffafdd5e..2a6178caa 100644
--- a/LUFA/Drivers/Board/AVR8/UNO/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/UNO/LEDs.h
@@ -118,7 +118,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h b/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h
index e66698715..12fa73cd1 100644
--- a/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h
@@ -167,9 +167,9 @@
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
 				#if (BOARD == BOARD_USB2AX)
-				PORTC ^= LEDMask;				
+				PINC  = LEDMask;				
 				#else
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 				#endif
 			}
 
diff --git a/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h b/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h
index 810be72ed..2d68caf02 100644
--- a/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h
@@ -114,7 +114,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h b/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h
index 62c0d76db..25a90a74e 100644
--- a/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h
@@ -126,7 +126,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTD ^= LEDMask;
+				PIND  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h b/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h
index 9322ab90c..96acd6212 100644
--- a/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h
@@ -122,7 +122,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTB ^= LEDMask;
+				PINB  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h b/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h
index ef36e1767..879d656c1 100644
--- a/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h
+++ b/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h
@@ -121,7 +121,7 @@
 
 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
 			{
-				PORTB ^= LEDMask;
+				PINB  = LEDMask;
 			}
 
 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
-- 
GitLab