Added LEDs_ToggleLEDs() function to several board LED drivers which were missing...
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 9 Sep 2010 09:57:03 +0000 (09:57 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 9 Sep 2010 09:57:03 +0000 (09:57 +0000)
Simplify some of the LED driver functions to produce more compact code.

12 files changed:
LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
LUFA/Drivers/Board/BUMBLEB/LEDs.h
LUFA/Drivers/Board/EVK527/LEDs.h
LUFA/Drivers/Board/JMDBU2/LEDs.h
LUFA/Drivers/Board/OLIMEX162/LEDs.h
LUFA/Drivers/Board/STK525/LEDs.h
LUFA/Drivers/Board/STK526/LEDs.h
LUFA/Drivers/Board/USBKEY/LEDs.h
LUFA/Drivers/Board/USBTINYMKII/LEDs.h
LUFA/Drivers/Board/XPLAIN/LEDs.h
LUFA/ManPages/ChangeLog.txt
LUFA/ManPages/LUFAPoweredProjects.txt

index b0fa0f6..1fe71de 100644 (file)
                        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 & LEDS_ALL_LEDS)) | (ActiveMask & LEDS_ALL_LEDS));
+                               PORTD = ((PORTD & ~LEDMask) | ActiveMask);
                        }
 
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
                        }
 
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
-                               PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
+                               PORTD ^= LEDMask;
                        }
                        
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
                        }
                        
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
index 1453da4..6446d12 100644 (file)
                                PORTB = ((PORTB & ~LedMask) | ActiveMask);
                        }
                        
                                PORTB = ((PORTB & ~LedMask) | ActiveMask);
                        }
                        
+                       static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
+                       {
+                               PORTB ^= LEDMask;
+                       }
+
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
                        static inline uint8_t LEDs_GetLEDs(void)
                        {
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
                        static inline uint8_t LEDs_GetLEDs(void)
                        {
index 7612ba0..9f36ec8 100644 (file)
                        
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
                        
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
-                               PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
+                               PORTD ^= LEDMask;
                        }
                        
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
                        }
                        
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
index 1acf2a9..70013a3 100644 (file)
                        
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
                        
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
-                               PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
+                               PORTD ^= LEDMask;
                        }
                        
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
                        }
                        
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
index 625d953..c4a4b3f 100644 (file)
                #if defined(__cplusplus)\r
                        }\r
                #endif\r
                #if defined(__cplusplus)\r
                        }\r
                #endif\r
-       \r
+               \r
 #endif\r
 \r
 /** @} */\r
 #endif\r
 \r
 /** @} */\r
index d2d1bbb..407c892 100644 (file)
                        
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
                        
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
-                               PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
+                               PORTD ^= LEDMask;
                        }
 
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
                        }
 
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
index 2d20e54..de65d26 100644 (file)
                        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 & LEDS_ALL_LEDS)) | (ActiveMask & LEDS_ALL_LEDS));
+                               PORTD = ((PORTD & ~LEDMask) | ActiveMask);
                        }
                        
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
                        }
                        
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
-                               PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
+                               PORTD ^= LEDMask;
                        }
                        
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
                        }
                        
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
index 86981f5..ebac08e 100644 (file)
                        
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
                        
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
-                               PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));
+                               PORTD ^= LEDMask;
                        }
                        
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
                        }
                        
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
index b0383a6..f394ec0 100644 (file)
                                PORTB = ((PORTB & ~LedMask) | ActiveMask);
                        }
                        
                                PORTB = ((PORTB & ~LedMask) | ActiveMask);
                        }
                        
+                       static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
+                       {
+                               PORTB ^= LEDMask;
+                       }
+
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
                        static inline uint8_t LEDs_GetLEDs(void)
                        {
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
                        static inline uint8_t LEDs_GetLEDs(void)
                        {
index 00f7bc2..697ec96 100644 (file)
                        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)
                        {
-                               PORTB = ((PORTB | (LEDMask & LEDS_ALL_LEDS)) & (~ActiveMask & LEDS_ALL_LEDS));
+                               PORTB = ((PORTB | LEDMask) & ~ActiveMask);
                        }
                        
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
                        }
                        
                        static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
                        {
-                               PORTD = (PORTB ^ (LEDMask & LEDS_ALL_LEDS));
+                               PORTB ^= LEDMask;
                        }
                        
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
                        }
                        
                        static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
index 253d40d..c92a944 100644 (file)
@@ -46,6 +46,7 @@
   *  - Fixed USBtoSerial and Benito project SetLineEncoding calls failing if the USART is busy, due to the RX ISR delaying the control
   *    request handler
   *  - Fixed LowLevel PrinterHost demo not sending control requests to the attached printer with the correct printer interface wIndex value
   *  - Fixed USBtoSerial and Benito project SetLineEncoding calls failing if the USART is busy, due to the RX ISR delaying the control
   *    request handler
   *  - Fixed LowLevel PrinterHost demo not sending control requests to the attached printer with the correct printer interface wIndex value
+  *  - Added LEDs_ToggleLEDs() function to several board LED drivers which were missing it (thanks to Andrei Krainev)
   *
   *  \section Sec_ChangeLog100807 Version 100807
   *  <b>New:</b>
   *
   *  \section Sec_ChangeLog100807 Version 100807
   *  <b>New:</b>
index b696130..0563462 100644 (file)
  *  are open design, and all are available for purchase as completed development boards suitable for project development.
  *
  *  - AT90USB162 Breadboard PCB (Russian): http://microsin.ru/content/view/685/44/
  *  are open design, and all are available for purchase as completed development boards suitable for project development.
  *
  *  - AT90USB162 Breadboard PCB (Russian): http://microsin.ru/content/view/685/44/
+ *  - AVR-USB-162, a USBKEY-like development board for the AT90USB162: http://olimex.com/dev/avr-usb-162.html
  *  - Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/wiki/benito
  *  - JM-DB-U2, an ATMEGA32U2 development board: http://u2.mattair.net/index.html
  *  - Micropendous, an open design/source set of AVR USB development boards: http://micropendous.org/
  *  - Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/wiki/benito
  *  - JM-DB-U2, an ATMEGA32U2 development board: http://u2.mattair.net/index.html
  *  - Micropendous, an open design/source set of AVR USB development boards: http://micropendous.org/
+ *  - Minimus USB, a board specially designed for PSGroove: http://www.minimususb.com/
  *  - Nanduino, a do-it-yourself AT90USB162 board: http://www.makestuff.eu/wordpress/?page_id=569
  *  - Nanduino, a do-it-yourself AT90USB162 board: http://www.makestuff.eu/wordpress/?page_id=569
- *  - AVR-USB-162, a USBKEY-like development board for the AT90USB162: http://olimex.com/dev/avr-usb-162.html
  *  - Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html
  *  - U2DIL/U4DIL, a set of DIP layout USB AVR boards: http://www.reworld.eu/re/en/products/u2dil/
  *  - USBFOO 2, AT90USB162 based development board: http://shop.kernelconcepts.de/product_info.php?products_id=102
  *  - Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html
  *  - U2DIL/U4DIL, a set of DIP layout USB AVR boards: http://www.reworld.eu/re/en/products/u2dil/
  *  - USBFOO 2, AT90USB162 based development board: http://shop.kernelconcepts.de/product_info.php?products_id=102
@@ -88,4 +89,5 @@
  *  - Elektor Magazine, "My First AVR-USB" by Antoine Authier (feature), January 2010 Issue
  *  - Elektor Magazine, "USB is Cool/Sucks" by Jerry Jacobs and Chris Vossen (minor mention), January 2010 Issue
  *  - Elektor Magazine, "20 x Open Source" by Jens Nickel, March 2010 Issue
  *  - Elektor Magazine, "My First AVR-USB" by Antoine Authier (feature), January 2010 Issue
  *  - Elektor Magazine, "USB is Cool/Sucks" by Jerry Jacobs and Chris Vossen (minor mention), January 2010 Issue
  *  - Elektor Magazine, "20 x Open Source" by Jens Nickel, March 2010 Issue
+ *  - Circuit Cellar Magazine, "Advanced USB Design Debugging" by Collin O'Flynn, August 2010 Issue
  */
\ No newline at end of file
  */
\ No newline at end of file