From 9a9b63259ac23bb82a4d4f062686ff5576cf294b Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 29 Nov 2011 20:33:53 -0800 Subject: [PATCH] AP_Baro_BMP085: implement AP_Baro interface --- libraries/AP_Baro/AP_Baro_BMP085.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/libraries/AP_Baro/AP_Baro_BMP085.cpp b/libraries/AP_Baro/AP_Baro_BMP085.cpp index 1a5ce7862c..26a906b6e7 100644 --- a/libraries/AP_Baro/AP_Baro_BMP085.cpp +++ b/libraries/AP_Baro/AP_Baro_BMP085.cpp @@ -55,7 +55,7 @@ extern "C" { // Public Methods ////////////////////////////////////////////////////////////// -bool AP_Baro_BMP085::Init(int initialiseWireLib, bool apm2_hardware) +bool AP_Baro_BMP085::init(int initialiseWireLib, bool apm2_hardware) { byte buff[22]; int i = 0; @@ -144,7 +144,7 @@ uint8_t AP_Baro_BMP085::Read() */ // Read the sensor. This is a state machine // We read one time Temperature (state=1) and then 4 times Pressure (states 2-5) -uint8_t AP_Baro_BMP085::Read() +uint8_t AP_Baro_BMP085::read() { uint8_t result = 0; @@ -166,6 +166,27 @@ uint8_t AP_Baro_BMP085::Read() return(result); } +int32_t AP_Baro_BMP085::get_pressure() { + return Press; +} + +int16_t AP_Baro_BMP085::get_temperature() { + return Temp; +} + +float AP_Baro_BMP085::get_altitude() { + return 0.0; // TODO +} + +int32_t AP_Baro_BMP085::get_raw_pressure() { + return RawPress; +} + +int32_t AP_Baro_BMP085::get_raw_temp() { + return RawTemp; +} + +// Private functions: ///////////////////////////////////////////////////////// // Send command to Read Pressure void AP_Baro_BMP085::Command_ReadPress()