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

Pressure and temperature sensor unit. More...

#include <unit_BMP280.hpp>

Inheritance diagram for m5::unit::UnitBMP280:

Classes

struct  config_t
 Settings for begin. More...
 

Public Member Functions

 UnitBMP280 (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 bmp280::Oversampling osrsPressure, const bmp280::Oversampling osrsTemperature, const bmp280::Filter filter, const bmp280::Standby st)
 Start periodic measurement.
 
bool startPeriodicMeasurement ()
 Start periodic measurement using current settings.
 
bool stopPeriodicMeasurement ()
 Stop periodic measurement.
 
Single shot measurement
bool measureSingleshot (bmp280::Data &d, const bmp280::Oversampling osrsPressure, const bmp280::Oversampling osrsTemperature, const bmp280::Filter filter)
 Measurement single shot.
 
bool measureSingleshot (bmp280::Data &d)
 Measurement single shot using current settings.
 
Settings
bool readOversampling (bmp280::Oversampling &osrsPressure, bmp280::Oversampling &osrsTemperature)
 Read the oversampling conditions.
 
bool writeOversampling (const bmp280::Oversampling osrsPressure, const bmp280::Oversampling osrsTemperature)
 Write the oversampling conditions.
 
bool writeOversamplingPressure (const bmp280::Oversampling osrsPressure)
 Write the oversampling conditions for pressure.
 
bool writeOversamplingTemperature (const bmp280::Oversampling osrsTemperature)
 Write the oversampling conditions for temperature.
 
bool writeOversampling (const bmp280::OversamplingSetting osrss)
 Write the oversampling by OversamplingSetting.
 
bool readFilter (bmp280::Filter &f)
 Read the IIR filter co-efficient.
 
bool writeFilter (const bmp280::Filter &f)
 Write the IIR filter co-efficient.
 
bool readStandbyTime (bmp280::Standby &s)
 Read the standby time.
 
bool writeStandbyTime (const bmp280::Standby s)
 Write the standby time.
 
bool readPowerMode (bmp280::PowerMode &m)
 Read the power mode.
 
bool writePowerMode (const bmp280::PowerMode m)
 Write the power mode.
 
bool writeUseCaseSetting (const bmp280::UseCase uc)
 Write the settings based on use cases.
 

Protected Member Functions

bool start_periodic_measurement (const bmp280::Oversampling osrsPressure, const bmp280::Oversampling osrsTemperature, const bmp280::Filter filter, const bmp280::Standby st)
 
bool start_periodic_measurement ()
 
bool stop_periodic_measurement ()
 
bool read_measurement (bmp280::Data &d)
 
bool measure_singleshot (bmp280::Data &d)
 
bool read_trimming (bmp280::Trimming &t)
 
bool is_data_ready ()
 
 M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (UnitBMP280, bmp280::Data)
 

Protected Attributes

std::unique_ptr< m5::container::CircularBuffer< bmp280::Data > > _data {}
 
config_t _cfg {}
 
bmp280::Trimming _trimming {}
 

Detailed Description

Pressure and temperature sensor unit.

Member Function Documentation

◆ measureSingleshot()

bool m5::unit::UnitBMP280::measureSingleshot ( bmp280::Data & d,
const bmp280::Oversampling osrsPressure,
const bmp280::Oversampling osrsTemperature,
const bmp280::Filter filter )

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::UnitBMP280::readFilter ( bmp280::Filter & f)

Read the IIR filter co-efficient.

Parameters
[out]ffilter
Returns
True if successful

◆ readOversampling()

bool m5::unit::UnitBMP280::readOversampling ( bmp280::Oversampling & osrsPressure,
bmp280::Oversampling & osrsTemperature )

Read the oversampling conditions.

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

◆ readPowerMode()

bool m5::unit::UnitBMP280::readPowerMode ( bmp280::PowerMode & m)

Read the power mode.

Parameters
[out]mPower mode
Returns
True if successful

◆ readStandbyTime()

bool m5::unit::UnitBMP280::readStandbyTime ( bmp280::Standby & s)

Read the standby time.

Parameters
[out]sstandby time
Returns
True if successful

◆ softReset()

bool m5::unit::UnitBMP280::softReset ( )

Soft reset.

Returns
True if successful

◆ startPeriodicMeasurement()

bool m5::unit::UnitBMP280::startPeriodicMeasurement ( const bmp280::Oversampling osrsPressure,
const bmp280::Oversampling osrsTemperature,
const bmp280::Filter filter,
const bmp280::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::UnitBMP280::stopPeriodicMeasurement ( )
inline

Stop periodic measurement.

Returns
True if successful

◆ writeFilter()

bool m5::unit::UnitBMP280::writeFilter ( const bmp280::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::UnitBMP280::writeOversampling ( const bmp280::Oversampling osrsPressure,
const bmp280::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::UnitBMP280::writeOversampling ( const bmp280::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::UnitBMP280::writeOversamplingPressure ( const bmp280::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::UnitBMP280::writeOversamplingTemperature ( const bmp280::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::UnitBMP280::writePowerMode ( const bmp280::PowerMode m)

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::UnitBMP280::writeStandbyTime ( const bmp280::Standby s)

Write the standby time.

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

◆ writeUseCaseSetting()

bool m5::unit::UnitBMP280::writeUseCaseSetting ( const bmp280::UseCase uc)

Write the settings based on use cases.

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