Adafruit MPL115A2 Library
Adafruit_MPL115A2.h
Go to the documentation of this file.
1 
5 #ifndef _ADAFRUIT_MPL115A2_H
6 #define _ADAFRUIT_MPL115A2_H
7 
8 #include "Arduino.h"
9 #include <Adafruit_I2CDevice.h>
10 #include <Wire.h>
11 
12 #define MPL115A2_DEFAULT_ADDRESS (0x60)
14 #define MPL115A2_REGISTER_PRESSURE_MSB \
15  (0x00)
16 #define MPL115A2_REGISTER_PRESSURE_LSB \
17  (0x01)
18 #define MPL115A2_REGISTER_TEMP_MSB \
19  (0x02)
20 #define MPL115A2_REGISTER_TEMP_LSB \
21  (0x03)
22 #define MPL115A2_REGISTER_A0_COEFF_MSB (0x04)
23 #define MPL115A2_REGISTER_A0_COEFF_LSB (0x05)
24 #define MPL115A2_REGISTER_B1_COEFF_MSB (0x06)
25 #define MPL115A2_REGISTER_B1_COEFF_LSB (0x07)
26 #define MPL115A2_REGISTER_B2_COEFF_MSB (0x08)
27 #define MPL115A2_REGISTER_B2_COEFF_LSB (0x09)
28 #define MPL115A2_REGISTER_C12_COEFF_MSB (0x0A)
29 #define MPL115A2_REGISTER_C12_COEFF_LSB (0x0B)
30 #define MPL115A2_REGISTER_STARTCONVERSION \
31  (0x12)
37 class Adafruit_MPL115A2 {
38 public:
40  bool begin();
41  bool begin(TwoWire *theWire);
42  bool begin(uint8_t addr);
43  bool begin(uint8_t addr, TwoWire *theWire);
44 
45  float getPressure();
46  float getTemperature();
47  void getPT(float *P, float *T);
48 
49 private:
50  Adafruit_I2CDevice *_i2c_dev = NULL;
51 
52  float _mpl115a2_a0;
53  float _mpl115a2_b1;
54  float _mpl115a2_b2;
55  float _mpl115a2_c12;
56 
57  void readCoefficients();
58 };
59 
60 #endif
Class that stores state and functions for interacting with MPL115A2 barometric pressure sensor...
Definition: Adafruit_MPL115A2.h:37