M5Unit-ENV 1.2.0 git rev:d576302
Loading...
Searching...
No Matches
m5::unit::UnitQMP6988 Class Reference

Barometric pressure sensor to measure atmospheric pressure and altitude estimation. More...

#include <unit_QMP6988.hpp>

Inheritance diagram for m5::unit::UnitQMP6988:

Classes

struct  config_t
 Settings for begin. More...
 

Public Member Functions

 UnitQMP6988 (const uint8_t addr=DEFAULT_ADDRESS)
 
virtual bool begin () override
 
virtual void update (const bool force=false) override
 
bool softReset ()
 Soft reset.
 
Settings for begin
config_t config ()
 Gets the configration.
 
void config (const config_t &cfg)
 Set the configration.
 
Measurement data by periodic
float temperature () const
 Oldest measured temperature (Celsius)
 
float celsius () const
 Oldest measured temperature (Celsius)
 
float fahrenheit () const
 Oldest measured temperature (Fahrenheit)
 
float pressure () const
 Oldest measured pressure (Pa)
 
Periodic measurement
bool startPeriodicMeasurement (const qmp6988::Oversampling osrsPressure, const qmp6988::Oversampling osrsTemperature, const qmp6988::Filter f, const qmp6988::Standby st)
 Start periodic measurement.
 
bool startPeriodicMeasurement ()
 Start periodic measurement using current settings.
 
bool stopPeriodicMeasurement ()
 Stop periodic measurement.
 
Single shot measurement
bool measureSingleshot (qmp6988::Data &d, const qmp6988::Oversampling osrsPressure, const qmp6988::Oversampling osrsTemperature, const qmp6988::Filter f)
 Measurement single shot.
 
bool measureSingleshot (qmp6988::Data &d)
 Measurement single shot using current settings.
 
Settings
bool readOversampling (qmp6988::Oversampling &osrsPressure, qmp6988::Oversampling &osrsTemperature)
 Read the oversampling conditions.
 
bool writeOversampling (const qmp6988::Oversampling osrsPressure, const qmp6988::Oversampling osrsTemperature)
 Write the oversampling conditions.
 
bool writeOversamplingPressure (const qmp6988::Oversampling osrsPressure)
 Write the oversampling conditions for pressure.
 
bool writeOversamplingTemperature (const qmp6988::Oversampling osrsTemperature)
 Write the oversampling conditions for temperature.
 
bool writeOversampling (const qmp6988::OversamplingSetting osrss)
 Write the oversampling by OversamplingSetting.
 
bool readFilter (qmp6988::Filter &f)
 Read the IIR filter co-efficient.
 
bool writeFilter (const qmp6988::Filter f)
 Write the IIR filter co-efficient.
 
bool readStandbyTime (qmp6988::Standby &st)
 Read the standby time.
 
bool writeStandbyTime (const qmp6988::Standby st)
 Write the standby time.
 
bool readPowerMode (qmp6988::PowerMode &mode)
 Read the power mode.
 
bool writePowerMode (const qmp6988::PowerMode mode)
 Write the power mode.
 
bool writeUseCaseSetting (const qmp6988::UseCase uc)
 Write the settings based on use cases.
 

Protected Member Functions

bool start_periodic_measurement ()
 
bool start_periodic_measurement (const qmp6988::Oversampling ost, const qmp6988::Oversampling osp, const qmp6988::Filter f, const qmp6988::Standby st)
 
bool stop_periodic_measurement ()
 
bool read_calibration (qmp6988::Calibration &c)
 
bool read_measurement (qmp6988::Data &d, const bool only_temperature=false)
 
bool is_data_ready ()
 
 M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (UnitQMP6988, qmp6988::Data)
 

Protected Attributes

std::unique_ptr< m5::container::CircularBuffer< qmp6988::Data > > _data {}
 
qmp6988::Calibration _calibration {}
 
config_t _cfg {}
 
bool _only_temperature {}
 

Detailed Description

Barometric pressure sensor to measure atmospheric pressure and altitude estimation.

Member Function Documentation

◆ measureSingleshot()

bool m5::unit::UnitQMP6988::measureSingleshot ( qmp6988::Data & d,
const qmp6988::Oversampling osrsPressure,
const qmp6988::Oversampling osrsTemperature,
const qmp6988::Filter f )

Measurement single shot.

Parameters
[out]dataMeasuerd data
osrsPressureOversampling factor for pressure
osrsTemperatureOversampling factor for temperature
filterFilter coeff
Returns
True if successful
Warning
During periodic detection runs, an error is returned
Measuring pressure requires measuring temperature
Each setting is overwritten

◆ readFilter()

bool m5::unit::UnitQMP6988::readFilter ( qmp6988::Filter & f)

Read the IIR filter co-efficient.

Parameters
[out]ffilter
Returns
True if successful

◆ readOversampling()

bool m5::unit::UnitQMP6988::readOversampling ( qmp6988::Oversampling & osrsPressure,
qmp6988::Oversampling & osrsTemperature )

Read the oversampling conditions.

Parameters
[out]osrsPressureOversampling for pressure
[out]osrsTemperatureOversampling for temperature
Returns
True if successful

◆ readPowerMode()

bool m5::unit::UnitQMP6988::readPowerMode ( qmp6988::PowerMode & mode)

Read the power mode.

Parameters
[out]modePowerMode
Returns
True if successful

◆ readStandbyTime()

bool m5::unit::UnitQMP6988::readStandbyTime ( qmp6988::Standby & st)

Read the standby time.

Parameters
[out]ststandby time
Returns
True if successful

◆ softReset()

bool m5::unit::UnitQMP6988::softReset ( )

Soft reset.

Returns
True if successful

◆ startPeriodicMeasurement()

bool m5::unit::UnitQMP6988::startPeriodicMeasurement ( const qmp6988::Oversampling osrsPressure,
const qmp6988::Oversampling osrsTemperature,
const qmp6988::Filter f,
const qmp6988::Standby st )
inline

Start periodic measurement.

Parameters
osrsPressureOversampling factor for pressure
osrsTemperatureOversampling factor for temperature
filterFilter coeff
stStandby time
Returns
True if successful
Warning
Measuring pressure requires measuring temperature

◆ stopPeriodicMeasurement()

bool m5::unit::UnitQMP6988::stopPeriodicMeasurement ( )
inline

Stop periodic measurement.

Returns
True if successful

◆ writeFilter()

bool m5::unit::UnitQMP6988::writeFilter ( const qmp6988::Filter f)

Write the IIR filter co-efficient.

Parameters
ffilter
Returns
True if successful
Warning
During periodic detection runs, an error is returned

◆ writeOversampling() [1/2]

bool m5::unit::UnitQMP6988::writeOversampling ( const qmp6988::Oversampling osrsPressure,
const qmp6988::Oversampling osrsTemperature )

Write the oversampling conditions.

Parameters
osrsPressureOversampling for pressure
osrsTemperatureOversampling for temperature
Returns
True if successful
Warning
During periodic detection runs, an error is returned

◆ writeOversampling() [2/2]

bool m5::unit::UnitQMP6988::writeOversampling ( const qmp6988::OversamplingSetting osrss)

Write the oversampling by OversamplingSetting.

Parameters
osrssOversamplingSetting
Returns
True if successful
Warning
During periodic detection runs, an error is returned

◆ writeOversamplingPressure()

bool m5::unit::UnitQMP6988::writeOversamplingPressure ( const qmp6988::Oversampling osrsPressure)

Write the oversampling conditions for pressure.

Parameters
osrsPressureOversampling for pressure
Returns
True if successful
Warning
During periodic detection runs, an error is returned

◆ writeOversamplingTemperature()

bool m5::unit::UnitQMP6988::writeOversamplingTemperature ( const qmp6988::Oversampling osrsTemperature)

Write the oversampling conditions for temperature.

Parameters
osrsTemperatureOversampling for temperature
Returns
True if successful
Warning
During periodic detection runs, an error is returned

◆ writePowerMode()

bool m5::unit::UnitQMP6988::writePowerMode ( const qmp6988::PowerMode mode)

Write the power mode.

Parameters
mPower mode
Returns
True if successful
Warning
Note that the measurement mode is changed
It is recommended to use start/stopPeriodicMeasurement or similar to change the measurement mode

◆ writeStandbyTime()

bool m5::unit::UnitQMP6988::writeStandbyTime ( const qmp6988::Standby st)

Write the standby time.

Parameters
ststandby time
Returns
True if successful
Warning
During periodic detection runs, an error is returned

◆ writeUseCaseSetting()

bool m5::unit::UnitQMP6988::writeUseCaseSetting ( const qmp6988::UseCase uc)

Write the settings based on use cases.

Parameters
ucUseCase
Returns
True if successful
Warning
During periodic detection runs, an error is returned