BMP3xx - Barometric Pressure Sensor

Description

Driver for the Bosch Sensortec BMP3xx barometric pressure sensor.


BMP3xx example

Basic example to perform pressure measurement:

#include "sl_i2cspm_instances.h"
#include "sl_bmp3xx.h"

  int main( void )
  {

    ...

    float pressure;
    int8_t result;

    result = sl_bmp3xx_init(sl_i2cspm_sensor_env);

    if (result != SL_STATUS_OK) {
      return SL_STATUS_FAIL;
    }

    result = sl_bmp3xx_measure_pressure(sl_i2cspm_sensor_env, &pressure);

    if (result != SL_STATUS_OK) {
      return SL_STATUS_FAIL;
    }

    ...

  } 

Data Structures

struct  sl_bmp3xx_config
 BMP3xx device configuration structure.
 

Functions

sl_status_t sl_bmp3xx_init (sl_i2cspm_t *i2cspm)
 Initialize the barometric pressure sensor chip.
 
void sl_bmp3xx_deinit (sl_i2cspm_t *i2cspm)
 De-initialize the barometric pressure module.
 
sl_status_t sl_bmp3xx_set_config (sl_i2cspm_t *i2cspm, sl_bmp3xx_config_t *cfg)
 Set the barometric pressure sensor configuration.
 
void sl_bmp3xx_get_config (sl_i2cspm_t *i2cspm, sl_bmp3xx_config_t *cfg)
 Get the barometric pressure sensor configuration.
 
sl_status_t sl_bmp3xx_measure_temperature (sl_i2cspm_t *i2cspm, float *temperature)
 Initiate temperature measurement on the barometric pressure sensor and read temperature from it.
 
sl_status_t sl_bmp3xx_measure_pressure (sl_i2cspm_t *i2cspm, float *pressure)
 Initiate pressure measurement on the barometric pressure sensor and read pressure from it.
 

Function Documentation

◆ sl_bmp3xx_init()

sl_status_t sl_bmp3xx_init ( sl_i2cspm_t *  i2cspm)

Initialize the barometric pressure sensor chip.

Parameters
[in]i2cspmThe I2CSPM instance to use.
Return values
SL_STATUS_OKSuccess
SL_STATUS_FAILInitialization failed

◆ sl_bmp3xx_deinit()

void sl_bmp3xx_deinit ( sl_i2cspm_t *  i2cspm)

De-initialize the barometric pressure module.

Parameters
[in]i2cspmThe I2CSPM instance to use.

◆ sl_bmp3xx_set_config()

sl_status_t sl_bmp3xx_set_config ( sl_i2cspm_t *  i2cspm,
sl_bmp3xx_config_t *  cfg 
)

Set the barometric pressure sensor configuration.

Parameters
[in]i2cspmThe I2CSPM instance to use.
[in]cfgStructure, which holds the configuration parameters
Note
Make sure to pass by Sleep Mode before switching between forced mode and normal mode. Refer to datasheet for more details.
Return values
SL_STATUS_OKSuccess
SL_STATUS_FAILSensor configuration failed

◆ sl_bmp3xx_get_config()

void sl_bmp3xx_get_config ( sl_i2cspm_t *  i2cspm,
sl_bmp3xx_config_t *  cfg 
)

Get the barometric pressure sensor configuration.

Parameters
[in]i2cspmThe I2CSPM instance to use.
[out]cfgStructure to get the sensor configuration.

◆ sl_bmp3xx_measure_temperature()

sl_status_t sl_bmp3xx_measure_temperature ( sl_i2cspm_t *  i2cspm,
float *  temperature 
)

Initiate temperature measurement on the barometric pressure sensor and read temperature from it.

It is a blocking function.

Parameters
[in]i2cspmThe I2CSPM instance to use.
[out]temperatureThe measured temperature in degrees Celsius
Return values
SL_STATUS_OKSuccess
SL_STATUS_FAILFailure during temperature measurement/read

◆ sl_bmp3xx_measure_pressure()

sl_status_t sl_bmp3xx_measure_pressure ( sl_i2cspm_t *  i2cspm,
float *  pressure 
)

Initiate pressure measurement on the barometric pressure sensor and read pressure from it.

It is a blocking function.

Parameters
[in]i2cspmThe I2CSPM instance to use.
[out]pressureThe measured pressure in Pascal.
Return values
SL_STATUS_OKSuccess
SL_STATUS_FAILFailure during pressure measurement/read