mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-25 08:47:16 +00:00
[UPDATE]添加新驱动、完善 BSP
- [update] 更新 template 工程配置 - [update] 更新 PLATFORM 配置 - [add] 添加 ra icu 驱动文件 - [add] 增加传感器类型 IAQ、EtOH - [add] 添加 CAN 驱动 - [add] 添加 RW007 驱动及使用说明 - [fix] GCC 编译问题 - [fix] flash 驱动 - [fix] 修改 scons 脚本配置
This commit is contained in:
@@ -37,7 +37,9 @@ static char *const sensor_name_str[] =
|
||||
"eco2_", /* eCO2 sensor */
|
||||
"gnss_", /* GPS/GNSS sensor */
|
||||
"tof_", /* TOF sensor */
|
||||
"spo2_" /* SpO2 sensor */
|
||||
"spo2_", /* SpO2 sensor */
|
||||
"iaq_", /* IAQ sensor */
|
||||
"etoh_", /* EtOH sensor */
|
||||
};
|
||||
|
||||
/* Sensor interrupt correlation function */
|
||||
@@ -134,7 +136,8 @@ static rt_err_t local_control(struct rt_sensor_device *sensor, int cmd, void *ar
|
||||
LOG_D("Undefined control");
|
||||
return RT_ERROR;
|
||||
}
|
||||
static struct rt_sensor_ops local_ops = {
|
||||
static struct rt_sensor_ops local_ops =
|
||||
{
|
||||
.fetch_data = local_fetch_data,
|
||||
.control = local_control
|
||||
};
|
||||
@@ -145,7 +148,7 @@ static rt_err_t rt_sensor_open(rt_device_t dev, rt_uint16_t oflag)
|
||||
rt_sensor_t sensor = (rt_sensor_t)dev;
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
rt_err_t res = RT_EOK;
|
||||
rt_err_t (*local_ctrl)(struct rt_sensor_device *sensor, int cmd, void *arg) = local_control;
|
||||
rt_err_t (*local_ctrl)(struct rt_sensor_device * sensor, int cmd, void *arg) = local_control;
|
||||
|
||||
if (sensor->module)
|
||||
{
|
||||
@@ -311,7 +314,7 @@ static rt_size_t rt_sensor_read(rt_device_t dev, rt_off_t pos, void *buf, rt_siz
|
||||
if (sensor->ops->fetch_data != RT_NULL)
|
||||
{
|
||||
result = sensor->ops->fetch_data(sensor, buf, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sensor->module)
|
||||
@@ -359,7 +362,7 @@ static rt_err_t rt_sensor_control(rt_device_t dev, int cmd, void *args)
|
||||
{
|
||||
sensor->config.range = (rt_int32_t)args;
|
||||
LOG_D("set range %d", sensor->config.range);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RT_SENSOR_CTRL_SET_ODR:
|
||||
/* Configuration data output rate */
|
||||
|
||||
Reference in New Issue
Block a user