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] i2cspm The I2CSPM instance to use.
Return values
SL_STATUS_OK Success
SL_STATUS_FAIL Initialization failed

sl_bmp3xx_deinit()

void sl_bmp3xx_deinit ( sl_i2cspm_t * i2cspm )

De-initialize the barometric pressure module.

Parameters
[in] i2cspm The 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] i2cspm The I2CSPM instance to use.
[in] cfg Structure, 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_OK Success
SL_STATUS_FAIL Sensor 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] i2cspm The I2CSPM instance to use.
[out] cfg Structure 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] i2cspm The I2CSPM instance to use.
[out] temperature The measured temperature in degrees Celsius
Return values
SL_STATUS_OK Success
SL_STATUS_FAIL Failure 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] i2cspm The I2CSPM instance to use.
[out] pressure The measured pressure in Pascal.
Return values
SL_STATUS_OK Success
SL_STATUS_FAIL Failure during pressure measurement/read