Library to control a BMP180 sensor.

BMP180 sensor

Revision:
1:608e890e88e7
Parent:
0:373de0f4d5cd
--- a/BMP180.cpp	Fri Aug 26 00:19:21 2016 +0000
+++ b/BMP180.cpp	Sun Aug 28 23:28:03 2016 +0000
@@ -38,12 +38,12 @@
 
     // Pre-calc
     ac1 = ac1 << 2;
-    mc  = mc  << 11;
+    mc  = (0xFFFF0000 | mc) << 11; // D1F6 << 11 == 0xFE8FB000 niet 0X68FB000
 
     return errors == 0; // 0 = ACK = success
 }
 
-int BMP180::ReadData(float& pTemperature, float& pPressure) {
+int BMP180::readData(float& pTemperature, float& pPressure) {
     long t, p;
 
     if (!ReadRawTemperature(&t) || !ReadRawPressure(&p))
@@ -104,12 +104,12 @@
 
 float BMP180::TrueTemperature(long ut) {
     // straight out from the documentation
+
     x1 = ((ut - ac6) * ac5) >> 15;
-    x2 = mc / (x1 + md);
-    b5 = x1 + x2;
+    b5 = x1 + (mc / (x1 + md));
 
     // convert to Celsius
-    return (long)((b5 + 8) >> 4) / 10.F;
+    return ((b5 + 8) >> 4) / 10.F;
 }
 
 float BMP180::TruePressure(long up) {