PX4 Firmware
PX4 Autopilot Software http://px4.io
Airspeed Class Referenceabstract

#include <airspeed.h>

Inheritance diagram for Airspeed:
Collaboration diagram for Airspeed:

Public Member Functions

 Airspeed (int bus, int address, unsigned conversion_interval, const char *path)
 
virtual ~Airspeed ()
 
virtual int init ()
 
virtual int ioctl (device::file_t *filp, int cmd, unsigned long arg)
 

Protected Member Functions

virtual int probe ()
 
virtual void Run ()=0
 Perform a poll cycle; collect from the previous measurement and start a new one. More...
 
virtual int measure ()=0
 
virtual int collect ()=0
 
void start ()
 Initialise the automatic measurement state machine and start it. More...
 
void stop ()
 Stop the automatic measurement state machine. More...
 
void new_report (const differential_pressure_s &report)
 add a new report to the reports queue More...
 

Protected Attributes

bool _sensor_ok
 
int _measure_interval
 
bool _collect_phase
 
float _diff_pres_offset
 
orb_advert_t _airspeed_pub
 
int _airspeed_orb_class_instance
 
int _class_instance
 
unsigned _conversion_interval
 
perf_counter_t _sample_perf
 
perf_counter_t _comms_errors
 

Private Member Functions

 Airspeed (const Airspeed &)
 
Airspeedoperator= (const Airspeed &)
 

Detailed Description

Definition at line 50 of file airspeed.h.

Constructor & Destructor Documentation

◆ Airspeed() [1/2]

Airspeed::Airspeed ( int  bus,
int  address,
unsigned  conversion_interval,
const char *  path 
)

Definition at line 59 of file airspeed.cpp.

◆ ~Airspeed()

Airspeed::~Airspeed ( )
virtual

Definition at line 75 of file airspeed.cpp.

References _airspeed_pub, _class_instance, _comms_errors, _sample_perf, AIRSPEED_BASE_DEVICE_PATH, orb_unadvertise(), perf_free(), and stop().

Here is the call graph for this function:

◆ Airspeed() [2/2]

Airspeed::Airspeed ( const Airspeed )
private

Member Function Documentation

◆ collect()

virtual int Airspeed::collect ( )
protectedpure virtual

Implemented in MEASAirspeed, SDP3X, ETSAirspeed, and MS5525.

◆ init()

int Airspeed::init ( )
virtual

Definition at line 92 of file airspeed.cpp.

References _airspeed_orb_class_instance, _airspeed_pub, _class_instance, AIRSPEED_BASE_DEVICE_PATH, ToneAlarmInterface::init(), measure(), orb_advertise_multi(), ORB_ID, and ORB_PRIO_HIGH.

Referenced by PX4IO::set_update_rate(), ms5525_airspeed::start_bus(), sdp3x_airspeed::start_bus(), ets_airspeed::start_bus(), meas_airspeed::start_bus(), and tone_alarm_main().

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

◆ ioctl()

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

Definition at line 133 of file airspeed.cpp.

References _conversion_interval, _diff_pres_offset, _measure_interval, AIRSPEEDIOCSSCALE, airspeed_scale::offset_pa, OK, SENSOR_POLLRATE_DEFAULT, SENSORIOCSPOLLRATE, and start().

Referenced by px4io_main(), and PX4IO::set_update_rate().

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

◆ measure()

virtual int Airspeed::measure ( )
protectedpure virtual

Implemented in MEASAirspeed, SDP3X, ETSAirspeed, and MS5525.

Referenced by init(), and probe().

Here is the caller graph for this function:

◆ new_report()

void Airspeed::new_report ( const differential_pressure_s report)
protected

add a new report to the reports queue

Parameters
reportdifferential_pressure_s report

◆ operator=()

Airspeed& Airspeed::operator= ( const Airspeed )
private

◆ probe()

int Airspeed::probe ( )
protectedvirtual

Reimplemented in SDP3X.

Definition at line 118 of file airspeed.cpp.

References measure().

Here is the call graph for this function:

◆ Run()

virtual void Airspeed::Run ( )
protectedpure virtual

Perform a poll cycle; collect from the previous measurement and start a new one.

Implemented in MEASAirspeed, SDP3X, ETSAirspeed, and MS5525.

◆ start()

void Airspeed::start ( )
protected

Initialise the automatic measurement state machine and start it.

Note
This function is called at open and error time. It might make sense to make it more aggressive about resetting the bus in case of errors.

Definition at line 200 of file airspeed.cpp.

References _collect_phase.

Referenced by ioctl(), MS5525::Run(), ETSAirspeed::Run(), and MEASAirspeed::Run().

Here is the caller graph for this function:

◆ stop()

void Airspeed::stop ( )
protected

Stop the automatic measurement state machine.

Definition at line 210 of file airspeed.cpp.

Referenced by ~Airspeed().

Here is the caller graph for this function:

Member Data Documentation

◆ _airspeed_orb_class_instance

int Airspeed::_airspeed_orb_class_instance
protected

Definition at line 82 of file airspeed.h.

Referenced by init().

◆ _airspeed_pub

orb_advert_t Airspeed::_airspeed_pub
protected

◆ _class_instance

int Airspeed::_class_instance
protected

Definition at line 84 of file airspeed.h.

Referenced by init(), and ~Airspeed().

◆ _collect_phase

bool Airspeed::_collect_phase
protected

Definition at line 78 of file airspeed.h.

Referenced by MS5525::Run(), ETSAirspeed::Run(), MEASAirspeed::Run(), and start().

◆ _comms_errors

◆ _conversion_interval

unsigned Airspeed::_conversion_interval
protected

Definition at line 86 of file airspeed.h.

Referenced by ioctl().

◆ _diff_pres_offset

float Airspeed::_diff_pres_offset
protected

◆ _measure_interval

int Airspeed::_measure_interval
protected

Definition at line 77 of file airspeed.h.

Referenced by ioctl(), MS5525::Run(), ETSAirspeed::Run(), and MEASAirspeed::Run().

◆ _sample_perf

perf_counter_t Airspeed::_sample_perf
protected

◆ _sensor_ok

bool Airspeed::_sensor_ok
protected

Definition at line 76 of file airspeed.h.

Referenced by MS5525::Run(), ETSAirspeed::Run(), SDP3X::Run(), and MEASAirspeed::Run().


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