LPS25H library

Dependents:   teensyIMU

Fork of LPS25H by yasuyuki onodera

Files at this revision

API Documentation at this revision

Comitter:
bclaus
Date:
Thu Oct 06 23:28:55 2016 +0000
Parent:
0:0d2babe81a04
Commit message:
functional;

Changed in this revision

LPS25H.cpp Show annotated file Show diff for this revision Revisions of this file
LPS25H.h Show annotated file Show diff for this revision Revisions of this file
diff -r 0d2babe81a04 -r 2a808d2d05ff LPS25H.cpp
--- a/LPS25H.cpp	Sun Oct 12 02:42:32 2014 +0000
+++ b/LPS25H.cpp	Thu Oct 06 23:28:55 2016 +0000
@@ -36,7 +36,7 @@
 
 }
 
-long LPS25H::pressure()
+void LPS25H::readPres()
 {
 
     // XL first and H last
@@ -49,14 +49,14 @@
     // get press_high
     get(LPS25H_PRESS_OUT_H);
     press.byte.UB=buf[0];
-    return press.Val;
+    presPa =  press.Val/40.96;
  
     // hPa = press.Val / 4096
     // Pa = press.Val / 40.96   
 }
 
 
-short LPS25H::temperature()
+void LPS25H::temperature()
 {
 
     // L first and H last
@@ -66,7 +66,7 @@
     // get press_high
     get(LPS25H_TEMP_OUT_H);
     temp.byte.HB=buf[0];
-    return temp.S;
+    tempC = 42.5 + temp.S/480;
  
     // C = 42.5 + temp.S / 480
     // range:0 to 80C
diff -r 0d2babe81a04 -r 2a808d2d05ff LPS25H.h
--- a/LPS25H.h	Sun Oct 12 02:42:32 2014 +0000
+++ b/LPS25H.h	Thu Oct 06 23:28:55 2016 +0000
@@ -8,7 +8,7 @@
 #ifndef LPS25H_H_
 #define LPS25H_H_
 
-#define LPS25H_ADDR                 0xB8
+#define LPS25H_ADDR                 0xBA
 #define LPS25H_REF_P_XL             0x08
 #define LPS25H_REF_P_L              0x09
 #define LPS25H_REF_P_H              0x0A
@@ -41,11 +41,13 @@
     LPS25H (PinName sda, PinName scl);
     LPS25H (I2C& p_i2c);
     void init();
+    float presPa;
+    float tempC;
 
     void put(unsigned char a, unsigned char b);
     void get(unsigned char a);
-    long pressure();
-    short temperature();
+    void readPres();
+    void temperature();
 
 protected: