Llibrary for the WiGo MPL3115A2, I2C Precision Altimeter sensor.

Dependents:   KL25Z_Batt_Test WIGO_MPL3115A2 Multi-Sensor SPACEmk2 ... more

30/05/2013 Added and tested the data acquisition using Interrupt. Added code for Altimeter trigger Interrupt but not yet tested.

Very basic library. Under development. Need to add in order: 1. IRQ configuration. 2. FIFO mode configuration.

Revision:
8:89ed6aeb5dbb
Parent:
7:59e9ba115d0a
Child:
9:75a5960adf5c
--- a/MPL3115A2.cpp	Sun Aug 25 21:48:05 2013 +0000
+++ b/MPL3115A2.cpp	Sun Sep 22 07:04:14 2013 +0000
@@ -47,6 +47,8 @@
     MPL3115A2_usr2_fptr = NULL;
     MPL3115A2_Int1.fall( NULL);
     MPL3115A2_Int2.fall( NULL);
+    
+    Reset();
 }
 
 void MPL3115A2::Reset( void)
@@ -452,6 +454,36 @@
         return 0;        
 }
 
+void MPL3115A2::SetPressureOffset( char offset)
+{
+    unsigned char data [2] = {0x2b, offset};
+
+    Standby();
+    writeRegs(data,2);
+
+    Active(); 
+}
+
+void MPL3115A2::SetTemperatureOffset( char offset)
+{
+    unsigned char data [2] = {0x2c, offset};
+
+    Standby();
+    writeRegs(data,2);
+
+    Active(); 
+}
+
+void MPL3115A2::SetAltitudeOffset( char offset)
+{
+    unsigned char data [2] = {0x2d, offset};
+
+    Standby();
+    writeRegs(data,2);
+
+    Active(); 
+}
+
 void MPL3115A2::readRegs(int addr, uint8_t * data, int len) {
     char t[1] = {addr};
     m_i2c.write(m_addr, t, 1, true);