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#
Functions#
Initialize the barometric pressure sensor chip.
De-initialize the barometric pressure module.
Set the barometric pressure sensor configuration.
Get the barometric pressure sensor configuration.
Initiate temperature measurement on the barometric pressure sensor and read temperature from it.
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2cspm_t * | [in] | i2cspm | The I2CSPM instance to use. |
sl_bmp3xx_deinit#
void sl_bmp3xx_deinit (sl_i2cspm_t * i2cspm)
De-initialize the barometric pressure module.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2cspm_t * | [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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2cspm_t * | [in] | i2cspm | The I2CSPM instance to use. |
sl_bmp3xx_config_t * | [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.
sl_bmp3xx_get_config#
void sl_bmp3xx_get_config (sl_i2cspm_t * i2cspm, sl_bmp3xx_config_t * cfg)
Get the barometric pressure sensor configuration.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2cspm_t * | [in] | i2cspm | The I2CSPM instance to use. |
sl_bmp3xx_config_t * | [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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2cspm_t * | [in] | i2cspm | The I2CSPM instance to use. |
float * | [out] | temperature | The measured temperature in degrees Celsius |
It is a blocking function.
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2cspm_t * | [in] | i2cspm | The I2CSPM instance to use. |
float * | [out] | pressure | The measured pressure in Pascal. |
It is a blocking function.