if (KeyboardReport.KeyCode)\r
{\r
/* Toggle status LED to indicate keypress */\r
- if (LEDs_GetLEDs() & LEDS_LED2)\r
- LEDs_TurnOffLEDs(LEDS_LED2);\r
- else\r
- LEDs_TurnOnLEDs(LEDS_LED2);\r
+ LEDs_ToggleLEDs(LEDS_LED2);\r
\r
char PressedKey = 0;\r
\r
if (KeyCode)\r
{\r
/* Toggle status LED to indicate keypress */\r
- if (LEDs_GetLEDs() & LEDS_LED2)\r
- LEDs_TurnOffLEDs(LEDS_LED2);\r
- else\r
- LEDs_TurnOnLEDs(LEDS_LED2);\r
+ LEDs_ToggleLEDs(LEDS_LED2);\r
\r
char PressedKey = 0;\r
\r
// TODO: Add code to initialize LED port pins as outputs here\r
}\r
\r
- static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)\r
+ static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)\r
{\r
- // TODO: Add code to turn on LEDs given in the LedMask mask here, leave others as-is\r
+ // TODO: Add code to turn on LEDs given in the LEDMask mask here, leave others as-is\r
}\r
\r
- static inline void LEDs_TurnOffLEDs(const uint8_t LedMask)\r
+ static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)\r
{\r
- // TODO: Add code to turn off LEDs given in the LedMask mask here, leave others as-is\r
+ // TODO: Add code to turn off LEDs given in the LEDMask mask here, leave others as-is\r
}\r
\r
- static inline void LEDs_SetAllLEDs(const uint8_t LedMask)\r
+ static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)\r
{\r
- // TODO: Add code to turn on only LEDs given in the LedMask mask here, all others off\r
+ // TODO: Add code to turn on only LEDs given in the LEDMask mask here, all others off\r
}\r
\r
- static inline void LEDs_ChangeLEDs(const uint8_t LedMask, const uint8_t ActiveMask)\r
+ static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)\r
{\r
- // TODO: Add code to set the Leds in the given LedMask to the status given in ActiveMask here\r
+ // TODO: Add code to set the Leds in the given LEDMask to the status given in ActiveMask here\r
+ }\r
+\r
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)\r
+ {\r
+ // TODO: Add code to toggle the Leds in the given LEDMask, ignoring all others\r
}\r
\r
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;\r
{\r
PORTD = ((PORTD & ~(LEDMask & LEDS_ALL_LEDS)) | (ActiveMask & LEDS_ALL_LEDS));\r
}\r
+\r
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)\r
+ {\r
+ PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));\r
+ }\r
\r
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;\r
static inline uint8_t LEDs_GetLEDs(void)\r
* \param[in] ActiveMask Mask of whether the LEDs in the LED mask should be turned on or off\r
*/\r
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask);\r
+ \r
+ /** Toggles all LEDs in the LED mask, leaving all others in their current states.\r
+ *\r
+ * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file)\r
+ */\r
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask);\r
\r
/** Returns the status of all the board LEDs; set LED masks in the return value indicate that the\r
* corresponding LED is on.\r
~((ActiveMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT));\r
}\r
\r
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)\r
+ {\r
+ PORTD = (PORTD ^ (LEDMask & LEDS_PORTD_LEDS));\r
+ PORTE = (PORTE ^ ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT));\r
+ }\r
+\r
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;\r
static inline uint8_t LEDs_GetLEDs(void)\r
{\r
PORTD &= ~LEDS_ALL_LEDS;\r
}\r
\r
- static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)\r
+ static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)\r
{\r
- PORTD |= LedMask;\r
+ PORTD |= LEDMask;\r
}\r
\r
- static inline void LEDs_TurnOffLEDs(const uint8_t LedMask)\r
+ static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)\r
{\r
- PORTD &= ~LedMask;\r
+ PORTD &= ~LEDMask;\r
}\r
\r
- static inline void LEDs_SetAllLEDs(const uint8_t LedMask)\r
+ static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)\r
{\r
- PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LedMask);\r
+ PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);\r
}\r
\r
- static inline void LEDs_ChangeLEDs(const uint8_t LedMask, const uint8_t ActiveMask)\r
+ static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)\r
{\r
- PORTD = ((PORTD & ~LedMask) | ActiveMask);\r
+ PORTD = ((PORTD & ~LEDMask) | ActiveMask);\r
}\r
\r
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)\r
+ {\r
+ PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));\r
+ }\r
+\r
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;\r
static inline uint8_t LEDs_GetLEDs(void)\r
{\r
PORTD &= ~LEDS_ALL_LEDS;\r
}\r
\r
- static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)\r
+ static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)\r
{\r
- PORTD |= LedMask;\r
+ PORTD |= LEDMask;\r
}\r
\r
- static inline void LEDs_TurnOffLEDs(const uint8_t LedMask)\r
+ static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)\r
{\r
- PORTD &= ~LedMask;\r
+ PORTD &= ~LEDMask;\r
}\r
\r
- static inline void LEDs_SetAllLEDs(const uint8_t LedMask)\r
+ static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)\r
{\r
- PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LedMask);\r
+ PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);\r
}\r
\r
- static inline void LEDs_ChangeLEDs(const uint8_t LedMask, const uint8_t ActiveMask)\r
+ static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)\r
{\r
- PORTD = ((PORTD & ~LedMask) | ActiveMask);\r
+ PORTD = ((PORTD & ~(LEDMask & LEDS_ALL_LEDS)) | (ActiveMask & LEDS_ALL_LEDS));\r
+ }\r
+ \r
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)\r
+ {\r
+ PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));\r
}\r
\r
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;\r
PORTD &= ~LEDS_ALL_LEDS;\r
}\r
\r
- static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)\r
+ static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)\r
{\r
- PORTD |= LedMask;\r
+ PORTD |= LEDMask;\r
}\r
\r
- static inline void LEDs_TurnOffLEDs(const uint8_t LedMask)\r
+ static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)\r
{\r
- PORTD &= ~LedMask;\r
+ PORTD &= ~LEDMask;\r
}\r
\r
- static inline void LEDs_SetAllLEDs(const uint8_t LedMask)\r
+ static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)\r
{\r
- PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LedMask);\r
+ PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);\r
}\r
\r
- static inline void LEDs_ChangeLEDs(const uint8_t LedMask, const uint8_t ActiveMask)\r
+ static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)\r
{\r
- PORTD = ((PORTD & ~LedMask) | ActiveMask);\r
+ PORTD = ((PORTD & ~LEDMask) | ActiveMask);\r
+ }\r
+ \r
+ static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)\r
+ {\r
+ PORTD = (PORTD ^ (LEDMask & LEDS_ALL_LEDS));\r
}\r
\r
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;\r
* - Added new USB_DeviceState variable to keep track of the current Device mode USB state\r
* - Added new Endpoint_ClearStatusStage() convenience function to assist with the status stages of control transfers\r
* - Added new Benito Arduino Programmer project\r
+ * - Added new LEDs_ToggleLEDs() function to the LEDs driver\r
* \r
* <b>Changed:</b>\r
* - Deprecated psuedo-scheduler and removed dynamic memory allocator from the library (first no longer needed and second unused)\r
/* Check if the LEDs should be ping-ponging (during enumeration) */\r
if (PingPongMSRemaining && !(--PingPongMSRemaining))\r
{\r
- LEDs_ChangeLEDs(LEDMASK_BUSY, (~LEDs_GetLEDs() & LEDMASK_BUSY));\r
+ LEDs_ToggleLEDs(LEDMASK_BUSY);\r
PingPongMSRemaining = PING_PONG_LED_PULSE_MS;\r
}\r
\r
if ((CmdState == CMD_STOP && Command != CMD_STOP) ||\r
(CmdState != CMD_STOP && Command == CMD_STOP))\r
{\r
- LEDs_ChangeLEDs(LEDS_LED4, ~LEDs_GetLEDs() & LEDS_LED4);\r
+ LEDs_ToggleLEDs(LEDS_LED4);\r
\r
Send_Command_Report(CMD_INITA, 8);\r
Send_Command_Report(CMD_INITB, 8);\r