modified from MMA8451Q
Dependents: XtrinsicSensorEVK SDFileSystem_HelloWorld5_copy xtrinsic_sensors
Revision 1:2d4b7fadb1e6, committed 2013-10-14
- Comitter:
- jppang
- Date:
- Mon Oct 14 15:00:36 2013 +0000
- Parent:
- 0:41db55eef564
- Commit message:
- modified from MMA8451Q
Changed in this revision
MMA8491Q.cpp | Show annotated file Show diff for this revision Revisions of this file |
MMA8491Q.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 41db55eef564 -r 2d4b7fadb1e6 MMA8491Q.cpp --- a/MMA8491Q.cpp Thu Oct 10 03:20:44 2013 +0000 +++ b/MMA8491Q.cpp Mon Oct 14 15:00:36 2013 +0000 @@ -44,7 +44,14 @@ uint8_t data[2] = {REG_CTRL_REG_1, 0x01}; writeRegs(data, 2); } - +/* +MMA8491Q::MMA8491Q(PinName sda, PinName scl, int addr, PinName Xout, PinName Yout, PinName Zout) + : m_i2c(sda, scl), m_addr(addr), m_xout(Xout), m_yout(Yout), m_zout(Zout) { + // activate the peripheral + uint8_t data[2] = {REG_CTRL_REG_1, 0x01}; + writeRegs(data, 2); +} +*/ MMA8491Q::~MMA8491Q() { } uint8_t MMA8491Q::getWhoAmI() {
diff -r 41db55eef564 -r 2d4b7fadb1e6 MMA8491Q.h --- a/MMA8491Q.h Thu Oct 10 03:20:44 2013 +0000 +++ b/MMA8491Q.h Mon Oct 14 15:00:36 2013 +0000 @@ -57,6 +57,8 @@ * @param addr addr of the I2C peripheral */ MMA8491Q(PinName sda, PinName scl, int addr); + + // MMA8491Q(PinName sda, PinName scl, int addr, PinName Xout, PinName Yout, PinName Zout); /** * MMA8491Q destructor @@ -153,6 +155,7 @@ void readRegs(int addr, uint8_t * data, int len); void writeRegs(uint8_t * data, int len); int16_t getAccAxis(uint8_t addr); + };