F
Fork of MMA8451Q by
Revision 5:e6a371766148, committed 2014-04-24
- Comitter:
- donoman
- Date:
- Thu Apr 24 21:24:34 2014 +0000
- Parent:
- 4:c4d879a39775
- Commit message:
- F U
Changed in this revision
diff -r c4d879a39775 -r e6a371766148 MMA8451Q.cpp --- a/MMA8451Q.cpp Fri Oct 12 11:35:07 2012 +0000 +++ b/MMA8451Q.cpp Thu Apr 24 21:24:34 2014 +0000 @@ -23,12 +23,13 @@ #define REG_OUT_X_MSB 0x01 #define REG_OUT_Y_MSB 0x03 #define REG_OUT_Z_MSB 0x05 + #define UINT14_MAX 16383 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, 0x02}; writeRegs(data, 2); } @@ -70,6 +71,8 @@ return acc; } + + void MMA8451Q::readRegs(int addr, uint8_t * data, int len) { char t[1] = {addr}; m_i2c.write(m_addr, t, 1, true);
diff -r c4d879a39775 -r e6a371766148 MMA8451Q.h --- a/MMA8451Q.h Fri Oct 12 11:35:07 2012 +0000 +++ b/MMA8451Q.h Thu Apr 24 21:24:34 2014 +0000 @@ -97,12 +97,17 @@ * @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); + //void readRegs(int addr, uint8_t * data, int len); + //void writeRegs(uint8_t * data, int len); int16_t getAccAxis(uint8_t addr); };
diff -r c4d879a39775 -r e6a371766148 TEMT6200.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TEMT6200.lib Thu Apr 24 21:24:34 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/frankvnk/code/TEMT6200/#5d1118cb5702