Elevator Altimeter
Fork of MPL3115A2 by
MPL3115A2.h@1:6fdcf150410e, 2017-05-18 (annotated)
- Committer:
- Rhyme
- Date:
- Thu May 18 06:30:44 2017 +0000
- Revision:
- 1:6fdcf150410e
- Parent:
- 0:752c9dbed2fa
- Child:
- 3:481015dc6ba9
getAlt. getPres. getTemp. now return double values, as m, hPa, and C
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rhyme | 0:752c9dbed2fa | 1 | /* |
Rhyme | 0:752c9dbed2fa | 2 | * File description |
Rhyme | 0:752c9dbed2fa | 3 | * |
Rhyme | 0:752c9dbed2fa | 4 | */ |
Rhyme | 0:752c9dbed2fa | 5 | #ifndef MPL3115A2_H |
Rhyme | 0:752c9dbed2fa | 6 | #define MPL3115A2_H |
Rhyme | 0:752c9dbed2fa | 7 | |
Rhyme | 0:752c9dbed2fa | 8 | #include "mbed.h" |
Rhyme | 0:752c9dbed2fa | 9 | |
Rhyme | 0:752c9dbed2fa | 10 | /** |
Rhyme | 0:752c9dbed2fa | 11 | * MPL3115A2 I2C Precision Altimeter |
Rhyme | 0:752c9dbed2fa | 12 | * |
Rhyme | 0:752c9dbed2fa | 13 | */ |
Rhyme | 0:752c9dbed2fa | 14 | |
Rhyme | 0:752c9dbed2fa | 15 | class MPL3115A2 |
Rhyme | 0:752c9dbed2fa | 16 | { |
Rhyme | 0:752c9dbed2fa | 17 | public: |
Rhyme | 0:752c9dbed2fa | 18 | /** |
Rhyme | 0:752c9dbed2fa | 19 | * MPL3115A2 |
Rhyme | 0:752c9dbed2fa | 20 | * |
Rhyme | 0:752c9dbed2fa | 21 | * @param sda SDA pin |
Rhyme | 0:752c9dbed2fa | 22 | * @param scl SCL pin |
Rhyme | 0:752c9dbed2fa | 23 | * @param addr address of the I2C peripheral |
Rhyme | 0:752c9dbed2fa | 24 | */ |
Rhyme | 0:752c9dbed2fa | 25 | MPL3115A2(PinName sda, PinName scl, int addr) ; |
Rhyme | 0:752c9dbed2fa | 26 | |
Rhyme | 0:752c9dbed2fa | 27 | ~MPL3115A2() ; |
Rhyme | 0:752c9dbed2fa | 28 | |
Rhyme | 0:752c9dbed2fa | 29 | /* |
Rhyme | 0:752c9dbed2fa | 30 | * some member functions here) |
Rhyme | 0:752c9dbed2fa | 31 | */ |
Rhyme | 0:752c9dbed2fa | 32 | uint8_t getStatus(void) ; |
Rhyme | 1:6fdcf150410e | 33 | /** |
Rhyme | 1:6fdcf150410e | 34 | * get Altitude (m) |
Rhyme | 1:6fdcf150410e | 35 | * |
Rhyme | 1:6fdcf150410e | 36 | * @param none |
Rhyme | 1:6fdcf150410e | 37 | * @returns double altitude in meter |
Rhyme | 1:6fdcf150410e | 38 | */ |
Rhyme | 1:6fdcf150410e | 39 | double getAltitude(void) ; |
Rhyme | 1:6fdcf150410e | 40 | |
Rhyme | 1:6fdcf150410e | 41 | /** |
Rhyme | 1:6fdcf150410e | 42 | * get Pressure |
Rhyme | 1:6fdcf150410e | 43 | * |
Rhyme | 1:6fdcf150410e | 44 | * @param none |
Rhyme | 1:6fdcf150410e | 45 | * @returns double pressure in hPa |
Rhyme | 1:6fdcf150410e | 46 | */ |
Rhyme | 1:6fdcf150410e | 47 | double getPressure(void) ; |
Rhyme | 1:6fdcf150410e | 48 | |
Rhyme | 1:6fdcf150410e | 49 | /** |
Rhyme | 1:6fdcf150410e | 50 | * get Temperature |
Rhyme | 1:6fdcf150410e | 51 | * |
Rhyme | 1:6fdcf150410e | 52 | * @param none |
Rhyme | 1:6fdcf150410e | 53 | * @returns double temperature in degree Celsius |
Rhyme | 1:6fdcf150410e | 54 | */ |
Rhyme | 1:6fdcf150410e | 55 | double getTemperature(void) ; |
Rhyme | 1:6fdcf150410e | 56 | |
Rhyme | 0:752c9dbed2fa | 57 | int32_t getAltDelta(void) ; /* x65536 */ |
Rhyme | 0:752c9dbed2fa | 58 | int32_t getPrsDelta(void) ; /* x16 */ |
Rhyme | 0:752c9dbed2fa | 59 | int16_t getTempDelta(void) ; |
Rhyme | 0:752c9dbed2fa | 60 | uint8_t getID(void) ; |
Rhyme | 0:752c9dbed2fa | 61 | uint8_t getFstatus(void) ; |
Rhyme | 0:752c9dbed2fa | 62 | uint8_t getFdata(void) ; |
Rhyme | 0:752c9dbed2fa | 63 | uint8_t getFsetup(void) ; |
Rhyme | 0:752c9dbed2fa | 64 | void setFsetup(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 65 | uint8_t getTimeDelay(void) ; |
Rhyme | 0:752c9dbed2fa | 66 | uint8_t getSysMod(void) ; |
Rhyme | 0:752c9dbed2fa | 67 | uint8_t getIntSource(void) ; |
Rhyme | 0:752c9dbed2fa | 68 | uint8_t getPtDataConfig(void) ; |
Rhyme | 0:752c9dbed2fa | 69 | void setPtDataConfig(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 70 | uint16_t getBarIn(void) ; |
Rhyme | 0:752c9dbed2fa | 71 | void setBarIn(uint16_t data) ; |
Rhyme | 0:752c9dbed2fa | 72 | int16_t getP_TGT(void) ; |
Rhyme | 0:752c9dbed2fa | 73 | void setP_TGT(int16_t data) ; |
Rhyme | 0:752c9dbed2fa | 74 | int8_t getT_TGT(void) ; |
Rhyme | 0:752c9dbed2fa | 75 | void setT_TGT(int8_t data) ; |
Rhyme | 0:752c9dbed2fa | 76 | uint16_t getP_WND(void) ; |
Rhyme | 0:752c9dbed2fa | 77 | void setP_WND(uint16_t data) ; |
Rhyme | 0:752c9dbed2fa | 78 | uint8_t getT_WND(void) ; |
Rhyme | 0:752c9dbed2fa | 79 | void setT_WND(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 80 | int32_t getP_MIN(void) ; |
Rhyme | 0:752c9dbed2fa | 81 | void setT_MIN(int32_t data) ; |
Rhyme | 0:752c9dbed2fa | 82 | int32_t getP_MAX(void) ; |
Rhyme | 0:752c9dbed2fa | 83 | void setP_MAX(int32_t data) ; |
Rhyme | 0:752c9dbed2fa | 84 | int16_t getT_MIN(void) ; |
Rhyme | 0:752c9dbed2fa | 85 | void setT_MIN(int16_t data) ; |
Rhyme | 0:752c9dbed2fa | 86 | int16_t getT_MAX(void) ; |
Rhyme | 0:752c9dbed2fa | 87 | void setT_MAX(int16_t data) ; |
Rhyme | 0:752c9dbed2fa | 88 | uint8_t getCTRL_REG1(void) ; |
Rhyme | 0:752c9dbed2fa | 89 | void setCTRL_REG1(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 90 | uint8_t getCTRL_REG2(void) ; |
Rhyme | 0:752c9dbed2fa | 91 | void setCTRL_REG2(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 92 | uint8_t getCTRL_REG3(void) ; |
Rhyme | 0:752c9dbed2fa | 93 | void setCTRL_REG3(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 94 | uint8_t getCTRL_REG4(void) ; |
Rhyme | 0:752c9dbed2fa | 95 | void setCTRL_REG4(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 96 | uint8_t getCTRL_REG5(void) ; |
Rhyme | 0:752c9dbed2fa | 97 | void setCTRL_REG5(uint8_t data) ; |
Rhyme | 1:6fdcf150410e | 98 | uint16_t getSampleTime(void) ; |
Rhyme | 1:6fdcf150410e | 99 | void oneShot(void) ; |
Rhyme | 0:752c9dbed2fa | 100 | void standby(void) ; |
Rhyme | 0:752c9dbed2fa | 101 | void activate(void) ; |
Rhyme | 0:752c9dbed2fa | 102 | void modeAlt(void) ; |
Rhyme | 0:752c9dbed2fa | 103 | void modeBar(void) ; |
Rhyme | 0:752c9dbed2fa | 104 | private: |
Rhyme | 0:752c9dbed2fa | 105 | I2C m_i2c; |
Rhyme | 0:752c9dbed2fa | 106 | int m_addr ; |
Rhyme | 0:752c9dbed2fa | 107 | void readRegs(int addr, uint8_t *data, int len) ; |
Rhyme | 0:752c9dbed2fa | 108 | void writeRegs(uint8_t *data, int len) ; |
Rhyme | 0:752c9dbed2fa | 109 | } ; |
Rhyme | 0:752c9dbed2fa | 110 | #endif /* MPL3115A2_H */ |