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

#include <SDP3X.hpp>

Inheritance diagram for SDP3X:
Collaboration diagram for SDP3X:

Public Member Functions

 SDP3X (int bus, int address=I2C_ADDRESS_1_SDP3X, const char *path=PATH_SDP3X)
 
- Public Member Functions inherited from Airspeed
 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)
 

Private Member Functions

void Run () override
 Perform a poll cycle; collect from the previous measurement and start a new one. More...
 
int measure () override
 
int collect () override
 
int probe () override
 
bool init_sdp3x ()
 
bool crc (const uint8_t data[], unsigned size, uint8_t checksum)
 Calculate the CRC8 for the sensor payload data. More...
 
int write_command (uint16_t command)
 Write a command in Sensirion specific logic. More...
 

Private Attributes

math::LowPassFilter2p _filter {SPD3X_MEAS_RATE, SDP3X_MEAS_DRIVER_FILTER_FREQ}
 
uint16_t _scale {0}
 

Additional Inherited Members

- Protected Member Functions inherited from Airspeed
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 inherited from Airspeed
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
 

Detailed Description

Definition at line 70 of file SDP3X.hpp.

Constructor & Destructor Documentation

◆ SDP3X()

SDP3X::SDP3X ( int  bus,
int  address = I2C_ADDRESS_1_SDP3X,
const char *  path = PATH_SDP3X 
)
inline

Definition at line 73 of file SDP3X.hpp.

References Run().

Here is the call graph for this function:

Member Function Documentation

◆ collect()

int SDP3X::collect ( )
overrideprivatevirtual

Implements Airspeed.

Definition at line 122 of file SDP3X.cpp.

References Airspeed::_airspeed_pub, Airspeed::_comms_errors, Airspeed::_diff_pres_offset, _filter, Airspeed::_sample_perf, _scale, math::LowPassFilter2p::apply(), crc(), differential_pressure_s::device_id, differential_pressure_s::differential_pressure_filtered_pa, differential_pressure_s::differential_pressure_raw_pa, differential_pressure_s::error_count, hrt_absolute_time(), OK, ORB_ID, orb_publish(), P, perf_begin(), perf_count(), perf_end(), perf_event_count(), SDP3X_SCALE_TEMPERATURE, differential_pressure_s::temperature, and differential_pressure_s::timestamp.

Referenced by measure(), and Run().

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

◆ crc()

bool SDP3X::crc ( const uint8_t  data[],
unsigned  size,
uint8_t  checksum 
)
private

Calculate the CRC8 for the sensor payload data.

Definition at line 187 of file SDP3X.cpp.

Referenced by collect(), and init_sdp3x().

Here is the caller graph for this function:

◆ init_sdp3x()

bool SDP3X::init_sdp3x ( )
private

Definition at line 58 of file SDP3X.cpp.

References Airspeed::_comms_errors, _scale, crc(), DRV_DIFF_PRESS_DEVTYPE_SDP31, DRV_DIFF_PRESS_DEVTYPE_SDP32, DRV_DIFF_PRESS_DEVTYPE_SDP33, perf_count(), SDP3X_CONT_MEAS_AVG_MODE, SDP3X_RESET_ADDR, SDP3X_RESET_CMD, SDP3X_SCALE_PRESSURE_SDP31, SDP3X_SCALE_PRESSURE_SDP32, SDP3X_SCALE_PRESSURE_SDP33, and write_command().

Referenced by probe().

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

◆ measure()

int SDP3X::measure ( )
inlineoverrideprivatevirtual

Implements Airspeed.

Definition at line 85 of file SDP3X.hpp.

References collect(), and probe().

Here is the call graph for this function:

◆ probe()

int SDP3X::probe ( )
overrideprivatevirtual

Reimplemented from Airspeed.

Definition at line 44 of file SDP3X.cpp.

References init_sdp3x().

Referenced by measure().

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

◆ Run()

void SDP3X::Run ( )
overrideprivatevirtual

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

Implements Airspeed.

Definition at line 171 of file SDP3X.cpp.

References Airspeed::_sensor_ok, collect(), CONVERSION_INTERVAL, and DEVICE_DEBUG.

Referenced by SDP3X().

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

◆ write_command()

int SDP3X::write_command ( uint16_t  command)
private

Write a command in Sensirion specific logic.

Definition at line 49 of file SDP3X.cpp.

Referenced by init_sdp3x().

Here is the caller graph for this function:

Member Data Documentation

◆ _filter

Definition at line 89 of file SDP3X.hpp.

Referenced by collect().

◆ _scale

uint16_t SDP3X::_scale {0}
private

Definition at line 103 of file SDP3X.hpp.

Referenced by collect(), and init_sdp3x().


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