Skip to content

Commit 488727a

Browse files
committed
Fix bug regarding the setFullScale function on the H3LIS331DL
Previous behaviour incorrectly set the ranges. Attempting to set a 100g range would actually set the data to come out in little endian order. Attempting to set a 200g range would actually set the data to come out in little endian order AND put the FS1/FS0 bits into an invalid state (10) Attempting to set a 400g range would actually set the data to come out in big endian order AND put the FS1/FS0 bits into an invalid state (10). Now we correctly set the range bits and leave little / big endian alone.
1 parent 24db1d7 commit 488727a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/SparkFun_LIS331.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ void LIS331::setFullScale(fs_range range)
253253
uint8_t data;
254254
LIS331_read(CTRL_REG4, &data, 1);
255255
data &= ~0xcf;
256-
data |= range<<5;
256+
data |= range<<4;
257257
LIS331_write(CTRL_REG4, &data, 1);
258258
}
259259

0 commit comments

Comments
 (0)