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

Header file for all define constants and function prototypes. More...

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

Data Structures

struct  bmp180_calib_param_t
 This structure holds all device specific calibration parameters. More...
 
struct  bmp180_t
 This structure holds BMP180 initialization parameters. More...
 

Macros

#define MACHINE_32_BIT
 The following definition uses for define the data types. More...
 
FUNCTION DEFINITIONS
#define bmp180_calc_temperature(ut)   bmp180_get_temperature(ut)
 
#define bmp180_calc_pressure(up)   bmp180_get_pressure(up)
 
#define bmp180_read_ut()   bmp180_get_ut()
 
#define bmp180_read_up()   bmp180_get_up()
 
#define bmp180_read_cal_param()   bmp180_get_cal_param()
 
#define smd500_read_cal_param()   smd500_get_cal_param()
 
BUS READ AND WRITE FUNCTION
#define BMP180_BUS_WR_RETURN_TYPE   s8
 Define the calling convention of YOUR bus communication routine. More...
 
#define BMP180_BUS_WR_PARAM_TYPES
 
#define BMP180_BUS_WR_PARAM_ORDER
 
#define BMP180_BUS_WRITE_FUNC(device_addr, register_addr, register_data, write_length)   bus_write(device_addr, register_addr, register_data, write_length)
 
#define BMP180_BUS_RD_RETURN_TYPE   s8
 link macro between API function calls and bus read function More...
 
#define BMP180_BUS_RD_PARAM_TYPES
 
#define BMP180_BUS_RD_PARAM_ORDER
 
#define BMP180_BUS_READ_FUNC(device_addr, register_addr, register_data, read_length)   bus_read(device_addr, register_addr, register_data, read_length)
 
BUS READ AND WRITE FUNCTION POINTERS DEFINITIONS
#define BMP180_WR_FUNC_PTR   s8 (*bus_write)(u8, u8, u8 *, u8)
 
#define BMP180_RD_FUNC_PTR   s8 (*bus_read)(u8, u8, u8 *, u8)
 
#define BMP180_MDELAY_DATA_TYPE   u32
 
I2C ADDRESS DEFINITION OF BMP180
#define BMP180_I2C_ADDR   (0xEE>>1)
 
ERROR CODE DEFINITIONS
#define E_BMP_NULL_PTR   ((s8)-127)
 
#define E_BMP_COMM_RES   ((s8)-1)
 
#define E_BMP_OUT_OF_RANGE   ((s8)-2)
 
CONSTANTS
#define BMP180_RETURN_FUNCTION_TYPE   s8
 
#define BMP180_INIT_VALUE   ((u8)0)
 
#define BMP180_INITIALIZE_OVERSAMP_SETTING_U8X   ((u8)0)
 
#define BMP180_INITIALIZE_SW_OVERSAMP_U8X   ((u8)0)
 
#define BMP180_INITIALIZE_NUMBER_OF_SAMPLES_U8X   ((u8)1)
 
#define BMP180_GEN_READ_WRITE_DATA_LENGTH   ((u8)1)
 
#define BMP180_TEMPERATURE_DATA_LENGTH   ((u8)2)
 
#define BMP180_PRESSURE_DATA_LENGTH   ((u8)3)
 
#define BMP180_SW_OVERSAMP_U8X   ((u8)1)
 
#define BMP180_OVERSAMP_SETTING_U8X   ((u8)3)
 
#define BMP180_2MS_DELAY_U8X   (2)
 
#define BMP180_3MS_DELAY_U8X   (3)
 
#define BMP180_AVERAGE_U8X   (3)
 
#define BMP180_INVALID_DATA   (0)
 
#define BMP180_CHECK_DIVISOR   (0)
 
#define BMP180_DATA_MEASURE   (3)
 
#define BMP180_CALCULATE_TRUE_PRESSURE   (8)
 
#define BMP180_CALCULATE_TRUE_TEMPERATURE   (8)
 
#define BMP180_SHIFT_BIT_POSITION_BY_01_BIT   (1)
 
#define BMP180_SHIFT_BIT_POSITION_BY_02_BITS   (2)
 
#define BMP180_SHIFT_BIT_POSITION_BY_04_BITS   (4)
 
#define BMP180_SHIFT_BIT_POSITION_BY_06_BITS   (6)
 
#define BMP180_SHIFT_BIT_POSITION_BY_08_BITS   (8)
 
#define BMP180_SHIFT_BIT_POSITION_BY_11_BITS   (11)
 
#define BMP180_SHIFT_BIT_POSITION_BY_12_BITS   (12)
 
#define BMP180_SHIFT_BIT_POSITION_BY_13_BITS   (13)
 
#define BMP180_SHIFT_BIT_POSITION_BY_15_BITS   (15)
 
#define BMP180_SHIFT_BIT_POSITION_BY_16_BITS   (16)
 
REGISTER ADDRESS DEFINITION
#define BMP180_PROM_START__ADDR   (0xAA)
 
#define BMP180_PROM_DATA__LEN   (22)
 
#define BMP180_CHIP_ID_REG   (0xD0)
 
#define BMP180_VERSION_REG   (0xD1)
 
#define BMP180_CTRL_MEAS_REG   (0xF4)
 
#define BMP180_ADC_OUT_MSB_REG   (0xF6)
 
#define BMP180_ADC_OUT_LSB_REG   (0xF7)
 
#define BMP180_SOFT_RESET_REG   (0xE0)
 
#define BMP180_T_MEASURE   (0x2E)
 
#define BMP180_P_MEASURE   (0x34)
 
#define BMP180_TEMP_CONVERSION_TIME   (5)
 
#define BMP180_PARAM_MG   (3038)
 
#define BMP180_PARAM_MH   (-7357)
 
#define BMP180_PARAM_MI   (3791)
 
ARRAY SIZE DEFINITIONS
#define BMP180_TEMPERATURE_DATA_BYTES   (2)
 
#define BMP180_PRESSURE_DATA_BYTES   (3)
 
#define BMP180_TEMPERATURE_LSB_DATA   (1)
 
#define BMP180_TEMPERATURE_MSB_DATA   (0)
 
#define BMP180_PRESSURE_MSB_DATA   (0)
 
#define BMP180_PRESSURE_LSB_DATA   (1)
 
#define BMP180_PRESSURE_XLSB_DATA   (2)
 
#define BMP180_CALIB_DATA_SIZE   (22)
 
#define BMP180_CALIB_PARAM_AC1_MSB   (0)
 
#define BMP180_CALIB_PARAM_AC1_LSB   (1)
 
#define BMP180_CALIB_PARAM_AC2_MSB   (2)
 
#define BMP180_CALIB_PARAM_AC2_LSB   (3)
 
#define BMP180_CALIB_PARAM_AC3_MSB   (4)
 
#define BMP180_CALIB_PARAM_AC3_LSB   (5)
 
#define BMP180_CALIB_PARAM_AC4_MSB   (6)
 
#define BMP180_CALIB_PARAM_AC4_LSB   (7)
 
#define BMP180_CALIB_PARAM_AC5_MSB   (8)
 
#define BMP180_CALIB_PARAM_AC5_LSB   (9)
 
#define BMP180_CALIB_PARAM_AC6_MSB   (10)
 
#define BMP180_CALIB_PARAM_AC6_LSB   (11)
 
#define BMP180_CALIB_PARAM_B1_MSB   (12)
 
#define BMP180_CALIB_PARAM_B1_LSB   (13)
 
#define BMP180_CALIB_PARAM_B2_MSB   (14)
 
#define BMP180_CALIB_PARAM_B2_LSB   (15)
 
#define BMP180_CALIB_PARAM_MB_MSB   (16)
 
#define BMP180_CALIB_PARAM_MB_LSB   (17)
 
#define BMP180_CALIB_PARAM_MC_MSB   (18)
 
#define BMP180_CALIB_PARAM_MC_LSB   (19)
 
#define BMP180_CALIB_PARAM_MD_MSB   (20)
 
#define BMP180_CALIB_PARAM_MD_LSB   (21)
 
BIT MASK, LENGTH AND POSITION FOR

AL VERSION

#define BMP180_CHIP_ID__POS   (0)
 
#define BMP180_CHIP_ID__MSK   (0xFF)
 
#define BMP180_CHIP_ID__LEN   (8)
 
#define BMP180_CHIP_ID__REG   (BMP180_CHIP_ID_REG)
 
#define BMP180_ML_VERSION__POS   (0)
 
#define BMP180_ML_VERSION__LEN   (4)
 
#define BMP180_ML_VERSION__MSK   (0x0F)
 
#define BMP180_ML_VERSION__REG   (BMP180_VERSION_REG)
 
#define BMP180_AL_VERSION__POS   (4)
 
#define BMP180_AL_VERSION__LEN   (4)
 
#define BMP180_AL_VERSION__MSK   (0xF0)
 
#define BMP180_AL_VERSION__REG   (BMP180_VERSION_REG)
 
GET AND SET BITSLICE FUNCTIONS
#define BMP180_GET_BITSLICE(regvar, bitname)   ((regvar & bitname##__MSK) >> (bitname##__POS))
 
#define BMP180_SET_BITSLICE(regvar, bitname, val)   ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK))
 

Typedefs

typedef signed short int s16
 
typedef signed int s32
 
typedef signed long long int s64
 
typedef signed char s8
 If your machine support 16 bit define the MACHINE_16_BIT. More...
 
typedef unsigned short int u16
 
typedef unsigned int u32
 
typedef unsigned long long int u64
 
typedef unsigned char u8
 

Functions

FUNCTION FOR INTIALIZATION
BMP180_RETURN_FUNCTION_TYPE bmp180_init (struct bmp180_t *bmp180)
 This function is used for initialize the bus read and bus write functions and assign the chip id and I2C address of the BMP180 chip id is read in the register 0xD0 bit from 0 to 7. More...
 
FUNCTION FOR TEMPERATURE AND PRESSURE READ
s16 bmp180_get_temperature (u32 v_uncomp_temperature_u32)
 this API is used to calculate the true temperature using the uncompensated temperature(ut) More...
 
s32 bmp180_get_pressure (u32 v_uncomp_pressure_u32)
 this API is used to calculate the true pressure using the uncompensated pressure(up) More...
 
FUNCTION FOR UNCOMPENSATED PRESSURE AND TEMPERATURE
u16 bmp180_get_uncomp_temperature (void)
 this API is used to read the uncompensated temperature(ut) from the register More...
 
u32 bmp180_get_uncomp_pressure (void)
 this API is used to read the uncompensated pressure(up) from the register More...
 
FUNCTION FOR CALIBRATION
BMP180_RETURN_FUNCTION_TYPE bmp180_get_calib_param (void)
 this function used for read the calibration parameter from the register More...
 

Macro Definition Documentation

#define BMP180_2MS_DELAY_U8X   (2)
#define BMP180_3MS_DELAY_U8X   (3)
#define BMP180_ADC_OUT_LSB_REG   (0xF7)
#define BMP180_ADC_OUT_MSB_REG   (0xF6)
#define BMP180_AL_VERSION__LEN   (4)
#define BMP180_AL_VERSION__MSK   (0xF0)
#define BMP180_AL_VERSION__POS   (4)
#define BMP180_AL_VERSION__REG   (BMP180_VERSION_REG)
#define BMP180_AVERAGE_U8X   (3)
#define BMP180_BUS_RD_PARAM_ORDER
Value:
(device_addr, \
register_addr, register_data, read_length)

links the order of parameters defined in BMP180_BUS_WR_PARAM_TYPE to function calls used inside the API

#define BMP180_BUS_RD_PARAM_TYPES
Value:
(u8,\
u8, u8 *, u8)
unsigned char u8
Definition: bmp180.h:191
unsigned char u8
Definition: bma2x2.h:192

defines the calling parameter types of the BMP180_WR_FUNCTION

#define BMP180_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.

BMP180_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 BMP180_WR_FUNC_PTR definition.

Note
: this macro also includes the "MSB='1' for reading BMP180 addresses.defines the return parameter type of the BMP180_WR_FUNCTION
#define BMP180_BUS_READ_FUNC (   device_addr,
  register_addr,
  register_data,
  read_length 
)    bus_read(device_addr, register_addr, register_data, read_length)
#define BMP180_BUS_WR_PARAM_ORDER
Value:
(device_addr, register_addr,\
register_data, write_length)

links the order of parameters defined in BMP180_BUS_WR_PARAM_TYPE to function calls used inside the API

#define BMP180_BUS_WR_PARAM_TYPES
Value:
u8 *, u8
unsigned char u8
Definition: bmp180.h:191
unsigned char u8
Definition: bma2x2.h:192

defines the calling parameter types of the BMP180_WR_FUNCTION

#define BMP180_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 BMP180_WR_FUNC_PTR would equal:

BMP180_WR_FUNC_PTR s8 (* bus_write)(u8, u8, u8 *, u8)

Parameters can be mixed as needed refer to the refer BMP180_BUS_WRITE_FUNC macro.

#define BMP180_BUS_WRITE_FUNC (   device_addr,
  register_addr,
  register_data,
  write_length 
)    bus_write(device_addr, register_addr, register_data, write_length)
#define bmp180_calc_pressure (   up)    bmp180_get_pressure(up)
#define bmp180_calc_temperature (   ut)    bmp180_get_temperature(ut)
#define BMP180_CALCULATE_TRUE_PRESSURE   (8)
#define BMP180_CALCULATE_TRUE_TEMPERATURE   (8)
#define BMP180_CALIB_DATA_SIZE   (22)
#define BMP180_CALIB_PARAM_AC1_LSB   (1)
#define BMP180_CALIB_PARAM_AC1_MSB   (0)
#define BMP180_CALIB_PARAM_AC2_LSB   (3)
#define BMP180_CALIB_PARAM_AC2_MSB   (2)
#define BMP180_CALIB_PARAM_AC3_LSB   (5)
#define BMP180_CALIB_PARAM_AC3_MSB   (4)
#define BMP180_CALIB_PARAM_AC4_LSB   (7)
#define BMP180_CALIB_PARAM_AC4_MSB   (6)
#define BMP180_CALIB_PARAM_AC5_LSB   (9)
#define BMP180_CALIB_PARAM_AC5_MSB   (8)
#define BMP180_CALIB_PARAM_AC6_LSB   (11)
#define BMP180_CALIB_PARAM_AC6_MSB   (10)
#define BMP180_CALIB_PARAM_B1_LSB   (13)
#define BMP180_CALIB_PARAM_B1_MSB   (12)
#define BMP180_CALIB_PARAM_B2_LSB   (15)
#define BMP180_CALIB_PARAM_B2_MSB   (14)
#define BMP180_CALIB_PARAM_MB_LSB   (17)
#define BMP180_CALIB_PARAM_MB_MSB   (16)
#define BMP180_CALIB_PARAM_MC_LSB   (19)
#define BMP180_CALIB_PARAM_MC_MSB   (18)
#define BMP180_CALIB_PARAM_MD_LSB   (21)
#define BMP180_CALIB_PARAM_MD_MSB   (20)
#define BMP180_CHECK_DIVISOR   (0)
#define BMP180_CHIP_ID__LEN   (8)
#define BMP180_CHIP_ID__MSK   (0xFF)
#define BMP180_CHIP_ID__POS   (0)
#define BMP180_CHIP_ID__REG   (BMP180_CHIP_ID_REG)
#define BMP180_CHIP_ID_REG   (0xD0)
#define BMP180_CTRL_MEAS_REG   (0xF4)
#define BMP180_DATA_MEASURE   (3)
#define BMP180_GEN_READ_WRITE_DATA_LENGTH   ((u8)1)
#define BMP180_GET_BITSLICE (   regvar,
  bitname 
)    ((regvar & bitname##__MSK) >> (bitname##__POS))
#define BMP180_I2C_ADDR   (0xEE>>1)
#define BMP180_INIT_VALUE   ((u8)0)
#define BMP180_INITIALIZE_NUMBER_OF_SAMPLES_U8X   ((u8)1)
#define BMP180_INITIALIZE_OVERSAMP_SETTING_U8X   ((u8)0)
#define BMP180_INITIALIZE_SW_OVERSAMP_U8X   ((u8)0)
#define BMP180_INVALID_DATA   (0)
#define BMP180_MDELAY_DATA_TYPE   u32
#define BMP180_ML_VERSION__LEN   (4)
#define BMP180_ML_VERSION__MSK   (0x0F)
#define BMP180_ML_VERSION__POS   (0)
#define BMP180_ML_VERSION__REG   (BMP180_VERSION_REG)
#define BMP180_OVERSAMP_SETTING_U8X   ((u8)3)
#define BMP180_P_MEASURE   (0x34)
#define BMP180_PARAM_MG   (3038)
#define BMP180_PARAM_MH   (-7357)
#define BMP180_PARAM_MI   (3791)
#define BMP180_PRESSURE_DATA_BYTES   (3)
#define BMP180_PRESSURE_DATA_LENGTH   ((u8)3)
#define BMP180_PRESSURE_LSB_DATA   (1)
#define BMP180_PRESSURE_MSB_DATA   (0)
#define BMP180_PRESSURE_XLSB_DATA   (2)
#define BMP180_PROM_DATA__LEN   (22)
#define BMP180_PROM_START__ADDR   (0xAA)
#define BMP180_RD_FUNC_PTR   s8 (*bus_read)(u8, u8, u8 *, u8)
#define bmp180_read_cal_param ( )    bmp180_get_cal_param()
#define bmp180_read_up ( )    bmp180_get_up()
#define bmp180_read_ut ( )    bmp180_get_ut()
#define BMP180_RETURN_FUNCTION_TYPE   s8
#define BMP180_SET_BITSLICE (   regvar,
  bitname,
  val 
)    ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK))
#define BMP180_SHIFT_BIT_POSITION_BY_01_BIT   (1)
#define BMP180_SHIFT_BIT_POSITION_BY_02_BITS   (2)
#define BMP180_SHIFT_BIT_POSITION_BY_04_BITS   (4)
#define BMP180_SHIFT_BIT_POSITION_BY_06_BITS   (6)
#define BMP180_SHIFT_BIT_POSITION_BY_08_BITS   (8)
#define BMP180_SHIFT_BIT_POSITION_BY_11_BITS   (11)
#define BMP180_SHIFT_BIT_POSITION_BY_12_BITS   (12)
#define BMP180_SHIFT_BIT_POSITION_BY_13_BITS   (13)
#define BMP180_SHIFT_BIT_POSITION_BY_15_BITS   (15)
#define BMP180_SHIFT_BIT_POSITION_BY_16_BITS   (16)
#define BMP180_SOFT_RESET_REG   (0xE0)
#define BMP180_SW_OVERSAMP_U8X   ((u8)1)
#define BMP180_T_MEASURE   (0x2E)
#define BMP180_TEMP_CONVERSION_TIME   (5)
#define BMP180_TEMPERATURE_DATA_BYTES   (2)
#define BMP180_TEMPERATURE_DATA_LENGTH   ((u8)2)
#define BMP180_TEMPERATURE_LSB_DATA   (1)
#define BMP180_TEMPERATURE_MSB_DATA   (0)
#define BMP180_VERSION_REG   (0xD1)
#define BMP180_WR_FUNC_PTR   s8 (*bus_write)(u8, u8, u8 *, u8)
#define E_BMP_COMM_RES   ((s8)-1)
#define E_BMP_NULL_PTR   ((s8)-127)
#define E_BMP_OUT_OF_RANGE   ((s8)-2)
#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 smd500_read_cal_param ( )    smd500_get_cal_param()

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

BMP180_RETURN_FUNCTION_TYPE bmp180_get_calib_param ( void  )
Parameter MSB LSB bit
AC1 0xAA 0xAB 0 to 7
AC2 0xAC 0xAD 0 to 7
AC3 0xAE 0xAF 0 to 7
AC4 0xB0 0xB1 0 to 7
AC5 0xB2 0xB3 0 to 7
AC6 0xB4 0xB5 0 to 7
B1 0xB6 0xB7 0 to 7
B2 0xB8 0xB9 0 to 7
MB 0xBA 0xBB 0 to 7
MC 0xBC 0xBD 0 to 7
MD 0xBE 0xBF 0 to 7
Returns
results of bus communication function
Return values
0-> Success
-1-> Error

+ Here is the caller graph for this function:

s32 bmp180_get_pressure ( u32  v_uncomp_pressure_u32)
Note
For reading the up data refer : bmp180_read_up()
Parameters
v_uncomp_pressure_u32the value of uncompensated pressure
Returns
Return the value of pressure in steps of 1.0 Pa
s16 bmp180_get_temperature ( u32  v_uncomp_temperature_u32)
Note
For reading the ut data refer : bmp180_read_ut()
Parameters
v_uncomp_temperature_u32the value of uncompensated temperature
Returns
Return the temperature in steps of 0.1 deg Celsius
u32 bmp180_get_uncomp_pressure ( void  )
Note
0xF6(MSB) bit from 0 to 7
0xF7(LSB) bit from 0 to 7
0xF8(LSB) bit from 3 to 7
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
u16 bmp180_get_uncomp_temperature ( void  )
Note
0xF6(MSB) bit from 0 to 7
0xF7(LSB) bit from 0 to 7
Returns
results of bus communication function
Return values
0-> Success
-1-> Error
BMP180_RETURN_FUNCTION_TYPE bmp180_init ( struct bmp180_t bmp180)
Parameters
bmp180structure pointer.
Note
While changing the parameter of the bmp180_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:


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