led.h File Reference
Interface to the board's 8 leds.
More...
#include <stdint.h>
Go to the source code of this file.
|
Enumerations |
| enum | LED {
RED0 = 0,
YELLOW0 = 1,
GREEN0 = 2,
BLUE0 = 3,
RED1 = 4,
YELLOW1 = 5,
GREEN1 = 6,
BLUE1 = 7
} |
| | LED identifiers.
|
Functions |
| int8_t | sb_led_on (LED led) |
| | Activates a specific led.
|
| int8_t | sb_led_off (LED led) |
| | Deactivates a specific led.
|
| int8_t | sb_led_toggle (LED led) |
| | Toggles a specific led.
|
| int8_t | sb_led_showLevel (uint8_t level, uint8_t max) |
| | Uses the led array as a level indicator.
|
| void | sb_led_set_all_leds (uint8_t setting) |
| | Sets all leds according to a bitfield.
|
Detailed Description
Interface to the board's 8 leds.
- Version:
- $Rev: 149 $
Function Documentation
| int8_t sb_led_off |
( |
LED |
led |
) |
|
Deactivates a specific led.
- Parameters:
-
- Returns:
- 0 on success, negative value on error
- Return values:
-
| 0 | success |
| -1 | invalid led id |
| int8_t sb_led_on |
( |
LED |
led |
) |
|
Activates a specific led.
- Parameters:
-
- Returns:
- 0 on success, negative value on error
- Return values:
-
| 0 | success |
| -1 | invalid led id |
| void sb_led_set_all_leds |
( |
uint8_t |
setting |
) |
|
Sets all leds according to a bitfield.
The bitfield contains one bit for each led. A set bit enables and a cleared bit disables the corresponding led.
- Parameters:
-
| setting | 8-bit bitfield describing the desired led states |
| int8_t sb_led_showLevel |
( |
uint8_t |
level, |
|
|
uint8_t |
max | |
|
) |
| | |
Uses the led array as a level indicator.
Allows the array of leds to be used as a (fill) level, progress or similar indicator. The 8 leds are used to display a ratio of a max-value<=255 in 9 steps.
- Parameters:
-
| level | level value |
| max | maximum possible value |
- Returns:
- the number of leds turned on on success, negative value on error
- Return values:
-
| >=0 | success |
| -1 | level exceeds max |
| -2 | max is 0 |
| int8_t sb_led_toggle |
( |
LED |
led |
) |
|
Toggles a specific led.
- Parameters:
-
- Returns:
- 0 on success, negative value on error
- Return values:
-
| 0 | success |
| -1 | invalid led id |