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@0:67dffed9369b, 2013-08-16 (annotated)
- Committer:
- mr63
- Date:
- Fri Aug 16 13:18:19 2013 +0000
- Revision:
- 0:67dffed9369b
- Child:
- 1:8e57853ce55b
This is an Easy to use, easy to understand library to work with the MPL3115A2 Altitude/Pressure Sensor that can be purchased from Sparkfun.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mr63 | 0:67dffed9369b | 1 | #ifndef MBED_MPL3115A2_H |
mr63 | 0:67dffed9369b | 2 | #define MBED_MPL3115A2_H |
mr63 | 0:67dffed9369b | 3 | |
mr63 | 0:67dffed9369b | 4 | #include "mbed.h" |
mr63 | 0:67dffed9369b | 5 | |
mr63 | 0:67dffed9369b | 6 | #define OFFSET 63 //Set for location this is the Altitude offset in meters |
mr63 | 0:67dffed9369b | 7 | |
mr63 | 0:67dffed9369b | 8 | |
mr63 | 0:67dffed9369b | 9 | class MPL3115A2 { |
mr63 | 0:67dffed9369b | 10 | public: |
mr63 | 0:67dffed9369b | 11 | MPL3115A2(int SlaveAddress, PinName pin1, PinName pin2, PinName pin3, PinName pin4); |
mr63 | 0:67dffed9369b | 12 | int Write_Register (char regnum, char data); |
mr63 | 0:67dffed9369b | 13 | int Read_Altitude_Data(); |
mr63 | 0:67dffed9369b | 14 | bool get_int1 (); |
mr63 | 0:67dffed9369b | 15 | bool get_int2 (); |
mr63 | 0:67dffed9369b | 16 | float Temp_F (); |
mr63 | 0:67dffed9369b | 17 | float Temp_C (); |
mr63 | 0:67dffed9369b | 18 | float Altitude_ft (); |
mr63 | 0:67dffed9369b | 19 | float Altitude_m (); |
mr63 | 0:67dffed9369b | 20 | int Init (); |
mr63 | 0:67dffed9369b | 21 | |
mr63 | 0:67dffed9369b | 22 | |
mr63 | 0:67dffed9369b | 23 | private: |
mr63 | 0:67dffed9369b | 24 | I2C _i2c; |
mr63 | 0:67dffed9369b | 25 | DigitalIn _pin1; |
mr63 | 0:67dffed9369b | 26 | DigitalIn _pin2; |
mr63 | 0:67dffed9369b | 27 | |
mr63 | 0:67dffed9369b | 28 | }; |
mr63 | 0:67dffed9369b | 29 | |
mr63 | 0:67dffed9369b | 30 | |
mr63 | 0:67dffed9369b | 31 | #endif |