EFR32 Mighty Gecko 1 Software Documentation
efr32mg1-doc-5.1.2
|
BMP280 Sensor Driver Support Header File.
mainpage
Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
File : bmp280.h
Date : 2016/07/01
Revision : 2.0.5(Pressure and Temperature compensation code revision is 1.1)
Usage: Sensor Driver for BMP280 sensor
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
The information provided is believed to be accurate and reliable. The copyright holder assumes no responsibility for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of the copyright holder.
Definition in file bmp280.h.
Go to the source code of this file.
Data Structures | |
struct | bmp280_calib_param_t |
This structure holds all device specific calibration parameters. More... | |
struct | bmp280_t |
This structure holds BMP280 initialization parameters. More... | |
Macros | |
#define | BMP280_64BITSUPPORT_PRESENT |
#define | MACHINE_32_BIT |
The following definition uses for define the data types. More... | |
ENABLE FLOATING OUTPUT | |
#define | BMP280_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 definition. | |
#define | BMP280_ENABLE_INT64 |
If the user wants to support 64 bit integer calculation (needed for optimal pressure accuracy) please set the following definition. If int64 calculation is not wanted (e.g. because it would include large libraries), please do not set the definition. | |
BUS READ AND WRITE FUNCTION POINTERS | |
#define | BMP280_BUS_WR_RETURN_TYPE s8 |
Define the calling convention of YOUR bus communication routine. More... | |
#define | BMP280_BUS_WR_PARAM_TYPES |
#define | BMP280_BUS_WR_PARAM_ORDER(device_addr, register_addr, register_data, wr_len) |
#define | BMP280_BUS_WRITE_FUNC(device_addr, register_addr, register_data, wr_len) |
#define | BMP280_BUS_RD_RETURN_TYPE s8 |
link macro between API function calls and bus read function More... | |
#define | BMP280_BUS_RD_PARAM_TYPES |
#define | BMP280_BUS_RD_PARAM_ORDER |
#define | BMP280_BUS_READ_FUNC(device_addr, register_addr, register_data, rd_len) |
#define | BMP280_WR_FUNC_PTR s8 (*bus_write)(u8, u8, u8 *, u8) |
#define | BMP280_RD_FUNC_PTR s8 (*bus_read)(u8, u8, u8 *, u8) |
#define | BMP280_MDELAY_DATA_TYPE u32 |
DELAY | |
#define | BMP280_DELAY_RETURN_TYPE void |
defines the return parameter type of the BMP280_DELAY_FUNCTION | |
#define | BMP280_DELAY_PARAM_TYPES u16 |
defines the calling parameter types of the BMP280_DELAY_FUNCTION | |
GET AND SET BITSLICE FUNCTIONS | |
#define | BMP280_DELAY_FUNC(delay_in_msec) delay_func(delay_in_msec) |
#define | BMP280_GET_BITSLICE(regvar, bitname) ((regvar & bitname##__MSK) >> bitname##__POS) |
#define | BMP280_SET_BITSLICE(regvar, bitname, val) ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK)) |
COMMON USED CONSTANTS | |
#define | BMP280_NULL (0) |
#define | BMP280_RETURN_FUNCTION_TYPE s8 |
#define | BMP280_SHIFT_BIT_POSITION_BY_01_BIT (1) |
#define | BMP280_SHIFT_BIT_POSITION_BY_02_BITS (2) |
#define | BMP280_SHIFT_BIT_POSITION_BY_03_BITS (3) |
#define | BMP280_SHIFT_BIT_POSITION_BY_04_BITS (4) |
#define | BMP280_SHIFT_BIT_POSITION_BY_05_BITS (5) |
#define | BMP280_SHIFT_BIT_POSITION_BY_08_BITS (8) |
#define | BMP280_SHIFT_BIT_POSITION_BY_11_BITS (11) |
#define | BMP280_SHIFT_BIT_POSITION_BY_12_BITS (12) |
#define | BMP280_SHIFT_BIT_POSITION_BY_13_BITS (13) |
#define | BMP280_SHIFT_BIT_POSITION_BY_14_BITS (14) |
#define | BMP280_SHIFT_BIT_POSITION_BY_15_BITS (15) |
#define | BMP280_SHIFT_BIT_POSITION_BY_16_BITS (16) |
#define | BMP280_SHIFT_BIT_POSITION_BY_17_BITS (17) |
#define | BMP280_SHIFT_BIT_POSITION_BY_18_BITS (18) |
#define | BMP280_SHIFT_BIT_POSITION_BY_19_BITS (19) |
#define | BMP280_SHIFT_BIT_POSITION_BY_25_BITS (25) |
#define | BMP280_SHIFT_BIT_POSITION_BY_31_BITS (31) |
#define | BMP280_SHIFT_BIT_POSITION_BY_33_BITS (33) |
#define | BMP280_SHIFT_BIT_POSITION_BY_35_BITS (35) |
#define | BMP280_SHIFT_BIT_POSITION_BY_47_BITS (47) |
#define | BMP280_PRESSURE_TEMPERATURE_CALIB_DATA_LENGTH (24) |
#define | BMP280_GEN_READ_WRITE_DATA_LENGTH (1) |
#define | BMP280_REGISTER_READ_DELAY (1) |
#define | BMP280_TEMPERATURE_DATA_LENGTH (3) |
#define | BMP280_PRESSURE_DATA_LENGTH (3) |
#define | BMP280_ALL_DATA_FRAME_LENGTH (6) |
#define | BMP280_INIT_VALUE (0) |
#define | BMP280_CHIP_ID_READ_COUNT (5) |
#define | BMP280_CHIP_ID_READ_SUCCESS (0) |
#define | BMP280_CHIP_ID_READ_FAIL ((s8)-1) |
#define | BMP280_INVALID_DATA (0) |
ERROR CODES | |
#define | SUCCESS ((u8)0) |
#define | E_BMP280_NULL_PTR ((s8)-127) |
#define | E_BMP280_COMM_RES ((s8)-1) |
#define | E_BMP280_OUT_OF_RANGE ((s8)-2) |
#define | ERROR ((s8)-1) |
CHIP ID DEFINITION | |
#define | BMP280_CHIP_ID1 (0x56) |
#define | BMP280_CHIP_ID2 (0x57) |
#define | BMP280_CHIP_ID3 (0x58) |
I2C ADDRESS DEFINITION | |
#define | BMP280_I2C_ADDRESS1 (0x76) |
#define | BMP280_I2C_ADDRESS2 (0x77) |
POWER MODE DEFINITION | |
#define | BMP280_SLEEP_MODE (0x00) |
#define | BMP280_FORCED_MODE (0x01) |
#define | BMP280_NORMAL_MODE (0x03) |
#define | BMP280_SOFT_RESET_CODE (0xB6) |
STANDBY TIME DEFINITION | |
#define | BMP280_STANDBY_TIME_1_MS (0x00) |
#define | BMP280_STANDBY_TIME_63_MS (0x01) |
#define | BMP280_STANDBY_TIME_125_MS (0x02) |
#define | BMP280_STANDBY_TIME_250_MS (0x03) |
#define | BMP280_STANDBY_TIME_500_MS (0x04) |
#define | BMP280_STANDBY_TIME_1000_MS (0x05) |
#define | BMP280_STANDBY_TIME_2000_MS (0x06) |
#define | BMP280_STANDBY_TIME_4000_MS (0x07) |
OVERSAMPLING DEFINITION | |
#define | BMP280_OVERSAMP_SKIPPED (0x00) |
#define | BMP280_OVERSAMP_1X (0x01) |
#define | BMP280_OVERSAMP_2X (0x02) |
#define | BMP280_OVERSAMP_4X (0x03) |
#define | BMP280_OVERSAMP_8X (0x04) |
#define | BMP280_OVERSAMP_16X (0x05) |
WORKING MODE DEFINITION | |
#define | BMP280_ULTRA_LOW_POWER_MODE (0x00) |
#define | BMP280_LOW_POWER_MODE (0x01) |
#define | BMP280_STANDARD_RESOLUTION_MODE (0x02) |
#define | BMP280_HIGH_RESOLUTION_MODE (0x03) |
#define | BMP280_ULTRA_HIGH_RESOLUTION_MODE (0x04) |
#define | BMP280_ULTRALOWPOWER_OVERSAMP_PRESSURE BMP280_OVERSAMP_1X |
#define | BMP280_ULTRALOWPOWER_OVERSAMP_TEMPERATURE BMP280_OVERSAMP_1X |
#define | BMP280_LOWPOWER_OVERSAMP_PRESSURE BMP280_OVERSAMP_2X |
#define | BMP280_LOWPOWER_OVERSAMP_TEMPERATURE BMP280_OVERSAMP_1X |
#define | BMP280_STANDARDRESOLUTION_OVERSAMP_PRESSURE BMP280_OVERSAMP_4X |
#define | BMP280_STANDARDRESOLUTION_OVERSAMP_TEMPERATURE BMP280_OVERSAMP_1X |
#define | BMP280_HIGHRESOLUTION_OVERSAMP_PRESSURE BMP280_OVERSAMP_8X |
#define | BMP280_HIGHRESOLUTION_OVERSAMP_TEMPERATURE BMP280_OVERSAMP_1X |
#define | BMP280_ULTRAHIGHRESOLUTION_OVERSAMP_PRESSURE BMP280_OVERSAMP_16X |
#define | BMP280_ULTRAHIGHRESOLUTION_OVERSAMP_TEMPERATURE BMP280_OVERSAMP_2X |
FILTER DEFINITION | |
#define | BMP280_FILTER_COEFF_OFF (0x00) |
#define | BMP280_FILTER_COEFF_2 (0x01) |
#define | BMP280_FILTER_COEFF_4 (0x02) |
#define | BMP280_FILTER_COEFF_8 (0x03) |
#define | BMP280_FILTER_COEFF_16 (0x04) |
DELAY TIME DEFINITION | |
#define | T_INIT_MAX (20) |
#define | T_MEASURE_PER_OSRS_MAX (37) |
#define | T_SETUP_PRESSURE_MAX (10) |
CALIBRATION PARAMETERS DEFINITION | |
#define | BMP280_TEMPERATURE_CALIB_DIG_T1_LSB_REG (0x88) |
#define | BMP280_TEMPERATURE_CALIB_DIG_T1_MSB_REG (0x89) |
#define | BMP280_TEMPERATURE_CALIB_DIG_T2_LSB_REG (0x8A) |
#define | BMP280_TEMPERATURE_CALIB_DIG_T2_MSB_REG (0x8B) |
#define | BMP280_TEMPERATURE_CALIB_DIG_T3_LSB_REG (0x8C) |
#define | BMP280_TEMPERATURE_CALIB_DIG_T3_MSB_REG (0x8D) |
#define | BMP280_PRESSURE_CALIB_DIG_P1_LSB_REG (0x8E) |
#define | BMP280_PRESSURE_CALIB_DIG_P1_MSB_REG (0x8F) |
#define | BMP280_PRESSURE_CALIB_DIG_P2_LSB_REG (0x90) |
#define | BMP280_PRESSURE_CALIB_DIG_P2_MSB_REG (0x91) |
#define | BMP280_PRESSURE_CALIB_DIG_P3_LSB_REG (0x92) |
#define | BMP280_PRESSURE_CALIB_DIG_P3_MSB_REG (0x93) |
#define | BMP280_PRESSURE_CALIB_DIG_P4_LSB_REG (0x94) |
#define | BMP280_PRESSURE_CALIB_DIG_P4_MSB_REG (0x95) |
#define | BMP280_PRESSURE_CALIB_DIG_P5_LSB_REG (0x96) |
#define | BMP280_PRESSURE_CALIB_DIG_P5_MSB_REG (0x97) |
#define | BMP280_PRESSURE_CALIB_DIG_P6_LSB_REG (0x98) |
#define | BMP280_PRESSURE_CALIB_DIG_P6_MSB_REG (0x99) |
#define | BMP280_PRESSURE_CALIB_DIG_P7_LSB_REG (0x9A) |
#define | BMP280_PRESSURE_CALIB_DIG_P7_MSB_REG (0x9B) |
#define | BMP280_PRESSURE_CALIB_DIG_P8_LSB_REG (0x9C) |
#define | BMP280_PRESSURE_CALIB_DIG_P8_MSB_REG (0x9D) |
#define | BMP280_PRESSURE_CALIB_DIG_P9_LSB_REG (0x9E) |
#define | BMP280_PRESSURE_CALIB_DIG_P9_MSB_REG (0x9F) |
REGISTER ADDRESS DEFINITION | |
#define | BMP280_CHIP_ID_REG (0xD0) /*Chip ID Register */ |
#define | BMP280_RST_REG (0xE0) /*Softreset Register */ |
#define | BMP280_STAT_REG (0xF3) /*Status Register */ |
#define | BMP280_CTRL_MEAS_REG (0xF4) /*Ctrl Measure Register */ |
#define | BMP280_CONFIG_REG (0xF5) /*Configuration Register */ |
#define | BMP280_PRESSURE_MSB_REG (0xF7) /*Pressure MSB Register */ |
#define | BMP280_PRESSURE_LSB_REG (0xF8) /*Pressure LSB Register */ |
#define | BMP280_PRESSURE_XLSB_REG (0xF9) /*Pressure XLSB Register */ |
#define | BMP280_TEMPERATURE_MSB_REG (0xFA) /*Temperature MSB Reg */ |
#define | BMP280_TEMPERATURE_LSB_REG (0xFB) /*Temperature LSB Reg */ |
#define | BMP280_TEMPERATURE_XLSB_REG (0xFC) /*Temperature XLSB Reg */ |
BIT LENGTH,POSITION AND MASK DEFINITION | |
FOR PRESSURE AND TEMPERATURE DATA REGISTERS | |
#define | BMP280_STATUS_REG_MEASURING__POS (3) |
#define | BMP280_STATUS_REG_MEASURING__MSK (0x08) |
#define | BMP280_STATUS_REG_MEASURING__LEN (1) |
#define | BMP280_STATUS_REG_MEASURING__REG (BMP280_STAT_REG) |
#define | BMP280_STATUS_REG_IM_UPDATE__POS (0) |
#define | BMP280_STATUS_REG_IM_UPDATE__MSK (0x01) |
#define | BMP280_STATUS_REG_IM_UPDATE__LEN (1) |
#define | BMP280_STATUS_REG_IM_UPDATE__REG (BMP280_STAT_REG) |
#define | BMP280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__POS (5) |
#define | BMP280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__MSK (0xE0) |
#define | BMP280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__LEN (3) |
#define | BMP280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__REG (BMP280_CTRL_MEAS_REG) |
#define | BMP280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__POS (2) |
#define | BMP280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__MSK (0x1C) |
#define | BMP280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__LEN (3) |
#define | BMP280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__REG (BMP280_CTRL_MEAS_REG) |
#define | BMP280_CTRL_MEAS_REG_POWER_MODE__POS (0) |
#define | BMP280_CTRL_MEAS_REG_POWER_MODE__MSK (0x03) |
#define | BMP280_CTRL_MEAS_REG_POWER_MODE__LEN (2) |
#define | BMP280_CTRL_MEAS_REG_POWER_MODE__REG (BMP280_CTRL_MEAS_REG) |
#define | BMP280_CONFIG_REG_STANDBY_DURN__POS (5) |
#define | BMP280_CONFIG_REG_STANDBY_DURN__MSK (0xE0) |
#define | BMP280_CONFIG_REG_STANDBY_DURN__LEN (3) |
#define | BMP280_CONFIG_REG_STANDBY_DURN__REG (BMP280_CONFIG_REG) |
#define | BMP280_CONFIG_REG_FILTER__POS (2) |
#define | BMP280_CONFIG_REG_FILTER__MSK (0x1C) |
#define | BMP280_CONFIG_REG_FILTER__LEN (3) |
#define | BMP280_CONFIG_REG_FILTER__REG (BMP280_CONFIG_REG) |
#define | BMP280_CONFIG_REG_SPI3_ENABLE__POS (0) |
#define | BMP280_CONFIG_REG_SPI3_ENABLE__MSK (0x01) |
#define | BMP280_CONFIG_REG_SPI3_ENABLE__LEN (1) |
#define | BMP280_CONFIG_REG_SPI3_ENABLE__REG (BMP280_CONFIG_REG) |
#define | BMP280_PRESSURE_XLSB_REG_DATA__POS (4) |
#define | BMP280_PRESSURE_XLSB_REG_DATA__MSK (0xF0) |
#define | BMP280_PRESSURE_XLSB_REG_DATA__LEN (4) |
#define | BMP280_PRESSURE_XLSB_REG_DATA__REG (BMP280_PRESSURE_XLSB_REG) |
#define | BMP280_TEMPERATURE_XLSB_REG_DATA__POS (4) |
#define | BMP280_TEMPERATURE_XLSB_REG_DATA__MSK (0xF0) |
#define | BMP280_TEMPERATURE_XLSB_REG_DATA__LEN (4) |
#define | BMP280_TEMPERATURE_XLSB_REG_DATA__REG (BMP280_TEMPERATURE_XLSB_REG) |
DEFINITIONS FOR ARRAY SIZE OF DATA | |
#define | BMP280_TEMPERATURE_DATA_SIZE (3) |
#define | BMP280_PRESSURE_DATA_SIZE (3) |
#define | BMP280_DATA_FRAME_SIZE (6) |
#define | BMP280_CALIB_DATA_SIZE (24) |
#define | BMP280_TEMPERATURE_MSB_DATA (0) |
#define | BMP280_TEMPERATURE_LSB_DATA (1) |
#define | BMP280_TEMPERATURE_XLSB_DATA (2) |
#define | BMP280_PRESSURE_MSB_DATA (0) |
#define | BMP280_PRESSURE_LSB_DATA (1) |
#define | BMP280_PRESSURE_XLSB_DATA (2) |
#define | BMP280_DATA_FRAME_PRESSURE_MSB_BYTE (0) |
#define | BMP280_DATA_FRAME_PRESSURE_LSB_BYTE (1) |
#define | BMP280_DATA_FRAME_PRESSURE_XLSB_BYTE (2) |
#define | BMP280_DATA_FRAME_TEMPERATURE_MSB_BYTE (3) |
#define | BMP280_DATA_FRAME_TEMPERATURE_LSB_BYTE (4) |
#define | BMP280_DATA_FRAME_TEMPERATURE_XLSB_BYTE (5) |
ARRAY PARAMETER FOR CALIBRATION | |
#define | BMP280_TEMPERATURE_CALIB_DIG_T1_LSB (0) |
#define | BMP280_TEMPERATURE_CALIB_DIG_T1_MSB (1) |
#define | BMP280_TEMPERATURE_CALIB_DIG_T2_LSB (2) |
#define | BMP280_TEMPERATURE_CALIB_DIG_T2_MSB (3) |
#define | BMP280_TEMPERATURE_CALIB_DIG_T3_LSB (4) |
#define | BMP280_TEMPERATURE_CALIB_DIG_T3_MSB (5) |
#define | BMP280_PRESSURE_CALIB_DIG_P1_LSB (6) |
#define | BMP280_PRESSURE_CALIB_DIG_P1_MSB (7) |
#define | BMP280_PRESSURE_CALIB_DIG_P2_LSB (8) |
#define | BMP280_PRESSURE_CALIB_DIG_P2_MSB (9) |
#define | BMP280_PRESSURE_CALIB_DIG_P3_LSB (10) |
#define | BMP280_PRESSURE_CALIB_DIG_P3_MSB (11) |
#define | BMP280_PRESSURE_CALIB_DIG_P4_LSB (12) |
#define | BMP280_PRESSURE_CALIB_DIG_P4_MSB (13) |
#define | BMP280_PRESSURE_CALIB_DIG_P5_LSB (14) |
#define | BMP280_PRESSURE_CALIB_DIG_P5_MSB (15) |
#define | BMP280_PRESSURE_CALIB_DIG_P6_LSB (16) |
#define | BMP280_PRESSURE_CALIB_DIG_P6_MSB (17) |
#define | BMP280_PRESSURE_CALIB_DIG_P7_LSB (18) |
#define | BMP280_PRESSURE_CALIB_DIG_P7_MSB (19) |
#define | BMP280_PRESSURE_CALIB_DIG_P8_LSB (20) |
#define | BMP280_PRESSURE_CALIB_DIG_P8_MSB (21) |
#define | BMP280_PRESSURE_CALIB_DIG_P9_LSB (22) |
#define | BMP280_PRESSURE_CALIB_DIG_P9_MSB (23) |
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 | |
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... | |
FUNCTION FOR READ UNCOMPENSATED 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. More... | |
FUNCTION FOR READ TRUE TEMPERATURE S32 OUTPUT | |
s32 | bmp280_compensate_temperature_int32 (s32 v_uncomp_temperature_s32) |
Reads actual temperature from uncompensated temperature. More... | |
FUNCTION FOR READ UNCOMPENSATED PRESSURE | |
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... | |
FUNCTION FOR READ TRUE PRESSURE S32 OUTPUT | |
u32 | bmp280_compensate_pressure_int32 (s32 v_uncomp_pressure_s32) |
Reads actual pressure from uncompensated pressure and returns the value in Pascal(Pa) More... | |
FUNCTION FOR READ UNCOMPENSATED TEMPERATURE AND PRESSURE | |
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... | |
FUNCTION FOR READ TRUE TEMPERATURE AND PRESSURE | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_read_pressure_temperature (u32 *v_pressure_u32, s32 *v_pressure_s32) |
This API reads the true pressure and temperature. More... | |
FUNCTION FOR READ CALIBRATION DATA | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_get_calib_param (void) |
This API is used to calibration parameters used for calculation in the registers. More... | |
FUNCTION FOR OVERSAMPLING TEMPERATURE AND 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. 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_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_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 POWER MODE | |
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_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 | |
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... | |
FUNCTION FOR SPI ENABLE | |
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_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 SETTING | |
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_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 | |
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_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... | |
FUNCTION FOR WORK MODE | |
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... | |
FUNCTION FOR FORCE MODE READING | |
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... | |
FUNCTION FOR COMMON READ AND WRITE | |
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... | |
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... | |
FUNCTION FOR TRUE TEMPERATURE CALCULATION | |
double | bmp280_compensate_temperature_double (s32 v_uncomp_temperature_s32) |
This API used to read actual temperature from uncompensated temperature. More... | |
FUNCTION FOR TRUE PRESSURE CALCULATION | |
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_int64 (s32 v_uncomp_pressure_s32) |
This API used to read actual pressure from uncompensated pressure. More... | |
FUNCTION FOR DELAY CALCULATION DURING FORCEMODE | |
BMP280_RETURN_FUNCTION_TYPE | bmp280_compute_wait_time (u8 *v_delaytime_u8r) |
Computing waiting time for sensor data read. More... | |
#define BMP280_BUS_RD_PARAM_ORDER |
#define BMP280_BUS_RD_PARAM_TYPES |
#define BMP280_BUS_RD_RETURN_TYPE s8 |
link macro between API function calls and bus read function
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.
BMP280_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 BMP280_WR_FUNC_PTR definition.
#define BMP280_BUS_READ_FUNC | ( | device_addr, | |
register_addr, | |||
register_data, | |||
rd_len | |||
) |
#define BMP280_BUS_WR_PARAM_TYPES |
#define BMP280_BUS_WR_RETURN_TYPE s8 |
Define the calling convention of YOUR bus communication routine.
If your communication function looks like this:
write_my_bus_xy(u8 device_addr, u8 register_addr, u8 * data, u8 length);
The BMP280_WR_FUNC_PTR would equal:
BMP280_WR_FUNC_PTR s8 (* bus_write)(u8, u8, u8 *, u8)
Parameters can be mixed as needed refer to the refer BMP280_BUS_WRITE_FUNC macro.
#define BMP280_BUS_WRITE_FUNC | ( | device_addr, | |
register_addr, | |||
register_data, | |||
wr_len | |||
) |
#define MACHINE_32_BIT |
The following definition uses for define the data types.
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
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.