From ff1bd3807ccba406f836cd81e20088e4d9c331e7 Mon Sep 17 00:00:00 2001 From: yangpeng Date: Tue, 26 Dec 2023 14:36:40 +0800 Subject: [PATCH] =?UTF-8?q?[components][drivers][sensor]=E6=9A=82=E6=97=B6?= =?UTF-8?q?=E7=A6=81=E6=AD=A2=E4=BD=BF=E7=94=A8sensorv2=E6=A1=86=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sensor v2框架仍在开发中 --- components/drivers/Kconfig | 6 +++--- components/drivers/include/drivers/sensor.h | 2 +- components/drivers/sensor/v1/sensor.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig index 0a1db41bf9..8b9467008e 100755 --- a/components/drivers/Kconfig +++ b/components/drivers/Kconfig @@ -565,9 +565,9 @@ config RT_USING_SENSOR default n if RT_USING_SENSOR - config RT_USING_SENSOR_V2 - bool "Enable Sensor Framework v2" - default n + # config RT_USING_SENSOR_V2 + # bool "Enable Sensor Framework v2" + # default n config RT_USING_SENSOR_CMD bool "Using Sensor cmd" diff --git a/components/drivers/include/drivers/sensor.h b/components/drivers/include/drivers/sensor.h index e09d8d8c94..6c8b78e8a5 100644 --- a/components/drivers/include/drivers/sensor.h +++ b/components/drivers/include/drivers/sensor.h @@ -238,7 +238,7 @@ struct rt_sensor_data struct rt_sensor_ops { - rt_size_t (*fetch_data)(struct rt_sensor_device *sensor, void *buf, rt_size_t len); + rt_ssize_t (*fetch_data)(struct rt_sensor_device *sensor, void *buf, rt_size_t len); rt_err_t (*control)(struct rt_sensor_device *sensor, int cmd, void *arg); }; diff --git a/components/drivers/sensor/v1/sensor.c b/components/drivers/sensor/v1/sensor.c index 0bf5a62638..6da12f9342 100644 --- a/components/drivers/sensor/v1/sensor.c +++ b/components/drivers/sensor/v1/sensor.c @@ -127,7 +127,7 @@ static rt_err_t rt_sensor_irq_init(rt_sensor_t sensor) // local rt_sensor_ops -static rt_size_t local_fetch_data(struct rt_sensor_device *sensor, void *buf, rt_size_t len) +static rt_ssize_t local_fetch_data(struct rt_sensor_device *sensor, void *buf, rt_size_t len) { LOG_D("Undefined fetch_data"); return 0; @@ -135,7 +135,7 @@ static rt_size_t local_fetch_data(struct rt_sensor_device *sensor, void *buf, rt static rt_err_t local_control(struct rt_sensor_device *sensor, int cmd, void *arg) { LOG_D("Undefined control"); - return RT_ERROR; + return -RT_ERROR; } static struct rt_sensor_ops local_ops = {