MPL3115A2 Fork
Fork of MPL3115A2 by
MPL3115A2.h@0:752c9dbed2fa, 2015-12-13 (annotated)
- Committer:
- Rhyme
- Date:
- Sun Dec 13 08:57:16 2015 +0000
- Revision:
- 0:752c9dbed2fa
- Child:
- 1:6fdcf150410e
commit before publishing
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 | 0:752c9dbed2fa | 33 | uint32_t getAltitude(void) ; /* x65536 */ |
Rhyme | 0:752c9dbed2fa | 34 | uint32_t getPressure(void) ; /* x64 */ |
Rhyme | 0:752c9dbed2fa | 35 | uint16_t getTemperature(void) ; /* x256 */ |
Rhyme | 0:752c9dbed2fa | 36 | int32_t getAltDelta(void) ; /* x65536 */ |
Rhyme | 0:752c9dbed2fa | 37 | int32_t getPrsDelta(void) ; /* x16 */ |
Rhyme | 0:752c9dbed2fa | 38 | int16_t getTempDelta(void) ; |
Rhyme | 0:752c9dbed2fa | 39 | uint8_t getID(void) ; |
Rhyme | 0:752c9dbed2fa | 40 | uint8_t getFstatus(void) ; |
Rhyme | 0:752c9dbed2fa | 41 | uint8_t getFdata(void) ; |
Rhyme | 0:752c9dbed2fa | 42 | uint8_t getFsetup(void) ; |
Rhyme | 0:752c9dbed2fa | 43 | void setFsetup(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 44 | uint8_t getTimeDelay(void) ; |
Rhyme | 0:752c9dbed2fa | 45 | uint8_t getSysMod(void) ; |
Rhyme | 0:752c9dbed2fa | 46 | uint8_t getIntSource(void) ; |
Rhyme | 0:752c9dbed2fa | 47 | uint8_t getPtDataConfig(void) ; |
Rhyme | 0:752c9dbed2fa | 48 | void setPtDataConfig(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 49 | uint16_t getBarIn(void) ; |
Rhyme | 0:752c9dbed2fa | 50 | void setBarIn(uint16_t data) ; |
Rhyme | 0:752c9dbed2fa | 51 | int16_t getP_TGT(void) ; |
Rhyme | 0:752c9dbed2fa | 52 | void setP_TGT(int16_t data) ; |
Rhyme | 0:752c9dbed2fa | 53 | int8_t getT_TGT(void) ; |
Rhyme | 0:752c9dbed2fa | 54 | void setT_TGT(int8_t data) ; |
Rhyme | 0:752c9dbed2fa | 55 | uint16_t getP_WND(void) ; |
Rhyme | 0:752c9dbed2fa | 56 | void setP_WND(uint16_t data) ; |
Rhyme | 0:752c9dbed2fa | 57 | uint8_t getT_WND(void) ; |
Rhyme | 0:752c9dbed2fa | 58 | void setT_WND(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 59 | int32_t getP_MIN(void) ; |
Rhyme | 0:752c9dbed2fa | 60 | void setT_MIN(int32_t data) ; |
Rhyme | 0:752c9dbed2fa | 61 | int32_t getP_MAX(void) ; |
Rhyme | 0:752c9dbed2fa | 62 | void setP_MAX(int32_t data) ; |
Rhyme | 0:752c9dbed2fa | 63 | int16_t getT_MIN(void) ; |
Rhyme | 0:752c9dbed2fa | 64 | void setT_MIN(int16_t data) ; |
Rhyme | 0:752c9dbed2fa | 65 | int16_t getT_MAX(void) ; |
Rhyme | 0:752c9dbed2fa | 66 | void setT_MAX(int16_t data) ; |
Rhyme | 0:752c9dbed2fa | 67 | uint8_t getCTRL_REG1(void) ; |
Rhyme | 0:752c9dbed2fa | 68 | void setCTRL_REG1(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 69 | uint8_t getCTRL_REG2(void) ; |
Rhyme | 0:752c9dbed2fa | 70 | void setCTRL_REG2(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 71 | uint8_t getCTRL_REG3(void) ; |
Rhyme | 0:752c9dbed2fa | 72 | void setCTRL_REG3(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 73 | uint8_t getCTRL_REG4(void) ; |
Rhyme | 0:752c9dbed2fa | 74 | void setCTRL_REG4(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 75 | uint8_t getCTRL_REG5(void) ; |
Rhyme | 0:752c9dbed2fa | 76 | void setCTRL_REG5(uint8_t data) ; |
Rhyme | 0:752c9dbed2fa | 77 | uint16_t OneShot(void) ; |
Rhyme | 0:752c9dbed2fa | 78 | void standby(void) ; |
Rhyme | 0:752c9dbed2fa | 79 | void activate(void) ; |
Rhyme | 0:752c9dbed2fa | 80 | void modeAlt(void) ; |
Rhyme | 0:752c9dbed2fa | 81 | void modeBar(void) ; |
Rhyme | 0:752c9dbed2fa | 82 | private: |
Rhyme | 0:752c9dbed2fa | 83 | I2C m_i2c; |
Rhyme | 0:752c9dbed2fa | 84 | int m_addr ; |
Rhyme | 0:752c9dbed2fa | 85 | void readRegs(int addr, uint8_t *data, int len) ; |
Rhyme | 0:752c9dbed2fa | 86 | void writeRegs(uint8_t *data, int len) ; |
Rhyme | 0:752c9dbed2fa | 87 | } ; |
Rhyme | 0:752c9dbed2fa | 88 | #endif /* MPL3115A2_H */ |