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 ADXL345 by
Revision 1:0fac771fec8d, committed 2016-02-24
- Comitter:
- JLarkin
- Date:
- Wed Feb 24 21:45:22 2016 +0000
- Parent:
- 0:bd8f0f20f433
- Commit message:
- Corrected GetOutput so it uses an array of shorts rather than array of ints.
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 0fac771fec8d ADXL345.cpp
--- a/ADXL345.cpp Mon Sep 06 13:53:03 2010 +0000
+++ b/ADXL345.cpp Wed Feb 24 21:45:22 2016 +0000
@@ -313,15 +313,15 @@
}
-void ADXL345::getOutput(int* readings){
+void ADXL345::getOutput(short* 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] = (short)buffer[1] << 8 | (short)buffer[0];
+ readings[1] = (short)buffer[3] << 8 | (short)buffer[2];
+ readings[2] = (short)buffer[5] << 8 | (short)buffer[4];
}
diff -r bd8f0f20f433 -r 0fac771fec8d ADXL345.h
--- a/ADXL345.h Mon Sep 06 13:53:03 2010 +0000
+++ b/ADXL345.h Wed Feb 24 21:45:22 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(short* readings);
/**
* Get the FIFO control settings.
