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
MPL3115A2.h
- Committer:
- pHysiX
- Date:
- 2014-05-02
- Revision:
- 1:8e57853ce55b
- Parent:
- 0:67dffed9369b
- Child:
- 3:fb9726aaa41d
File content as of revision 1:8e57853ce55b:
#include "mbed.h" #ifndef _MPL3115A2_H_ #define _MPL3115A2_H_ #define OFFSET 0x00 //Set for location this is the Altitude offset in meters #define SLAVE_ADDRESS 0xC0 #define STARTING_REGISTER 0x01 class MPL3115A2 { public: 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: 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