MAV'RIC
bmp085.h
1 /*
2  * bmp085.h
3  *
4  * Created: 12/03/2013 22:14:32
5  * Author: sfx
6  */
7 
8 
9 #ifndef BMP085_H_
10 #define BMP085_H_
11 
12 
13 #include "compiler.h"
14 
15 #define BARO_ALT_LPF 0.95
16 #define VARIO_LPF 0.95
17 
18 #define BMP085_SLAVE_ADDRESS 0x77 //
19 
20 #define BMP085_ULTRALOWPOWER 0
21 #define BMP085_STANDARD 1
22 #define BMP085_HIGHRES 2
23 #define BMP085_ULTRAHIGHRES 3
24 #define BMP085_CAL_AC1 0xAA // R Calibration data (16 bits)
25 #define BMP085_CAL_AC2 0xAC // R Calibration data (16 bits)
26 #define BMP085_CAL_AC3 0xAE // R Calibration data (16 bits)
27 #define BMP085_CAL_AC4 0xB0 // R Calibration data (16 bits)
28 #define BMP085_CAL_AC5 0xB2 // R Calibration data (16 bits)
29 #define BMP085_CAL_AC6 0xB4 // R Calibration data (16 bits)
30 #define BMP085_CAL_B1 0xB6 // R Calibration data (16 bits)
31 #define BMP085_CAL_B2 0xB8 // R Calibration data (16 bits)
32 #define BMP085_CAL_MB 0xBA // R Calibration data (16 bits)
33 #define BMP085_CAL_MC 0xBC // R Calibration data (16 bits)
34 #define BMP085_CAL_MD 0xBE // R Calibration data (16 bits)
35 
36 #define BMP085_CONTROL 0xF4
37 #define BMP085_TEMPDATA 0xF6
38 #define BMP085_PRESSUREDATA 0xF6
39 #define BMP085_READTEMPCMD 0x2E
40 #define BMP085_READPRESSURECMD 0x34
41 
42 #define BMP085_OVERSAMPLING_MODE BMP085_HIGHRES
43 
44 typedef enum bmp085_state_t{IDLE, GET_TEMP, GET_PRESSURE} bmp085_state_t;
45 
46 typedef struct{
47  uint8_t raw_pressure[3];
48  uint8_t raw_temperature[2];
49  float pressure;
50  float temperature;
51  float last_altitudes[3];
52  float altitude;
53  float altitude_offset;
54  float vario_vz;
55  uint32_t last_update;
56  uint32_t last_state_update;
57  bmp085_state_t state;
58  float dt;
59 } barometer_t;
60 
61 
62 void bmp085_init(void);
63 
64 void bmp085_init_slow(void);
65 
66 void bmp085_start_pressure_measurement(void);
67 
68 barometer_t* bmp085_update(float offset);
69 
70 bool bmp085_new_valid_barometer(uint32_t *time_prev_barometer);
71 
72 #endif /* BMP085_H_ */
Define the barometer structure.
Definition: barometer.h:60