aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA
diff options
context:
space:
mode:
Diffstat (limited to 'LUFA')
-rw-r--r--LUFA/DriverStubs/LEDs.h21
-rw-r--r--LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h5
-rw-r--r--LUFA/Drivers/Board/LEDs.h6
-rw-r--r--LUFA/Drivers/Board/RZUSBSTICK/LEDs.h6
-rw-r--r--LUFA/Drivers/Board/STK525/LEDs.h21
-rw-r--r--LUFA/Drivers/Board/STK526/LEDs.h21
-rw-r--r--LUFA/Drivers/Board/USBKEY/LEDs.h21
-rw-r--r--LUFA/ManPages/ChangeLog.txt1
8 files changed, 70 insertions, 32 deletions
diff --git a/LUFA/DriverStubs/LEDs.h b/LUFA/DriverStubs/LEDs.h
index 993481d8b..3f4cca006 100644
--- a/LUFA/DriverStubs/LEDs.h
+++ b/LUFA/DriverStubs/LEDs.h
@@ -86,24 +86,29 @@
// TODO: Add code to initialize LED port pins as outputs here
}
- static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)
+ static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
- // TODO: Add code to turn on LEDs given in the LedMask mask here, leave others as-is
+ // TODO: Add code to turn on LEDs given in the LEDMask mask here, leave others as-is
}
- static inline void LEDs_TurnOffLEDs(const uint8_t LedMask)
+ static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
{
- // TODO: Add code to turn off LEDs given in the LedMask mask here, leave others as-is
+ // TODO: Add code to turn off LEDs given in the LEDMask mask here, leave others as-is
}
- static inline void LEDs_SetAllLEDs(const uint8_t LedMask)
+ static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
{
- // TODO: Add code to turn on only LEDs given in the LedMask mask here, all others off
+ // TODO: Add code to turn on only LEDs given in the LEDMask mask here, all others off
}
- static inline void LEDs_ChangeLEDs(const uint8_t LedMask, const uint8_t ActiveMask)
+ static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)
{
- // TODO: Add code to set the Leds in the given LedMask to the status given in ActiveMask here
+ // TODO: Add code to set the Leds in the given LEDMask to the status given in ActiveMask here
+ }
+
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
+ {
+ // TODO: Add code to toggle the Leds in the given LEDMask, ignoring all others
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h b/LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
index 9f808279a..8487ee74e 100644
--- a/LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
+++ b/LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
@@ -110,6 +110,11 @@
{
PORTD = ((PORTD & ~(LEDMask & LEDS_ALL_LEDS)) | (ActiveMask & LEDS_ALL_LEDS));
}
+
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
+ {
+ PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
+ }
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
diff --git a/LUFA/Drivers/Board/LEDs.h b/LUFA/Drivers/Board/LEDs.h
index cd2b857a4..cea947a85 100644
--- a/LUFA/Drivers/Board/LEDs.h
+++ b/LUFA/Drivers/Board/LEDs.h
@@ -142,6 +142,12 @@
* \param[in] ActiveMask Mask of whether the LEDs in the LED mask should be turned on or off
*/
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask);
+
+ /** Toggles all LEDs in the LED mask, leaving all others in their current states.
+ *
+ * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file)
+ */
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask);
/** Returns the status of all the board LEDs; set LED masks in the return value indicate that the
* corresponding LED is on.
diff --git a/LUFA/Drivers/Board/RZUSBSTICK/LEDs.h b/LUFA/Drivers/Board/RZUSBSTICK/LEDs.h
index 24977ea5e..ecaab1edf 100644
--- a/LUFA/Drivers/Board/RZUSBSTICK/LEDs.h
+++ b/LUFA/Drivers/Board/RZUSBSTICK/LEDs.h
@@ -131,6 +131,12 @@
~((ActiveMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT));
}
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
+ {
+ PORTD = (PORTD ^ (LEDMask & LEDS_PORTD_LEDS));
+ PORTE = (PORTE ^ ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT));
+ }
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
diff --git a/LUFA/Drivers/Board/STK525/LEDs.h b/LUFA/Drivers/Board/STK525/LEDs.h
index a769f16d0..73c03f75a 100644
--- a/LUFA/Drivers/Board/STK525/LEDs.h
+++ b/LUFA/Drivers/Board/STK525/LEDs.h
@@ -88,26 +88,31 @@
PORTD &= ~LEDS_ALL_LEDS;
}
- static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)
+ static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
- PORTD |= LedMask;
+ PORTD |= LEDMask;
}
- static inline void LEDs_TurnOffLEDs(const uint8_t LedMask)
+ static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
{
- PORTD &= ~LedMask;
+ PORTD &= ~LEDMask;
}
- static inline void LEDs_SetAllLEDs(const uint8_t LedMask)
+ static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
{
- PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LedMask);
+ PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
}
- static inline void LEDs_ChangeLEDs(const uint8_t LedMask, const uint8_t ActiveMask)
+ static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)
{
- PORTD = ((PORTD & ~LedMask) | ActiveMask);
+ PORTD = ((PORTD & ~LEDMask) | ActiveMask);
}
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
+ {
+ PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
+ }
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
diff --git a/LUFA/Drivers/Board/STK526/LEDs.h b/LUFA/Drivers/Board/STK526/LEDs.h
index 6b17ab1c8..5718f405d 100644
--- a/LUFA/Drivers/Board/STK526/LEDs.h
+++ b/LUFA/Drivers/Board/STK526/LEDs.h
@@ -88,24 +88,29 @@
PORTD &= ~LEDS_ALL_LEDS;
}
- static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)
+ static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
- PORTD |= LedMask;
+ PORTD |= LEDMask;
}
- static inline void LEDs_TurnOffLEDs(const uint8_t LedMask)
+ static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
{
- PORTD &= ~LedMask;
+ PORTD &= ~LEDMask;
}
- static inline void LEDs_SetAllLEDs(const uint8_t LedMask)
+ static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
{
- PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LedMask);
+ PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
}
- static inline void LEDs_ChangeLEDs(const uint8_t LedMask, const uint8_t ActiveMask)
+ static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)
{
- PORTD = ((PORTD & ~LedMask) | ActiveMask);
+ PORTD = ((PORTD & ~(LEDMask & LEDS_ALL_LEDS)) | (ActiveMask & LEDS_ALL_LEDS));
+ }
+
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
+ {
+ PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Board/USBKEY/LEDs.h b/LUFA/Drivers/Board/USBKEY/LEDs.h
index 68df3172f..2e61d2eb2 100644
--- a/LUFA/Drivers/Board/USBKEY/LEDs.h
+++ b/LUFA/Drivers/Board/USBKEY/LEDs.h
@@ -88,24 +88,29 @@
PORTD &= ~LEDS_ALL_LEDS;
}
- static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)
+ static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
- PORTD |= LedMask;
+ PORTD |= LEDMask;
}
- static inline void LEDs_TurnOffLEDs(const uint8_t LedMask)
+ static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
{
- PORTD &= ~LedMask;
+ PORTD &= ~LEDMask;
}
- static inline void LEDs_SetAllLEDs(const uint8_t LedMask)
+ static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
{
- PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LedMask);
+ PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
}
- static inline void LEDs_ChangeLEDs(const uint8_t LedMask, const uint8_t ActiveMask)
+ static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)
{
- PORTD = ((PORTD & ~LedMask) | ActiveMask);
+ PORTD = ((PORTD & ~LEDMask) | ActiveMask);
+ }
+
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
+ {
+ PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt
index b7c1e288d..eb6c89ebf 100644
--- a/LUFA/ManPages/ChangeLog.txt
+++ b/LUFA/ManPages/ChangeLog.txt
@@ -32,6 +32,7 @@
* - Added new USB_DeviceState variable to keep track of the current Device mode USB state
* - Added new Endpoint_ClearStatusStage() convenience function to assist with the status stages of control transfers
* - Added new Benito Arduino Programmer project
+ * - Added new LEDs_ToggleLEDs() function to the LEDs driver
*
* <b>Changed:</b>
* - Deprecated psuedo-scheduler and removed dynamic memory allocator from the library (first no longer needed and second unused)