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 ?
lower->ops->set_interval(lower, val) : -ENOTSUP;
lower->ops->set_interval(lower, *val) : -ENOTSUP;
if (ret >= 0)
{
upper->interval = *val;

View File

@ -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.
*