PX4 Firmware
PX4 Autopilot Software http://px4.io
OSDatxxxx Class Reference

#include <atxxxx.h>

Inheritance diagram for OSDatxxxx:
Collaboration diagram for OSDatxxxx:

Public Member Functions

 OSDatxxxx (int bus=OSD_BUS)
 
 ~OSDatxxxx ()
 
virtual int init ()
 

Static Public Member Functions

static int custom_command (int argc, char *argv[])
 
static int print_usage (const char *reason=nullptr)
 
static int task_spawn (int argc, char *argv[])
 

Protected Member Functions

virtual int probe ()
 

Private Member Functions

void Run () override
 
int start ()
 
int reset ()
 
int init_osd ()
 
int readRegister (unsigned reg, uint8_t *data, unsigned count)
 
int writeRegister (unsigned reg, uint8_t data)
 
int add_character_to_screen (char c, uint8_t pos_x, uint8_t pos_y)
 
void add_string_to_screen_centered (const char *str, uint8_t pos_y, int max_length)
 
void clear_line (uint8_t pos_x, uint8_t pos_y, int length)
 
int add_battery_info (uint8_t pos_x, uint8_t pos_y)
 
int add_altitude (uint8_t pos_x, uint8_t pos_y)
 
int add_flighttime (float flight_time, uint8_t pos_x, uint8_t pos_y)
 
int enable_screen ()
 
int disable_screen ()
 
int update_topics ()
 
int update_screen ()
 

Static Private Member Functions

static const char * get_flight_mode (uint8_t nav_state)
 

Private Attributes

uORB::Subscription _battery_sub {ORB_ID(battery_status)}
 
uORB::Subscription _local_position_sub {ORB_ID(vehicle_local_position)}
 
uORB::Subscription _vehicle_status_sub {ORB_ID(vehicle_status)}
 
float _battery_voltage_filtered_v {0.f}
 
float _battery_discharge_mah {0.f}
 
bool _battery_valid {false}
 
float _local_position_z {0.f}
 
bool _local_position_valid {false}
 
uint8_t _arming_state {0}
 
uint64_t _arming_timestamp {0}
 
uint8_t _nav_state {0}
 

Detailed Description

Definition at line 81 of file atxxxx.h.

Constructor & Destructor Documentation

◆ OSDatxxxx()

OSDatxxxx::OSDatxxxx ( int  bus = OSD_BUS)

Definition at line 49 of file atxxxx.cpp.

Referenced by task_spawn().

Here is the caller graph for this function:

◆ ~OSDatxxxx()

OSDatxxxx::~OSDatxxxx ( )

Definition at line 56 of file atxxxx.cpp.

Member Function Documentation

◆ add_altitude()

int OSDatxxxx::add_altitude ( uint8_t  pos_x,
uint8_t  pos_y 
)
private

Definition at line 306 of file atxxxx.cpp.

References _local_position_z, add_character_to_screen(), OSD_SYMBOL_ARROW_NORTH, and OSD_SYMBOL_M.

Referenced by update_screen().

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

◆ add_battery_info()

int OSDatxxxx::add_battery_info ( uint8_t  pos_x,
uint8_t  pos_y 
)
private

Definition at line 275 of file atxxxx.cpp.

References _battery_discharge_mah, _battery_voltage_filtered_v, add_character_to_screen(), OSD_SYMBOL_BATT_3, and OSD_SYMBOL_MAH.

Referenced by update_screen().

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

◆ add_character_to_screen()

int OSDatxxxx::add_character_to_screen ( char  c,
uint8_t  pos_x,
uint8_t  pos_y 
)
private

Definition at line 211 of file atxxxx.cpp.

References OSD_CHARS_PER_ROW, position, and writeRegister().

Referenced by add_altitude(), add_battery_info(), add_flighttime(), add_string_to_screen_centered(), clear_line(), and init().

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

◆ add_flighttime()

int OSDatxxxx::add_flighttime ( float  flight_time,
uint8_t  pos_x,
uint8_t  pos_y 
)
private

Definition at line 322 of file atxxxx.cpp.

References add_character_to_screen(), and OSD_SYMBOL_FLIGHT_TIME.

Referenced by update_screen().

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

◆ add_string_to_screen_centered()

void OSDatxxxx::add_string_to_screen_centered ( const char *  str,
uint8_t  pos_y,
int  max_length 
)
private

Definition at line 242 of file atxxxx.cpp.

References add_character_to_screen(), and OSD_CHARS_PER_ROW.

Referenced by update_screen().

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

◆ clear_line()

void OSDatxxxx::clear_line ( uint8_t  pos_x,
uint8_t  pos_y,
int  length 
)
private

Definition at line 267 of file atxxxx.cpp.

References add_character_to_screen().

Referenced by update_screen().

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

◆ custom_command()

int OSDatxxxx::custom_command ( int  argc,
char *  argv[] 
)
static
See also
ModuleBase::custom_command

Definition at line 560 of file atxxxx.cpp.

References print_usage().

Here is the call graph for this function:

◆ disable_screen()

int OSDatxxxx::disable_screen ( )
private

Definition at line 350 of file atxxxx.cpp.

References data, readRegister(), and writeRegister().

Here is the call graph for this function:

◆ enable_screen()

int OSDatxxxx::enable_screen ( )
private

Definition at line 338 of file atxxxx.cpp.

References data, readRegister(), and writeRegister().

Referenced by init_osd().

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

◆ get_flight_mode()

const char * OSDatxxxx::get_flight_mode ( uint8_t  nav_state)
staticprivate

Definition at line 414 of file atxxxx.cpp.

References flight_mode.

Referenced by update_screen().

Here is the caller graph for this function:

◆ init()

int OSDatxxxx::init ( )
virtual

Definition at line 98 of file atxxxx.cpp.

References add_character_to_screen(), ToneAlarmInterface::init(), init_osd(), OSD_CHARS_PER_ROW, OSD_NUM_ROWS_NTSC, OSD_NUM_ROWS_PAL, and reset().

Referenced by task_spawn().

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

◆ init_osd()

int OSDatxxxx::init_osd ( )
private

Definition at line 156 of file atxxxx.cpp.

References data, enable_screen(), OSD_PAL_TX_MODE, OSD_ZERO_BYTE, and writeRegister().

Referenced by init().

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

◆ print_usage()

int OSDatxxxx::print_usage ( const char *  reason = nullptr)
static
See also
ModuleBase::print_usage

Definition at line 537 of file atxxxx.cpp.

Referenced by custom_command().

Here is the caller graph for this function:

◆ probe()

int OSDatxxxx::probe ( )
protectedvirtual

Definition at line 140 of file atxxxx.cpp.

References data, readRegister(), and writeRegister().

Here is the call graph for this function:

◆ readRegister()

int OSDatxxxx::readRegister ( unsigned  reg,
uint8_t *  data,
unsigned  count 
)
private

Definition at line 174 of file atxxxx.cpp.

References DEVICE_LOG, and DIR_READ.

Referenced by disable_screen(), enable_screen(), and probe().

Here is the caller graph for this function:

◆ reset()

int OSDatxxxx::reset ( )
private

Definition at line 515 of file atxxxx.cpp.

References writeRegister().

Referenced by init().

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

◆ Run()

void OSDatxxxx::Run ( )
overrideprivate

Definition at line 524 of file atxxxx.cpp.

References update_screen(), and update_topics().

Here is the call graph for this function:

◆ start()

int OSDatxxxx::start ( )
private

Definition at line 132 of file atxxxx.cpp.

References OSD_UPDATE_RATE.

Referenced by task_spawn().

Here is the caller graph for this function:

◆ task_spawn()

int OSDatxxxx::task_spawn ( int  argc,
char *  argv[] 
)
static
See also
ModuleBase::task_spawn

Definition at line 62 of file atxxxx.cpp.

References init(), OSDatxxxx(), and start().

Here is the call graph for this function:

◆ update_screen()

int OSDatxxxx::update_screen ( )
private

Definition at line 480 of file atxxxx.cpp.

References _arming_state, _arming_timestamp, _battery_valid, _local_position_valid, _nav_state, add_altitude(), add_battery_info(), add_flighttime(), add_string_to_screen_centered(), clear_line(), flight_mode, get_flight_mode(), and hrt_absolute_time().

Referenced by Run().

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

◆ update_topics()

int OSDatxxxx::update_topics ( )
private

Definition at line 362 of file atxxxx.cpp.

References _arming_state, _arming_timestamp, _battery_discharge_mah, _battery_sub, _battery_valid, _battery_voltage_filtered_v, _local_position_sub, _local_position_valid, _local_position_z, _nav_state, _vehicle_status_sub, uORB::Subscription::copy(), hrt_absolute_time(), and uORB::Subscription::updated().

Referenced by Run().

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

◆ writeRegister()

int OSDatxxxx::writeRegister ( unsigned  reg,
uint8_t  data 
)
private

Definition at line 193 of file atxxxx.cpp.

References data, DEVICE_LOG, DIR_WRITE, and OK.

Referenced by add_character_to_screen(), disable_screen(), enable_screen(), init_osd(), probe(), and reset().

Here is the caller graph for this function:

Member Data Documentation

◆ _arming_state

uint8_t OSDatxxxx::_arming_state {0}
private

Definition at line 150 of file atxxxx.h.

Referenced by update_screen(), and update_topics().

◆ _arming_timestamp

uint64_t OSDatxxxx::_arming_timestamp {0}
private

Definition at line 151 of file atxxxx.h.

Referenced by update_screen(), and update_topics().

◆ _battery_discharge_mah

float OSDatxxxx::_battery_discharge_mah {0.f}
private

Definition at line 142 of file atxxxx.h.

Referenced by add_battery_info(), and update_topics().

◆ _battery_sub

uORB::Subscription OSDatxxxx::_battery_sub {ORB_ID(battery_status)}
private

Definition at line 136 of file atxxxx.h.

Referenced by update_topics().

◆ _battery_valid

bool OSDatxxxx::_battery_valid {false}
private

Definition at line 143 of file atxxxx.h.

Referenced by update_screen(), and update_topics().

◆ _battery_voltage_filtered_v

float OSDatxxxx::_battery_voltage_filtered_v {0.f}
private

Definition at line 141 of file atxxxx.h.

Referenced by add_battery_info(), and update_topics().

◆ _local_position_sub

uORB::Subscription OSDatxxxx::_local_position_sub {ORB_ID(vehicle_local_position)}
private

Definition at line 137 of file atxxxx.h.

Referenced by update_topics().

◆ _local_position_valid

bool OSDatxxxx::_local_position_valid {false}
private

Definition at line 147 of file atxxxx.h.

Referenced by update_screen(), and update_topics().

◆ _local_position_z

float OSDatxxxx::_local_position_z {0.f}
private

Definition at line 146 of file atxxxx.h.

Referenced by add_altitude(), and update_topics().

◆ _nav_state

uint8_t OSDatxxxx::_nav_state {0}
private

Definition at line 154 of file atxxxx.h.

Referenced by update_screen(), and update_topics().

◆ _vehicle_status_sub

uORB::Subscription OSDatxxxx::_vehicle_status_sub {ORB_ID(vehicle_status)}
private

Definition at line 138 of file atxxxx.h.

Referenced by update_topics().


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