Go to the documentation of this file.00001
00002
00003
00004
00083 #ifndef __BMP085_H__
00084 #define __BMP085_H__
00085
00086
00087
00088 #define bmp085_calc_temperature(ut) bmp085_get_temperature(ut)
00089
00090 #define bmp085_calc_pressure(up) bmp085_get_pressure(up)
00091
00092 #define bmp085_read_ut() bmp085_get_ut()
00093
00094 #define bmp085_read_up() bmp085_get_up()
00095
00096 #define bmp085_read_reg(address, data, length) bmp085_get_reg(address, data, length)
00097
00098 #define bmp085_write_reg(address, data, length) bmp085_set_reg(address, data, length)
00099
00100 #define bmp085_read_cal_param() bmp085_get_cal_param()
00101
00102 #define smd500_read_cal_param() smd500_get_cal_param()
00103
00104
00114 #define BMP085_BUS_WR_RETURN_TYPE char
00115
00119 #define BMP085_BUS_WR_PARAM_TYPES unsigned char, unsigned char, unsigned char*, unsigned char
00120
00124 #define BMP085_BUS_WR_PARAM_ORDER device_addr, register_addr, register_data, write_length
00125
00126
00127
00128 #define BMP085_BUS_WRITE_FUNC(device_addr, register_addr, register_data, write_length) bus_write( device_addr, register_addr, register_data, write_length )
00129
00130
00131
00135 #define BMP085_BUS_RD_RETURN_TYPE char
00136
00140 #define BMP085_BUS_RD_PARAM_TYPES unsigned char, unsigned char, unsigned char*, unsigned char
00141
00145 #define BMP085_BUS_RD_PARAM_ORDER device_addr, register_addr, register_data, read_length
00146
00147
00148
00149 #define BMP085_BUS_READ_FUNC(device_addr, register_addr, register_data, read_length) bus_read( device_addr, register_addr, register_data, read_length )
00150
00151
00152
00153
00154
00155
00156
00157 #define BMP085_CHIP_ID 0x55
00158 #define BOSCH_PRESSURE_SMD500 05
00159 #define BOSCH_PRESSURE_BMP085 85
00160
00161
00162
00163
00164
00165 #define BMP085_I2C_ADDR (0xEE >> 1)
00166
00167
00168
00169
00170
00171 #define E_BMP_NULL_PTR (char)-127
00172 #define E_BMP_COMM_RES (char)-1
00173 #define E_BMP_OUT_OF_RANGE (char)-2
00174 #define E_SENSOR_NOT_DETECTED (char) 0
00175
00176
00177
00178
00179
00180
00181 #define BMP085_PROM_START__ADDR 0xAA
00182 #define BMP085_PROM_DATA__LEN 22
00183
00184 #define BMP085_CHIP_ID_REG 0xD0
00185 #define BMP085_VERSION_REG 0xD1
00186
00187 #define BMP085_CTRL_MEAS_REG 0xF4
00188 #define BMP085_ADC_OUT_MSB_REG 0xF6
00189 #define BMP085_ADC_OUT_LSB_REG 0xF7
00190
00191 #define BMP085_SOFT_RESET_REG 0xE0
00192
00193 #define BMP085_T_MEASURE 0x2E // temperature measurent
00194 #define BMP085_P_MEASURE 0x34 // pressure measurement
00195
00196 #define BMP085_TEMP_CONVERSION_TIME 5 // TO be spec'd by GL or SB
00197
00198
00199
00200 #define SMD500_PROM_START__ADDR 0xF8
00201 #define SMD500_PROM_DATA__LEN 8
00202
00203 #define SMD500_PARAM_M1 -2218 //calibration parameter
00204 #define SMD500_PARAM_M2 -457 //calibration parameter
00205 #define SMD500_PARAM_M3 -1984 //calibration parameter
00206 #define SMD500_PARAM_M4 8808 //calibration parameter
00207 #define SMD500_PARAM_M5 496 //calibration parameter
00208 #define SMD500_PARAM_M6 1415 //calibration parameter
00209
00210 #define SMD500_PARAM_MB -4955 //calibration parameter
00211 #define SMD500_PARAM_MC 11611 //calibration parameter
00212 #define SMD500_PARAM_MD -12166 //calibration parameter
00213 #define SMD500_PARAM_ME -17268 //calibration parameter
00214 #define SMD500_PARAM_MF -8970 //calibration parameter
00215
00216 #define SMD500_PARAM_MG 3038 //calibration parameter
00217 #define SMD500_PARAM_MH -7357 //calibration parameter
00218 #define SMD500_PARAM_MI 3791 //calibration parameter
00219 #define SMD500_PARAM_MJ 64385 //calibration parameter
00220
00221 #define SMD500_STANDBY 0 // set the device in stand-by modus to reduce power consumption
00222 #define SMD500_MASTERCLOCK_32768HZ 0x04 // external Master clock 32.768kHz
00223 #define SMD500_MASTERCLOCK_1MHZ 0 // external Master clock 1MHz
00224 #define SMD500_T_RESOLUTION_13BIT 0 // 13 Bit resolution temperature
00225 #define SMD500_T_RESOLUTION_16BIT 0x80 // 16 Bit resolution temperature
00226 #define SMD500_T_MEASURE 0x6A // temperature measurent
00227 #define SMD500_P_MEASURE 0xF0 // pressure measurement
00228
00229 #define SMD500_TEMP_CONVERSION_TIME_13 9
00230 #define SMD500_TEMP_CONVERSION_TIME_16 34
00231
00232
00233
00234
00235 #define BMP085_MDELAY_DATA_TYPE unsigned int
00236 #define BMP085_MDELAY_RETURN_TYPE void
00237
00240 typedef struct
00241 {
00242 short ac1;
00243 short ac2;
00244 short ac3;
00245 unsigned short ac4;
00246 unsigned short ac5;
00247 unsigned short ac6;
00248 short b1;
00249 short b2;
00250 short mb;
00251 short mc;
00252 short md;
00253 } bmp085_smd500_calibration_param_t;
00254
00255
00259 typedef struct
00260 {
00261 bmp085_smd500_calibration_param_t cal_param;
00262 unsigned char mode;
00263 unsigned char chip_id, ml_version, al_version;
00264 unsigned char dev_addr;
00265 unsigned char sensortype;
00266
00267 long param_b5;
00268 int number_of_samples;
00269 short oversampling_setting;
00270 short smd500_t_resolution, smd500_masterclock;
00271 BMP085_BUS_WR_RETURN_TYPE (*bus_write)( BMP085_BUS_WR_PARAM_TYPES );
00272 BMP085_BUS_RD_RETURN_TYPE (*bus_read)( BMP085_BUS_RD_PARAM_TYPES );
00273 BMP085_MDELAY_RETURN_TYPE (*delay_msec)( BMP085_MDELAY_DATA_TYPE );
00274 } bmp085_t;
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285 #define BMP085_CHIP_ID__POS 0
00286 #define BMP085_CHIP_ID__MSK 0xFF
00287 #define BMP085_CHIP_ID__LEN 8
00288 #define BMP085_CHIP_ID__REG BMP085_CHIP_ID_REG
00289
00290
00291 #define BMP085_ML_VERSION__POS 0
00292 #define BMP085_ML_VERSION__LEN 4
00293 #define BMP085_ML_VERSION__MSK 0x0F
00294 #define BMP085_ML_VERSION__REG BMP085_VERSION_REG
00295
00296
00297
00298 #define BMP085_AL_VERSION__POS 4
00299 #define BMP085_AL_VERSION__LEN 4
00300 #define BMP085_AL_VERSION__MSK 0xF0
00301 #define BMP085_AL_VERSION__REG BMP085_VERSION_REG
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313 #define BMP085_GET_BITSLICE(regvar, bitname) (regvar & bitname##__MSK) >> bitname##__POS
00314
00315
00316 #define BMP085_SET_BITSLICE(regvar, bitname, val) (regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK)
00317
00318
00319
00320
00321
00322
00330 int bmp085_init( bmp085_t* );
00331
00332
00333
00334
00335 short bmp085_get_temperature( unsigned long ut );
00336
00337
00338 long bmp085_get_pressure( unsigned long up );
00339
00340
00341
00342 unsigned short bmp085_get_ut( void );
00343 unsigned long bmp085_get_up( void );
00344
00345
00346
00347
00348
00349
00350
00351 char bmp085_get_reg( unsigned char , unsigned char*, unsigned char );
00352
00353
00354
00355 char bmp085_set_reg( unsigned char , unsigned char*, unsigned char );
00356
00357
00358
00359
00360
00361
00362 int bmp085_get_cal_param( void );
00363 int smd500_get_cal_param( void );
00364
00365
00366 #endif // __BMP085_H__
00367
00368
00369
00370
00371