BMP180 Pressure/Temperature Sensor library

Dependents:   frdm_mikroklimat Weather_Station WMG Sample_BMP180 ... more

Yet another BMP180 library!

Bosch BMP180 is a pressure and temperature sensor which can be addressed through an I2C interface.

This library is based on the Bosch documentation (/media/uploads/spiridion/bst-bmp180-ds000-09.pdf ) and has been tested on LPC1768 and FRM-KL25Z plateforms using the BMP180 Sparkfun breakout (https://www.sparkfun.com/products/11824).

Files at this revision

API Documentation at this revision

Comitter:
spiridion
Date:
Mon Mar 17 20:42:23 2014 +0000
Parent:
0:9a0671b6009f
Commit message:
remove calibration reading in constructor; and minor doc update

Changed in this revision

BMP180.cpp Show annotated file Show diff for this revision Revisions of this file
BMP180.h Show annotated file Show diff for this revision Revisions of this file
diff -r 9a0671b6009f -r 072073c79cfd BMP180.cpp
--- a/BMP180.cpp	Sat Mar 08 21:42:40 2014 +0000
+++ b/BMP180.cpp	Mon Mar 17 20:42:23 2014 +0000
@@ -11,7 +11,7 @@
   Released under the MIT License (see http://mbed.org/license/mit)
 
   Documentation regarding the BMP180 can be found here:
-                     ...............
+  http://mbed.org/media/uploads/spiridion/bst-bmp180-ds000-09.pdf
 */
 
 #include "BMP180.h"
@@ -24,13 +24,19 @@
 BMP180::BMP180(PinName sda, PinName scl, int address)
    : m_i2c(sda,scl), m_addr(address)
 {
-    Initialize();
+    m_altitude = 0;
+    m_oss = BMP180_OSS_NORMAL; 
+    m_temperature = UNSET_BMP180_TEMPERATURE_VALUE;
+    m_pressure = UNSET_BMP180_PRESSURE_VALUE;  
 }
 
 BMP180::BMP180(I2C& i2c, int address)
    : m_i2c(i2c), m_addr(address)
 {
-    Initialize();
+    m_altitude = 0;
+    m_oss = BMP180_OSS_NORMAL; 
+    m_temperature = UNSET_BMP180_TEMPERATURE_VALUE;
+    m_pressure = UNSET_BMP180_PRESSURE_VALUE;  
 }
 
 int  BMP180::Initialize(float altitude, int overSamplingSetting)
@@ -40,7 +46,6 @@
         
     m_altitude = altitude;
     m_oss = overSamplingSetting; 
-
     m_temperature = UNSET_BMP180_TEMPERATURE_VALUE;
     m_pressure = UNSET_BMP180_PRESSURE_VALUE;  
     
diff -r 9a0671b6009f -r 072073c79cfd BMP180.h
--- a/BMP180.h	Sat Mar 08 21:42:40 2014 +0000
+++ b/BMP180.h	Mon Mar 17 20:42:23 2014 +0000
@@ -11,7 +11,7 @@
   Released under the MIT License (see http://mbed.org/license/mit)
 
   Documentation regarding the BMP180 can be found here: 
-                     ...............
+  http://mbed.org/media/uploads/spiridion/bst-bmp180-ds000-09.pdf
 */
 
 #ifndef BMP180_H
@@ -52,9 +52,11 @@
  *     BMP180 bmp180(PIN_SDA, PIN_SCL);
  *     float pressure, temperature;
  *     
- *     bmp180.Initialize(64, BMP180_OSS_NORMAL); // 64m altitude compensation and normal oversampling
+ *     // bmp180.Initialize(); // no altitude compensation and normal oversampling 
+ *     bmp180.Initialize(64, BMP180_OSS_ULTRA_LOW_POWER); // 64m altitude compensation and low power oversampling
  *     
- *     while(1) {        
+ *     while(1) 
+ *     {        
  *         if (bmp180.ReadData(&pressure, &temperature))
  *             printf("Pressure(hPa): %8.2f \t Temperature(C): %8.2f\n", pressure, temperature);  
  *         wait(1);