PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Public Member Functions | |
RGBLED (int bus, int rgbled) | |
virtual | ~RGBLED () |
virtual int | init () |
virtual int | probe () |
int | status () |
Private Member Functions | |
void | Run () override |
Main loop function. More... | |
int | send_led_enable (bool enable) |
Sent ENABLE flag to LED driver. More... | |
int | send_led_rgb () |
Send RGB PWM settings to LED driver according to current color and brightness. More... | |
int | get (bool &on, bool &powersave, uint8_t &r, uint8_t &g, uint8_t &b) |
void | update_params () |
Private Attributes | |
float | _brightness {1.0f} |
float | _max_brightness {1.0f} |
uint8_t | _r {0} |
uint8_t | _g {0} |
uint8_t | _b {0} |
volatile bool | _running {false} |
volatile bool | _should_run {true} |
bool | _leds_enabled {true} |
uORB::Subscription | _parameter_update_sub {ORB_ID(parameter_update)} |
LedController | _led_controller |
Definition at line 63 of file rgbled.cpp.
RGBLED::RGBLED | ( | int | bus, |
int | rgbled | ||
) |
Definition at line 107 of file rgbled.cpp.
Referenced by rgbled_main().
|
virtual |
Definition at line 113 of file rgbled.cpp.
References _running, _should_run, and counter.
|
private |
Definition at line 316 of file rgbled.cpp.
References OK, SETTING_ENABLE, and SETTING_NOT_POWERSAVE.
|
virtual |
Definition at line 124 of file rgbled.cpp.
References _running, ToneAlarmInterface::init(), OK, send_led_enable(), send_led_rgb(), and update_params().
|
virtual |
this may look strange, but is needed. There is a serial EEPROM (Microchip-24aa01) that responds to a bunch of I2C addresses, including the 0x55 used by this LED device. So we need to do enough operations to be sure we are talking to the right device. These 3 operations seem to be enough, as the 3rd one consistently fails if no RGBLED is on the bus.
Definition at line 147 of file rgbled.cpp.
References OK, and send_led_enable().
|
overrideprivate |
Main loop function.
Definition at line 200 of file rgbled.cpp.
References _b, _brightness, _g, _led_controller, _parameter_update_sub, _r, _running, _should_run, LedControlDataSingle::brightness, LedControlDataSingle::color, uORB::Subscription::copy(), LedControlData::leds, LedController::maximum_update_interval(), send_led_enable(), send_led_rgb(), LedController::update(), update_params(), and uORB::Subscription::updated().
|
private |
Sent ENABLE flag to LED driver.
Definition at line 279 of file rgbled.cpp.
References _leds_enabled, msg, SETTING_ENABLE, SETTING_NOT_POWERSAVE, and SUB_ADDR_SETTINGS.
Referenced by init(), probe(), and Run().
|
private |
Send RGB PWM settings to LED driver according to current color and brightness.
Definition at line 304 of file rgbled.cpp.
References _b, _brightness, _g, _max_brightness, _r, f(), msg, SUB_ADDR_PWM0, SUB_ADDR_PWM1, and SUB_ADDR_PWM2.
Referenced by init(), and Run().
int RGBLED::status | ( | ) |
Definition at line 177 of file rgbled.cpp.
References DEVICE_LOG, and OK.
|
private |
Definition at line 336 of file rgbled.cpp.
References _max_brightness, param_find(), and param_get().
Referenced by init(), and Run().
|
private |
Definition at line 80 of file rgbled.cpp.
Referenced by Run(), and send_led_rgb().
|
private |
Definition at line 75 of file rgbled.cpp.
Referenced by Run(), and send_led_rgb().
|
private |
Definition at line 79 of file rgbled.cpp.
Referenced by Run(), and send_led_rgb().
|
private |
Definition at line 87 of file rgbled.cpp.
Referenced by Run().
|
private |
Definition at line 83 of file rgbled.cpp.
Referenced by send_led_enable().
|
private |
Definition at line 76 of file rgbled.cpp.
Referenced by send_led_rgb(), and update_params().
|
private |
Definition at line 85 of file rgbled.cpp.
Referenced by Run().
|
private |
Definition at line 78 of file rgbled.cpp.
Referenced by Run(), and send_led_rgb().
|
private |
Definition at line 81 of file rgbled.cpp.
|
private |
Definition at line 82 of file rgbled.cpp.