k

Files at this revision

API Documentation at this revision

Comitter:
sbk
Date:
Fri Jul 30 11:11:40 2021 +0000
Parent:
2:c705222de18d
Commit message:
d

Changed in this revision

MPL3115.cpp Show annotated file Show diff for this revision Revisions of this file
MPL3115.h Show annotated file Show diff for this revision Revisions of this file
--- a/MPL3115.cpp	Wed Apr 26 00:10:29 2017 +0000
+++ b/MPL3115.cpp	Fri Jul 30 11:11:40 2021 +0000
@@ -29,7 +29,7 @@
  */
 
 #include "MPL3115.h"
- #include "mbed.h"
+#include "mbed.h"
 
 MPL3115::MPL3115(PinName sda, PinName scl) : MPL3115_i2c(sda,scl)
  {
@@ -51,16 +51,23 @@
  }
  
  
- 
- void MPL3115::acquire_MPL3115_data_Altitude_in_m(float * alt_data)
+ void MPL3115::acquire_MPL3115_data_Altitude_in_m(float * alt_data, float * temp_data, char * db)
+// void MPL3115::acquire_MPL3115_data_Altitude_in_m(float * alt_data)
  {
-  
    char data_bytes[7];
    char d[1];
    d[0]=MPL3115_STATUS;
    MPL3115_i2c.write(MPL3115_I2C_ADDRESS,d,1,true);  // Read the 6 data bytes - LSB and MSB for X, Y and Z Axes.
    MPL3115_i2c.read(MPL3115_I2C_ADDRESS,data_bytes,5);
+   db = data_bytes;
+//   printf("\n");
+//   for (int i=1; i<=3; i++)
+//   {
+//        printf("DBYTE:%.2f", (float)(short)data_bytes[i]);
+//   }
    alt_data[0]= (float)((short)((data_bytes[1] << 8 ) | data_bytes[2])) + (float)(data_bytes[3]>>4) * 0.0625;
-  
-  
- }
\ No newline at end of file
+   temp_data[0] = ((float)((short) (data_bytes[4]))) + ((float) (data_bytes[5] >> 4)*0.0625);
+//   printf("\n");
+ }
+ 
+ 
\ No newline at end of file
--- a/MPL3115.h	Wed Apr 26 00:10:29 2017 +0000
+++ b/MPL3115.h	Fri Jul 30 11:11:40 2021 +0000
@@ -40,6 +40,11 @@
 #define MPL3115_CTRL_REG2 0x27
 #define MPL3115_WHO_AM_I_VALUE 0xC4
 
+#define MPL3115_OUT_T_MSB 0x04
+#define MPL3115_OUT_T_LSB 0x05
+#define MPL3115_BAR_IN_MSB 0x14
+#define MPL3115_BAR_IN_LSB 0x15
+
 class MPL3115
 {
     public:
@@ -48,7 +53,8 @@
       
     void MPL3115_config(void);
         
-    void acquire_MPL3115_data_Altitude_in_m(float * du);
+    void acquire_MPL3115_data_Altitude_in_m(float * du, float * te, char * db);
+//    void acquire_MPL3115_data_Altitude_in_m(float * du);
     
     private:
     I2C MPL3115_i2c;