MetaWear C++ API  0.20.0
C++ implementation of the MetaWear protocol
Enumerations | Functions | Variables
barometer_bosch.h File Reference

Interacts with the supported Bosch barometers, currenly BMP280 and BME280. More...

#include "sensor_common.h"

Go to the source code of this file.

Enumerations

enum  MblMwBaroBoschOversampling {
  MBL_MW_BARO_BOSCH_OVERSAMPLING_SKIP = 0 , MBL_MW_BARO_BOSCH_OVERSAMPLING_ULTRA_LOW_POWER , MBL_MW_BARO_BOSCH_OVERSAMPLING_LOW_POWER , MBL_MW_BARO_BOSCH_OVERSAMPLING_STANDARD ,
  MBL_MW_BARO_BOSCH_OVERSAMPLING_HIGH , MBL_MW_BARO_BOSCH_OVERSAMPLING_ULTRA_HIGH
}
 Supported oversampling modes on the Bosch barometers.
 
enum  MblMwBaroBoschIirFilter {
  MBL_MW_BARO_BOSCH_IIR_FILTER_OFF = 0 , MBL_MW_BARO_BOSCH_IIR_FILTER_AVG_2 , MBL_MW_BARO_BOSCH_IIR_FILTER_AVG_4 , MBL_MW_BARO_BOSCH_IIR_FILTER_AVG_8 ,
  MBL_MW_BARO_BOSCH_IIR_FILTER_AVG_16
}
 Supported filter modes on the Bosch barometers.
 
enum  MblMwBaroBmp280StandbyTime {
  MBL_MW_BARO_BMP280_STANDBY_TIME_0_5ms = 0 , MBL_MW_BARO_BMP280_STANDBY_TIME_62_5ms , MBL_MW_BARO_BMP280_STANDBY_TIME_125ms , MBL_MW_BARO_BMP280_STANDBY_TIME_250ms ,
  MBL_MW_BARO_BMP280_STANDBY_TIME_500ms , MBL_MW_BARO_BMP280_STANDBY_TIME_1000ms , MBL_MW_BARO_BMP280_STANDBY_TIME_2000ms , MBL_MW_BARO_BMP280_STANDBY_TIME_4000ms
}
 Supported stand by times on the BMP280 barometer.
 
enum  MblMwBaroBme280StandbyTime {
  MBL_MW_BARO_BME280_STANDBY_TIME_0_5ms = 0 , MBL_MW_BARO_BME280_STANDBY_TIME_62_5ms , MBL_MW_BARO_BME280_STANDBY_TIME_125ms , MBL_MW_BARO_BME280_STANDBY_TIME_250ms ,
  MBL_MW_BARO_BME280_STANDBY_TIME_500ms , MBL_MW_BARO_BME280_STANDBY_TIME_1000ms , MBL_MW_BARO_BME280_STANDBY_TIME_10ms , MBL_MW_BARO_BME280_STANDBY_TIME_20ms
}
 Supported stand by times on the BME280 barometer.
 

Functions

METAWEAR_API MblMwDataSignalmbl_mw_baro_bosch_get_pressure_data_signal (const MblMwMetaWearBoard *board)
 Retrieves the data signal representing pressure data from a Bosch barometer This signal represent the pressure in Pascals. More...
 
METAWEAR_API MblMwDataSignalmbl_mw_baro_bosch_get_pressure_read_data_signal (const MblMwMetaWearBoard *board)
 Retrieves the data signal representing a single read from a Bosch barometer This signal represent the pressure in Pascals. More...
 
METAWEAR_API MblMwDataSignalmbl_mw_baro_bosch_get_altitude_data_signal (const MblMwMetaWearBoard *board)
 Retrieves the data signal representing altitude data from a Bosch barometer This signal represent the altitude in Meters. More...
 
METAWEAR_API void mbl_mw_baro_bosch_set_oversampling (MblMwMetaWearBoard *board, MblMwBaroBoschOversampling oversampling)
 Set the oversampling mode Settings available from ultra low power to ultra high resolution to adapt the sensor to the target application. More...
 
METAWEAR_API void mbl_mw_baro_bosch_set_iir_filter (MblMwMetaWearBoard *board, MblMwBaroBoschIirFilter iir_filter)
 Set the iir filter coefficient The built-in IIR filter minimizes short-term disturbances in the output data caused by the slamming of a door or window. More...
 
METAWEAR_API void mbl_mw_baro_bmp280_set_standby_time (MblMwMetaWearBoard *board, MblMwBaroBmp280StandbyTime standby_time)
 Set the standby time for the BMP280 barometer When the sensor operates in normal mode, it perpetualy cycles between an active measurement period and an inactive standby period. More...
 
METAWEAR_API void mbl_mw_baro_bme280_set_standby_time (MblMwMetaWearBoard *board, MblMwBaroBme280StandbyTime standby_time)
 Set the standby time for the BME280 barometer When the sensor operates in normal mode, it continuously cycles between an active measurement period and an inactive standby period. More...
 
METAWEAR_API float mbl_mw_baro_bosch_set_standby_time (MblMwMetaWearBoard *board, float standby_time_ms)
 Set the standby time. More...
 
METAWEAR_API void mbl_mw_baro_bosch_write_config (const MblMwMetaWearBoard *board)
 Writes the configuration to the sensor Applies the STANDBY, IIR and OVERSAMPLING values set in set_standbytime(), set_oversampling(), and set_iir_filter(). More...
 
METAWEAR_API void mbl_mw_baro_bosch_start (const MblMwMetaWearBoard *board)
 Start pressure and altitude sensing. More...
 
METAWEAR_API void mbl_mw_baro_bosch_stop (const MblMwMetaWearBoard *board)
 Stop pressure and altitude sensing. More...
 

Variables

const uint8_t MBL_MW_MODULE_BARO_TYPE_BMP280 = 0
 Constant identifying the BMP280 barometer module type.
 
const uint8_t MBL_MW_MODULE_BARO_TYPE_BME280 = 1
 Constant identifying the BME280 barometer module type.
 

Detailed Description

Interacts with the supported Bosch barometers, currenly BMP280 and BME280.

The BMP280 and BME280 sensors are identical except for the standby times. Functions that are generic for both barometers have "bosch" in the name whereas functions specific to either accelerometer are contain their model i.e. "bmp280" or "bme280".

Function Documentation

◆ mbl_mw_baro_bme280_set_standby_time()

METAWEAR_API void mbl_mw_baro_bme280_set_standby_time ( MblMwMetaWearBoard board,
MblMwBaroBme280StandbyTime  standby_time 
)

Set the standby time for the BME280 barometer When the sensor operates in normal mode, it continuously cycles between an active measurement period and an inactive standby period.

See MblMwBaroBme280StandbyTime for allowed values.

Parameters
boardPointer to the board to modify
standby_timeStandby time value to set

◆ mbl_mw_baro_bmp280_set_standby_time()

METAWEAR_API void mbl_mw_baro_bmp280_set_standby_time ( MblMwMetaWearBoard board,
MblMwBaroBmp280StandbyTime  standby_time 
)

Set the standby time for the BMP280 barometer When the sensor operates in normal mode, it perpetualy cycles between an active measurement period and an inactive standby period.

See MblMwBaroBmp280StandbyTime for allowed values.

Parameters
boardPointer to the board to modify
standby_timeStandby time value to set

◆ mbl_mw_baro_bosch_get_altitude_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_baro_bosch_get_altitude_data_signal ( const MblMwMetaWearBoard board)

Retrieves the data signal representing altitude data from a Bosch barometer This signal represent the altitude in Meters.

Parameters
boardPointer to the board to retrieve the signal from
Returns
Pointer to the board's altitude data signal Int32 is return signal data type (can be negative)

◆ mbl_mw_baro_bosch_get_pressure_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_baro_bosch_get_pressure_data_signal ( const MblMwMetaWearBoard board)

Retrieves the data signal representing pressure data from a Bosch barometer This signal represent the pressure in Pascals.

Parameters
boardPointer to the board to retrieve the signal from
Returns
Pointer to the board's pressure data signal uInt32 is return signal data type

◆ mbl_mw_baro_bosch_get_pressure_read_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_baro_bosch_get_pressure_read_data_signal ( const MblMwMetaWearBoard board)

Retrieves the data signal representing a single read from a Bosch barometer This signal represent the pressure in Pascals.

Parameters
boardPointer to the board to retrieve the signal from
Returns
Pointer to the board's pressure data signal uInt32 is return signal data type

◆ mbl_mw_baro_bosch_set_iir_filter()

METAWEAR_API void mbl_mw_baro_bosch_set_iir_filter ( MblMwMetaWearBoard board,
MblMwBaroBoschIirFilter  iir_filter 
)

Set the iir filter coefficient The built-in IIR filter minimizes short-term disturbances in the output data caused by the slamming of a door or window.

The filter coefficient ranges from 0 (off) to 16. See MblMwBaroBoschIirFilter for allowed values.

Parameters
boardPointer to the board to modify
iir_filterIIR filter value to set

◆ mbl_mw_baro_bosch_set_oversampling()

METAWEAR_API void mbl_mw_baro_bosch_set_oversampling ( MblMwMetaWearBoard board,
MblMwBaroBoschOversampling  oversampling 
)

Set the oversampling mode Settings available from ultra low power to ultra high resolution to adapt the sensor to the target application.

See MblMwBaroBoschOversampling for allowed values. The settings are predefined combinations of pressure measurement oversampling and temperature measurement oversampling.

Parameters
boardPointer to the board to modify
oversamplingOversampling value to set

◆ mbl_mw_baro_bosch_set_standby_time()

METAWEAR_API float mbl_mw_baro_bosch_set_standby_time ( MblMwMetaWearBoard board,
float  standby_time_ms 
)

Set the standby time.

If an invalid standby time is used, the closest valid value will be chosen When the sensor operates in normal mode, it continuously cycles between an active measurement period and an inactive standby period.

Parameters
boardPointer to the board to modify
standby_time_msStandby time value to set, in milliseconds
Returns
Selected standby time, in milliseconds, or -1 if barometer not present

◆ mbl_mw_baro_bosch_start()

METAWEAR_API void mbl_mw_baro_bosch_start ( const MblMwMetaWearBoard board)

Start pressure and altitude sensing.

Parameters
boardPointer to the board to send the command to

◆ mbl_mw_baro_bosch_stop()

METAWEAR_API void mbl_mw_baro_bosch_stop ( const MblMwMetaWearBoard board)

Stop pressure and altitude sensing.

Parameters
boardPointer to the board to send the command to

◆ mbl_mw_baro_bosch_write_config()

METAWEAR_API void mbl_mw_baro_bosch_write_config ( const MblMwMetaWearBoard board)

Writes the configuration to the sensor Applies the STANDBY, IIR and OVERSAMPLING values set in set_standbytime(), set_oversampling(), and set_iir_filter().

Parameters
boardPointer to the board to send the command to