Skip to content

Commit a20ac0f

Browse files
SPRESENSEjerpelea
authored andcommitted
sensors/bmi160: Fix a bug sensor_time is truncated
Fix a bug that sensor_time resolution is lost by bit shift. Signed-off-by: SPRESENSE <[email protected]>
1 parent be5c907 commit a20ac0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/sensors/bmi160.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ static ssize_t bmi160_read(FAR struct file *filep, FAR char *buffer,
145145
return 0;
146146
}
147147

148-
bmi160_getregs(priv, BMI160_DATA_8, (FAR uint8_t *)buffer, 15);
148+
/* Set sensor_time to the lower 24 bits of SENSORTIME. */
149149

150-
/* Adjust sensing time into 24 bit */
150+
p->sensor_time = 0;
151151

152-
p->sensor_time >>= 8;
152+
bmi160_getregs(priv, BMI160_DATA_8, (FAR uint8_t *)buffer, 15);
153153

154154
return len;
155155
}

0 commit comments

Comments
 (0)