hw 4.2.2
Fork of MMA8451Q8b by
Revision 9:4e96b8139119, committed 2015-02-09
- Comitter:
- rahulpatle101
- Date:
- Mon Feb 09 18:59:46 2015 +0000
- Parent:
- 8:993bb9e96a4b
- Commit message:
- for hw
Changed in this revision
MMA8451Q8.cpp | Show annotated file Show diff for this revision Revisions of this file |
MMA8451Q8.h | Show annotated file Show diff for this revision Revisions of this file |
--- 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]);
--- a/MMA8451Q8.h Tue Feb 03 17:59:00 2015 +0000 +++ b/MMA8451Q8.h Mon Feb 09 18:59:46 2015 +0000 @@ -112,6 +112,7 @@ void setGLimit(int gSelect); // added in .cpp file for tap configuration void setPulseConfiguration(uint8_t latch,uint8_t axisSet); + void setRegisterInStandby(uint8_t regAddress, uint8_t regData); void readRegs(int addr, uint8_t * data, int len); void writeRegs(uint8_t * data, int len);