XDK API  3.6.0
Documentation
Functions | Variables
bmp280.c File Reference
#include "bmp280.h"
+ Include dependency graph for bmp280.c:

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. Softreset 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_tp_bmp280
 

Function Documentation

double bmp280_compensate_pressure_double ( s32  v_uncomp_pressure_s32)
Note
Output value of "96386.2" equals 96386.2 Pa = 963.862 hPa.
Parameters
v_uncomp_pressure_s32: value of uncompensated pressure
Returns
Actual pressure in floating point
u32 bmp280_compensate_pressure_int32 ( s32  v_uncomp_pressure_s32)
Note
Output value of "96386" equals 96386 Pa = 963.86 hPa = 963.86 millibar
Parameters
v_uncomp_pressure_s32value of uncompensated pressure
Returns
Returns the Actual pressure out put as s32

+ Here is the caller graph for this function:

u32 bmp280_compensate_pressure_int64 ( s32  v_uncomp_pressure_s32)
Note
returns the value in Pa as unsigned 32 bit integer in Q24.8 format (24 integer bits and 8 fractional bits). Output value of "24674867" represents 24674867 / 256 = 96386.2 Pa = 963.862 hPa
Parameters
v_uncomp_pressure_s32: value of uncompensated pressure
Returns
actual pressure as 64bit output
double bmp280_compensate_temperature_double ( s32  v_uncomp_temperature_s32)
Note
Returns the value in Degree centigrade
Output value of "51.23" equals 51.23 DegC.
Parameters
v_uncomp_temperature_s32: value of uncompensated temperature
Returns
Actual temperature in floating point
s32 bmp280_compensate_temperature_int32 ( s32  v_uncomp_temperature_s32)
Note
Returns the value in 0.01 degree Centigrade
Output value of "5123" equals 51.23 DegC.
Parameters
v_uncomp_temperature_s32: value of uncompensated temperature
Returns
Actual temperature output as s32

+ Here is the caller graph for this function:

BMP280_RETURN_FUNCTION_TYPE bmp280_compute_wait_time ( u8 v_delaytime_u8r)
Parameters
v_delaytime_u8rThe value of delay time
Returns
0

+ Here is the caller graph for this function:

BMP280_RETURN_FUNCTION_TYPE bmp280_get_calib_param ( void  )
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
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the caller graph for this function:

BMP280_RETURN_FUNCTION_TYPE bmp280_get_filter ( u8 v_value_u8)
Parameters
v_value_u8: The value of filter coefficient
value Filter coefficient
0x00 BMP280_FILTER_COEFF_OFF
0x01 BMP280_FILTER_COEFF_2
0x02 BMP280_FILTER_COEFF_4
0x03 BMP280_FILTER_COEFF_8
0x04 BMP280_FILTER_COEFF_16
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_get_forced_uncomp_pressure_temperature ( s32 v_uncomp_pressure_s32,
s32 v_uncomp_temperature_s32 
)
Parameters
v_uncomp_pressure_s32The value of uncompensated pressure.
v_uncomp_temperature_s32The value of uncompensated temperature
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the call graph for this function:

BMP280_RETURN_FUNCTION_TYPE bmp280_get_oversamp_pressure ( u8 v_value_u8)
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
Parameters
v_value_u8: The value of pressure over sampling
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_get_oversamp_temperature ( u8 v_value_u8)
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
Parameters
v_value_u8:The value of temperature over sampling
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_get_power_mode ( u8 v_power_mode_u8)
Parameters
v_power_mode_u8: The value of power mode value
value Power mode
0x00 BMP280_SLEEP_MODE
0x01 and 0x02 BMP280_FORCED_MODE
0x03 BMP280_NORMAL_MODE
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_get_spi3 ( u8 v_enable_disable_u8)
Parameters
v_enable_disable_u8: The spi3 enable or disable state
value Description
0 Disable
1 Enable
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_get_standby_durn ( u8 v_standby_durn_u8)
Parameters
v_standby_durn_u8: The standby duration time value.
value standby duration
0x00 BMP280_STANDBYTIME_1_MS
0x01 BMP280_STANDBYTIME_63_MS
0x02 BMP280_STANDBYTIME_125_MS
0x03 BMP280_STANDBYTIME_250_MS
0x04 BMP280_STANDBYTIME_500_MS
0x05 BMP280_STANDBYTIME_1000_MS
0x06 BMP280_STANDBYTIME_2000_MS
0x07 BMP280_STANDBYTIME_4000_MS
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_init ( struct bmp280_t bmp280)
Parameters
*bmp280structure pointer.
Note
While changing the parameter of the p_bmp280
consider the following point: Changing the reference value of the parameter will changes the local copy or local reference make sure your changes will not affect the reference value of the parameter (Better case don't change the reference value of the parameter)
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the call graph for this function:

BMP280_RETURN_FUNCTION_TYPE bmp280_read_pressure_temperature ( u32 v_pressure_u32,
s32 v_temperature_s32 
)
Parameters
v_pressure_u32: The value of compensated pressure.
v_temperature_s32: The value of compensated temperature.
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the call graph for this function:

BMP280_RETURN_FUNCTION_TYPE bmp280_read_register ( u8  v_addr_u8,
u8 v_data_u8,
u8  v_len_u8 
)
Parameters
v_addr_u8-> Address of the register
v_data_u8-> The data from the register
v_len_u8-> no of bytes to read
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_read_uncomp_pressure ( s32 v_uncomp_pressure_s32)
Note
0xF7 -> MSB -> bit from 0 to 7
0xF8 -> LSB -> bit from 0 to 7
0xF9 -> LSB -> bit from 4 to 7
Parameters
v_uncomp_pressure_s32: The value of uncompensated pressure
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_read_uncomp_pressure_temperature ( s32 v_uncomp_pressure_s32,
s32 v_uncomp_temperature_s32 
)
Parameters
v_uncomp_pressure_s32The value of uncompensated pressure.
v_uncomp_temperature_s32The value of uncompensated temperature.
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the caller graph for this function:

BMP280_RETURN_FUNCTION_TYPE bmp280_read_uncomp_temperature ( s32 v_uncomp_temperature_s32)
Note
0xFA -> MSB -> bit from 0 to 7
0xFB -> LSB -> bit from 0 to 7
0xFC -> LSB -> bit from 4 to 7
Parameters
v_uncomp_temperature_s32: The uncompensated temperature.
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_set_filter ( u8  v_value_u8)
Parameters
v_value_u8: The value of filter coefficient
value Filter coefficient
0x00 BMP280_FILTER_COEFF_OFF
0x01 BMP280_FILTER_COEFF_2
0x02 BMP280_FILTER_COEFF_4
0x03 BMP280_FILTER_COEFF_8
0x04 BMP280_FILTER_COEFF_16
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_set_oversamp_pressure ( u8  v_value_u8)
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
Parameters
v_value_u8: The value of pressure over sampling
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_set_oversamp_temperature ( u8  v_value_u8)
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
Parameters
v_value_u8:The value of temperature over sampling
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_set_power_mode ( u8  v_power_mode_u8)
Parameters
v_power_mode_u8: The value of power mode value
value Power mode
0x00 BMP280_SLEEP_MODE
0x01 and 0x02 BMP280_FORCED_MODE
0x03 BMP280_NORMAL_MODE
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_set_soft_rst ( void  )
Note
Usage Hint : bmp280_set_softreset()
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_set_spi3 ( u8  v_enable_disable_u8)
Parameters
v_enable_disable_u8: The spi3 enable or disable state
value Description
0 Disable
1 Enable
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_set_standby_durn ( u8  v_standby_durn_u8)
Note
Normal mode comprises an automated perpetual cycling between an (active) Measurement period and an (inactive) standby period.
The standby time is determined by the contents of the register t_sb. Standby time can be set using BMP280_STANDBYTIME_125_MS.
bme280_set_standby_durN(BMP280_STANDBYTIME_125_MS)
Parameters
v_standby_durn_u8: The standby duration time value.
value standby duration
0x00 BMP280_STANDBYTIME_1_MS
0x01 BMP280_STANDBYTIME_63_MS
0x02 BMP280_STANDBYTIME_125_MS
0x03 BMP280_STANDBYTIME_250_MS
0x04 BMP280_STANDBYTIME_500_MS
0x05 BMP280_STANDBYTIME_1000_MS
0x06 BMP280_STANDBYTIME_2000_MS
0x07 BMP280_STANDBYTIME_4000_MS
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_set_work_mode ( u8  v_work_mode_u8)
Parameters
v_work_mode_u8: The value of work mode
value mode
0 BMP280_ULTRA_LOW_POWER_MODE
1 BMP280_LOW_POWER_MODE
2 BMP280_STANDARD_RESOLUTION_MODE
3 BMP280_HIGH_RESOLUTION_MODE
4 BMP280_ULTRA_HIGH_RESOLUTION_MODE
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP280_RETURN_FUNCTION_TYPE bmp280_write_register ( u8  v_addr_u8,
u8 v_data_u8,
u8  v_len_u8 
)
Parameters
v_addr_u8-> Address of the register
v_data_u8-> The data from the register
v_len_u8-> no of bytes to read
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

Variable Documentation

struct bmp280_t* p_bmp280
static

pointer to BMP280


All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:43 by doxygen 1.8.8