Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MMA8451Q by
Revision 5:3224e40449d8, committed 2017-11-06
- Comitter:
- radovan
- Date:
- Mon Nov 06 17:46:36 2017 +0000
- Parent:
- 4:c4d879a39775
- Commit message:
- cvaccfreefall
Changed in this revision
MMA8451Q.cpp | Show annotated file Show diff for this revision Revisions of this file |
MMA8451Q.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MMA8451Q.cpp Fri Oct 12 11:35:07 2012 +0000 +++ b/MMA8451Q.cpp Mon Nov 06 17:46:36 2017 +0000 @@ -28,8 +28,11 @@ 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}; writeRegs(data, 2); + + } MMA8451Q::~MMA8451Q() { }
--- a/MMA8451Q.h Fri Oct 12 11:35:07 2012 +0000 +++ b/MMA8451Q.h Mon Nov 06 17:46:36 2017 +0000 @@ -97,12 +97,15 @@ * @param res array where acceleration data will be stored */ void getAccAllAxis(float * res); + + void readRegs(int addr, uint8_t * data, int len); + void writeRegs(uint8_t * data, int len); + private: I2C m_i2c; int m_addr; - void readRegs(int addr, uint8_t * data, int len); - void writeRegs(uint8_t * data, int len); + int16_t getAccAxis(uint8_t addr); };