Robot Control Library
|
Control the LEDs on Robotics Cape and BeagleBone Blue.
<rc/led.h>
Typedefs | |
typedef enum rc_led_t | rc_led_t |
Availabe LEDs on the BeagleBone platform. More... | |
Functions | |
int | rc_led_set (rc_led_t led, int value) |
sets the state of an LED More... | |
void | rc_led_cleanup (void) |
closes file descriptors to all opened LEDs More... | |
int | rc_led_get (rc_led_t led) |
gets the current state of an LED More... | |
int | rc_led_blink (rc_led_t led, float hz, float duration) |
blinks an led at specified frequency and duration. More... | |
void | rc_led_stop_blink (rc_led_t led) |
Stops an LED from blinking. More... | |
void | rc_led_stop_blink_all (void) |
stops all LEDs from blinking More... | |
enum rc_led_t |
Availabe LEDs on the BeagleBone platform.
This list may expand for future boards. Note that the WIFI and USR LEDs are normally controlled by separate processes. They can be controlled, but may conflict as other processes continue to try to write to them simultaneously.
The BAT LED's are controlled by the rc_battery_monitor service. If you want to control these LEDs yourself please stop the service first.
Enumerator | |
---|---|
RC_LED_GREEN | |
RC_LED_RED | |
RC_LED_USR0 | |
RC_LED_USR1 | |
RC_LED_USR2 | |
RC_LED_USR3 | |
RC_LED_BAT25 | |
RC_LED_BAT50 | |
RC_LED_BAT75 | |
RC_LED_BAT100 | |
RC_LED_WIFI |
int rc_led_set | ( | rc_led_t | led, |
int | value | ||
) |
sets the state of an LED
[in] | led | rc_led_t enum |
[in] | value | 0 for OFF, non-zero for ON |
void rc_led_cleanup | ( | void | ) |
closes file descriptors to all opened LEDs
This does NOT turn off the LEDs, it is up to the user to leave the LEDs in the desired state before closing.
int rc_led_get | ( | rc_led_t | led | ) |
gets the current state of an LED
[in] | led | rc_led_t enum |
int rc_led_blink | ( | rc_led_t | led, |
float | hz, | ||
float | duration | ||
) |
blinks an led at specified frequency and duration.
This is a blocking function call, it does not return until either the specified duration has completed or rc_led_stop_blink has been called from another thread.
[in] | led | rc_led_t enum |
[in] | hz | blink frequency in HZ |
[in] | duration | blink duration in seconds |
void rc_led_stop_blink | ( | rc_led_t | led | ) |
Stops an LED from blinking.
Since rc_led_blink is a blocking function, it's obviously necessary to call rc_led_stop_blink from a separate thread or signal handler. This will cause rc_led_blink to return 1 if blinking was stopped mid-way. Also see rc_led_stop_blink_all
[in] | led | rc_led_t enum |
void rc_led_stop_blink_all | ( | void | ) |
stops all LEDs from blinking
Since rc_led_blink is a blocking function, it's obviously necessary to call rc_led_stop_blink from a separate thread or signal handler. This will cause rc_led_blink to return 1 if blinking was stopped mid-way.