PX4 Firmware
PX4 Autopilot Software http://px4.io
|
class LedController Handles the led_control topic: blinking, priorities and state updates. More...
#include <led.h>
Classes | |
struct | NextState |
struct | PerLedData |
struct | PerPriorityData |
Public Member Functions | |
LedController ()=default | |
~LedController ()=default | |
int | maximum_update_interval () const |
get maxium time between two consecutive calls to update() in us. More... | |
int | update (LedControlData &control_data) |
Update and retrieve the Led state. More... | |
Static Public Attributes | |
static constexpr int | BREATHE_INTERVAL = 25 * 1000 |
single step when in breathe mode More... | |
static constexpr int | BREATHE_STEPS = 64 |
number of steps in breathe mode for a full on-off cycle More... | |
static constexpr int | BLINK_FAST_DURATION = 100 * 1000 |
duration of half a blinking cycle (on-to-off and off-to-on) in us More... | |
static constexpr int | BLINK_NORMAL_DURATION = 500 * 1000 |
duration of half a blinking cycle (on-to-off and off-to-on) in us More... | |
static constexpr int | BLINK_SLOW_DURATION = 2000 * 1000 |
duration of half a blinking cycle (on-to-off and off-to-on) in us More... | |
Private Member Functions | |
void | get_control_data (LedControlData &control_data) |
set control_data based on current Led states More... | |
Private Attributes | |
PerLedData | _states [BOARD_MAX_LEDS] |
keep current LED states More... | |
uORB::Subscription | _led_control_sub {ORB_ID(led_control)} |
uorb subscription More... | |
hrt_abstime | _last_update_call {0} |
bool | _force_update {true} |
force an orb_copy in the beginning More... | |
bool | _breathe_enabled {false} |
true if at least one of the led's is currently in breathe mode More... | |
class LedController Handles the led_control topic: blinking, priorities and state updates.
|
default |
|
default |
|
inlineprivate |
set control_data based on current Led states
Definition at line 197 of file led.cpp.
References _breathe_enabled, _states, LedController::PerPriorityData::blink_times_left, BOARD_MAX_LEDS, BREATHE_INTERVAL, BREATHE_STEPS, LedControlDataSingle::brightness, LedControlDataSingle::color, LedController::PerPriorityData::color, counter, LedController::PerLedData::current_blinking_time, LedControlData::leds, LedController::PerPriorityData::mode, and LedController::PerLedData::priority.
Referenced by update().
|
inline |
get maxium time between two consecutive calls to update() in us.
Definition at line 72 of file led.h.
Referenced by RGBLED_PWM::Run(), RGBLED::Run(), and RGBLED_NPC5623C::Run().
int LedController::update | ( | LedControlData & | control_data | ) |
Update and retrieve the Led state.
It will do the orb_copy() and needs to be called at least every maximum_update_interval(). In addition a caller might poll on the led_control_sub
control_data | output structure (will always be set) |
Definition at line 41 of file led.cpp.
References _force_update, _last_update_call, _led_control_sub, _states, LedController::PerLedData::apply_next_state(), BLINK_FAST_DURATION, BLINK_NORMAL_DURATION, BLINK_SLOW_DURATION, LedController::PerPriorityData::blink_times_left, BOARD_MAX_LEDS, BREATHE_INTERVAL, BREATHE_STEPS, uORB::Subscription::copy(), LedController::PerLedData::current_blinking_time, get_control_data(), hrt_absolute_time(), hrt_abstime, led_control, led_control_s::led_mask, LedController::PerPriorityData::mode, LedController::PerLedData::next_state, led_control_s::priority, LedController::NextState::priority, LedController::PerLedData::priority, LedController::NextState::reset(), LedController::NextState::set(), LedController::PerLedData::set(), and uORB::Subscription::updated().
Referenced by RGBLED_PWM::Run(), RGBLED::Run(), and RGBLED_NPC5623C::Run().
|
private |
true if at least one of the led's is currently in breathe mode
Definition at line 180 of file led.h.
Referenced by get_control_data().
|
private |
|
private |
|
private |
|
private |
keep current LED states
Definition at line 175 of file led.h.
Referenced by get_control_data(), and update().
|
static |
|
static |
|
static |
|
static |
single step when in breathe mode
Definition at line 85 of file led.h.
Referenced by get_control_data(), and update().
|
static |
number of steps in breathe mode for a full on-off cycle
Definition at line 86 of file led.h.
Referenced by get_control_data(), and update().