Needed for FXAS21000 NXP gyroscope
Fork of FXAS21000 by
Diff: FXAS21000.h
- Revision:
- 0:4cfc774d6d85
- Child:
- 1:88a036a417bf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FXAS21000.h Sat Apr 19 00:10:49 2014 +0000 @@ -0,0 +1,69 @@ +#ifndef FXAS21000_H +#define FXAS21000_H + +#include "mbed.h" + + +// MMA8652 Slave Address +#define FXAS21000_SLAVE_ADDR 0x40 + +// MMA8652 internal register addresses +#define FXAS21000_STATUS 0x00 +#define FXAS21000_WHOAMI 0x0C +#define FXAS21000_XYZ_DATA_CFG 0x0E +#define FXAS21000_CTRL_REG0 0x0D +#define FXAS21000_CTRL_REG1 0x13 +#define FXAS21000_WHOAMI_VAL 0xD1 + +class FXAS21000 +{ +public: + /** + * FXAS21000 constructor + * + * @param sda SDA pin + * @param sdl SCL pin + * + */ + FXAS21000(PinName sda, PinName scl); + + + /** + * Get the Gyro values + * Result is floating point degrees / second + * + * @param floating point array where the results will be placed + */ + void ReadXYZ(float * a); + + + /** + * Get the Gyro values + * Result is signed 16 bit value + * + * @param int16_t point array where the results will be placed + */ + void ReadXYZraw(int16_t * t); + + + /** + * Get the value of the WHO_AM_I register + * + * @returns DEVICE_ID value == 0xD1 + */ + //char getWhoAmI(); + char getWhoAmI(void); + +private: + + I2C _i2c; + /** Set the device in active mode + */ + void begin( void); + + void RegRead( char reg, char * d, int len); + + +}; + +#endif