projects
/
pub
/
USBasp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3991c94
)
Added new LEDs_ToggleLEDs() function to the Board LEDs driver.
author
Dean Camera
<dean@fourwalledcubicle.com>
Fri, 24 Jul 2009 01:44:01 +0000
(
01:44
+0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Fri, 24 Jul 2009 01:44:01 +0000
(
01:44
+0000)
12 files changed:
Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c
patch
|
blob
|
blame
|
history
Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
patch
|
blob
|
blame
|
history
LUFA/DriverStubs/LEDs.h
patch
|
blob
|
blame
|
history
LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
patch
|
blob
|
blame
|
history
LUFA/Drivers/Board/LEDs.h
patch
|
blob
|
blame
|
history
LUFA/Drivers/Board/RZUSBSTICK/LEDs.h
patch
|
blob
|
blame
|
history
LUFA/Drivers/Board/STK525/LEDs.h
patch
|
blob
|
blame
|
history
LUFA/Drivers/Board/STK526/LEDs.h
patch
|
blob
|
blame
|
history
LUFA/Drivers/Board/USBKEY/LEDs.h
patch
|
blob
|
blame
|
history
LUFA/ManPages/ChangeLog.txt
patch
|
blob
|
blame
|
history
Projects/Benito/Benito.c
patch
|
blob
|
blame
|
history
Projects/MissileLauncher/MissileLauncher.c
patch
|
blob
|
blame
|
history
diff --git
a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c
b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c
index
273cd71
..
1a53526
100644
(file)
--- a/
Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c
+++ b/
Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c
@@
-156,10
+156,7
@@
void ReadNextReport(void)
if (KeyboardReport.KeyCode)
\r
{
\r
/* Toggle status LED to indicate keypress */
\r
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
\r
char PressedKey = 0;
\r
\r
diff --git
a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
index
eee1755
..
2cc08a1
100644
(file)
--- a/
Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
+++ b/
Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
@@
-250,10
+250,7
@@
void ProcessKeyboardReport(uint8_t* KeyboardReport)
if (KeyCode)
\r
{
\r
/* Toggle status LED to indicate keypress */
\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
\r
char PressedKey = 0;
\r
\r
diff --git
a/LUFA/DriverStubs/LEDs.h
b/LUFA/DriverStubs/LEDs.h
index
993481d
..
3f4cca0
100644
(file)
--- 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
\r
}
\r
\r
// TODO: Add code to initialize LED port pins as outputs here
\r
}
\r
\r
- static inline void LEDs_TurnOnLEDs(const uint8_t L
ed
Mask)
\r
+ static inline void LEDs_TurnOnLEDs(const uint8_t L
ED
Mask)
\r
{
\r
{
\r
- // TODO: Add code to turn on LEDs given in the L
ed
Mask mask here, leave others as-is
\r
+ // TODO: Add code to turn on LEDs given in the L
ED
Mask mask here, leave others as-is
\r
}
\r
\r
}
\r
\r
- static inline void LEDs_TurnOffLEDs(const uint8_t L
ed
Mask)
\r
+ static inline void LEDs_TurnOffLEDs(const uint8_t L
ED
Mask)
\r
{
\r
{
\r
- // TODO: Add code to turn off LEDs given in the L
ed
Mask mask here, leave others as-is
\r
+ // TODO: Add code to turn off LEDs given in the L
ED
Mask mask here, leave others as-is
\r
}
\r
\r
}
\r
\r
- static inline void LEDs_SetAllLEDs(const uint8_t L
ed
Mask)
\r
+ static inline void LEDs_SetAllLEDs(const uint8_t L
ED
Mask)
\r
{
\r
{
\r
- // TODO: Add code to turn on only LEDs given in the L
ed
Mask mask here, all others off
\r
+ // TODO: Add code to turn on only LEDs given in the L
ED
Mask mask here, all others off
\r
}
\r
\r
}
\r
\r
- static inline void LEDs_ChangeLEDs(const uint8_t L
ed
Mask, const uint8_t ActiveMask)
\r
+ static inline void LEDs_ChangeLEDs(const uint8_t L
ED
Mask, const uint8_t ActiveMask)
\r
{
\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
\r
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
\r
diff --git
a/LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
b/LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
index
9f80827
..
8487ee7
100644
(file)
--- a/
LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
+++ b/
LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
@@
-110,6
+110,11
@@
{
\r
PORTD = ((PORTD & ~(LEDMask & LEDS_ALL_LEDS)) | (ActiveMask & LEDS_ALL_LEDS));
\r
}
\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
\r
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
\r
static inline uint8_t LEDs_GetLEDs(void)
\r
diff --git
a/LUFA/Drivers/Board/LEDs.h
b/LUFA/Drivers/Board/LEDs.h
index
cd2b857
..
cea947a
100644
(file)
--- 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
\r
*/
\r
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask);
\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
\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
diff --git
a/LUFA/Drivers/Board/RZUSBSTICK/LEDs.h
b/LUFA/Drivers/Board/RZUSBSTICK/LEDs.h
index
24977ea
..
ecaab1e
100644
(file)
--- 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));
\r
}
\r
\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
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
\r
static inline uint8_t LEDs_GetLEDs(void)
\r
{
\r
diff --git
a/LUFA/Drivers/Board/STK525/LEDs.h
b/LUFA/Drivers/Board/STK525/LEDs.h
index
a769f16
..
73c03f7
100644
(file)
--- a/
LUFA/Drivers/Board/STK525/LEDs.h
+++ b/
LUFA/Drivers/Board/STK525/LEDs.h
@@
-88,26
+88,31
@@
PORTD &= ~LEDS_ALL_LEDS;
\r
}
\r
\r
PORTD &= ~LEDS_ALL_LEDS;
\r
}
\r
\r
- static inline void LEDs_TurnOnLEDs(const uint8_t L
ed
Mask)
\r
+ static inline void LEDs_TurnOnLEDs(const uint8_t L
ED
Mask)
\r
{
\r
{
\r
- PORTD |= L
ed
Mask;
\r
+ PORTD |= L
ED
Mask;
\r
}
\r
\r
}
\r
\r
- static inline void LEDs_TurnOffLEDs(const uint8_t L
ed
Mask)
\r
+ static inline void LEDs_TurnOffLEDs(const uint8_t L
ED
Mask)
\r
{
\r
{
\r
- PORTD &= ~L
ed
Mask;
\r
+ PORTD &= ~L
ED
Mask;
\r
}
\r
\r
}
\r
\r
- static inline void LEDs_SetAllLEDs(const uint8_t L
ed
Mask)
\r
+ static inline void LEDs_SetAllLEDs(const uint8_t L
ED
Mask)
\r
{
\r
{
\r
- PORTD = ((PORTD & ~LEDS_ALL_LEDS) | L
ed
Mask);
\r
+ PORTD = ((PORTD & ~LEDS_ALL_LEDS) | L
ED
Mask);
\r
}
\r
\r
}
\r
\r
- static inline void LEDs_ChangeLEDs(const uint8_t L
ed
Mask, const uint8_t ActiveMask)
\r
+ static inline void LEDs_ChangeLEDs(const uint8_t L
ED
Mask, const uint8_t ActiveMask)
\r
{
\r
{
\r
- PORTD = ((PORTD & ~L
ed
Mask) | ActiveMask);
\r
+ PORTD = ((PORTD & ~L
ED
Mask) | ActiveMask);
\r
}
\r
\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
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
\r
static inline uint8_t LEDs_GetLEDs(void)
\r
{
\r
diff --git
a/LUFA/Drivers/Board/STK526/LEDs.h
b/LUFA/Drivers/Board/STK526/LEDs.h
index
6b17ab1
..
5718f40
100644
(file)
--- a/
LUFA/Drivers/Board/STK526/LEDs.h
+++ b/
LUFA/Drivers/Board/STK526/LEDs.h
@@
-88,24
+88,29
@@
PORTD &= ~LEDS_ALL_LEDS;
\r
}
\r
\r
PORTD &= ~LEDS_ALL_LEDS;
\r
}
\r
\r
- static inline void LEDs_TurnOnLEDs(const uint8_t L
ed
Mask)
\r
+ static inline void LEDs_TurnOnLEDs(const uint8_t L
ED
Mask)
\r
{
\r
{
\r
- PORTD |= L
ed
Mask;
\r
+ PORTD |= L
ED
Mask;
\r
}
\r
\r
}
\r
\r
- static inline void LEDs_TurnOffLEDs(const uint8_t L
ed
Mask)
\r
+ static inline void LEDs_TurnOffLEDs(const uint8_t L
ED
Mask)
\r
{
\r
{
\r
- PORTD &= ~L
ed
Mask;
\r
+ PORTD &= ~L
ED
Mask;
\r
}
\r
\r
}
\r
\r
- static inline void LEDs_SetAllLEDs(const uint8_t L
ed
Mask)
\r
+ static inline void LEDs_SetAllLEDs(const uint8_t L
ED
Mask)
\r
{
\r
{
\r
- PORTD = ((PORTD & ~LEDS_ALL_LEDS) | L
ed
Mask);
\r
+ PORTD = ((PORTD & ~LEDS_ALL_LEDS) | L
ED
Mask);
\r
}
\r
\r
}
\r
\r
- static inline void LEDs_ChangeLEDs(const uint8_t L
ed
Mask, const uint8_t ActiveMask)
\r
+ static inline void LEDs_ChangeLEDs(const uint8_t L
ED
Mask, const uint8_t ActiveMask)
\r
{
\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
}
\r
\r
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
\r
diff --git
a/LUFA/Drivers/Board/USBKEY/LEDs.h
b/LUFA/Drivers/Board/USBKEY/LEDs.h
index
68df317
..
2e61d2e
100644
(file)
--- a/
LUFA/Drivers/Board/USBKEY/LEDs.h
+++ b/
LUFA/Drivers/Board/USBKEY/LEDs.h
@@
-88,24
+88,29
@@
PORTD &= ~LEDS_ALL_LEDS;
\r
}
\r
\r
PORTD &= ~LEDS_ALL_LEDS;
\r
}
\r
\r
- static inline void LEDs_TurnOnLEDs(const uint8_t L
ed
Mask)
\r
+ static inline void LEDs_TurnOnLEDs(const uint8_t L
ED
Mask)
\r
{
\r
{
\r
- PORTD |= L
ed
Mask;
\r
+ PORTD |= L
ED
Mask;
\r
}
\r
\r
}
\r
\r
- static inline void LEDs_TurnOffLEDs(const uint8_t L
ed
Mask)
\r
+ static inline void LEDs_TurnOffLEDs(const uint8_t L
ED
Mask)
\r
{
\r
{
\r
- PORTD &= ~L
ed
Mask;
\r
+ PORTD &= ~L
ED
Mask;
\r
}
\r
\r
}
\r
\r
- static inline void LEDs_SetAllLEDs(const uint8_t L
ed
Mask)
\r
+ static inline void LEDs_SetAllLEDs(const uint8_t L
ED
Mask)
\r
{
\r
{
\r
- PORTD = ((PORTD & ~LEDS_ALL_LEDS) | L
ed
Mask);
\r
+ PORTD = ((PORTD & ~LEDS_ALL_LEDS) | L
ED
Mask);
\r
}
\r
\r
}
\r
\r
- static inline void LEDs_ChangeLEDs(const uint8_t L
ed
Mask, const uint8_t ActiveMask)
\r
+ static inline void LEDs_ChangeLEDs(const uint8_t L
ED
Mask, const uint8_t ActiveMask)
\r
{
\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
}
\r
\r
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
\r
diff --git
a/LUFA/ManPages/ChangeLog.txt
b/LUFA/ManPages/ChangeLog.txt
index
b7c1e28
..
eb6c89e
100644
(file)
--- 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
\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 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
*
\r
* <b>Changed:</b>
\r
* - Deprecated psuedo-scheduler and removed dynamic memory allocator from the library (first no longer needed and second unused)
\r
diff --git
a/Projects/Benito/Benito.c
b/Projects/Benito/Benito.c
index
1afb74a
..
2f0317d
100644
(file)
--- a/
Projects/Benito/Benito.c
+++ b/
Projects/Benito/Benito.c
@@
-107,7
+107,7
@@
int main(void)
/* Check if the LEDs should be ping-ponging (during enumeration) */
\r
if (PingPongMSRemaining && !(--PingPongMSRemaining))
\r
{
\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
PingPongMSRemaining = PING_PONG_LED_PULSE_MS;
\r
}
\r
\r
diff --git
a/Projects/MissileLauncher/MissileLauncher.c
b/Projects/MissileLauncher/MissileLauncher.c
index
1ae3704
..
50a8009
100644
(file)
--- a/
Projects/MissileLauncher/MissileLauncher.c
+++ b/
Projects/MissileLauncher/MissileLauncher.c
@@
-173,7
+173,7
@@
void Send_Command(uint8_t* Command)
if ((CmdState == CMD_STOP && Command != CMD_STOP) ||
\r
(CmdState != CMD_STOP && Command == CMD_STOP))
\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
\r
Send_Command_Report(CMD_INITA, 8);
\r
Send_Command_Report(CMD_INITB, 8);
\r