sensor: change set_interval to use a value, not a pointer to value

This commit is contained in:
Matias N 2021-01-18 17:54:46 -03:00 committed by Alan Carvalho de Assis
parent 1b8e9312dc
commit 42b6c665da
2 changed files with 16 additions and 14 deletions

View File

@ -370,7 +370,7 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
} }
ret = lower->ops->set_interval ? ret = lower->ops->set_interval ?
lower->ops->set_interval(lower, val) : -ENOTSUP; lower->ops->set_interval(lower, *val) : -ENOTSUP;
if (ret >= 0) if (ret >= 0)
{ {
upper->interval = *val; upper->interval = *val;

View File

@ -443,8 +443,8 @@ struct sensor_ops_s
* *
* Description: * Description:
* Set the sensor output data period in microseconds for a given sensor. * 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 * 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. * period_us < min_delay it will be replaced by min_delay.
* *
* Before changing the interval, you need to push the prepared data to * Before changing the interval, you need to push the prepared data to
* ensure that they are not lost. * ensure that they are not lost.
@ -460,7 +460,7 @@ struct sensor_ops_s
**************************************************************************/ **************************************************************************/
CODE int (*set_interval)(FAR struct sensor_lowerhalf_s *lower, CODE int (*set_interval)(FAR struct sensor_lowerhalf_s *lower,
FAR unsigned int *period_us); FAR unsigned int period_us);
/************************************************************************** /**************************************************************************
* Name: batch * Name: batch
@ -571,13 +571,14 @@ struct sensor_lowerhalf_s
int type; int type;
/* The size of the circular buffer used, in bytes units. /* The size of the circular buffer used, in bytes units.
* This sensor circular buffer is used to slove issue that application * This sensor circular buffer is used to solve the issue where the
* can't read sensor event in time. If this length of buffer is too large, * application can't read sensor event in time. If this length of buffer
* the latency of sensor event will be too larage. If the length of buffer * is too large, the latency of the sensor event will be too large.
* is too small, the event will be overwrite before application read them. * If the length of buffer is too small, the events will be overwriten
* So, it's recommended to set according to sensor odr. If odr is low, you * before the application can read them.
* can set to a length of sensor event. If odr is high, you can set to two * So, it's recommended to set the size according to sensor ODR. If ODR is
* or three length of sensor event. * 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; uint32_t buffer_size;
@ -599,7 +600,7 @@ struct sensor_lowerhalf_s
* Name: push_event * Name: push_event
* *
* Description: * 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. * It is provided by upper half driver to lower half driver.
* *
* Input Parameters: * Input Parameters:
@ -615,8 +616,9 @@ struct sensor_lowerhalf_s
* Name: notify_event * Name: notify_event
* *
* Description: * Description:
* Lower half driver notify sensor data ready and can read by fetch. * Lower half driver notifies that sensor data is ready and can be
* It is provided by upper half driver to lower half driver. * 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. * This api is used when sensor_ops_s::fetch isn't NULL.
* *