diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-07-24 01:44:01 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-07-24 01:44:01 +0000 |
commit | 200821fe827230570e253c1679f00bcdb6c5bd94 (patch) | |
tree | 0aed41075af0b12258d1dee1c3946e61e9e4d0e0 /LUFA/Drivers/Board | |
parent | 3991c94b3858bbb02ca9ea6497cf60c84635b99a (diff) | |
download | lufa-200821fe827230570e253c1679f00bcdb6c5bd94.tar.gz lufa-200821fe827230570e253c1679f00bcdb6c5bd94.tar.bz2 lufa-200821fe827230570e253c1679f00bcdb6c5bd94.zip |
Added new LEDs_ToggleLEDs() function to the Board LEDs driver.
Diffstat (limited to 'LUFA/Drivers/Board')
-rw-r--r-- | LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h | 5 | ||||
-rw-r--r-- | LUFA/Drivers/Board/LEDs.h | 6 | ||||
-rw-r--r-- | LUFA/Drivers/Board/RZUSBSTICK/LEDs.h | 6 | ||||
-rw-r--r-- | LUFA/Drivers/Board/STK525/LEDs.h | 21 | ||||
-rw-r--r-- | LUFA/Drivers/Board/STK526/LEDs.h | 21 | ||||
-rw-r--r-- | LUFA/Drivers/Board/USBKEY/LEDs.h | 21 |
6 files changed, 56 insertions, 24 deletions
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;
|