[sensor] use rt_ssize_t as the return value data type

This commit is contained in:
Meco Man 2022-11-08 19:08:31 -05:00 committed by guo
parent 255020bca8
commit 39b25f660a
2 changed files with 4 additions and 4 deletions

View File

@ -238,7 +238,7 @@ struct rt_sensor_data
struct rt_sensor_ops
{
rt_size_t (*fetch_data)(rt_sensor_t sensor, void *buf, rt_size_t len);
rt_ssize_t (*fetch_data)(rt_sensor_t sensor, void *buf, rt_size_t len);
rt_err_t (*control)(rt_sensor_t sensor, int cmd, void *arg);
};

View File

@ -123,15 +123,15 @@ static rt_err_t _sensor_irq_init(rt_sensor_t sensor)
}
/* sensor local ops */
static rt_size_t _local_fetch_data(rt_sensor_t sensor, void *buf, rt_size_t len)
static rt_ssize_t _local_fetch_data(rt_sensor_t sensor, void *buf, rt_size_t len)
{
LOG_D("Undefined fetch_data");
return 0;
return -RT_EINVAL;
}
static rt_err_t _local_control(rt_sensor_t sensor, int cmd, void *arg)
{
LOG_D("Undefined control");
return RT_ERROR;
return -RT_EINVAL;
}
static struct rt_sensor_ops local_ops =
{