27 #include <mraa/i2c.hpp>
30 #define MPL3115A2_NAME "mpl3115a2"
32 #define MPL3115A2_I2C_ADDRESS 0x60
33 #define MPL3115A2_DEVICE_ID 0xc4
35 #define MPL3115A2_STATUS 0x00
36 #define MPL3115A2_OUT_PRESS 0x01
37 #define MPL3115A2_OUT_TEMP 0x04
38 #define MPL3115A2_WHO_AM_I 0x0c
39 #define MPL3115A2_PT_DATA_CFG 0x13
40 #define MPL3115A2_P_MIN 0x1C
41 #define MPL3115A2_T_MIN 0x1F
42 #define MPL3115A2_P_MAX 0x21
43 #define MPL3115A2_T_MAX 0x24
44 #define MPL3115A2_CTRL_REG1 0x26
47 #define MPL3115A2_CTRL_SBYB 0x01
48 #define MPL3115A2_CTRL_OST 0x02
49 #define MPL3115A2_CTRL_RESET 0x04
50 #define MPL3115A2_CTRL_ALT_MODE 0x80
52 #define MPL3115A2_SETOVERSAMPLE(a) ((a & 7) << 3)
53 #define MPL3115A2_GETOVERSAMPLE(a) ((a >> 3) & 7)
54 #define MPL3115A2_MAXOVERSAMPLE 7
91 MPL3115A2(
int bus,
int devAddr=MPL3115A2_I2C_ADDRESS, uint8_t mode=6);
169 float getAltitude (
float sealevelPressure = 101325.0);
227 mraa::Result
i2cWriteReg (uint8_t reg, uint8_t value);
248 mraa::I2c m_i2ControlCtx;
250 uint8_t m_oversampling;
252 int32_t m_iTemperature;
float getPressureMax(void)
Definition: mpl3115a2.cpp:267
int sampleData(void)
Definition: mpl3115a2.cpp:147
void setOversampling(uint8_t oversampling)
Definition: mpl3115a2.cpp:241
int32_t getTempReg(int reg)
Definition: mpl3115a2.cpp:190
float convertTempCtoF(float fTemp)
Definition: mpl3115a2.cpp:279
float getTemperatureMax(void)
Definition: mpl3115a2.cpp:255
API for the MPL3115A2 Atmospheric Pressure Sensor.
Definition: mpl3115a2.h:82
float getAltitude(float sealevelPressure=101325.0)
Definition: mpl3115a2.cpp:235
float getTemperature(int bSampleData=true)
Definition: mpl3115a2.cpp:212
int32_t getPressureReg(int reg)
Definition: mpl3115a2.cpp:185
uint8_t i2cReadReg_8(int reg)
Definition: mpl3115a2.cpp:323
float convertPaToinHg(float fPressure)
Definition: mpl3115a2.cpp:288
MPL3115A2(int bus, int devAddr=MPL3115A2_I2C_ADDRESS, uint8_t mode=6)
Definition: mpl3115a2.cpp:39
float getPressureMin(void)
Definition: mpl3115a2.cpp:273
int resetSensor(void)
Definition: mpl3115a2.cpp:135
mraa::Result i2cWriteReg(uint8_t reg, uint8_t value)
Definition: mpl3115a2.cpp:298
uint8_t getOversampling(void)
Definition: mpl3115a2.cpp:249
float getSealevelPressure(float altitudeMeters=0.0)
Definition: mpl3115a2.cpp:229
float getTemperatureMin(void)
Definition: mpl3115a2.cpp:261
int testSensor(void)
Definition: mpl3115a2.cpp:73
uint16_t i2cReadReg_16(int reg)
Definition: mpl3115a2.cpp:312
void dumpSensor(void)
Definition: mpl3115a2.cpp:114
float getPressure(int bSampleData=true)
Definition: mpl3115a2.cpp:195