Fork of original LPS331 library Changed the I2C address to 0xBA

Revision:
1:f70e671b008f
Parent:
0:ef4f624dc3ec
--- a/LPS331.cpp	Sat Oct 04 12:02:25 2014 +0000
+++ b/LPS331.cpp	Fri Oct 10 04:37:48 2014 +0000
@@ -39,22 +39,41 @@
 long LPS331::value()
 {
 
-    // get press_high
-    get(LPS331_PRESS_OUT_H);
-    //press=buf[0]*0x10000;
-    press.byte.UB=buf[0];
+    // XL first and H last
+    // get press_xl
+    get(LPS331_PRESS_POUT_XL_REH);
+    press.byte.LB=buf[0];
     // get tpress_low
     get(LPS331_PRESS_OUT_L);
-    //press+=buf[0]*0x100;
     press.byte.HB=buf[0];
-    // get press_xl
-    get(LPS331_PRESS_POUT_XL_REH);
-    //press+=buf[0];
-    press.byte.LB=buf[0];
+    // get press_high
+    get(LPS331_PRESS_OUT_H);
+    press.byte.UB=buf[0];
     return press.Val;
-    
+ 
+    // hPa = press.Val / 4096
+    // Pa = press.Val / 40.96   
 }
 
+
+short LPS331::temperature()
+{
+
+    // L first and H last
+    // get tpress_low
+    get(LPS331_TEMP_OUT_L);
+    temp.byte.LB=buf[0];
+    // get press_high
+    get(LPS331_TEMP_OUT_H);
+    temp.byte.HB=buf[0];
+    return temp.S;
+ 
+    // C = 42.5 + temp.S / 480
+    // range:0 to 80C
+    // accuracy:+-2C
+}
+
+
 void LPS331::init()
 {
     // Power ON Cycle=1Hz
@@ -62,3 +81,4 @@
 }
 
 
+