Skip to content

Commit 2cf01ae

Browse files
Merge pull request #4 from PaulStoffregen/master
Compatibility with 32 bit boards
2 parents a5ca826 + 9f8b2c7 commit 2cf01ae

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ author=SparkFun Electronics
44
maintainer=SparkFun Electronics
55
sentence=An Arduino library for interfacing with the SparkFun Triple Axis Accelerometer Breakout - ADXL345
66
paragraph=An Arduino library for interfacing with the SparkFun Triple Axis Accelerometer Breakout - ADXL345
7-
category=sensors
7+
category=Sensors
88
url=https://github.com/sparkfun/SparkFun_ADXL345_Arduino_Library
99
architectures=*

src/SparkFun_ADXL345.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ void ADXL345::readAccel(int *x, int *y, int *z) {
7474
readFrom(ADXL345_DATAX0, ADXL345_TO_READ, _buff); // Read Accel Data from ADXL345
7575

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

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

0 commit comments

Comments
 (0)