A basic library for the FXOS8700Q combination accelerometer / magnetometer
Dependencies: MotionSensor
Fork of FXOS8700Q by
Revision 10:8b9c3245ad61, committed 2016-05-05
- Comitter:
- fy13ba
- Date:
- Thu May 05 14:57:29 2016 +0000
- Parent:
- 9:5553a64d0762
- Commit message:
- final version
Changed in this revision
FXOS8700Q.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 5553a64d0762 -r 8b9c3245ad61 FXOS8700Q.h --- a/FXOS8700Q.h Wed May 07 18:08:08 2014 +0000 +++ b/FXOS8700Q.h Thu May 05 14:57:29 2016 +0000 @@ -48,16 +48,16 @@ * @code * #include "mbed.h" * #include "FXOS8700Q.h" -* -* +* +* * int main(void) { -* +* * FXOS8700Q combo( A4, A5, FXOS8700Q_I2C_ADDRESS0); * PwmOut rled(LED_RED); * PwmOut gled(LED_GREEN); * PwmOut bled(LED_BLUE); -* -* while (true) { +* +* while (true) { * rled1.0 - combo(acc.getAccX()); * gled1.0 - combo(acc.getAccY()); * bled1.0 - combo(acc.getAccZ()); @@ -70,20 +70,20 @@ class FXOS8700Q_acc : public MotionSensor { public: - /** - * FXOS8700Q constructor - * - * @param sda SDA pin - * @param sdl SCL pin - * @param addr addr of the I2C peripheral - */ - - FXOS8700Q_acc(PinName sda, PinName scl, int addr); + /** + * FXOS8700Q constructor + * + * @param sda SDA pin + * @param sdl SCL pin + * @param addr addr of the I2C peripheral + */ - /** - * FXOS8700Q destructor - */ - ~FXOS8700Q_acc(); + FXOS8700Q_acc(PinName sda, PinName scl, int addr); + + /** + * FXOS8700Q destructor + */ + ~FXOS8700Q_acc(); void enable(void); void disable(void); @@ -98,27 +98,27 @@ void getZ(float * z); void getAxis(MotionSensorDataCounts &data); void getAxis(MotionSensorDataUnits &data); - - void readRegs(int addr, uint8_t * data, int len); - + + void readRegs(int addr, uint8_t * data, int len); + private: - I2C m_i2c; - int m_addr; + I2C m_i2c; + int m_addr; - void writeRegs(uint8_t * data, int len); - int16_t getAccAxis(uint8_t addr); + void writeRegs(uint8_t * data, int len); + int16_t getAccAxis(uint8_t addr); }; class FXOS8700Q_mag : public MotionSensor { public: - FXOS8700Q_mag(PinName sda, PinName scl, int addr); + FXOS8700Q_mag(PinName sda, PinName scl, int addr); - /** - * FXOS8700Q destructor - */ - ~FXOS8700Q_mag(); + /** + * FXOS8700Q destructor + */ + ~FXOS8700Q_mag(); void enable(void); void disable(void); @@ -133,17 +133,17 @@ void getZ(float * z); void getAxis(MotionSensorDataCounts &data); void getAxis(MotionSensorDataUnits &data); - - void readRegs(int addr, uint8_t * data, int len); - + + void readRegs(int addr, uint8_t * data, int len); + private: - I2C m_i2c; - int m_addr; - char sbuf[12]; - int sstatus; - - void writeRegs(uint8_t * data, int len); - int16_t getAccAxis(uint8_t addr); + I2C m_i2c; + int m_addr; + char sbuf[12]; + int sstatus; + + void writeRegs(uint8_t * data, int len); + int16_t getAccAxis(uint8_t addr); };