Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
200821fe
Commit
200821fe
authored
Jul 24, 2009
by
Dean Camera
Browse files
Added new LEDs_ToggleLEDs() function to the Board LEDs driver.
parent
3991c94b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c
View file @
200821fe
...
@@ -156,10 +156,7 @@ void ReadNextReport(void)
...
@@ -156,10 +156,7 @@ void ReadNextReport(void)
if
(
KeyboardReport
.
KeyCode
)
if
(
KeyboardReport
.
KeyCode
)
{
{
/* Toggle status LED to indicate keypress */
/* Toggle status LED to indicate keypress */
if
(
LEDs_GetLEDs
()
&
LEDS_LED2
)
LEDs_ToggleLEDs
(
LEDS_LED2
);
LEDs_TurnOffLEDs
(
LEDS_LED2
);
else
LEDs_TurnOnLEDs
(
LEDS_LED2
);
char
PressedKey
=
0
;
char
PressedKey
=
0
;
...
...
Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
View file @
200821fe
...
@@ -250,10 +250,7 @@ void ProcessKeyboardReport(uint8_t* KeyboardReport)
...
@@ -250,10 +250,7 @@ void ProcessKeyboardReport(uint8_t* KeyboardReport)
if
(
KeyCode
)
if
(
KeyCode
)
{
{
/* Toggle status LED to indicate keypress */
/* Toggle status LED to indicate keypress */
if
(
LEDs_GetLEDs
()
&
LEDS_LED2
)
LEDs_ToggleLEDs
(
LEDS_LED2
);
LEDs_TurnOffLEDs
(
LEDS_LED2
);
else
LEDs_TurnOnLEDs
(
LEDS_LED2
);
char
PressedKey
=
0
;
char
PressedKey
=
0
;
...
...
LUFA/DriverStubs/LEDs.h
View file @
200821fe
...
@@ -86,24 +86,29 @@
...
@@ -86,24 +86,29 @@
// TODO: Add code to initialize LED port pins as outputs here
// TODO: Add code to initialize LED port pins as outputs here
}
}
static
inline
void
LEDs_TurnOnLEDs
(
const
uint8_t
L
ed
Mask
)
static
inline
void
LEDs_TurnOnLEDs
(
const
uint8_t
L
ED
Mask
)
{
{
// TODO: Add code to turn on LEDs given in the L
ed
Mask mask here, leave others as-is
// TODO: Add code to turn on LEDs given in the L
ED
Mask mask here, leave others as-is
}
}
static
inline
void
LEDs_TurnOffLEDs
(
const
uint8_t
L
ed
Mask
)
static
inline
void
LEDs_TurnOffLEDs
(
const
uint8_t
L
ED
Mask
)
{
{
// TODO: Add code to turn off LEDs given in the L
ed
Mask mask here, leave others as-is
// TODO: Add code to turn off LEDs given in the L
ED
Mask mask here, leave others as-is
}
}
static
inline
void
LEDs_SetAllLEDs
(
const
uint8_t
L
ed
Mask
)
static
inline
void
LEDs_SetAllLEDs
(
const
uint8_t
L
ED
Mask
)
{
{
// TODO: Add code to turn on only LEDs given in the L
ed
Mask mask here, all others off
// TODO: Add code to turn on only LEDs given in the L
ED
Mask mask here, all others off
}
}
static
inline
void
LEDs_ChangeLEDs
(
const
uint8_t
L
ed
Mask
,
const
uint8_t
ActiveMask
)
static
inline
void
LEDs_ChangeLEDs
(
const
uint8_t
L
ED
Mask
,
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
;
static
inline
uint8_t
LEDs_GetLEDs
(
void
)
ATTR_WARN_UNUSED_RESULT
;
...
...
LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
View file @
200821fe
...
@@ -110,6 +110,11 @@
...
@@ -110,6 +110,11 @@
{
{
PORTD
=
((
PORTD
&
~
(
LEDMask
&
LEDS_ALL_LEDS
))
|
(
ActiveMask
&
LEDS_ALL_LEDS
));
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
)
ATTR_WARN_UNUSED_RESULT
;
static
inline
uint8_t
LEDs_GetLEDs
(
void
)
static
inline
uint8_t
LEDs_GetLEDs
(
void
)
...
...
LUFA/Drivers/Board/LEDs.h
View file @
200821fe
...
@@ -142,6 +142,12 @@
...
@@ -142,6 +142,12 @@
* \param[in] ActiveMask Mask of whether the LEDs in the LED mask should be turned on or off
* \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
);
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
/** Returns the status of all the board LEDs; set LED masks in the return value indicate that the
* corresponding LED is on.
* corresponding LED is on.
...
...
LUFA/Drivers/Board/RZUSBSTICK/LEDs.h
View file @
200821fe
...
@@ -131,6 +131,12 @@
...
@@ -131,6 +131,12 @@
~
((
ActiveMask
&
LEDS_PORTE_LEDS
)
<<
LEDS_PORTE_MASK_SHIFT
));
~
((
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
)
ATTR_WARN_UNUSED_RESULT
;
static
inline
uint8_t
LEDs_GetLEDs
(
void
)
static
inline
uint8_t
LEDs_GetLEDs
(
void
)
{
{
...
...
LUFA/Drivers/Board/STK525/LEDs.h
View file @
200821fe
...
@@ -88,26 +88,31 @@
...
@@ -88,26 +88,31 @@
PORTD
&=
~
LEDS_ALL_LEDS
;
PORTD
&=
~
LEDS_ALL_LEDS
;
}
}
static
inline
void
LEDs_TurnOnLEDs
(
const
uint8_t
L
ed
Mask
)
static
inline
void
LEDs_TurnOnLEDs
(
const
uint8_t
L
ED
Mask
)
{
{
PORTD
|=
L
ed
Mask
;
PORTD
|=
L
ED
Mask
;
}
}
static
inline
void
LEDs_TurnOffLEDs
(
const
uint8_t
L
ed
Mask
)
static
inline
void
LEDs_TurnOffLEDs
(
const
uint8_t
L
ED
Mask
)
{
{
PORTD
&=
~
L
ed
Mask
;
PORTD
&=
~
L
ED
Mask
;
}
}
static
inline
void
LEDs_SetAllLEDs
(
const
uint8_t
L
ed
Mask
)
static
inline
void
LEDs_SetAllLEDs
(
const
uint8_t
L
ED
Mask
)
{
{
PORTD
=
((
PORTD
&
~
LEDS_ALL_LEDS
)
|
L
ed
Mask
);
PORTD
=
((
PORTD
&
~
LEDS_ALL_LEDS
)
|
L
ED
Mask
);
}
}
static
inline
void
LEDs_ChangeLEDs
(
const
uint8_t
L
ed
Mask
,
const
uint8_t
ActiveMask
)
static
inline
void
LEDs_ChangeLEDs
(
const
uint8_t
L
ED
Mask
,
const
uint8_t
ActiveMask
)
{
{
PORTD
=
((
PORTD
&
~
L
ed
Mask
)
|
ActiveMask
);
PORTD
=
((
PORTD
&
~
L
ED
Mask
)
|
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
)
ATTR_WARN_UNUSED_RESULT
;
static
inline
uint8_t
LEDs_GetLEDs
(
void
)
static
inline
uint8_t
LEDs_GetLEDs
(
void
)
{
{
...
...
LUFA/Drivers/Board/STK526/LEDs.h
View file @
200821fe
...
@@ -88,24 +88,29 @@
...
@@ -88,24 +88,29 @@
PORTD
&=
~
LEDS_ALL_LEDS
;
PORTD
&=
~
LEDS_ALL_LEDS
;
}
}
static
inline
void
LEDs_TurnOnLEDs
(
const
uint8_t
L
ed
Mask
)
static
inline
void
LEDs_TurnOnLEDs
(
const
uint8_t
L
ED
Mask
)
{
{
PORTD
|=
L
ed
Mask
;
PORTD
|=
L
ED
Mask
;
}
}
static
inline
void
LEDs_TurnOffLEDs
(
const
uint8_t
L
ed
Mask
)
static
inline
void
LEDs_TurnOffLEDs
(
const
uint8_t
L
ED
Mask
)
{
{
PORTD
&=
~
L
ed
Mask
;
PORTD
&=
~
L
ED
Mask
;
}
}
static
inline
void
LEDs_SetAllLEDs
(
const
uint8_t
L
ed
Mask
)
static
inline
void
LEDs_SetAllLEDs
(
const
uint8_t
L
ED
Mask
)
{
{
PORTD
=
((
PORTD
&
~
LEDS_ALL_LEDS
)
|
L
ed
Mask
);
PORTD
=
((
PORTD
&
~
LEDS_ALL_LEDS
)
|
L
ED
Mask
);
}
}
static
inline
void
LEDs_ChangeLEDs
(
const
uint8_t
L
ed
Mask
,
const
uint8_t
ActiveMask
)
static
inline
void
LEDs_ChangeLEDs
(
const
uint8_t
L
ED
Mask
,
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
;
static
inline
uint8_t
LEDs_GetLEDs
(
void
)
ATTR_WARN_UNUSED_RESULT
;
...
...
LUFA/Drivers/Board/USBKEY/LEDs.h
View file @
200821fe
...
@@ -88,24 +88,29 @@
...
@@ -88,24 +88,29 @@
PORTD
&=
~
LEDS_ALL_LEDS
;
PORTD
&=
~
LEDS_ALL_LEDS
;
}
}
static
inline
void
LEDs_TurnOnLEDs
(
const
uint8_t
L
ed
Mask
)
static
inline
void
LEDs_TurnOnLEDs
(
const
uint8_t
L
ED
Mask
)
{
{
PORTD
|=
L
ed
Mask
;
PORTD
|=
L
ED
Mask
;
}
}
static
inline
void
LEDs_TurnOffLEDs
(
const
uint8_t
L
ed
Mask
)
static
inline
void
LEDs_TurnOffLEDs
(
const
uint8_t
L
ED
Mask
)
{
{
PORTD
&=
~
L
ed
Mask
;
PORTD
&=
~
L
ED
Mask
;
}
}
static
inline
void
LEDs_SetAllLEDs
(
const
uint8_t
L
ed
Mask
)
static
inline
void
LEDs_SetAllLEDs
(
const
uint8_t
L
ED
Mask
)
{
{
PORTD
=
((
PORTD
&
~
LEDS_ALL_LEDS
)
|
L
ed
Mask
);
PORTD
=
((
PORTD
&
~
LEDS_ALL_LEDS
)
|
L
ED
Mask
);
}
}
static
inline
void
LEDs_ChangeLEDs
(
const
uint8_t
L
ed
Mask
,
const
uint8_t
ActiveMask
)
static
inline
void
LEDs_ChangeLEDs
(
const
uint8_t
L
ED
Mask
,
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
)
ATTR_WARN_UNUSED_RESULT
;
...
...
LUFA/ManPages/ChangeLog.txt
View file @
200821fe
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
* - Added new USB_DeviceState variable to keep track of the current Device mode USB state
* - 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 Endpoint_ClearStatusStage() convenience function to assist with the status stages of control transfers
* - Added new Benito Arduino Programmer project
* - Added new Benito Arduino Programmer project
* - Added new LEDs_ToggleLEDs() function to the LEDs driver
*
*
* <b>Changed:</b>
* <b>Changed:</b>
* - Deprecated psuedo-scheduler and removed dynamic memory allocator from the library (first no longer needed and second unused)
* - Deprecated psuedo-scheduler and removed dynamic memory allocator from the library (first no longer needed and second unused)
...
...
Projects/Benito/Benito.c
View file @
200821fe
...
@@ -107,7 +107,7 @@ int main(void)
...
@@ -107,7 +107,7 @@ int main(void)
/* Check if the LEDs should be ping-ponging (during enumeration) */
/* Check if the LEDs should be ping-ponging (during enumeration) */
if
(
PingPongMSRemaining
&&
!
(
--
PingPongMSRemaining
))
if
(
PingPongMSRemaining
&&
!
(
--
PingPongMSRemaining
))
{
{
LEDs_
ChangeLEDs
(
LEDMASK_BUSY
,
(
~
LEDs_Get
LEDs
(
)
&
LEDMASK_BUSY
)
)
;
LEDs_
Toggle
LEDs
(
LEDMASK_BUSY
);
PingPongMSRemaining
=
PING_PONG_LED_PULSE_MS
;
PingPongMSRemaining
=
PING_PONG_LED_PULSE_MS
;
}
}
...
...
Projects/MissileLauncher/MissileLauncher.c
View file @
200821fe
...
@@ -173,7 +173,7 @@ void Send_Command(uint8_t* Command)
...
@@ -173,7 +173,7 @@ void Send_Command(uint8_t* Command)
if
((
CmdState
==
CMD_STOP
&&
Command
!=
CMD_STOP
)
||
if
((
CmdState
==
CMD_STOP
&&
Command
!=
CMD_STOP
)
||
(
CmdState
!=
CMD_STOP
&&
Command
==
CMD_STOP
))
(
CmdState
!=
CMD_STOP
&&
Command
==
CMD_STOP
))
{
{
LEDs_
Chang
eLEDs
(
LEDS_LED4
,
~
LEDs_GetLEDs
()
&
LEDS_LED4
);
LEDs_
Toggl
eLEDs
(
LEDS_LED4
);
Send_Command_Report
(
CMD_INITA
,
8
);
Send_Command_Report
(
CMD_INITA
,
8
);
Send_Command_Report
(
CMD_INITB
,
8
);
Send_Command_Report
(
CMD_INITB
,
8
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment