This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit a20ac0fe7c579ed8db15e3348acd81865bc53e4f
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Wed Jul 9 09:35:48 2025 +0900

    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 <41312067+sprese...@users.noreply.github.com>
---
 drivers/sensors/bmi160.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/sensors/bmi160.c b/drivers/sensors/bmi160.c
index 6cf4001ddd9..58091a9da4e 100644
--- a/drivers/sensors/bmi160.c
+++ b/drivers/sensors/bmi160.c
@@ -145,11 +145,11 @@ static ssize_t bmi160_read(FAR struct file *filep, FAR 
char *buffer,
       return 0;
     }
 
-  bmi160_getregs(priv, BMI160_DATA_8, (FAR uint8_t *)buffer, 15);
+  /* Set sensor_time to the lower 24 bits of SENSORTIME. */
 
-  /* Adjust sensing time into 24 bit */
+  p->sensor_time = 0;
 
-  p->sensor_time >>= 8;
+  bmi160_getregs(priv, BMI160_DATA_8, (FAR uint8_t *)buffer, 15);
 
   return len;
 }

Reply via email to