PX4 Firmware
PX4 Autopilot Software http://px4.io
BlinkM Class Reference
Inheritance diagram for BlinkM:
Collaboration diagram for BlinkM:

Public Member Functions

 BlinkM (int bus, int blinkm)
 
virtual ~BlinkM ()=default
 
virtual int init ()
 
virtual int probe ()
 
virtual int setMode (int mode)
 
virtual int ioctl (device::file_t *filp, int cmd, unsigned long arg)
 

Static Public Attributes

static const char *const script_names []
 

Private Types

enum  ScriptID {
  USER = 0, RGB, WHITE_FLASH, RED_FLASH,
  GREEN_FLASH, BLUE_FLASH, CYAN_FLASH, MAGENTA_FLASH,
  YELLOW_FLASH, BLACK, HUE_CYCLE, MOOD_LIGHT,
  VIRTUAL_CANDLE, WATER_REFLECTIONS, OLD_NEON, THE_SEASONS,
  THUNDERSTORM, STOP_LIGHT, MORSE_CODE
}
 
enum  ledColors {
  LED_OFF, LED_RED, LED_ORANGE, LED_YELLOW,
  LED_PURPLE, LED_GREEN, LED_BLUE, LED_CYAN,
  LED_WHITE, LED_AMBER
}
 

Private Member Functions

void setLEDColor (int ledcolor)
 
void Run () override
 
int set_rgb (uint8_t r, uint8_t g, uint8_t b)
 
int fade_rgb (uint8_t r, uint8_t g, uint8_t b)
 
int fade_hsb (uint8_t h, uint8_t s, uint8_t b)
 
int fade_rgb_random (uint8_t r, uint8_t g, uint8_t b)
 
int fade_hsb_random (uint8_t h, uint8_t s, uint8_t b)
 
int set_fade_speed (uint8_t s)
 
int play_script (uint8_t script_id)
 
int play_script (const char *script_name)
 
int stop_script ()
 
int write_script_line (uint8_t line, uint8_t ticks, uint8_t cmd, uint8_t arg1, uint8_t arg2, uint8_t arg3)
 
int read_script_line (uint8_t line, uint8_t &ticks, uint8_t cmd[4])
 
int set_script (uint8_t length, uint8_t repeats)
 
int get_rgb (uint8_t &r, uint8_t &g, uint8_t &b)
 
int get_firmware_version (uint8_t version[2])
 

Private Attributes

int led_color_1
 
int led_color_2
 
int led_color_3
 
int led_color_4
 
int led_color_5
 
int led_color_6
 
int led_color_7
 
int led_color_8
 
int led_blink
 
bool systemstate_run
 
uORB::Subscription vehicle_status_sub {ORB_ID(vehicle_status)}
 
uORB::Subscription battery_status_sub {ORB_ID(battery_status)}
 
uORB::Subscription vehicle_control_mode_sub {ORB_ID(vehicle_control_mode)}
 
uORB::Subscription vehicle_gps_position_sub {ORB_ID(vehicle_gps_position)}
 
uORB::Subscription actuator_armed_sub {ORB_ID(actuator_armed)}
 
uORB::Subscription safety_sub {ORB_ID(safety)}
 
int num_of_cells
 
int detected_cells_runcount
 
int t_led_color [8]
 
int t_led_blink
 
int led_thread_runcount
 
int led_interval
 
bool detected_cells_blinked
 
bool led_thread_ready
 
int num_of_used_sats
 

Detailed Description

Definition at line 116 of file blinkm.cpp.

Member Enumeration Documentation

◆ ledColors

enum BlinkM::ledColors
private
Enumerator
LED_OFF 
LED_RED 
LED_ORANGE 
LED_YELLOW 
LED_PURPLE 
LED_GREEN 
LED_BLUE 
LED_CYAN 
LED_WHITE 
LED_AMBER 

Definition at line 153 of file blinkm.cpp.

◆ ScriptID

enum BlinkM::ScriptID
private
Enumerator
USER 
RGB 
WHITE_FLASH 
RED_FLASH 
GREEN_FLASH 
BLUE_FLASH 
CYAN_FLASH 
MAGENTA_FLASH 
YELLOW_FLASH 
BLACK 
HUE_CYCLE 
MOOD_LIGHT 
VIRTUAL_CANDLE 
WATER_REFLECTIONS 
OLD_NEON 
THE_SEASONS 
THUNDERSTORM 
STOP_LIGHT 
MORSE_CODE 

Definition at line 131 of file blinkm.cpp.

Constructor & Destructor Documentation

◆ BlinkM()

BlinkM::BlinkM ( int  bus,
int  blinkm 
)

Definition at line 257 of file blinkm.cpp.

References detected_cells_blinked, led_interval, led_thread_ready, led_thread_runcount, num_of_used_sats, and t_led_blink.

Referenced by blinkm_main().

Here is the caller graph for this function:

◆ ~BlinkM()

virtual BlinkM::~BlinkM ( )
virtualdefault

Member Function Documentation

◆ fade_hsb()

int BlinkM::fade_hsb ( uint8_t  h,
uint8_t  s,
uint8_t  b 
)
private

Definition at line 788 of file blinkm.cpp.

References msg.

◆ fade_hsb_random()

int BlinkM::fade_hsb_random ( uint8_t  h,
uint8_t  s,
uint8_t  b 
)
private

Definition at line 804 of file blinkm.cpp.

References msg.

◆ fade_rgb()

int BlinkM::fade_rgb ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
private

Definition at line 780 of file blinkm.cpp.

References msg.

◆ fade_rgb_random()

int BlinkM::fade_rgb_random ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
private

Definition at line 796 of file blinkm.cpp.

References msg.

◆ get_firmware_version()

int BlinkM::get_firmware_version ( uint8_t  version[2])
private

Definition at line 920 of file blinkm.cpp.

References blinkm_usage(), and msg.

Referenced by probe().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_rgb()

int BlinkM::get_rgb ( uint8_t &  r,
uint8_t &  g,
uint8_t &  b 
)
private

Definition at line 903 of file blinkm.cpp.

References msg, and OK.

◆ init()

int BlinkM::init ( )
virtual

Definition at line 283 of file blinkm.cpp.

References ToneAlarmInterface::init(), OK, set_rgb(), stop_script(), and warnx.

Here is the call graph for this function:

◆ ioctl()

int BlinkM::ioctl ( device::file_t filp,
int  cmd,
unsigned long  arg 
)
virtual

Definition at line 332 of file blinkm.cpp.

References BLINKM_PLAY_SCRIPT, BLINKM_PLAY_SCRIPT_NAMED, BLINKM_SET_USER_SCRIPT, OK, play_script(), set_script(), and write_script_line().

Here is the call graph for this function:

◆ play_script() [1/2]

int BlinkM::play_script ( uint8_t  script_id)
private

Definition at line 820 of file blinkm.cpp.

References msg.

Referenced by ioctl(), and play_script().

Here is the caller graph for this function:

◆ play_script() [2/2]

int BlinkM::play_script ( const char *  script_name)
private

Definition at line 828 of file blinkm.cpp.

References play_script(), script_names, set_rgb(), and stop_script().

Here is the call graph for this function:

◆ probe()

int BlinkM::probe ( )
virtual

Definition at line 317 of file blinkm.cpp.

References DEVICE_DEBUG, get_firmware_version(), and OK.

Here is the call graph for this function:

◆ read_script_line()

int BlinkM::read_script_line ( uint8_t  line,
uint8_t &  ticks,
uint8_t  cmd[4] 
)
private

Definition at line 876 of file blinkm.cpp.

References msg, and OK.

◆ Run()

◆ set_fade_speed()

int BlinkM::set_fade_speed ( uint8_t  s)
private

Definition at line 812 of file blinkm.cpp.

References msg.

◆ set_rgb()

int BlinkM::set_rgb ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
private

Definition at line 772 of file blinkm.cpp.

References msg.

Referenced by init(), play_script(), Run(), setLEDColor(), and setMode().

Here is the caller graph for this function:

◆ set_script()

int BlinkM::set_script ( uint8_t  length,
uint8_t  repeats 
)
private

Definition at line 895 of file blinkm.cpp.

References msg.

Referenced by ioctl().

Here is the caller graph for this function:

◆ setLEDColor()

void BlinkM::setLEDColor ( int  ledcolor)
private

Definition at line 726 of file blinkm.cpp.

References LED_AMBER, LED_BLUE, LED_CYAN, LED_GREEN, LED_OFF, LED_ORANGE, LED_PURPLE, LED_RED, LED_WHITE, LED_YELLOW, and set_rgb().

Referenced by Run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMode()

int BlinkM::setMode ( int  mode)
virtual

Definition at line 299 of file blinkm.cpp.

References OK, set_rgb(), stop_script(), and systemstate_run.

Here is the call graph for this function:

◆ stop_script()

int BlinkM::stop_script ( )
private

Definition at line 860 of file blinkm.cpp.

References msg.

Referenced by init(), play_script(), Run(), and setMode().

Here is the caller graph for this function:

◆ write_script_line()

int BlinkM::write_script_line ( uint8_t  line,
uint8_t  ticks,
uint8_t  cmd,
uint8_t  arg1,
uint8_t  arg2,
uint8_t  arg3 
)
private

Definition at line 868 of file blinkm.cpp.

References msg.

Referenced by ioctl().

Here is the caller graph for this function:

Member Data Documentation

◆ actuator_armed_sub

uORB::Subscription BlinkM::actuator_armed_sub {ORB_ID(actuator_armed)}
private

Definition at line 182 of file blinkm.cpp.

Referenced by Run().

◆ battery_status_sub

uORB::Subscription BlinkM::battery_status_sub {ORB_ID(battery_status)}
private

Definition at line 179 of file blinkm.cpp.

Referenced by Run().

◆ detected_cells_blinked

bool BlinkM::detected_cells_blinked
private

Definition at line 192 of file blinkm.cpp.

Referenced by BlinkM(), and Run().

◆ detected_cells_runcount

int BlinkM::detected_cells_runcount
private

Definition at line 186 of file blinkm.cpp.

Referenced by Run().

◆ led_blink

int BlinkM::led_blink
private

Definition at line 174 of file blinkm.cpp.

Referenced by Run().

◆ led_color_1

int BlinkM::led_color_1
private

Definition at line 166 of file blinkm.cpp.

Referenced by Run().

◆ led_color_2

int BlinkM::led_color_2
private

Definition at line 167 of file blinkm.cpp.

Referenced by Run().

◆ led_color_3

int BlinkM::led_color_3
private

Definition at line 168 of file blinkm.cpp.

Referenced by Run().

◆ led_color_4

int BlinkM::led_color_4
private

Definition at line 169 of file blinkm.cpp.

Referenced by Run().

◆ led_color_5

int BlinkM::led_color_5
private

Definition at line 170 of file blinkm.cpp.

Referenced by Run().

◆ led_color_6

int BlinkM::led_color_6
private

Definition at line 171 of file blinkm.cpp.

Referenced by Run().

◆ led_color_7

int BlinkM::led_color_7
private

Definition at line 172 of file blinkm.cpp.

Referenced by Run().

◆ led_color_8

int BlinkM::led_color_8
private

Definition at line 173 of file blinkm.cpp.

Referenced by Run().

◆ led_interval

int BlinkM::led_interval
private

Definition at line 190 of file blinkm.cpp.

Referenced by BlinkM(), and Run().

◆ led_thread_ready

bool BlinkM::led_thread_ready
private

Definition at line 193 of file blinkm.cpp.

Referenced by BlinkM(), and Run().

◆ led_thread_runcount

int BlinkM::led_thread_runcount
private

Definition at line 189 of file blinkm.cpp.

Referenced by BlinkM(), and Run().

◆ num_of_cells

int BlinkM::num_of_cells
private

Definition at line 185 of file blinkm.cpp.

Referenced by Run().

◆ num_of_used_sats

int BlinkM::num_of_used_sats
private

Definition at line 195 of file blinkm.cpp.

Referenced by BlinkM(), and Run().

◆ safety_sub

uORB::Subscription BlinkM::safety_sub {ORB_ID(safety)}
private

Definition at line 183 of file blinkm.cpp.

Referenced by Run().

◆ script_names

const char *const BlinkM::script_names
static
Initial value:
= {
"USER",
"RGB",
"WHITE_FLASH",
"RED_FLASH",
"GREEN_FLASH",
"BLUE_FLASH",
"CYAN_FLASH",
"MAGENTA_FLASH",
"YELLOW_FLASH",
"BLACK",
"HUE_CYCLE",
"MOOD_LIGHT",
"VIRTUAL_CANDLE",
"WATER_REFLECTIONS",
"OLD_NEON",
"THE_SEASONS",
"THUNDERSTORM",
"STOP_LIGHT",
"MORSE_CODE",
nullptr
}

Definition at line 128 of file blinkm.cpp.

Referenced by blinkm_main(), and play_script().

◆ systemstate_run

bool BlinkM::systemstate_run
private

Definition at line 176 of file blinkm.cpp.

Referenced by Run(), and setMode().

◆ t_led_blink

int BlinkM::t_led_blink
private

Definition at line 188 of file blinkm.cpp.

Referenced by BlinkM(), and Run().

◆ t_led_color

int BlinkM::t_led_color[8]
private

Definition at line 187 of file blinkm.cpp.

Referenced by Run().

◆ vehicle_control_mode_sub

uORB::Subscription BlinkM::vehicle_control_mode_sub {ORB_ID(vehicle_control_mode)}
private

Definition at line 180 of file blinkm.cpp.

Referenced by Run().

◆ vehicle_gps_position_sub

uORB::Subscription BlinkM::vehicle_gps_position_sub {ORB_ID(vehicle_gps_position)}
private

Definition at line 181 of file blinkm.cpp.

Referenced by Run().

◆ vehicle_status_sub

uORB::Subscription BlinkM::vehicle_status_sub {ORB_ID(vehicle_status)}
private

Definition at line 178 of file blinkm.cpp.

Referenced by Run().


The documentation for this class was generated from the following file: