9 static const int32_t ALTITUDE_INVALID
= 0x7fffffff;
10 static const int32_t TEMPERATURE_INVALID
= 0x7fffffff;
11 static const uint32_t PRESSURE_INVALID
= 0xffffffff;
13 BaroBase() : m_initialized(false), m_altitudeHome(ALTITUDE_INVALID
) {}
15 virtual void initialize() = 0;
16 // Return expected duration of pressure measurement (ms)
17 virtual uint8_t getPressureDuration() = 0;
18 // Start reading pressure
19 virtual void startPressure() = 0;
20 // Get pressure result (deci-Pascals)
21 virtual uint32_t getPressure() = 0;
22 // Return expected duration of temperature measurement (ms)
23 virtual uint8_t getTemperatureDuration() = 0;
24 // Start reading temperature
25 virtual void startTemperature() = 0;
26 // Get temperature result (centiDegrees)
27 virtual int32_t getTemperature() = 0;
30 bool isInitialized() const { return m_initialized
; }
31 int32_t pressureToAltitude(uint32_t pressurePa
);
33 int32_t getAltitudeHome() const { return m_altitudeHome
; }
34 void setAltitudeHome(int32_t altitudeHome
) { m_altitudeHome
= altitudeHome
; }
37 int32_t m_altitudeHome
;
40 class BaroI2CBase
: public BaroBase
43 static uint8_t m_address
;
44 static void readRegister(uint8_t reg
, uint8_t *data
, size_t size
);
45 static void writeRegister(uint8_t reg
, uint8_t *data
, size_t size
);