Fork from Mark Randall MPL3115A2 Altitude/Pressure Sensor. Changed to make it compatible with TiltyQuad TiltyIMU module. By Ian HUA 2014.

Fork of MPL3115A2 by Mark Randall

Revision:
1:8e57853ce55b
Parent:
0:67dffed9369b
Child:
3:fb9726aaa41d
diff -r 67dffed9369b -r 8e57853ce55b MPL3115A2.h
--- a/MPL3115A2.h	Fri Aug 16 13:18:19 2013 +0000
+++ b/MPL3115A2.h	Fri May 02 17:00:28 2014 +0000
@@ -1,31 +1,39 @@
-#ifndef MBED_MPL3115A2_H
-#define MBED_MPL3115A2_H
- 
 #include "mbed.h"
 
-#define OFFSET 63  //Set for location this is the Altitude offset in meters
+#ifndef _MPL3115A2_H_
+#define _MPL3115A2_H_
+
+#define OFFSET 0x00  //Set for location this is the Altitude offset in meters
 
- 
-class MPL3115A2 {
+#define SLAVE_ADDRESS 0xC0
+
+#define STARTING_REGISTER 0x01
+
+class MPL3115A2
+{
 public:
-    MPL3115A2(int SlaveAddress, PinName pin1, PinName pin2, PinName pin3, PinName pin4);
-	  int Write_Register (char regnum, char data);
-		int Read_Altitude_Data();
-		bool get_int1 ();
-		bool get_int2 ();
-	  float Temp_F ();
-	  float Temp_C ();
-	  float Altitude_ft ();
-	  float Altitude_m ();
-	  int   Init ();
-  
+    MPL3115A2(PinName pin1, PinName pin2);
+    //MPL3115A2(int SlaveAddress, PinName pin1, PinName pin2, PinName pin3, PinName pin4);
+    
+    bool   init (void);
+    
+    bool getInterrupt1(void);
+    bool getInterrupt2(void);
+    
+    float Temp_F(void);
+    float Temp_C(void);
+    
+    float Altitude_ft(void);
+    float Altitude_m(void);
 
 private:
-	I2C _i2c;	
-	DigitalIn _pin1;
-	DigitalIn _pin2;
-
+    int Write_Register (char regnum, char data);
+    int Read_Altitude_Data(void);
+    
+    char _SensorData[8];    //Char array that holds the current Altitude and Temperature data
+    
+    I2C _i2c;
+    //DigitalIn _pin1;
+    //DigitalIn _pin2;
 };
-
- 
 #endif