Friedrich-Alexander-Universität Erlangen-Nürnberg  /   Technische Fakultät  /   Department Informatik

SPiCboard library (libspicboard, revision 14673M) API documentation

Found a bug or something ambiguous? Mail us to get it fixed!

led.h
Go to the documentation of this file.
1 #ifndef LED_H
2 #define LED_H
3 #include <stdint.h>
4 
5 
6 /**
7  *
8  * \addtogroup LED LED access
9  *
10  * \brief Interface to the board's 8 LEDs
11  *
12  * @{
13  *
14  * \file led.h
15  *
16  * \version \$Rev: 7715 $
17  *
18  */
19 
20 /**
21  * \brief LED identifiers
22  *
23  */
24 typedef enum {
25  RED0=0, YELLOW0=1, GREEN0=2, BLUE0=3,
26  RED1=4, YELLOW1=5, GREEN1=6, BLUE1=7
27 } LED;
28 
29 /**
30  * \brief Activates a specific LED
31  *
32  * \param led LED ID
33  * \return 0 on success, negative value on error
34  * \retval 0 success
35  * \retval -1 invalid LED ID
36  */
37 int8_t sb_led_on(LED led);
38 
39 /**
40  * \brief Deactivates a specific LED
41  *
42  * \param led LED ID
43  * \return 0 on success, negative value on error
44  * \retval 0 success
45  * \retval -1 invalid LED ID
46  */
47 int8_t sb_led_off(LED led);
48 
49 /**
50  * \brief Toggles a specific LED
51  *
52  * \param led LED ID
53  * \return 0 on success, negative value on error
54  * \retval 0 success
55  * \retval -1 invalid LED ID
56  */
57 int8_t sb_led_toggle(LED led);
58 
59 /**
60  * \brief Uses the LED array as a level indicator
61  *
62  * Allows the array of LEDs to be used as a (fill) level, progress
63  * or similar indicator. The 8 LEDs are used to display a ratio of
64  * a max-value<=255 in 9 steps.
65  *
66  * \param level level value
67  * \param max maximum possible value
68  * \return the number of LEDs turned on on success, negative value on error
69  * \retval >=0 success
70  * \retval -1 level exceeds max
71  * \retval -2 max is 0
72  */
73 int8_t sb_led_show_level(uint8_t level, uint8_t max);
74 
75 /**
76  * \brief Sets all LEDs according to a bitfield
77  *
78  * The bitfield contains one bit for each LED. A set bit enables
79  * and a cleared bit disables the corresponding LED.
80  *
81  * \param setting 8-bit bitfield describing the desired LED states
82  */
83 void sb_led_set_all_leds(uint8_t setting);
84 
85 /** @}*/
86 
87 #endif
88 
Definition: led.h:26
void sb_led_set_all_leds(uint8_t setting)
Sets all LEDs according to a bitfield.
Definition: led.h:25
Definition: led.h:26
Definition: led.h:26
Definition: led.h:25
Definition: led.h:25
LED
LED identifiers.
Definition: led.h:24
Definition: led.h:26
int8_t sb_led_toggle(LED led)
Toggles a specific LED.
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_show_level(uint8_t level, uint8_t max)
Uses the LED array as a level indicator.
Definition: led.h:25