EFM32 Happy Gecko Software Documentation
efm32hg-doc-5.1.2
|
BMP280 Sensor Driver.
Definition in file bmp280.c.
#include "bmp280.h"
Go to the source code of this file.
Functions | |
double | bmp280_compensate_pressure_double (s32 v_uncomp_pressure_s32) |
Reads actual pressure from uncompensated pressure and returns pressure in Pa as double. More... | |
u32 | bmp280_compensate_pressure_int32 (s32 v_uncomp_pressure_s32) |
Reads actual pressure from uncompensated pressure and returns the value in Pascal(Pa) More... | |
u32 | bmp280_compensate_pressure_int64 (s32 v_uncomp_pressure_s32) |
This API used to read actual pressure from uncompensated pressure. More... | |
double | bmp280_compensate_temperature_double (s32 v_uncomp_temperature_s32) |
This API used to read actual temperature from uncompensated temperature. More... | |
s32 | bmp280_compensate_temperature_int32 (s32 v_uncomp_temperature_s32) |
Reads actual temperature from uncompensated temperature. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_compute_wait_time (u8 *v_delaytime_u8r) |
Computing waiting time for sensor data read. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_get_calib_param (void) |
This API is used to calibration parameters used for calculation in the registers. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_get_filter (u8 *v_value_u8) |
This API is used to reads filter setting in the register 0xF5 bit 3 and 4. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_get_forced_uncomp_pressure_temperature (s32 *v_uncomp_pressure_s32, s32 *v_uncomp_temperature_s32) |
This API used to read both uncompensated pressure and temperature in forced mode. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_get_oversamp_pressure (u8 *v_value_u8) |
This API is used to get the pressure oversampling setting in the register 0xF4 bits from 2 to 4. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_get_oversamp_temperature (u8 *v_value_u8) |
This API is used to get the temperature oversampling setting in the register 0xF4 bits from 5 to 7. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_get_power_mode (u8 *v_power_mode_u8) |
This API used to get the Operational Mode from the sensor in the register 0xF4 bit 0 and 1. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_get_spi3 (u8 *v_enable_disable_u8) |
This API used to get the sensor SPI mode(communication type) in the register 0xF5 bit 0. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_get_standby_durn (u8 *v_standby_durn_u8) |
This API used to Read the standby duration time from the sensor in the register 0xF5 bit 5 to 7. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_init (struct bmp280_t *bmp280) |
This function is used for initialize the bus read and bus write functions and assign the chip id and I2C address of the BMP280 sensor chip id is read in the register 0xD0 bit from 0 to 7. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_read_pressure_temperature (u32 *v_pressure_u32, s32 *v_temperature_s32) |
This API reads the true pressure and temperature. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_read_register (u8 v_addr_u8, u8 *v_data_u8, u8 v_len_u8) |
This API reads the data from the given register. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_read_uncomp_pressure (s32 *v_uncomp_pressure_s32) |
This API is used to read uncompensated pressure. in the registers 0xF7, 0xF8 and 0xF9. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_read_uncomp_pressure_temperature (s32 *v_uncomp_pressure_s32, s32 *v_uncomp_temperature_s32) |
reads uncompensated pressure and temperature More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_read_uncomp_temperature (s32 *v_uncomp_temperature_s32) |
This API is used to read uncompensated temperature in the registers 0xFA, 0xFB and 0xFC. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_set_filter (u8 v_value_u8) |
This API is used to write filter setting in the register 0xF5 bit 3 and 4. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_set_oversamp_pressure (u8 v_value_u8) |
This API is used to set the pressure oversampling setting in the register 0xF4 bits from 2 to 4. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_set_oversamp_temperature (u8 v_value_u8) |
This API is used to set the temperature oversampling setting in the register 0xF4 bits from 5 to 7. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_set_power_mode (u8 v_power_mode_u8) |
This API used to set the Operational Mode from the sensor in the register 0xF4 bit 0 and 1. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_set_soft_rst (void) |
Used to reset the sensor The value 0xB6 is written to the 0xE0 register the device is reset using the complete power-on-reset procedure. Soft reset can be easily set using bmp280_set_softreset(). More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_set_spi3 (u8 v_enable_disable_u8) |
This API used to set the sensor SPI mode(communication type) in the register 0xF5 bit 0. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_set_standby_durn (u8 v_standby_durn_u8) |
This API used to Read the standby duration time from the sensor in the register 0xF5 bit 5 to 7. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_set_work_mode (u8 v_work_mode_u8) |
This API is used to write the working mode of the sensor. More... | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_write_register (u8 v_addr_u8, u8 *v_data_u8, u8 v_len_u8) |
This API write the data to the given register. More... | |
Variables | |
static struct bmp280_t * | p_bmp280 |
double bmp280_compensate_pressure_double | ( | s32 | v_uncomp_pressure_s32 | ) |
Reads actual pressure from uncompensated pressure and returns pressure in Pa as double.
v_uncomp_pressure_s32 | : value of uncompensated pressure |
Definition at line 1381 of file bmp280.c.
References bmp280_t::calib_param, bmp280_calib_param_t::dig_P1, bmp280_calib_param_t::dig_P2, bmp280_calib_param_t::dig_P3, bmp280_calib_param_t::dig_P4, bmp280_calib_param_t::dig_P5, bmp280_calib_param_t::dig_P6, bmp280_calib_param_t::dig_P7, bmp280_calib_param_t::dig_P8, bmp280_calib_param_t::dig_P9, and bmp280_calib_param_t::t_fine.
Reads actual pressure from uncompensated pressure and returns the value in Pascal(Pa)
v_uncomp_pressure_s32 | value of uncompensated pressure |
Definition at line 280 of file bmp280.c.
References bmp280_t::calib_param, bmp280_calib_param_t::dig_P1, bmp280_calib_param_t::dig_P2, bmp280_calib_param_t::dig_P3, bmp280_calib_param_t::dig_P4, bmp280_calib_param_t::dig_P5, bmp280_calib_param_t::dig_P6, bmp280_calib_param_t::dig_P7, bmp280_calib_param_t::dig_P8, bmp280_calib_param_t::dig_P9, and bmp280_calib_param_t::t_fine.
Referenced by bmp280_read_pressure_temperature().
This API used to read actual pressure from uncompensated pressure.
v_uncomp_pressure_s32 | : value of uncompensated pressure |
Definition at line 1432 of file bmp280.c.
References bmp280_t::calib_param, bmp280_calib_param_t::dig_P1, bmp280_calib_param_t::dig_P2, bmp280_calib_param_t::dig_P3, bmp280_calib_param_t::dig_P4, bmp280_calib_param_t::dig_P5, bmp280_calib_param_t::dig_P6, bmp280_calib_param_t::dig_P7, bmp280_calib_param_t::dig_P8, bmp280_calib_param_t::dig_P9, and bmp280_calib_param_t::t_fine.
Referenced by BMP_getPressure().
double bmp280_compensate_temperature_double | ( | s32 | v_uncomp_temperature_s32 | ) |
This API used to read actual temperature from uncompensated temperature.
v_uncomp_temperature_s32 | : value of uncompensated temperature |
Definition at line 1343 of file bmp280.c.
References bmp280_t::calib_param, bmp280_calib_param_t::dig_T1, bmp280_calib_param_t::dig_T2, bmp280_calib_param_t::dig_T3, and bmp280_calib_param_t::t_fine.
Reads actual temperature from uncompensated temperature.
v_uncomp_temperature_s32 | : value of uncompensated temperature |
Definition at line 185 of file bmp280.c.
References bmp280_t::calib_param, bmp280_calib_param_t::dig_T1, bmp280_calib_param_t::dig_T2, bmp280_calib_param_t::dig_T3, and bmp280_calib_param_t::t_fine.
Referenced by bmp280_read_pressure_temperature(), BMP_getPressure(), and BMP_getTemperature().
BMP280_RETURN_FUNCTION_TYPE bmp280_compute_wait_time | ( | u8 * | v_delaytime_u8r | ) |
Computing waiting time for sensor data read.
v_delaytime_u8r | The value of delay time |
Definition at line 1495 of file bmp280.c.
References bmp280_t::oversamp_pressure, and bmp280_t::oversamp_temperature.
Referenced by bmp280_get_forced_uncomp_pressure_temperature().
BMP280_RETURN_FUNCTION_TYPE bmp280_get_calib_param | ( | void | ) |
This API is used to calibration parameters used for calculation in the registers.
parameter | Register address | bit |
---|---|---|
dig_T1 | 0x88 and 0x89 | from 0 : 7 to 8: 15 |
dig_T2 | 0x8A and 0x8B | from 0 : 7 to 8: 15 |
dig_T3 | 0x8C and 0x8D | from 0 : 7 to 8: 15 |
dig_P1 | 0x8E and 0x8F | from 0 : 7 to 8: 15 |
dig_P2 | 0x90 and 0x91 | from 0 : 7 to 8: 15 |
dig_P3 | 0x92 and 0x93 | from 0 : 7 to 8: 15 |
dig_P4 | 0x94 and 0x95 | from 0 : 7 to 8: 15 |
dig_P5 | 0x96 and 0x97 | from 0 : 7 to 8: 15 |
dig_P6 | 0x98 and 0x99 | from 0 : 7 to 8: 15 |
dig_P7 | 0x9A and 0x9B | from 0 : 7 to 8: 15 |
dig_P8 | 0x9C and 0x9D | from 0 : 7 to 8: 15 |
dig_P9 | 0x9E and 0x9F | from 0 : 7 to 8: 15 |
0 | -> Success |
-1 | -> Error |
Definition at line 473 of file bmp280.c.
References bmp280_t::calib_param, bmp280_t::dev_addr, bmp280_calib_param_t::dig_P1, bmp280_calib_param_t::dig_P2, bmp280_calib_param_t::dig_P3, bmp280_calib_param_t::dig_P4, bmp280_calib_param_t::dig_P5, bmp280_calib_param_t::dig_P6, bmp280_calib_param_t::dig_P7, bmp280_calib_param_t::dig_P8, bmp280_calib_param_t::dig_P9, bmp280_calib_param_t::dig_T1, bmp280_calib_param_t::dig_T2, and bmp280_calib_param_t::dig_T3.
Referenced by bmp280_init().
BMP280_RETURN_FUNCTION_TYPE bmp280_get_filter | ( | u8 * | v_value_u8 | ) |
This API is used to reads filter setting in the register 0xF5 bit 3 and 4.
v_value_u8 | : The value of filter coefficient
|
0 | -> Success |
-1 | -> Error |
Definition at line 971 of file bmp280.c.
References bmp280_t::dev_addr.
BMP280_RETURN_FUNCTION_TYPE bmp280_get_forced_uncomp_pressure_temperature | ( | s32 * | v_uncomp_pressure_s32, |
s32 * | v_uncomp_temperature_s32 | ||
) |
This API used to read both uncompensated pressure and temperature in forced mode.
v_uncomp_pressure_s32 | The value of uncompensated pressure. |
v_uncomp_temperature_s32 | The value of uncompensated temperature |
0 | -> Success |
-1 | -> Error |
Definition at line 1236 of file bmp280.c.
References bmp280_compute_wait_time(), bmp280_read_uncomp_pressure_temperature(), bmp280_t::delay_msec, bmp280_t::dev_addr, bmp280_t::oversamp_pressure, and bmp280_t::oversamp_temperature.
Referenced by BMP_getPressure(), and BMP_getTemperature().
BMP280_RETURN_FUNCTION_TYPE bmp280_get_oversamp_pressure | ( | u8 * | v_value_u8 | ) |
This API is used to get the pressure oversampling setting in the register 0xF4 bits from 2 to 4.
value | Pressure oversampling |
---|---|
0x00 | BMP280_OVERSAMP_SKIPPED |
0x01 | BMP280_OVERSAMP_1X |
0x02 | BMP280_OVERSAMP_2X |
0x03 | BMP280_OVERSAMP_4X |
0x04 | BMP280_OVERSAMP_8X |
0x05,0x06 and 0x07 | BMP280_OVERSAMP_16X |
v_value_u8 | : The value of pressure over sampling |
0 | -> Success |
-1 | -> Error |
Definition at line 680 of file bmp280.c.
References bmp280_t::dev_addr, and bmp280_t::oversamp_pressure.
BMP280_RETURN_FUNCTION_TYPE bmp280_get_oversamp_temperature | ( | u8 * | v_value_u8 | ) |
This API is used to get the temperature oversampling setting in the register 0xF4 bits from 5 to 7.
value | Temperature oversampling |
---|---|
0x00 | BMP280_OVERSAMP_SKIPPED |
0x01 | BMP280_OVERSAMP_1X |
0x02 | BMP280_OVERSAMP_2X |
0x03 | BMP280_OVERSAMP_4X |
0x04 | BMP280_OVERSAMP_8X |
0x05,0x06 and 0x07 | BMP280_OVERSAMP_16X |
v_value_u8 | :The value of temperature over sampling |
0 | -> Success |
-1 | -> Error |
Definition at line 583 of file bmp280.c.
References bmp280_t::dev_addr, and bmp280_t::oversamp_temperature.
BMP280_RETURN_FUNCTION_TYPE bmp280_get_power_mode | ( | u8 * | v_power_mode_u8 | ) |
This API used to get the Operational Mode from the sensor in the register 0xF4 bit 0 and 1.
v_power_mode_u8 | : The value of power mode value
|
0 | -> Success |
-1 | -> Error |
Definition at line 772 of file bmp280.c.
References bmp280_t::dev_addr.
BMP280_RETURN_FUNCTION_TYPE bmp280_get_spi3 | ( | u8 * | v_enable_disable_u8 | ) |
This API used to get the sensor SPI mode(communication type) in the register 0xF5 bit 0.
v_enable_disable_u8 | : The spi3 enable or disable state
|
0 | -> Success |
-1 | -> Error |
Definition at line 888 of file bmp280.c.
References bmp280_t::dev_addr.
BMP280_RETURN_FUNCTION_TYPE bmp280_get_standby_durn | ( | u8 * | v_standby_durn_u8 | ) |
This API used to Read the standby duration time from the sensor in the register 0xF5 bit 5 to 7.
v_standby_durn_u8 | : The standby duration time value.
|
0 | -> Success |
-1 | -> Error |
Definition at line 1058 of file bmp280.c.
References bmp280_t::dev_addr.
BMP280_RETURN_FUNCTION_TYPE bmp280_init | ( | struct bmp280_t * | bmp280 | ) |
This function is used for initialize the bus read and bus write functions and assign the chip id and I2C address of the BMP280 sensor chip id is read in the register 0xD0 bit from 0 to 7.
*bmp280 | structure pointer. |
0 | -> Success |
-1 | -> Error |
Definition at line 85 of file bmp280.c.
References bmp280_get_calib_param(), bmp280_t::chip_id, bmp280_t::delay_msec, and bmp280_t::dev_addr.
Referenced by BMP_init().
BMP280_RETURN_FUNCTION_TYPE bmp280_read_pressure_temperature | ( | u32 * | v_pressure_u32, |
s32 * | v_temperature_s32 | ||
) |
This API reads the true pressure and temperature.
v_pressure_u32 | : The value of compensated pressure. |
v_temperature_s32 | : The value of compensated temperature. |
0 | -> Success |
-1 | -> Error |
Definition at line 425 of file bmp280.c.
References bmp280_compensate_pressure_int32(), bmp280_compensate_temperature_int32(), and bmp280_read_uncomp_pressure_temperature().
This API reads the data from the given register.
v_addr_u8 | -> Address of the register |
v_data_u8 | -> The data from the register |
v_len_u8 | -> no of bytes to read |
0 | -> Success |
-1 | -> Error |
Definition at line 1312 of file bmp280.c.
References bmp280_t::dev_addr.
BMP280_RETURN_FUNCTION_TYPE bmp280_read_uncomp_pressure | ( | s32 * | v_uncomp_pressure_s32 | ) |
This API is used to read uncompensated pressure. in the registers 0xF7, 0xF8 and 0xF9.
v_uncomp_pressure_s32 | : The value of uncompensated pressure |
0 | -> Success |
-1 | -> Error |
Definition at line 235 of file bmp280.c.
References bmp280_t::dev_addr.
Referenced by BMP_getPressure().
BMP280_RETURN_FUNCTION_TYPE bmp280_read_uncomp_pressure_temperature | ( | s32 * | v_uncomp_pressure_s32, |
s32 * | v_uncomp_temperature_s32 | ||
) |
reads uncompensated pressure and temperature
v_uncomp_pressure_s32 | The value of uncompensated pressure. |
v_uncomp_temperature_s32 | The value of uncompensated temperature. |
0 | -> Success |
-1 | -> Error |
Definition at line 364 of file bmp280.c.
References bmp280_t::dev_addr.
Referenced by bmp280_get_forced_uncomp_pressure_temperature(), and bmp280_read_pressure_temperature().
BMP280_RETURN_FUNCTION_TYPE bmp280_read_uncomp_temperature | ( | s32 * | v_uncomp_temperature_s32 | ) |
This API is used to read uncompensated temperature in the registers 0xFA, 0xFB and 0xFC.
v_uncomp_temperature_s32 | : The uncompensated temperature. |
0 | -> Success |
-1 | -> Error |
Definition at line 139 of file bmp280.c.
References bmp280_t::dev_addr.
Referenced by BMP_getPressure(), and BMP_getTemperature().
BMP280_RETURN_FUNCTION_TYPE bmp280_set_filter | ( | u8 | v_value_u8 | ) |
This API is used to write filter setting in the register 0xF5 bit 3 and 4.
v_value_u8 | : The value of filter coefficient
|
0 | -> Success |
-1 | -> Error |
Definition at line 1010 of file bmp280.c.
References bmp280_t::dev_addr.
BMP280_RETURN_FUNCTION_TYPE bmp280_set_oversamp_pressure | ( | u8 | v_value_u8 | ) |
This API is used to set the pressure oversampling setting in the register 0xF4 bits from 2 to 4.
value | Pressure oversampling |
---|---|
0x00 | BMP280_OVERSAMP_SKIPPED |
0x01 | BMP280_OVERSAMP_1X |
0x02 | BMP280_OVERSAMP_2X |
0x03 | BMP280_OVERSAMP_4X |
0x04 | BMP280_OVERSAMP_8X |
0x05,0x06 and 0x07 | BMP280_OVERSAMP_16X |
v_value_u8 | : The value of pressure over sampling |
0 | -> Success |
-1 | -> Error |
Definition at line 725 of file bmp280.c.
References bmp280_t::dev_addr, and bmp280_t::oversamp_pressure.
BMP280_RETURN_FUNCTION_TYPE bmp280_set_oversamp_temperature | ( | u8 | v_value_u8 | ) |
This API is used to set the temperature oversampling setting in the register 0xF4 bits from 5 to 7.
value | Temperature oversampling |
---|---|
0x00 | BMP280_OVERSAMP_SKIPPED |
0x01 | BMP280_OVERSAMP_1X |
0x02 | BMP280_OVERSAMP_2X |
0x03 | BMP280_OVERSAMP_4X |
0x04 | BMP280_OVERSAMP_8X |
0x05,0x06 and 0x07 | BMP280_OVERSAMP_16X |
v_value_u8 | :The value of temperature over sampling |
0 | -> Success |
-1 | -> Error |
Definition at line 628 of file bmp280.c.
References bmp280_t::dev_addr, and bmp280_t::oversamp_temperature.
BMP280_RETURN_FUNCTION_TYPE bmp280_set_power_mode | ( | u8 | v_power_mode_u8 | ) |
This API used to set the Operational Mode from the sensor in the register 0xF4 bit 0 and 1.
v_power_mode_u8 | : The value of power mode value
|
0 | -> Success |
-1 | -> Error |
Definition at line 809 of file bmp280.c.
References bmp280_t::dev_addr, bmp280_t::oversamp_pressure, and bmp280_t::oversamp_temperature.
Referenced by BMP_config(), BMP_deInit(), and BMP_init().
BMP280_RETURN_FUNCTION_TYPE bmp280_set_soft_rst | ( | void | ) |
Used to reset the sensor The value 0xB6 is written to the 0xE0 register the device is reset using the complete power-on-reset procedure. Soft reset can be easily set using bmp280_set_softreset().
0 | -> Success |
-1 | -> Error |
Definition at line 852 of file bmp280.c.
References bmp280_t::dev_addr.
BMP280_RETURN_FUNCTION_TYPE bmp280_set_spi3 | ( | u8 | v_enable_disable_u8 | ) |
This API used to set the sensor SPI mode(communication type) in the register 0xF5 bit 0.
v_enable_disable_u8 | : The spi3 enable or disable state
|
0 | -> Success |
-1 | -> Error |
Definition at line 925 of file bmp280.c.
References bmp280_t::dev_addr.
BMP280_RETURN_FUNCTION_TYPE bmp280_set_standby_durn | ( | u8 | v_standby_durn_u8 | ) |
This API used to Read the standby duration time from the sensor in the register 0xF5 bit 5 to 7.
v_standby_durn_u8 | : The standby duration time value.
|
0 | -> Success |
-1 | -> Error |
Definition at line 1111 of file bmp280.c.
References bmp280_t::dev_addr.
Referenced by BMP_config().
BMP280_RETURN_FUNCTION_TYPE bmp280_set_work_mode | ( | u8 | v_work_mode_u8 | ) |
This API is used to write the working mode of the sensor.
v_work_mode_u8 | : The value of work mode
|
0 | -> Success |
-1 | -> Error |
Definition at line 1157 of file bmp280.c.
References bmp280_t::dev_addr, bmp280_t::oversamp_pressure, and bmp280_t::oversamp_temperature.
Referenced by BMP_config(), and BMP_init().
This API write the data to the given register.
v_addr_u8 | -> Address of the register |
v_data_u8 | -> The data from the register |
v_len_u8 | -> no of bytes to read |
0 | -> Success |
-1 | -> Error |
Definition at line 1281 of file bmp280.c.
References bmp280_t::dev_addr.