From 42b6c665da5fcd7d3fb0ca9a472561d666969b76 Mon Sep 17 00:00:00 2001 From: Matias N Date: Mon, 18 Jan 2021 17:54:46 -0300 Subject: [PATCH] sensor: change set_interval to use a value, not a pointer to value --- drivers/sensors/sensor.c | 2 +- include/nuttx/sensors/sensor.h | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/sensors/sensor.c b/drivers/sensors/sensor.c index 0b637136a4..4dcfc1ea6c 100644 --- a/drivers/sensors/sensor.c +++ b/drivers/sensors/sensor.c @@ -370,7 +370,7 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } ret = lower->ops->set_interval ? - lower->ops->set_interval(lower, val) : -ENOTSUP; + lower->ops->set_interval(lower, *val) : -ENOTSUP; if (ret >= 0) { upper->interval = *val; diff --git a/include/nuttx/sensors/sensor.h b/include/nuttx/sensors/sensor.h index 23d155b0a5..b32cf8b532 100644 --- a/include/nuttx/sensors/sensor.h +++ b/include/nuttx/sensors/sensor.h @@ -443,8 +443,8 @@ struct sensor_ops_s * * Description: * Set the sensor output data period in microseconds for a given sensor. - * If *period_us > max_delay it will be truncated to max_dealy and if - * *period_us < min_delay it will be replaced by min_delay. + * If period_us > max_delay it will be truncated to max_dealy and if + * period_us < min_delay it will be replaced by min_delay. * * Before changing the interval, you need to push the prepared data to * ensure that they are not lost. @@ -460,7 +460,7 @@ struct sensor_ops_s **************************************************************************/ CODE int (*set_interval)(FAR struct sensor_lowerhalf_s *lower, - FAR unsigned int *period_us); + FAR unsigned int period_us); /************************************************************************** * Name: batch @@ -571,13 +571,14 @@ struct sensor_lowerhalf_s int type; /* The size of the circular buffer used, in bytes units. - * This sensor circular buffer is used to slove issue that application - * can't read sensor event in time. If this length of buffer is too large, - * the latency of sensor event will be too larage. If the length of buffer - * is too small, the event will be overwrite before application read them. - * So, it's recommended to set according to sensor odr. If odr is low, you - * can set to a length of sensor event. If odr is high, you can set to two - * or three length of sensor event. + * This sensor circular buffer is used to solve the issue where the + * application can't read sensor event in time. If this length of buffer + * is too large, the latency of the sensor event will be too large. + * If the length of buffer is too small, the events will be overwriten + * before the application can read them. + * So, it's recommended to set the size according to sensor ODR. If ODR is + * low, you can set to a length of sensor event. If ODR is high, you can + * set to two or three times the length of sensor event. */ uint32_t buffer_size; @@ -599,7 +600,7 @@ struct sensor_lowerhalf_s * Name: push_event * * Description: - * Lower half driver push sensor event by calling this function. + * Lower half driver pushes a sensor event by calling this function. * It is provided by upper half driver to lower half driver. * * Input Parameters: @@ -615,8 +616,9 @@ struct sensor_lowerhalf_s * Name: notify_event * * Description: - * Lower half driver notify sensor data ready and can read by fetch. - * It is provided by upper half driver to lower half driver. + * Lower half driver notifies that sensor data is ready and can be + * read by fetch. It is provided by upper half driver to lower half + * driver. * * This api is used when sensor_ops_s::fetch isn't NULL. *