ADXL345 triple axis, digital accelerometer library.
Fork of ADXL345 by
Revision 1:ae395b3e81e8, committed 2016-09-21
- Comitter:
- yjones3
- Date:
- Wed Sep 21 15:58:21 2016 +0000
- Parent:
- 0:bd8f0f20f433
- Commit message:
- Working copy of output data, not including button press.
Changed in this revision
ADXL345.cpp | Show annotated file Show diff for this revision Revisions of this file |
ADXL345.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r bd8f0f20f433 -r ae395b3e81e8 ADXL345.cpp --- a/ADXL345.cpp Mon Sep 06 13:53:03 2010 +0000 +++ b/ADXL345.cpp Wed Sep 21 15:58:21 2016 +0000 @@ -313,15 +313,15 @@ } -void ADXL345::getOutput(int* readings){ +void ADXL345::getOutput(int16_t* readings){ char buffer[6]; multiByteRead(ADXL345_DATAX0_REG, buffer, 6); - readings[0] = (int)buffer[1] << 8 | (int)buffer[0]; - readings[1] = (int)buffer[3] << 8 | (int)buffer[2]; - readings[2] = (int)buffer[5] << 8 | (int)buffer[4]; + readings[0] = (int16_t)buffer[1] << 8 | (int16_t)buffer[0]; + readings[1] = (int16_t)buffer[3] << 8 | (int16_t)buffer[2]; + readings[2] = (int16_t)buffer[5] << 8 | (int16_t)buffer[4]; }
diff -r bd8f0f20f433 -r ae395b3e81e8 ADXL345.h --- a/ADXL345.h Mon Sep 06 13:53:03 2010 +0000 +++ b/ADXL345.h Wed Sep 21 15:58:21 2016 +0000 @@ -469,7 +469,7 @@ * @param Pointer to a buffer to hold the accelerometer value for the * x-axis, y-axis and z-axis [in that order]. */ - void getOutput(int* readings); + void getOutput(int16_t* readings); /** * Get the FIFO control settings.