Release candidate version. The pointer in GAS Pressure display is changed to a triangle.
Dependencies: UniGraphic mbed vt100
Please note, at 2-Mar-2018 the current version of mbed-lib has a defect in Ticker.
https://os.mbed.com/forum/bugs-suggestions/topic/29287/
So, mbed lib version 157 is intentionally being used.
Please do not update mbed library until the problem in the above URL is fixed.
In this version, format of GAS Pressure Display has been changed.
moto
sensors/MMA8451Q.h@0:774324cbc5a6, 2018-03-02 (annotated)
- Committer:
- Rhyme
- Date:
- Fri Mar 02 07:56:09 2018 +0000
- Revision:
- 0:774324cbc5a6
Release candidate version. GAS Pressure pointer is now a triangle.; Some source file clean-up was done.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rhyme | 0:774324cbc5a6 | 1 | #ifndef _MMA8451Q_H_ |
Rhyme | 0:774324cbc5a6 | 2 | #define _MMA8451Q_H_ |
Rhyme | 0:774324cbc5a6 | 3 | |
Rhyme | 0:774324cbc5a6 | 4 | #include "mbed.h" |
Rhyme | 0:774324cbc5a6 | 5 | /** |
Rhyme | 0:774324cbc5a6 | 6 | * MMA8451Q 3-Axis, 14-bit/8-bit Digital Accelerometer |
Rhyme | 0:774324cbc5a6 | 7 | */ |
Rhyme | 0:774324cbc5a6 | 8 | |
Rhyme | 0:774324cbc5a6 | 9 | class MMA8451Q { |
Rhyme | 0:774324cbc5a6 | 10 | public: |
Rhyme | 0:774324cbc5a6 | 11 | /** |
Rhyme | 0:774324cbc5a6 | 12 | * MMA8451Q constructor |
Rhyme | 0:774324cbc5a6 | 13 | * |
Rhyme | 0:774324cbc5a6 | 14 | * @param i2c pointer to the I2C object |
Rhyme | 0:774324cbc5a6 | 15 | * @param addr 7bit addr of the I2C peripheral |
Rhyme | 0:774324cbc5a6 | 16 | */ |
Rhyme | 0:774324cbc5a6 | 17 | MMA8451Q(I2C *i2c, int addr); |
Rhyme | 0:774324cbc5a6 | 18 | |
Rhyme | 0:774324cbc5a6 | 19 | /** |
Rhyme | 0:774324cbc5a6 | 20 | * MMA8451Q destructor |
Rhyme | 0:774324cbc5a6 | 21 | */ |
Rhyme | 0:774324cbc5a6 | 22 | ~MMA8451Q(); |
Rhyme | 0:774324cbc5a6 | 23 | |
Rhyme | 0:774324cbc5a6 | 24 | /** |
Rhyme | 0:774324cbc5a6 | 25 | * get all x, y, z data as int16_t |
Rhyme | 0:774324cbc5a6 | 26 | * @param data[] three int16_t data will be returned |
Rhyme | 0:774324cbc5a6 | 27 | * @returns I2C status 0: success others: I2C error |
Rhyme | 0:774324cbc5a6 | 28 | */ |
Rhyme | 0:774324cbc5a6 | 29 | int getAllRawData(int16_t data[]) ; |
Rhyme | 0:774324cbc5a6 | 30 | |
Rhyme | 0:774324cbc5a6 | 31 | /** |
Rhyme | 0:774324cbc5a6 | 32 | * get all x, y, z data as float |
Rhyme | 0:774324cbc5a6 | 33 | * @param data three float data will be returned |
Rhyme | 0:774324cbc5a6 | 34 | * @returns I2C status 0: success others: I2C error |
Rhyme | 0:774324cbc5a6 | 35 | */ |
Rhyme | 0:774324cbc5a6 | 36 | int getAllData(float value[]) ; |
Rhyme | 0:774324cbc5a6 | 37 | int16_t getRawData(uint8_t addr) ; |
Rhyme | 0:774324cbc5a6 | 38 | int16_t getRawX(void) ; |
Rhyme | 0:774324cbc5a6 | 39 | int16_t getRawY(void) ; |
Rhyme | 0:774324cbc5a6 | 40 | int16_t getRawZ(void) ; |
Rhyme | 0:774324cbc5a6 | 41 | |
Rhyme | 0:774324cbc5a6 | 42 | float getAccX(void) ; |
Rhyme | 0:774324cbc5a6 | 43 | float getAccY(void) ; |
Rhyme | 0:774324cbc5a6 | 44 | float getAccZ(void) ; |
Rhyme | 0:774324cbc5a6 | 45 | |
Rhyme | 0:774324cbc5a6 | 46 | private: |
Rhyme | 0:774324cbc5a6 | 47 | I2C *p_i2c; |
Rhyme | 0:774324cbc5a6 | 48 | int m_addr; |
Rhyme | 0:774324cbc5a6 | 49 | int readRegs(int addr, uint8_t * data, int len); |
Rhyme | 0:774324cbc5a6 | 50 | int writeRegs(uint8_t * data, int len); |
Rhyme | 0:774324cbc5a6 | 51 | } ; |
Rhyme | 0:774324cbc5a6 | 52 | |
Rhyme | 0:774324cbc5a6 | 53 | #endif /* _MMA8451Q_H_ */ |