Update oXs_out_frsky.cpp
[openXsensor.git] / openXsensor / oXs_bmp180.h
blob8118264239391ddb8eb659c9de36533af1a053a7
1 #ifndef OXS_BMP180_h
2 #define OXS_BMP180_h
5 #include "Arduino.h"
6 #include "oXs_config_basic.h"
7 #include "oXs_config_advanced.h"
8 #include "oXs_config_macros.h"
9 #include "I2C.h"
10 #include "oXs_ms5611.h"
12 #define BMP180_ADR 0x77 // I2C address of BMP180
14 /*=========================================================================
15 CALIBRATION DATA for BMP180
16 -----------------------------------------------------------------------*/
17 typedef struct
19 int16_t ac1;
20 int16_t ac2;
21 int16_t ac3;
22 uint16_t ac4;
23 uint16_t ac5;
24 uint16_t ac6;
25 int16_t b1;
26 int16_t b2;
27 int16_t mb;
28 int16_t mc;
29 int16_t md;
30 } bmp085_calib_data;
31 /*=========================================================================*/
33 class OXS_BMP180 {
34 public:
35 #ifdef DEBUG
36 OXS_BMP180( HardwareSerial &print);
37 #else
38 OXS_BMP180( void ) ;
39 #endif
40 VARIODATA varioData ;
41 void setup();
42 bool readSensor();
43 void resetValues();
45 private:
46 uint8_t _addr;
48 uint8_t errorI2C ; //error code returned by I2C::Write and I2C::Read; 0 = no error
49 bool errorCalibration ; // (true = error)
50 void SendCommand(byte command);
51 long getData(byte command, byte del);
52 void calculateVario() ;
53 unsigned int low, high;
54 int32_t D1 ;
55 int32_t D2 ;
56 int32_t D2Prev ;
57 int32_t D2Apply ;
58 int64_t dT ;
59 int32_t TEMP ;
60 int64_t OFF, SENS;
61 int16_t alt_temp_compensation ;
63 int32_t altitude ; // in cm * 100
64 int32_t altitudeLowPass ;
65 int32_t altitudeHighPass ;
66 int sensitivityMin ;
69 unsigned long extended2Micros ; // used to temporarilly save micros() >> 1
70 unsigned long pressureMicros ; // save time when program send command asking the MS5611 to get the pressure
71 unsigned long pressureMicrosPrev1 ; // save the previous pressureMicros
72 unsigned long pressureMicrosPrev2 ; // save the previous of the previous pressureMicros
73 unsigned long altMillis ;
74 unsigned long nextAltMillis ; // save when Altitude has to be calculated; altitude is available only after 3200 in order to get a stable value (less temperature drift)
75 unsigned long nextAverageAltMillis ; // save when AverageAltitude has to be calculated
77 float climbRate2AltFloat ;
78 float abs_deltaClimbRate ;
80 #ifdef DEBUG
81 HardwareSerial* printer;
82 #endif
83 }; // end class OXS_MS5611
85 #endif // OXS_BMP180