Driver library for the Freescale FXOS8700Q sensor
Dependencies: MotionSensor
Dependents: el14dg_Project frdm_serial_peopleAndComputing simple-client-app-shield pelion-example-frdm ... more
Fork of FXOS8700Q by
Revision 11:aee7dea904e2, committed 2015-06-19
- Comitter:
- sam_grove
- Date:
- Fri Jun 19 12:16:44 2015 -0500
- Parent:
- 10:834488c11340
- Commit message:
- Update addr type in readRegs parameter
Changed in this revision
FXOS8700Q.cpp | Show annotated file Show diff for this revision Revisions of this file |
FXOS8700Q.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 834488c11340 -r aee7dea904e2 FXOS8700Q.cpp --- a/FXOS8700Q.cpp Thu Jun 18 22:53:07 2015 +0000 +++ b/FXOS8700Q.cpp Fri Jun 19 12:16:44 2015 -0500 @@ -53,10 +53,10 @@ _addr = 0; } -void FXOS8700Q::readRegs(int addr, uint8_t *data, uint32_t len) const +void FXOS8700Q::readRegs(uint8_t addr, uint8_t *data, uint32_t len) const { - char t[1] = {addr}; - _i2c->write(_addr, t, sizeof(t), true); + uint8_t t[1] = {addr}; + _i2c->write(_addr, (char *)t, sizeof(t), true); _i2c->read(_addr, (char *)data, len); } @@ -72,6 +72,7 @@ _i2c->write(_addr, (char *)data, len); } + int16_t FXOS8700Q::getSensorAxis(uint8_t addr) const { uint8_t res[2];
diff -r 834488c11340 -r aee7dea904e2 FXOS8700Q.h --- a/FXOS8700Q.h Thu Jun 18 22:53:07 2015 +0000 +++ b/FXOS8700Q.h Fri Jun 19 12:16:44 2015 -0500 @@ -93,7 +93,7 @@ @param len The amount of data to read from it @return 0 if successful, negative number otherwise */ - void readRegs(int addr, uint8_t *data, uint32_t len) const; + void readRegs(uint8_t addr, uint8_t *data, uint32_t len) const; /** Read the ID from a whoAmI register @return The device whoAmI register contents