XDK API  3.6.0
Documentation
Data Structures | Macros | Typedefs
bme280.h File Reference

BME280 Sensor Driver Support Header File. More...

+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  bme280_calibration_param_t
 This structure holds all device specific calibration parameters. More...
 
struct  bme280_t
 This structure holds BME280 initialization parameters. More...
 

Macros

#define BME280_64BITSUPPORT_PRESENT
 
#define MACHINE_32_BIT
 The following definition uses for define the data types. More...
 
ENABLE FLOATING OUTPUT
#define BME280_ENABLE_FLOAT
 If the user wants to support floating point calculations, please set the following define. If floating point calculation is not wanted or allowed (e.g. in Linux kernel), please do not set the define. More...
 
#define BME280_ENABLE_INT64
 If the user wants to support 64 bit integer calculation (needed for optimal pressure accuracy) please set the following define. If int64 calculation is not wanted (e.g. because it would include large libraries), please do not set the define. More...
 
BUS READ AND WRITE FUNCTION POINTERS
#define BME280_BUS_WR_RETURN_TYPE   s8
 Define the calling convention of YOUR bus communication routine. More...
 
#define BME280_BUS_WR_PARAM_TYPES
 
#define BME280_BUS_WR_PARAM_ORDER(device_addr, register_addr, register_data, wr_len)
 
#define BME280_BUS_WRITE_FUNC(device_addr, register_addr, register_data, wr_len)
 
#define BME280_BUS_RD_RETURN_TYPE   s8
 link macro between API function calls and bus read function More...
 
#define BME280_BUS_RD_PARAM_TYPES
 defines the calling parameter types of the BME280_RD_FUNCTION More...
 
#define BME280_BUS_RD_PARAM_ORDER
 
#define BME280_BUS_READ_FUNC(device_addr, register_addr, register_data, rd_len)
 
#define BME280_WR_FUNC_PTR
 
#define BME280_RD_FUNC_PTR
 
#define BME280_MDELAY_DATA_TYPE   u32
 
#define BME280_3MS_DELAY   (3)
 
#define BME280_REGISTER_READ_DELAY   (1)
 
DELAY
#define BME280_DELAY_RETURN_TYPE   void
 
#define BME280_DELAY_PARAM_TYPES   u16
 
GET AND SET BITSLICE FUNCTIONS
#define BME280_DELAY_FUNC(delay_in_msec)   delay_func(delay_in_msec)
 
#define BME280_GET_BITSLICE(regvar, bitname)   ((regvar & bitname##__MSK) >> bitname##__POS)
 
#define BME280_SET_BITSLICE(regvar, bitname, val)   ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK))
 
COMMON USED CONSTANTS
#define BME280_NULL   (0)
 
#define BME280_RETURN_FUNCTION_TYPE   s8
 
#define BME280_SHIFT_BIT_POSITION_BY_01_BIT   (1)
 
#define BME280_SHIFT_BIT_POSITION_BY_02_BITS   (2)
 
#define BME280_SHIFT_BIT_POSITION_BY_03_BITS   (3)
 
#define BME280_SHIFT_BIT_POSITION_BY_04_BITS   (4)
 
#define BME280_SHIFT_BIT_POSITION_BY_07_BITS   (7)
 
#define BME280_SHIFT_BIT_POSITION_BY_08_BITS   (8)
 
#define BME280_SHIFT_BIT_POSITION_BY_10_BITS   (10)
 
#define BME280_SHIFT_BIT_POSITION_BY_11_BITS   (11)
 
#define BME280_SHIFT_BIT_POSITION_BY_12_BITS   (12)
 
#define BME280_SHIFT_BIT_POSITION_BY_13_BITS   (13)
 
#define BME280_SHIFT_BIT_POSITION_BY_14_BITS   (14)
 
#define BME280_SHIFT_BIT_POSITION_BY_15_BITS   (15)
 
#define BME280_SHIFT_BIT_POSITION_BY_16_BITS   (16)
 
#define BME280_SHIFT_BIT_POSITION_BY_17_BITS   (17)
 
#define BME280_SHIFT_BIT_POSITION_BY_18_BITS   (18)
 
#define BME280_SHIFT_BIT_POSITION_BY_19_BITS   (19)
 
#define BME280_SHIFT_BIT_POSITION_BY_20_BITS   (20)
 
#define BME280_SHIFT_BIT_POSITION_BY_25_BITS   (25)
 
#define BME280_SHIFT_BIT_POSITION_BY_31_BITS   (31)
 
#define BME280_SHIFT_BIT_POSITION_BY_33_BITS   (33)
 
#define BME280_SHIFT_BIT_POSITION_BY_35_BITS   (35)
 
#define BME280_SHIFT_BIT_POSITION_BY_47_BITS   (47)
 
#define BME280_PRESSURE_TEMPERATURE_CALIB_DATA_LENGTH   (26)
 
#define BME280_HUMIDITY_CALIB_DATA_LENGTH   (7)
 
#define BME280_GEN_READ_WRITE_DATA_LENGTH   (1)
 
#define BME280_HUMIDITY_DATA_LENGTH   (2)
 
#define BME280_TEMPERATURE_DATA_LENGTH   (3)
 
#define BME280_PRESSURE_DATA_LENGTH   (3)
 
#define BME280_ALL_DATA_FRAME_LENGTH   (8)
 
#define BME280_INIT_VALUE   (0)
 
#define BME280_CHIP_ID_READ_COUNT   (5)
 
#define BME280_INVALID_DATA   (0)
 
ERROR CODE DEFINITIONS
#define SUCCESS   ((u8)0)
 
#define E_BME280_NULL_PTR   ((s8)-127)
 
#define E_BME280_COMM_RES   ((s8)-1)
 
#define E_BME280_OUT_OF_RANGE   ((s8)-2)
 
#define ERROR   ((s8)-1)
 
#define BME280_CHIP_ID_READ_FAIL   ((s8)-1)
 
#define BME280_CHIP_ID_READ_SUCCESS   ((u8)0)
 
CHIP ID DEFINITIONS
#define BME280_CHIP_ID   (0x60)
 
I2C ADDRESS DEFINITIONS
#define BME280_I2C_ADDRESS1   (0x76)
 
#define BME280_I2C_ADDRESS2   (0x77)
 
POWER MODE DEFINITIONS
#define BME280_SLEEP_MODE   (0x00)
 
#define BME280_FORCED_MODE   (0x01)
 
#define BME280_NORMAL_MODE   (0x03)
 
#define BME280_SOFT_RESET_CODE   (0xB6)
 
STANDBY DEFINITIONS
#define BME280_STANDBY_TIME_1_MS   (0x00)
 
#define BME280_STANDBY_TIME_63_MS   (0x01)
 
#define BME280_STANDBY_TIME_125_MS   (0x02)
 
#define BME280_STANDBY_TIME_250_MS   (0x03)
 
#define BME280_STANDBY_TIME_500_MS   (0x04)
 
#define BME280_STANDBY_TIME_1000_MS   (0x05)
 
#define BME280_STANDBY_TIME_10_MS   (0x06)
 
#define BME280_STANDBY_TIME_20_MS   (0x07)
 
OVER SAMPLING DEFINITIONS
#define BME280_OVERSAMP_SKIPPED   (0x00)
 
#define BME280_OVERSAMP_1X   (0x01)
 
#define BME280_OVERSAMP_2X   (0x02)
 
#define BME280_OVERSAMP_4X   (0x03)
 
#define BME280_OVERSAMP_8X   (0x04)
 
#define BME280_OVERSAMP_16X   (0x05)
 
WORK MODE DEFINITIONS
#define BME280_STANDARD_OVERSAMP_HUMIDITY   BME280_OVERSAMP_1X
 
FILTER DEFINITIONS
#define BME280_FILTER_COEFF_OFF   (0x00)
 
#define BME280_FILTER_COEFF_2   (0x01)
 
#define BME280_FILTER_COEFF_4   (0x02)
 
#define BME280_FILTER_COEFF_8   (0x03)
 
#define BME280_FILTER_COEFF_16   (0x04)
 
DELAY DEFINITIONS
#define T_INIT_MAX   (20)
 
#define T_MEASURE_PER_OSRS_MAX   (37)
 
#define T_SETUP_PRESSURE_MAX   (10)
 
#define T_SETUP_HUMIDITY_MAX   (10)
 
DEFINITIONS FOR ARRAY SIZE OF DATA
#define BME280_HUMIDITY_DATA_SIZE   (2)
 
#define BME280_TEMPERATURE_DATA_SIZE   (3)
 
#define BME280_PRESSURE_DATA_SIZE   (3)
 
#define BME280_DATA_FRAME_SIZE   (8)
 
#define BME280_CALIB_DATA_SIZE   (26)
 
#define BME280_TEMPERATURE_MSB_DATA   (0)
 
#define BME280_TEMPERATURE_LSB_DATA   (1)
 
#define BME280_TEMPERATURE_XLSB_DATA   (2)
 
#define BME280_PRESSURE_MSB_DATA   (0)
 
#define BME280_PRESSURE_LSB_DATA   (1)
 
#define BME280_PRESSURE_XLSB_DATA   (2)
 
#define BME280_HUMIDITY_MSB_DATA   (0)
 
#define BME280_HUMIDITY_LSB_DATA   (1)
 
#define BME280_DATA_FRAME_PRESSURE_MSB_BYTE   (0)
 
#define BME280_DATA_FRAME_PRESSURE_LSB_BYTE   (1)
 
#define BME280_DATA_FRAME_PRESSURE_XLSB_BYTE   (2)
 
#define BME280_DATA_FRAME_TEMPERATURE_MSB_BYTE   (3)
 
#define BME280_DATA_FRAME_TEMPERATURE_LSB_BYTE   (4)
 
#define BME280_DATA_FRAME_TEMPERATURE_XLSB_BYTE   (5)
 
#define BME280_DATA_FRAME_HUMIDITY_MSB_BYTE   (6)
 
#define BME280_DATA_FRAME_HUMIDITY_LSB_BYTE   (7)
 
ARRAY PARAMETER FOR CALIBRATION
#define BME280_TEMPERATURE_CALIB_DIG_T1_LSB   (0)
 
#define BME280_TEMPERATURE_CALIB_DIG_T1_MSB   (1)
 
#define BME280_TEMPERATURE_CALIB_DIG_T2_LSB   (2)
 
#define BME280_TEMPERATURE_CALIB_DIG_T2_MSB   (3)
 
#define BME280_TEMPERATURE_CALIB_DIG_T3_LSB   (4)
 
#define BME280_TEMPERATURE_CALIB_DIG_T3_MSB   (5)
 
#define BME280_PRESSURE_CALIB_DIG_P1_LSB   (6)
 
#define BME280_PRESSURE_CALIB_DIG_P1_MSB   (7)
 
#define BME280_PRESSURE_CALIB_DIG_P2_LSB   (8)
 
#define BME280_PRESSURE_CALIB_DIG_P2_MSB   (9)
 
#define BME280_PRESSURE_CALIB_DIG_P3_LSB   (10)
 
#define BME280_PRESSURE_CALIB_DIG_P3_MSB   (11)
 
#define BME280_PRESSURE_CALIB_DIG_P4_LSB   (12)
 
#define BME280_PRESSURE_CALIB_DIG_P4_MSB   (13)
 
#define BME280_PRESSURE_CALIB_DIG_P5_LSB   (14)
 
#define BME280_PRESSURE_CALIB_DIG_P5_MSB   (15)
 
#define BME280_PRESSURE_CALIB_DIG_P6_LSB   (16)
 
#define BME280_PRESSURE_CALIB_DIG_P6_MSB   (17)
 
#define BME280_PRESSURE_CALIB_DIG_P7_LSB   (18)
 
#define BME280_PRESSURE_CALIB_DIG_P7_MSB   (19)
 
#define BME280_PRESSURE_CALIB_DIG_P8_LSB   (20)
 
#define BME280_PRESSURE_CALIB_DIG_P8_MSB   (21)
 
#define BME280_PRESSURE_CALIB_DIG_P9_LSB   (22)
 
#define BME280_PRESSURE_CALIB_DIG_P9_MSB   (23)
 
#define BME280_HUMIDITY_CALIB_DIG_H1   (25)
 
#define BME280_HUMIDITY_CALIB_DIG_H2_LSB   (0)
 
#define BME280_HUMIDITY_CALIB_DIG_H2_MSB   (1)
 
#define BME280_HUMIDITY_CALIB_DIG_H3   (2)
 
#define BME280_HUMIDITY_CALIB_DIG_H4_MSB   (3)
 
#define BME280_HUMIDITY_CALIB_DIG_H4_LSB   (4)
 
#define BME280_HUMIDITY_CALIB_DIG_H5_MSB   (5)
 
#define BME280_HUMIDITY_CALIB_DIG_H6   (6)
 
#define BME280_MASK_DIG_H4   (0x0F)
 
CALIBRATION REGISTER ADDRESS DEFINITIONS
#define BME280_TEMPERATURE_CALIB_DIG_T1_LSB_REG   (0x88)
 
#define BME280_TEMPERATURE_CALIB_DIG_T1_MSB_REG   (0x89)
 
#define BME280_TEMPERATURE_CALIB_DIG_T2_LSB_REG   (0x8A)
 
#define BME280_TEMPERATURE_CALIB_DIG_T2_MSB_REG   (0x8B)
 
#define BME280_TEMPERATURE_CALIB_DIG_T3_LSB_REG   (0x8C)
 
#define BME280_TEMPERATURE_CALIB_DIG_T3_MSB_REG   (0x8D)
 
#define BME280_PRESSURE_CALIB_DIG_P1_LSB_REG   (0x8E)
 
#define BME280_PRESSURE_CALIB_DIG_P1_MSB_REG   (0x8F)
 
#define BME280_PRESSURE_CALIB_DIG_P2_LSB_REG   (0x90)
 
#define BME280_PRESSURE_CALIB_DIG_P2_MSB_REG   (0x91)
 
#define BME280_PRESSURE_CALIB_DIG_P3_LSB_REG   (0x92)
 
#define BME280_PRESSURE_CALIB_DIG_P3_MSB_REG   (0x93)
 
#define BME280_PRESSURE_CALIB_DIG_P4_LSB_REG   (0x94)
 
#define BME280_PRESSURE_CALIB_DIG_P4_MSB_REG   (0x95)
 
#define BME280_PRESSURE_CALIB_DIG_P5_LSB_REG   (0x96)
 
#define BME280_PRESSURE_CALIB_DIG_P5_MSB_REG   (0x97)
 
#define BME280_PRESSURE_CALIB_DIG_P6_LSB_REG   (0x98)
 
#define BME280_PRESSURE_CALIB_DIG_P6_MSB_REG   (0x99)
 
#define BME280_PRESSURE_CALIB_DIG_P7_LSB_REG   (0x9A)
 
#define BME280_PRESSURE_CALIB_DIG_P7_MSB_REG   (0x9B)
 
#define BME280_PRESSURE_CALIB_DIG_P8_LSB_REG   (0x9C)
 
#define BME280_PRESSURE_CALIB_DIG_P8_MSB_REG   (0x9D)
 
#define BME280_PRESSURE_CALIB_DIG_P9_LSB_REG   (0x9E)
 
#define BME280_PRESSURE_CALIB_DIG_P9_MSB_REG   (0x9F)
 
#define BME280_HUMIDITY_CALIB_DIG_H1_REG   (0xA1)
 
#define BME280_HUMIDITY_CALIB_DIG_H2_LSB_REG   (0xE1)
 
#define BME280_HUMIDITY_CALIB_DIG_H2_MSB_REG   (0xE2)
 
#define BME280_HUMIDITY_CALIB_DIG_H3_REG   (0xE3)
 
#define BME280_HUMIDITY_CALIB_DIG_H4_MSB_REG   (0xE4)
 
#define BME280_HUMIDITY_CALIB_DIG_H4_LSB_REG   (0xE5)
 
#define BME280_HUMIDITY_CALIB_DIG_H5_MSB_REG   (0xE6)
 
#define BME280_HUMIDITY_CALIB_DIG_H6_REG   (0xE7)
 
REGISTER ADDRESS DEFINITIONS
#define BME280_CHIP_ID_REG   (0xD0) /*Chip ID Register */
 
#define BME280_RST_REG   (0xE0) /*Softreset Register */
 
#define BME280_STAT_REG   (0xF3) /*Status Register */
 
#define BME280_CTRL_MEAS_REG   (0xF4) /*Ctrl Measure Register */
 
#define BME280_CTRL_HUMIDITY_REG   (0xF2) /*Ctrl Humidity Register*/
 
#define BME280_CONFIG_REG   (0xF5) /*Configuration Register */
 
#define BME280_PRESSURE_MSB_REG   (0xF7) /*Pressure MSB Register */
 
#define BME280_PRESSURE_LSB_REG   (0xF8) /*Pressure LSB Register */
 
#define BME280_PRESSURE_XLSB_REG   (0xF9) /*Pressure XLSB Register */
 
#define BME280_TEMPERATURE_MSB_REG   (0xFA) /*Temperature MSB Reg */
 
#define BME280_TEMPERATURE_LSB_REG   (0xFB) /*Temperature LSB Reg */
 
#define BME280_TEMPERATURE_XLSB_REG   (0xFC) /*Temperature XLSB Reg */
 
#define BME280_HUMIDITY_MSB_REG   (0xFD) /*Humidity MSB Reg */
 
#define BME280_HUMIDITY_LSB_REG   (0xFE) /*Humidity LSB Reg */
 
BIT MASK, LENGTH AND POSITION DEFINITIONS

FOR PRESSURE AND TEMPERATURE DATA

#define BME280_STAT_REG_MEASURING__POS   (3)
 
#define BME280_STAT_REG_MEASURING__MSK   (0x08)
 
#define BME280_STAT_REG_MEASURING__LEN   (1)
 
#define BME280_STAT_REG_MEASURING__REG   (BME280_STAT_REG)
 
#define BME280_STAT_REG_IM_UPDATE__POS   (0)
 
#define BME280_STAT_REG_IM_UPDATE__MSK   (0x01)
 
#define BME280_STAT_REG_IM_UPDATE__LEN   (1)
 
#define BME280_STAT_REG_IM_UPDATE__REG   (BME280_STAT_REG)
 
#define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__POS   (5)
 
#define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__MSK   (0xE0)
 
#define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__LEN   (3)
 
#define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__REG   (BME280_CTRL_MEAS_REG)
 
#define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__POS   (2)
 
#define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__MSK   (0x1C)
 
#define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__LEN   (3)
 
#define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__REG   (BME280_CTRL_MEAS_REG)
 
#define BME280_CTRL_MEAS_REG_POWER_MODE__POS   (0)
 
#define BME280_CTRL_MEAS_REG_POWER_MODE__MSK   (0x03)
 
#define BME280_CTRL_MEAS_REG_POWER_MODE__LEN   (2)
 
#define BME280_CTRL_MEAS_REG_POWER_MODE__REG   (BME280_CTRL_MEAS_REG)
 
#define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__POS   (0)
 
#define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__MSK   (0x07)
 
#define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__LEN   (3)
 
#define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__REG   (BME280_CTRL_HUMIDITY_REG)
 
#define BME280_CONFIG_REG_TSB__POS   (5)
 
#define BME280_CONFIG_REG_TSB__MSK   (0xE0)
 
#define BME280_CONFIG_REG_TSB__LEN   (3)
 
#define BME280_CONFIG_REG_TSB__REG   (BME280_CONFIG_REG)
 
#define BME280_CONFIG_REG_FILTER__POS   (2)
 
#define BME280_CONFIG_REG_FILTER__MSK   (0x1C)
 
#define BME280_CONFIG_REG_FILTER__LEN   (3)
 
#define BME280_CONFIG_REG_FILTER__REG   (BME280_CONFIG_REG)
 
#define BME280_CONFIG_REG_SPI3_ENABLE__POS   (0)
 
#define BME280_CONFIG_REG_SPI3_ENABLE__MSK   (0x01)
 
#define BME280_CONFIG_REG_SPI3_ENABLE__LEN   (1)
 
#define BME280_CONFIG_REG_SPI3_ENABLE__REG   (BME280_CONFIG_REG)
 
#define BME280_PRESSURE_XLSB_REG_DATA__POS   (4)
 
#define BME280_PRESSURE_XLSB_REG_DATA__MSK   (0xF0)
 
#define BME280_PRESSURE_XLSB_REG_DATA__LEN   (4)
 
#define BME280_PRESSURE_XLSB_REG_DATA__REG   (BME280_PRESSURE_XLSB_REG)
 
#define BME280_TEMPERATURE_XLSB_REG_DATA__POS   (4)
 
#define BME280_TEMPERATURE_XLSB_REG_DATA__MSK   (0xF0)
 
#define BME280_TEMPERATURE_XLSB_REG_DATA__LEN   (4)
 
#define BME280_TEMPERATURE_XLSB_REG_DATA__REG   (BME280_TEMPERATURE_XLSB_REG)
 

Typedefs

typedef signed short int s16
 
typedef signed int s32
 
typedef signed long long int s64
 
typedef signed char s8
 
typedef unsigned short int u16
 
typedef unsigned int u32
 
typedef unsigned long long int u64
 
typedef unsigned char u8
 

Functions

FUNCTION FOR INTIALIZATION
BME280_RETURN_FUNCTION_TYPE bme280_init (struct bme280_t *bme280)
 This function is used for initialize the bus read and bus write functions and assign the chip id and I2C address of the BME280 sensor chip id is read in the register 0xD0 bit from 0 to 7. More...
 
FUNCTION FOR INTIALIZATION UNCOMPENSATED TEMPERATURE
BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_temperature (s32 *v_uncomp_temperature_s32)
 This API is used to read uncompensated temperature in the registers 0xFA, 0xFB and 0xFC. More...
 
FUNCTION FOR INTIALIZATION TRUE TEMPERATURE
s32 bme280_compensate_temperature_int32 (s32 v_uncomp_temperature_s32)
 Reads actual temperature from uncompensated temperature. More...
 
s16 bme280_compensate_temperature_int32_sixteen_bit_output (s32 v_uncomp_temperature_s32)
 Reads actual temperature from uncompensated temperature. More...
 
FUNCTION FOR INTIALIZATION UNCOMPENSATED PRESSURE
BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_pressure (s32 *v_uncomp_pressure_s32)
 This API is used to read uncompensated pressure. in the registers 0xF7, 0xF8 and 0xF9. More...
 
FUNCTION FOR INTIALIZATION TRUE PRESSURE
u32 bme280_compensate_pressure_int32 (s32 v_uncomp_pressure_s32)
 Reads actual pressure from uncompensated pressure. More...
 
FUNCTION FOR INTIALIZATION UNCOMPENSATED HUMIDITY
BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_humidity (s32 *v_uncomp_humidity_s32)
 This API is used to read uncompensated humidity. in the registers 0xF7, 0xF8 and 0xF9. More...
 
FUNCTION FOR INTIALIZATION RELATIVE HUMIDITY
u32 bme280_compensate_humidity_int32 (s32 v_uncomp_humidity_s32)
 Reads actual humidity from uncompensated humidity. More...
 
u16 bme280_compensate_humidity_int32_sixteen_bit_output (s32 v_uncomp_humidity_s32)
 Reads actual humidity from uncompensated humidity. More...
 
FUNCTION FOR INTIALIZATION UNCOMPENSATED PRESSURE,

TEMPERATURE AND HUMIDITY

BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_pressure_temperature_humidity (s32 *v_uncomp_pressure_s32, s32 *v_uncomp_temperature_s32, s32 *v_uncomp_humidity_s32)
 This API used to read uncompensated pressure,temperature and humidity. More...
 
FUNCTION FOR TRUE UNCOMPENSATED PRESSURE,

TEMPERATURE AND HUMIDITY

BME280_RETURN_FUNCTION_TYPE bme280_read_pressure_temperature_humidity (u32 *v_pressure_u32, s32 *v_temperature_s32, u32 *v_humidity_u32)
 This API used to read true pressure, temperature and humidity. More...
 
FUNCTION FOR CALIBRATION
BME280_RETURN_FUNCTION_TYPE bme280_get_calib_param (void)
 This API is used to calibration parameters used for calculation in the registers. More...
 
FUNCTION FOR TEMPERATURE OVER SAMPLING
BME280_RETURN_FUNCTION_TYPE bme280_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...
 
BME280_RETURN_FUNCTION_TYPE bme280_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...
 
FUNCTION FOR PRESSURE OVER SAMPLING
BME280_RETURN_FUNCTION_TYPE bme280_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...
 
BME280_RETURN_FUNCTION_TYPE bme280_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...
 
FUNCTION FOR HUMIDITY OVER SAMPLING
BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_humidity (u8 *v_value_u8)
 This API is used to get the humidity oversampling setting in the register 0xF2 bits from 0 to 2. More...
 
BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_humidity (u8 v_value_u8)
 This API is used to set the humidity oversampling setting in the register 0xF2 bits from 0 to 2. More...
 
FUNCTION FOR POWER MODE
BME280_RETURN_FUNCTION_TYPE bme280_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...
 
BME280_RETURN_FUNCTION_TYPE bme280_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...
 
FUNCTION FOR SOFT RESET
BME280_RETURN_FUNCTION_TYPE bme280_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. More...
 
FUNCTION FOR SPI ENABLE
BME280_RETURN_FUNCTION_TYPE bme280_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...
 
BME280_RETURN_FUNCTION_TYPE bme280_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...
 
FUNCTION FOR IIR FILTER
BME280_RETURN_FUNCTION_TYPE bme280_get_filter (u8 *v_value_u8)
 This API is used to reads filter setting in the register 0xF5 bit 3 and 4. More...
 
BME280_RETURN_FUNCTION_TYPE bme280_set_filter (u8 v_value_u8)
 This API is used to write filter setting in the register 0xF5 bit 3 and 4. More...
 
FUNCTION FOR STANDBY DURATION
BME280_RETURN_FUNCTION_TYPE bme280_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...
 
BME280_RETURN_FUNCTION_TYPE bme280_set_standby_durn (u8 v_standby_durn_u8)
 This API used to write the standby duration time from the sensor in the register 0xF5 bit 5 to 7. More...
 
FUNCTION FOR FORCE MODE DATA READ
BME280_RETURN_FUNCTION_TYPE bme280_get_forced_uncomp_pressure_temperature_humidity (s32 *v_uncom_pressure_s32, s32 *v_uncom_temperature_s32, s32 *v_uncom_humidity_s32)
 This API used to read uncompensated temperature,pressure and humidity in forced mode. More...
 
FUNCTION FOR COMMON READ AND WRITE
BME280_RETURN_FUNCTION_TYPE bme280_write_register (u8 v_addr_u8, u8 *v_data_u8, u8 v_len_u8)
 This API write the data to the given register. More...
 
BME280_RETURN_FUNCTION_TYPE bme280_read_register (u8 v_addr_u8, u8 *v_data_u8, u8 v_len_u8)
 This API reads the data from the given register. More...
 
FUNCTION FOR FLOAT OUTPUT TEMPERATURE
double bme280_compensate_temperature_double (s32 v_uncom_temperature_s32)
 Reads actual temperature from uncompensated temperature. More...
 
FUNCTION FOR FLOAT OUTPUT PRESSURE
double bme280_compensate_pressure_double (s32 v_uncom_pressure_s32)
 Reads actual pressure from uncompensated pressure. More...
 
FUNCTION FOR FLOAT OUTPUT HUMIDITY
double bme280_compensate_humidity_double (s32 v_uncom_humidity_s32)
 Reads actual humidity from uncompensated humidity. More...
 
FUNCTION FOR 64BIT OUTPUT PRESSURE
u32 bme280_compensate_pressure_int64 (s32 v_uncom_pressure_s32)
 Reads actual pressure from uncompensated pressure. More...
 
FUNCTION FOR 24BIT OUTPUT PRESSURE
u32 bme280_compensate_pressure_int64_twentyfour_bit_output (s32 v_uncom_pressure_s32)
 Reads actual pressure from uncompensated pressure. More...
 
FUNCTION FOR WAIT PERIOD
BME280_RETURN_FUNCTION_TYPE bme280_compute_wait_time (u8 *v_delaytime_u8)
 Computing waiting time for sensor data read. More...
 

Macro Definition Documentation

#define BME280_3MS_DELAY   (3)
#define BME280_64BITSUPPORT_PRESENT
#define BME280_ALL_DATA_FRAME_LENGTH   (8)
#define BME280_BUS_RD_PARAM_ORDER
Value:
(device_addr, register_addr,\
register_data)
#define BME280_BUS_RD_PARAM_TYPES
Value:
(u8, u8,\
u8 *, u8)
unsigned char u8
Definition: bme280.h:284
#define BME280_BUS_RD_RETURN_TYPE   s8
Note
The bus write function can change since this is a system dependant issue.

If the bus_read parameter calling order is like: reg_addr, reg_data, wr_len it would be as it is here.

If the parameters are differently ordered or your communication function like I2C need to know the device address, you can change this macro accordingly.

BME280_BUS_READ_FUNC(dev_addr, reg_addr, reg_data, wr_len)\ bus_read(dev_addr, reg_addr, reg_data, wr_len)

This macro lets all API functions call YOUR communication routine in a way that equals your definition in the refer BME280_WR_FUNC_PTR definition.

Note
: this macro also includes the "MSB='1' for reading BME280 addresses.
#define BME280_BUS_READ_FUNC (   device_addr,
  register_addr,
  register_data,
  rd_len 
)
Value:
bus_read(device_addr, register_addr,\
register_data, rd_len)
#define BME280_BUS_WR_PARAM_ORDER (   device_addr,
  register_addr,
  register_data,
  wr_len 
)
#define BME280_BUS_WR_PARAM_TYPES
Value:
u8 *, u8
unsigned char u8
Definition: bma2x2.h:192
unsigned char u8
Definition: bme280.h:284
#define BME280_BUS_WR_RETURN_TYPE   s8
Note
This includes types of parameters. This example shows the configuration for an SPI bus link.

If your communication function looks like this:

write_my_bus_xy(u8 device_addr, u8 register_addr, u8 * data, u8 length);

The BME280_WR_FUNC_PTR would equal:

BME280_WR_FUNC_PTR s8 (* bus_write)(u8, u8, u8 *, u8)

Parameters can be mixed as needed refer to the refer BME280_BUS_WRITE_FUNC macro.defines the return parameter type of the BME280_WR_FUNCTION

#define BME280_BUS_WRITE_FUNC (   device_addr,
  register_addr,
  register_data,
  wr_len 
)
Value:
bus_write(device_addr, register_addr,\
register_data, wr_len)
#define BME280_CALIB_DATA_SIZE   (26)
#define BME280_CHIP_ID   (0x60)
#define BME280_CHIP_ID_READ_COUNT   (5)
#define BME280_CHIP_ID_READ_FAIL   ((s8)-1)
#define BME280_CHIP_ID_READ_SUCCESS   ((u8)0)
#define BME280_CHIP_ID_REG   (0xD0) /*Chip ID Register */
#define BME280_CONFIG_REG   (0xF5) /*Configuration Register */
#define BME280_CONFIG_REG_FILTER__LEN   (3)
#define BME280_CONFIG_REG_FILTER__MSK   (0x1C)
#define BME280_CONFIG_REG_FILTER__POS   (2)
#define BME280_CONFIG_REG_FILTER__REG   (BME280_CONFIG_REG)
#define BME280_CONFIG_REG_SPI3_ENABLE__LEN   (1)
#define BME280_CONFIG_REG_SPI3_ENABLE__MSK   (0x01)
#define BME280_CONFIG_REG_SPI3_ENABLE__POS   (0)
#define BME280_CONFIG_REG_SPI3_ENABLE__REG   (BME280_CONFIG_REG)
#define BME280_CONFIG_REG_TSB__LEN   (3)
#define BME280_CONFIG_REG_TSB__MSK   (0xE0)
#define BME280_CONFIG_REG_TSB__POS   (5)
#define BME280_CONFIG_REG_TSB__REG   (BME280_CONFIG_REG)
#define BME280_CTRL_HUMIDITY_REG   (0xF2) /*Ctrl Humidity Register*/
#define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__LEN   (3)
#define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__MSK   (0x07)
#define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__POS   (0)
#define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__REG   (BME280_CTRL_HUMIDITY_REG)
#define BME280_CTRL_MEAS_REG   (0xF4) /*Ctrl Measure Register */
#define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__LEN   (3)
#define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__MSK   (0x1C)
#define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__POS   (2)
#define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__REG   (BME280_CTRL_MEAS_REG)
#define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__LEN   (3)
#define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__MSK   (0xE0)
#define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__POS   (5)
#define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__REG   (BME280_CTRL_MEAS_REG)
#define BME280_CTRL_MEAS_REG_POWER_MODE__LEN   (2)
#define BME280_CTRL_MEAS_REG_POWER_MODE__MSK   (0x03)
#define BME280_CTRL_MEAS_REG_POWER_MODE__POS   (0)
#define BME280_CTRL_MEAS_REG_POWER_MODE__REG   (BME280_CTRL_MEAS_REG)
#define BME280_DATA_FRAME_HUMIDITY_LSB_BYTE   (7)
#define BME280_DATA_FRAME_HUMIDITY_MSB_BYTE   (6)
#define BME280_DATA_FRAME_PRESSURE_LSB_BYTE   (1)
#define BME280_DATA_FRAME_PRESSURE_MSB_BYTE   (0)
#define BME280_DATA_FRAME_PRESSURE_XLSB_BYTE   (2)
#define BME280_DATA_FRAME_SIZE   (8)

data frames includes temperature, pressure and humidity

#define BME280_DATA_FRAME_TEMPERATURE_LSB_BYTE   (4)
#define BME280_DATA_FRAME_TEMPERATURE_MSB_BYTE   (3)
#define BME280_DATA_FRAME_TEMPERATURE_XLSB_BYTE   (5)
#define BME280_DELAY_FUNC (   delay_in_msec)    delay_func(delay_in_msec)
#define BME280_DELAY_PARAM_TYPES   u16
#define BME280_DELAY_RETURN_TYPE   void
#define BME280_ENABLE_FLOAT
#define BME280_ENABLE_INT64
#define BME280_FILTER_COEFF_16   (0x04)
#define BME280_FILTER_COEFF_2   (0x01)
#define BME280_FILTER_COEFF_4   (0x02)
#define BME280_FILTER_COEFF_8   (0x03)
#define BME280_FILTER_COEFF_OFF   (0x00)
#define BME280_FORCED_MODE   (0x01)
#define BME280_GEN_READ_WRITE_DATA_LENGTH   (1)
#define BME280_GET_BITSLICE (   regvar,
  bitname 
)    ((regvar & bitname##__MSK) >> bitname##__POS)
#define BME280_HUMIDITY_CALIB_DATA_LENGTH   (7)
#define BME280_HUMIDITY_CALIB_DIG_H1   (25)
#define BME280_HUMIDITY_CALIB_DIG_H1_REG   (0xA1)
#define BME280_HUMIDITY_CALIB_DIG_H2_LSB   (0)
#define BME280_HUMIDITY_CALIB_DIG_H2_LSB_REG   (0xE1)
#define BME280_HUMIDITY_CALIB_DIG_H2_MSB   (1)
#define BME280_HUMIDITY_CALIB_DIG_H2_MSB_REG   (0xE2)
#define BME280_HUMIDITY_CALIB_DIG_H3   (2)
#define BME280_HUMIDITY_CALIB_DIG_H3_REG   (0xE3)
#define BME280_HUMIDITY_CALIB_DIG_H4_LSB   (4)
#define BME280_HUMIDITY_CALIB_DIG_H4_LSB_REG   (0xE5)
#define BME280_HUMIDITY_CALIB_DIG_H4_MSB   (3)
#define BME280_HUMIDITY_CALIB_DIG_H4_MSB_REG   (0xE4)
#define BME280_HUMIDITY_CALIB_DIG_H5_MSB   (5)
#define BME280_HUMIDITY_CALIB_DIG_H5_MSB_REG   (0xE6)
#define BME280_HUMIDITY_CALIB_DIG_H6   (6)
#define BME280_HUMIDITY_CALIB_DIG_H6_REG   (0xE7)
#define BME280_HUMIDITY_DATA_LENGTH   (2)
#define BME280_HUMIDITY_DATA_SIZE   (2)
#define BME280_HUMIDITY_LSB_DATA   (1)
#define BME280_HUMIDITY_LSB_REG   (0xFE) /*Humidity LSB Reg */
#define BME280_HUMIDITY_MSB_DATA   (0)
#define BME280_HUMIDITY_MSB_REG   (0xFD) /*Humidity MSB Reg */
#define BME280_I2C_ADDRESS1   (0x76)
#define BME280_I2C_ADDRESS2   (0x77)
#define BME280_INIT_VALUE   (0)
#define BME280_INVALID_DATA   (0)
#define BME280_MASK_DIG_H4   (0x0F)
#define BME280_MDELAY_DATA_TYPE   u32
#define BME280_NORMAL_MODE   (0x03)
#define BME280_NULL   (0)
#define BME280_OVERSAMP_16X   (0x05)
#define BME280_OVERSAMP_1X   (0x01)
#define BME280_OVERSAMP_2X   (0x02)
#define BME280_OVERSAMP_4X   (0x03)
#define BME280_OVERSAMP_8X   (0x04)
#define BME280_OVERSAMP_SKIPPED   (0x00)
#define BME280_PRESSURE_CALIB_DIG_P1_LSB   (6)
#define BME280_PRESSURE_CALIB_DIG_P1_LSB_REG   (0x8E)
#define BME280_PRESSURE_CALIB_DIG_P1_MSB   (7)
#define BME280_PRESSURE_CALIB_DIG_P1_MSB_REG   (0x8F)
#define BME280_PRESSURE_CALIB_DIG_P2_LSB   (8)
#define BME280_PRESSURE_CALIB_DIG_P2_LSB_REG   (0x90)
#define BME280_PRESSURE_CALIB_DIG_P2_MSB   (9)
#define BME280_PRESSURE_CALIB_DIG_P2_MSB_REG   (0x91)
#define BME280_PRESSURE_CALIB_DIG_P3_LSB   (10)
#define BME280_PRESSURE_CALIB_DIG_P3_LSB_REG   (0x92)
#define BME280_PRESSURE_CALIB_DIG_P3_MSB   (11)
#define BME280_PRESSURE_CALIB_DIG_P3_MSB_REG   (0x93)
#define BME280_PRESSURE_CALIB_DIG_P4_LSB   (12)
#define BME280_PRESSURE_CALIB_DIG_P4_LSB_REG   (0x94)
#define BME280_PRESSURE_CALIB_DIG_P4_MSB   (13)
#define BME280_PRESSURE_CALIB_DIG_P4_MSB_REG   (0x95)
#define BME280_PRESSURE_CALIB_DIG_P5_LSB   (14)
#define BME280_PRESSURE_CALIB_DIG_P5_LSB_REG   (0x96)
#define BME280_PRESSURE_CALIB_DIG_P5_MSB   (15)
#define BME280_PRESSURE_CALIB_DIG_P5_MSB_REG   (0x97)
#define BME280_PRESSURE_CALIB_DIG_P6_LSB   (16)
#define BME280_PRESSURE_CALIB_DIG_P6_LSB_REG   (0x98)
#define BME280_PRESSURE_CALIB_DIG_P6_MSB   (17)
#define BME280_PRESSURE_CALIB_DIG_P6_MSB_REG   (0x99)
#define BME280_PRESSURE_CALIB_DIG_P7_LSB   (18)
#define BME280_PRESSURE_CALIB_DIG_P7_LSB_REG   (0x9A)
#define BME280_PRESSURE_CALIB_DIG_P7_MSB   (19)
#define BME280_PRESSURE_CALIB_DIG_P7_MSB_REG   (0x9B)
#define BME280_PRESSURE_CALIB_DIG_P8_LSB   (20)
#define BME280_PRESSURE_CALIB_DIG_P8_LSB_REG   (0x9C)
#define BME280_PRESSURE_CALIB_DIG_P8_MSB   (21)
#define BME280_PRESSURE_CALIB_DIG_P8_MSB_REG   (0x9D)
#define BME280_PRESSURE_CALIB_DIG_P9_LSB   (22)
#define BME280_PRESSURE_CALIB_DIG_P9_LSB_REG   (0x9E)
#define BME280_PRESSURE_CALIB_DIG_P9_MSB   (23)
#define BME280_PRESSURE_CALIB_DIG_P9_MSB_REG   (0x9F)
#define BME280_PRESSURE_DATA_LENGTH   (3)
#define BME280_PRESSURE_DATA_SIZE   (3)
#define BME280_PRESSURE_LSB_DATA   (1)
#define BME280_PRESSURE_LSB_REG   (0xF8) /*Pressure LSB Register */
#define BME280_PRESSURE_MSB_DATA   (0)
#define BME280_PRESSURE_MSB_REG   (0xF7) /*Pressure MSB Register */
#define BME280_PRESSURE_TEMPERATURE_CALIB_DATA_LENGTH   (26)
#define BME280_PRESSURE_XLSB_DATA   (2)
#define BME280_PRESSURE_XLSB_REG   (0xF9) /*Pressure XLSB Register */
#define BME280_PRESSURE_XLSB_REG_DATA__LEN   (4)
#define BME280_PRESSURE_XLSB_REG_DATA__MSK   (0xF0)
#define BME280_PRESSURE_XLSB_REG_DATA__POS   (4)
#define BME280_PRESSURE_XLSB_REG_DATA__REG   (BME280_PRESSURE_XLSB_REG)
#define BME280_RD_FUNC_PTR
Value:
s8 (*bus_read)(u8, u8,\
u8 *, u8)
signed char s8
Definition: bme280.h:278
unsigned char u8
Definition: bme280.h:284
#define BME280_REGISTER_READ_DELAY   (1)
#define BME280_RETURN_FUNCTION_TYPE   s8
#define BME280_RST_REG   (0xE0) /*Softreset Register */
#define BME280_SET_BITSLICE (   regvar,
  bitname,
  val 
)    ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK))
#define BME280_SHIFT_BIT_POSITION_BY_01_BIT   (1)
#define BME280_SHIFT_BIT_POSITION_BY_02_BITS   (2)
#define BME280_SHIFT_BIT_POSITION_BY_03_BITS   (3)
#define BME280_SHIFT_BIT_POSITION_BY_04_BITS   (4)
#define BME280_SHIFT_BIT_POSITION_BY_07_BITS   (7)
#define BME280_SHIFT_BIT_POSITION_BY_08_BITS   (8)
#define BME280_SHIFT_BIT_POSITION_BY_10_BITS   (10)
#define BME280_SHIFT_BIT_POSITION_BY_11_BITS   (11)
#define BME280_SHIFT_BIT_POSITION_BY_12_BITS   (12)
#define BME280_SHIFT_BIT_POSITION_BY_13_BITS   (13)
#define BME280_SHIFT_BIT_POSITION_BY_14_BITS   (14)
#define BME280_SHIFT_BIT_POSITION_BY_15_BITS   (15)
#define BME280_SHIFT_BIT_POSITION_BY_16_BITS   (16)
#define BME280_SHIFT_BIT_POSITION_BY_17_BITS   (17)
#define BME280_SHIFT_BIT_POSITION_BY_18_BITS   (18)
#define BME280_SHIFT_BIT_POSITION_BY_19_BITS   (19)
#define BME280_SHIFT_BIT_POSITION_BY_20_BITS   (20)
#define BME280_SHIFT_BIT_POSITION_BY_25_BITS   (25)
#define BME280_SHIFT_BIT_POSITION_BY_31_BITS   (31)
#define BME280_SHIFT_BIT_POSITION_BY_33_BITS   (33)
#define BME280_SHIFT_BIT_POSITION_BY_35_BITS   (35)
#define BME280_SHIFT_BIT_POSITION_BY_47_BITS   (47)
#define BME280_SLEEP_MODE   (0x00)
#define BME280_SOFT_RESET_CODE   (0xB6)
#define BME280_STANDARD_OVERSAMP_HUMIDITY   BME280_OVERSAMP_1X
#define BME280_STANDBY_TIME_1000_MS   (0x05)
#define BME280_STANDBY_TIME_10_MS   (0x06)
#define BME280_STANDBY_TIME_125_MS   (0x02)
#define BME280_STANDBY_TIME_1_MS   (0x00)
#define BME280_STANDBY_TIME_20_MS   (0x07)
#define BME280_STANDBY_TIME_250_MS   (0x03)
#define BME280_STANDBY_TIME_500_MS   (0x04)
#define BME280_STANDBY_TIME_63_MS   (0x01)
#define BME280_STAT_REG   (0xF3) /*Status Register */
#define BME280_STAT_REG_IM_UPDATE__LEN   (1)
#define BME280_STAT_REG_IM_UPDATE__MSK   (0x01)
#define BME280_STAT_REG_IM_UPDATE__POS   (0)
#define BME280_STAT_REG_IM_UPDATE__REG   (BME280_STAT_REG)
#define BME280_STAT_REG_MEASURING__LEN   (1)
#define BME280_STAT_REG_MEASURING__MSK   (0x08)
#define BME280_STAT_REG_MEASURING__POS   (3)
#define BME280_STAT_REG_MEASURING__REG   (BME280_STAT_REG)
#define BME280_TEMPERATURE_CALIB_DIG_T1_LSB   (0)
#define BME280_TEMPERATURE_CALIB_DIG_T1_LSB_REG   (0x88)
#define BME280_TEMPERATURE_CALIB_DIG_T1_MSB   (1)
#define BME280_TEMPERATURE_CALIB_DIG_T1_MSB_REG   (0x89)
#define BME280_TEMPERATURE_CALIB_DIG_T2_LSB   (2)
#define BME280_TEMPERATURE_CALIB_DIG_T2_LSB_REG   (0x8A)
#define BME280_TEMPERATURE_CALIB_DIG_T2_MSB   (3)
#define BME280_TEMPERATURE_CALIB_DIG_T2_MSB_REG   (0x8B)
#define BME280_TEMPERATURE_CALIB_DIG_T3_LSB   (4)
#define BME280_TEMPERATURE_CALIB_DIG_T3_LSB_REG   (0x8C)
#define BME280_TEMPERATURE_CALIB_DIG_T3_MSB   (5)
#define BME280_TEMPERATURE_CALIB_DIG_T3_MSB_REG   (0x8D)
#define BME280_TEMPERATURE_DATA_LENGTH   (3)
#define BME280_TEMPERATURE_DATA_SIZE   (3)
#define BME280_TEMPERATURE_LSB_DATA   (1)
#define BME280_TEMPERATURE_LSB_REG   (0xFB) /*Temperature LSB Reg */
#define BME280_TEMPERATURE_MSB_DATA   (0)
#define BME280_TEMPERATURE_MSB_REG   (0xFA) /*Temperature MSB Reg */
#define BME280_TEMPERATURE_XLSB_DATA   (2)
#define BME280_TEMPERATURE_XLSB_REG   (0xFC) /*Temperature XLSB Reg */
#define BME280_TEMPERATURE_XLSB_REG_DATA__LEN   (4)
#define BME280_TEMPERATURE_XLSB_REG_DATA__MSK   (0xF0)
#define BME280_TEMPERATURE_XLSB_REG_DATA__POS   (4)
#define BME280_TEMPERATURE_XLSB_REG_DATA__REG   (BME280_TEMPERATURE_XLSB_REG)
#define BME280_WR_FUNC_PTR
Value:
s8 (*bus_write)(u8, u8,\
u8 *, u8)
signed char s8
Definition: bme280.h:278
unsigned char u8
Definition: bme280.h:284
#define E_BME280_COMM_RES   ((s8)-1)
#define E_BME280_NULL_PTR   ((s8)-127)
#define E_BME280_OUT_OF_RANGE   ((s8)-2)
#define ERROR   ((s8)-1)
#define MACHINE_32_BIT
Note
While porting the API please consider the following
Please check the version of C standard
Are you using Linux platform

For the Linux platform support Please use the types.h for your data types definitions

By default it is defined as 32 bit machine configuration define your data types based on your machine/compiler/controller configuration

#define SUCCESS   ((u8)0)
#define T_INIT_MAX   (20)
#define T_MEASURE_PER_OSRS_MAX   (37)
#define T_SETUP_HUMIDITY_MAX   (10)
#define T_SETUP_PRESSURE_MAX   (10)

Typedef Documentation

typedef signed short int s16

used for signed 16bit

typedef signed int s32

used for signed 32bit

typedef signed long long int s64

used for signed 64bit

typedef signed char s8

used for signed 8bit

typedef unsigned short int u16

used for unsigned 16bit

typedef unsigned int u32

used for unsigned 32bit

typedef unsigned long long int u64

used for unsigned 64bit

typedef unsigned char u8

used for unsigned 8bit

Function Documentation

double bme280_compensate_humidity_double ( s32  v_uncom_humidity_s32)
Note
returns the value in relative humidity (rH)
Output value of "42.12" equals 42.12 rH
Parameters
v_uncom_humidity_s32: value of uncompensated humidity
Returns
Return the actual humidity in floating point
u32 bme280_compensate_humidity_int32 ( s32  v_uncomp_humidity_s32)
Note
Returns the value in rH as unsigned 32bit integer in Q22.10 format(22 integer 10 fractional bits).
An output value of 42313 represents 42313 / 1024 = 41.321 rH
Parameters
v_uncomp_humidity_s32value of uncompensated humidity
Returns
Return the actual relative humidity output as u32

+ Here is the caller graph for this function:

u16 bme280_compensate_humidity_int32_sixteen_bit_output ( s32  v_uncomp_humidity_s32)
Note
Returns the value in rH as unsigned 16bit integer
An output value of 42313 represents 42313/512 = 82.643 rH
Parameters
v_uncomp_humidity_s32value of uncompensated humidity
Returns
Return the actual relative humidity output as u16

+ Here is the call graph for this function:

double bme280_compensate_pressure_double ( s32  v_uncom_pressure_s32)
Note
Returns pressure in Pa as double.
Output value of "96386.2" equals 96386.2 Pa = 963.862 hPa.
Parameters
v_uncom_pressure_s32: value of uncompensated pressure
Returns
Return the actual pressure in floating point
u32 bme280_compensate_pressure_int32 ( s32  v_uncomp_pressure_s32)
Note
Returns the value in Pascal(Pa) Output value of "96386" equals 96386 Pa = 963.86 hPa = 963.86 millibar
Parameters
v_uncomp_pressure_s32: value of uncompensated pressure
Returns
Return the actual pressure output as u32

+ Here is the caller graph for this function:

u32 bme280_compensate_pressure_int64 ( s32  v_uncom_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_uncom_pressure_s32: value of uncompensated temperature
Returns
Return the actual pressure in u32

+ Here is the caller graph for this function:

u32 bme280_compensate_pressure_int64_twentyfour_bit_output ( s32  v_uncom_pressure_s32)
Note
Returns the value in Pa.
Output value of "12337434"
represents 12337434 / 128 = 96386.2 Pa = 963.862 hPa
Parameters
v_uncom_pressure_s32: value of uncompensated pressure
Returns
the actual pressure in u32

+ Here is the call graph for this function:

double bme280_compensate_temperature_double ( s32  v_uncom_temperature_s32)
Note
returns the value in Degree centigrade
Output value of "51.23" equals 51.23 DegC.
Parameters
v_uncom_temperature_s32: value of uncompensated temperature
Returns
Return the actual temperature in floating point
s32 bme280_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
Returns the actual temperature

+ Here is the caller graph for this function:

s16 bme280_compensate_temperature_int32_sixteen_bit_output ( s32  v_uncomp_temperature_s32)
Note
Returns the value with 500LSB/DegC centred around 24 DegC output value of "5123" equals(5123/500)+24 = 34.246DegC
Parameters
v_uncomp_temperature_s32value of uncompensated temperature
Returns
Return the actual temperature as s16 output

+ Here is the call graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_compute_wait_time ( u8 v_delaytime_u8)
Parameters
v_delaytime_u8: The value of delay time for force mode
Return values
0-> Success

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_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
dig_H1 0xA1 from 0 to 7
dig_H2 0xE1 and 0xE2 from 0 : 7 to 8: 15
dig_H3 0xE3 from 0 to 7
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
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
dig_H1 0xA1 from 0 to 7
dig_H2 0xE1 and 0xE2 from 0 : 7 to 8: 15
dig_H3 0xE3 from 0 to 7
dig_H4 0xE4 and 0xE5 from 4 : 11 to 0: 3
dig_H5 0xE5 and 0xE6 from 0 : 3 to 4: 11
dig_H6 0xE7 from 0 to 7
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_get_filter ( u8 v_value_u8)
Parameters
v_value_u8: The value of IIR filter coefficient
value Filter coefficient
0x00 BME280_FILTER_COEFF_OFF
0x01 BME280_FILTER_COEFF_2
0x02 BME280_FILTER_COEFF_4
0x03 BME280_FILTER_COEFF_8
0x04 BME280_FILTER_COEFF_16
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BME280_RETURN_FUNCTION_TYPE bme280_get_forced_uncomp_pressure_temperature_humidity ( s32 v_uncom_pressure_s32,
s32 v_uncom_temperature_s32,
s32 v_uncom_humidity_s32 
)
Parameters
v_uncom_pressure_s32The value of uncompensated pressure
v_uncom_temperature_s32The value of uncompensated temperature
v_uncom_humidity_s32The value of uncompensated humidity
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the call graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_humidity ( u8 v_value_u8)
value Humidity oversampling
0x00 Skipped
0x01 BME280_OVERSAMP_1X
0x02 BME280_OVERSAMP_2X
0x03 BME280_OVERSAMP_4X
0x04 BME280_OVERSAMP_8X
0x05,0x06 and 0x07 BME280_OVERSAMP_16X
Parameters
v_value_u8: The value of humidity over sampling
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_pressure ( u8 v_value_u8)
value Pressure oversampling
0x00 Skipped
0x01 BME280_OVERSAMP_1X
0x02 BME280_OVERSAMP_2X
0x03 BME280_OVERSAMP_4X
0x04 BME280_OVERSAMP_8X
0x05,0x06 and 0x07 BME280_OVERSAMP_16X
Parameters
v_value_u8: The value of pressure oversampling
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_temperature ( u8 v_value_u8)
value Temperature oversampling
0x00 Skipped
0x01 BME280_OVERSAMP_1X
0x02 BME280_OVERSAMP_2X
0x03 BME280_OVERSAMP_4X
0x04 BME280_OVERSAMP_8X
0x05,0x06 and 0x07 BME280_OVERSAMP_16X
Parameters
v_value_u8: The value of temperature over sampling
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BME280_RETURN_FUNCTION_TYPE bme280_get_power_mode ( u8 v_power_mode_u8)
Parameters
v_power_mode_u8: The value of power mode
value mode
0x00 BME280_SLEEP_MODE
0x01 and 0x02 BME280_FORCED_MODE
0x03 BME280_NORMAL_MODE
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_get_spi3 ( u8 v_enable_disable_u8)
Parameters
v_enable_disable_u8: The value of SPI enable
value Description
0 Disable
1 Enable
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BME280_RETURN_FUNCTION_TYPE bme280_get_standby_durn ( u8 v_standby_durn_u8)
Parameters
v_standby_durn_u8: The value of standby duration time value.
value standby duration
0x00 BME280_STANDBY_TIME_1_MS
0x01 BME280_STANDBY_TIME_63_MS
0x02 BME280_STANDBY_TIME_125_MS
0x03 BME280_STANDBY_TIME_250_MS
0x04 BME280_STANDBY_TIME_500_MS
0x05 BME280_STANDBY_TIME_1000_MS
0x06 BME280_STANDBY_TIME_2000_MS
0x07 BME280_STANDBY_TIME_4000_MS
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_init ( struct bme280_t bme280)
Parameters
bme280structure pointer.
Note
While changing the parameter of the bme280_t
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:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_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

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_humidity ( s32 v_uncomp_humidity_s32)
Note
0xFD -> MSB -> bit from 0 to 7
0xFE -> LSB -> bit from 0 to 7
Parameters
v_uncomp_humidity_s32: The value of uncompensated humidity
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_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

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_pressure_temperature_humidity ( s32 v_uncomp_pressure_s32,
s32 v_uncomp_temperature_s32,
s32 v_uncomp_humidity_s32 
)
Parameters
v_uncomp_pressure_s32The value of uncompensated pressure.
v_uncomp_temperature_s32The value of uncompensated temperature
v_uncomp_humidity_s32The value of uncompensated humidity.
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_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 value of uncompensated temperature
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_set_filter ( u8  v_value_u8)
Parameters
v_value_u8: The value of IIR filter coefficient
value Filter coefficient
0x00 BME280_FILTER_COEFF_OFF
0x01 BME280_FILTER_COEFF_2
0x02 BME280_FILTER_COEFF_4
0x03 BME280_FILTER_COEFF_8
0x04 BME280_FILTER_COEFF_16
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_humidity ( u8  v_value_u8)
value Humidity oversampling
0x00 Skipped
0x01 BME280_OVERSAMP_1X
0x02 BME280_OVERSAMP_2X
0x03 BME280_OVERSAMP_4X
0x04 BME280_OVERSAMP_8X
0x05,0x06 and 0x07 BME280_OVERSAMP_16X
Parameters
v_value_u8: The value of humidity over sampling
Note
The "BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY" register sets the humidity data acquisition options of the device.
changes to this registers only become effective after a write operation to "BME280_CTRL_MEAS_REG" register.
In the code automated reading and writing of "BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY"
register first set the "BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY" and then read and write the "BME280_CTRL_MEAS_REG" register in the function.
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_pressure ( u8  v_value_u8)
value Pressure oversampling
0x00 Skipped
0x01 BME280_OVERSAMP_1X
0x02 BME280_OVERSAMP_2X
0x03 BME280_OVERSAMP_4X
0x04 BME280_OVERSAMP_8X
0x05,0x06 and 0x07 BME280_OVERSAMP_16X
Parameters
v_value_u8: The value of pressure oversampling
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_temperature ( u8  v_value_u8)
value Temperature oversampling
0x00 Skipped
0x01 BME280_OVERSAMP_1X
0x02 BME280_OVERSAMP_2X
0x03 BME280_OVERSAMP_4X
0x04 BME280_OVERSAMP_8X
0x05,0x06 and 0x07 BME280_OVERSAMP_16X
Parameters
v_value_u8: The value of temperature over sampling
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_set_power_mode ( u8  v_power_mode_u8)
Parameters
v_power_mode_u8: The value of power mode
value mode
0x00 BME280_SLEEP_MODE
0x01 and 0x02 BME280_FORCED_MODE
0x03 BME280_NORMAL_MODE
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_set_soft_rst ( void  )
Note
Soft reset can be easily set using bme280_set_softreset().
Usage Hint : bme280_set_softreset()
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_set_spi3 ( u8  v_enable_disable_u8)
Parameters
v_enable_disable_u8: The value of SPI enable
value Description
0 Disable
1 Enable
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the call graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_set_standby_durn ( u8  v_standby_durn_u8)
Parameters
v_standby_durn_u8: The value of standby duration time value.
value standby duration
0x00 BME280_STANDBY_TIME_1_MS
0x01 BME280_STANDBY_TIME_63_MS
0x02 BME280_STANDBY_TIME_125_MS
0x03 BME280_STANDBY_TIME_250_MS
0x04 BME280_STANDBY_TIME_500_MS
0x05 BME280_STANDBY_TIME_1000_MS
0x06 BME280_STANDBY_TIME_2000_MS
0x07 BME280_STANDBY_TIME_4000_MS
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 BME280_STANDBY_TIME_125_MS.
Usage Hint : bme280_set_standby_durn(BME280_STANDBY_TIME_125_MS)
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

BME280_RETURN_FUNCTION_TYPE bme280_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

+ Here is the caller graph for this function:


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:42 by doxygen 1.8.8