Ian Hua / MPL3115A2

Fork of MPL3115A2 by Mark Randall

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MPL3115A2.h Source File

MPL3115A2.h

00001 #include "mbed.h"
00002 #include "I2CMasterRtos.h"
00003 
00004 #ifndef _MPL3115A2_H_
00005 #define _MPL3115A2_H_
00006 
00007 #define OFFSET 0x00  //Set for location this is the Altitude offset in meters
00008 
00009 #define SLAVE_ADDRESS 0xC0
00010 
00011 #define STARTING_REGISTER 0x01
00012 
00013 class MPL3115A2
00014 {
00015 public:
00016     MPL3115A2(PinName pin1, PinName pin2);
00017     //MPL3115A2(int SlaveAddress, PinName pin1, PinName pin2, PinName pin3, PinName pin4);
00018     
00019     bool   init (void);
00020     
00021     bool getInterrupt1(void);
00022     bool getInterrupt2(void);
00023     
00024     float Temp_F(void);
00025     float Temp_C(void);
00026     
00027     float Altitude_ft(void);
00028     float Altitude_m(void);
00029 
00030 private:
00031     int Write_Register (char regnum, char data);
00032     int Read_Altitude_Data(void);
00033     
00034     char _SensorData[8];    //Char array that holds the current Altitude and Temperature data
00035     
00036     I2CMasterRtos _i2c;
00037     //DigitalIn _pin1;
00038     //DigitalIn _pin2;
00039 };
00040 #endif