hw 4.2.2
Fork of MMA8451Q8b by
Diff: MMA8451Q8.cpp
- Revision:
- 9:4e96b8139119
- Parent:
- 8:993bb9e96a4b
diff -r 993bb9e96a4b -r 4e96b8139119 MMA8451Q8.cpp --- a/MMA8451Q8.cpp Tue Feb 03 17:59:00 2015 +0000 +++ b/MMA8451Q8.cpp Mon Feb 09 18:59:46 2015 +0000 @@ -86,6 +86,17 @@ return (float(getAccAxis(REG_OUT_X_MSB))/gScaling[gChosen]); } +void MMA8451Q::setRegisterInStandby(uint8_t regAddress,uint8_t regData){ + uint8_t data[NUM_DATA] = {REG_CTRL_REG_1, 0x00}; // put in standby mode +// set up configuration bits. + writeRegs(data, NUM_DATA); // put in standby + data[ADDRESS_INDEX ] = regAddress; + data[DATA_INDEX] = regData; + writeRegs(data, NUM_DATA); + data[ADDRESS_INDEX ] = REG_CTRL_REG_1; // put back in active mode + data[DATA_INDEX] = 0x01; + writeRegs(data, 2); // make active +} float MMA8451Q::getAccY() { return (float(getAccAxis(REG_OUT_Y_MSB))/gScaling[gChosen]);