Skip to content

Commit af78398

Browse files
committed
Fix issue in GetAxesRaw
1 parent d6141e5 commit af78398

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=STM32duino LSM303AGR
2-
version=2.0.1
2+
version=2.0.2
33
author=AST
44
maintainer=stm32duino
55
sentence=3D accelerometer and 3D magnetometer.

src/LSM303AGR_ACC_Sensor.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,9 @@ LSM303AGR_ACC_StatusTypeDef LSM303AGR_ACC_Sensor::GetAxesRaw(int16_t *pData)
414414
}
415415

416416
/* Format the data. */
417-
pData[0] = ( ( ( ( ( int16_t )regValue[1] ) << 8 ) + ( int16_t )regValue[0] ) >> shift );
418-
pData[1] = ( ( ( ( ( int16_t )regValue[3] ) << 8 ) + ( int16_t )regValue[2] ) >> shift );
419-
pData[2] = ( ( ( ( ( int16_t )regValue[5] ) << 8 ) + ( int16_t )regValue[4] ) >> shift );
417+
pData[0] = ( (int16_t)( ( ( ( int16_t )regValue[1] ) << 8 ) + ( int16_t )regValue[0] ) >> shift );
418+
pData[1] = ( (int16_t)( ( ( ( int16_t )regValue[3] ) << 8 ) + ( int16_t )regValue[2] ) >> shift );
419+
pData[2] = ( (int16_t)( ( ( ( int16_t )regValue[5] ) << 8 ) + ( int16_t )regValue[4] ) >> shift );
420420

421421
return LSM303AGR_ACC_STATUS_OK;
422422
}

0 commit comments

Comments
 (0)