Renamed the whole thing in order to prevent messing up with the real library
Fork of MMA8451Q by
Diff: MMA8451Q.cpp
- Revision:
- 5:d3d979cbf5b6
- Parent:
- 3:db7126dbd63f
--- a/MMA8451Q.cpp Fri Oct 12 11:35:07 2012 +0000 +++ b/MMA8451Q.cpp Thu Aug 07 08:36:48 2014 +0000 @@ -28,8 +28,13 @@ MMA8451Q::MMA8451Q(PinName sda, PinName scl, int addr) : m_i2c(sda, scl), m_addr(addr) { // activate the peripheral - uint8_t data[2] = {REG_CTRL_REG_1, 0x01}; +// uint8_t data[2] = {REG_CTRL_REG_1, 0x01}; + uint8_t data[2] = {REG_CTRL_REG_1, 0x15}; // 0001 0101. 200Hz, low noise, active + uint8_t dataa[2] = {0x2b, 0x12}; // high resoluition + writeRegs(data, 2); + writeRegs(dataa, 2); + } MMA8451Q::~MMA8451Q() { } @@ -40,6 +45,15 @@ return who_am_i; } +int16_t MMA8451Q::getAccXX() { + return (getAccAxis(REG_OUT_X_MSB)); +} + +int16_t MMA8451Q::getAccYY() { + return (getAccAxis(REG_OUT_Y_MSB)); +} + + float MMA8451Q::getAccX() { return (float(getAccAxis(REG_OUT_X_MSB))/4096.0); }