This is an automated email from the ASF dual-hosted git repository.
raiden00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 615f1f3f466 drivers/sensors/ms56xx: Replace custom curtime with
standard function
615f1f3f466 is described below
commit 615f1f3f466767013b0874c19682317fc0f9fbe6
Author: Matteo Golin <[email protected]>
AuthorDate: Thu Sep 25 20:16:09 2025 -0400
drivers/sensors/ms56xx: Replace custom curtime with standard function
The custom implementation of obtaining a timestamp for this driver
returned an unsigned long, which limited the amount of time the driver
could run before roll-over quite significantly (since timestamps are in
microseconds). This change standardizes the driver to use the sensor
driver implementation for timestamps.
Signed-off-by: Matteo Golin <[email protected]>
---
drivers/sensors/ms56xx_uorb.c | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
diff --git a/drivers/sensors/ms56xx_uorb.c b/drivers/sensors/ms56xx_uorb.c
index b18a62af649..a659c7e347f 100644
--- a/drivers/sensors/ms56xx_uorb.c
+++ b/drivers/sensors/ms56xx_uorb.c
@@ -122,8 +122,6 @@ static uint32_t ms56xx_compensate_press(FAR struct
ms56xx_dev_s *priv,
uint32_t press, uint32_t dt,
int32_t *temp);
-static unsigned long ms56xx_curtime(void);
-
/* Sensor methods */
static int ms56xx_set_interval(FAR struct sensor_lowerhalf_s *lower,
@@ -152,24 +150,6 @@ static const struct sensor_ops_s g_sensor_ops =
* Private Functions
****************************************************************************/
-/****************************************************************************
- * Name: ms56xx_curtime
- *
- * Description: Helper to get current timestamp.
- *
- * Return:
- * Timestamp in microseconds
- *
- ****************************************************************************/
-
-static unsigned long ms56xx_curtime(void)
-{
- struct timespec ts;
-
- clock_systime_timespec(&ts);
- return 1000000ull * ts.tv_sec + ts.tv_nsec / 1000;
-}
-
/****************************************************************************
* Name: ms56xx_sendcmd
*
@@ -358,7 +338,7 @@ static inline void baro_measure_read(FAR struct
ms56xx_dev_s *priv,
temp = ms56xx_compensate_temp(priv, temp_raw, &deltat);
press = ms56xx_compensate_press(priv, press, deltat, &temp);
- baro->timestamp = ms56xx_curtime();
+ baro->timestamp = sensor_get_timestamp();
baro->pressure = press / 100.0f;
baro->temperature = temp / 100.0f;
}