BMP3xx - Barometric Pressure Sensor#

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;
    }

    ...

  } 

Modules#

sl_bmp3xx_config_t

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.


Definition at line 128 of file hardware/driver/bmp3xx/inc/sl_bmp3xx.h

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.


Definition at line 137 of file hardware/driver/bmp3xx/inc/sl_bmp3xx.h

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.


Definition at line 156 of file hardware/driver/bmp3xx/inc/sl_bmp3xx.h

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.


Definition at line 168 of file hardware/driver/bmp3xx/inc/sl_bmp3xx.h

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.

Parameters
[in]i2cspm

The I2CSPM instance to use.

[out]temperature

The measured temperature in degrees Celsius

It is a blocking function.


Definition at line 184 of file hardware/driver/bmp3xx/inc/sl_bmp3xx.h

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.

Parameters
[in]i2cspm

The I2CSPM instance to use.

[out]pressure

The measured pressure in Pascal.

It is a blocking function.


Definition at line 200 of file hardware/driver/bmp3xx/inc/sl_bmp3xx.h