Skip to content

Commit

Permalink
Compatibility with 32 bit chips
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulStoffregen committed Nov 15, 2016
1 parent a5ca826 commit d970210
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/SparkFun_ADXL345.cpp
Expand Up @@ -74,9 +74,9 @@ void ADXL345::readAccel(int *x, int *y, int *z) {
readFrom(ADXL345_DATAX0, ADXL345_TO_READ, _buff); // Read Accel Data from ADXL345

// Each Axis @ All g Ranges: 10 Bit Resolution (2 Bytes)
*x = (((int)_buff[1]) << 8) | _buff[0];
*y = (((int)_buff[3]) << 8) | _buff[2];
*z = (((int)_buff[5]) << 8) | _buff[4];
*x = (int16_t)((((int)_buff[1]) << 8) | _buff[0]);
*y = (int16_t)((((int)_buff[3]) << 8) | _buff[2]);
*z = (int16_t)((((int)_buff[5]) << 8) | _buff[4]);
}

void ADXL345::get_Gxyz(double *xyz){
Expand Down Expand Up @@ -818,4 +818,4 @@ void print_byte(byte val){
for(i=7; i>=0; i--){
Serial.print(val >> i & 1, BIN);
}
}
}

0 comments on commit d970210

Please sign in to comment.