Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
红岛
rt-thread
提交
3994ebbf
R
rt-thread
项目概览
红岛
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3994ebbf
编写于
2月 26, 2020
作者:
L
luhuadong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Sensor] Add vendor info and sensor types for cmd
上级
7335fd38
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
6 deletion
+34
-6
components/drivers/sensors/sensor_cmd.c
components/drivers/sensors/sensor_cmd.c
+34
-6
未找到文件。
components/drivers/sensors/sensor_cmd.c
浏览文件 @
3994ebbf
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
* Date Author Notes
* Date Author Notes
* 2019-01-31 flybreak first version
* 2019-01-31 flybreak first version
* 2019-07-16 WillianChan Increase the output of sensor information
* 2019-07-16 WillianChan Increase the output of sensor information
* 2020-02-22 luhuadong Add vendor info and sensor types for cmd
*/
*/
#include "sensor.h"
#include "sensor.h"
...
@@ -33,24 +34,42 @@ static void sensor_show_data(rt_size_t num, rt_sensor_t sensor, struct rt_sensor
...
@@ -33,24 +34,42 @@ static void sensor_show_data(rt_size_t num, rt_sensor_t sensor, struct rt_sensor
case
RT_SENSOR_CLASS_MAG
:
case
RT_SENSOR_CLASS_MAG
:
LOG_I
(
"num:%3d, x:%5d, y:%5d, z:%5d mGauss, timestamp:%5d"
,
num
,
sensor_data
->
data
.
mag
.
x
,
sensor_data
->
data
.
mag
.
y
,
sensor_data
->
data
.
mag
.
z
,
sensor_data
->
timestamp
);
LOG_I
(
"num:%3d, x:%5d, y:%5d, z:%5d mGauss, timestamp:%5d"
,
num
,
sensor_data
->
data
.
mag
.
x
,
sensor_data
->
data
.
mag
.
y
,
sensor_data
->
data
.
mag
.
z
,
sensor_data
->
timestamp
);
break
;
break
;
case
RT_SENSOR_CLASS_HUMI
:
LOG_I
(
"num:%3d, humi:%3d.%d%%, timestamp:%5d"
,
num
,
sensor_data
->
data
.
humi
/
10
,
sensor_data
->
data
.
humi
%
10
,
sensor_data
->
timestamp
);
break
;
case
RT_SENSOR_CLASS_TEMP
:
case
RT_SENSOR_CLASS_TEMP
:
LOG_I
(
"num:%3d, temp:%3d.%dC, timestamp:%5d"
,
num
,
sensor_data
->
data
.
temp
/
10
,
sensor_data
->
data
.
temp
%
10
,
sensor_data
->
timestamp
);
LOG_I
(
"num:%3d, temp:%3d.%d C, timestamp:%5d"
,
num
,
sensor_data
->
data
.
temp
/
10
,
sensor_data
->
data
.
temp
%
10
,
sensor_data
->
timestamp
);
break
;
case
RT_SENSOR_CLASS_HUMI
:
LOG_I
(
"num:%3d, humi:%3d.%d% %, timestamp:%5d"
,
num
,
sensor_data
->
data
.
humi
/
10
,
sensor_data
->
data
.
humi
%
10
,
sensor_data
->
timestamp
);
break
;
break
;
case
RT_SENSOR_CLASS_BARO
:
case
RT_SENSOR_CLASS_BARO
:
LOG_I
(
"num:%3d, press:%5d pa, timestamp:%5d"
,
num
,
sensor_data
->
data
.
baro
,
sensor_data
->
timestamp
);
LOG_I
(
"num:%3d, press:%5d pa, timestamp:%5d"
,
num
,
sensor_data
->
data
.
baro
,
sensor_data
->
timestamp
);
break
;
break
;
case
RT_SENSOR_CLASS_
STEP
:
case
RT_SENSOR_CLASS_
LIGHT
:
LOG_I
(
"num:%3d,
step:%5d, timestamp:%5d"
,
num
,
sensor_data
->
data
.
step
,
sensor_data
->
timestamp
);
LOG_I
(
"num:%3d,
light:%5d lux, timestamp:%5d"
,
num
,
sensor_data
->
data
.
light
,
sensor_data
->
timestamp
);
break
;
break
;
case
RT_SENSOR_CLASS_PROXIMITY
:
case
RT_SENSOR_CLASS_PROXIMITY
:
LOG_I
(
"num:%3d, distance:%5d, timestamp:%5d"
,
num
,
sensor_data
->
data
.
proximity
,
sensor_data
->
timestamp
);
LOG_I
(
"num:%3d, distance:%5d, timestamp:%5d"
,
num
,
sensor_data
->
data
.
proximity
,
sensor_data
->
timestamp
);
break
;
break
;
case
RT_SENSOR_CLASS_HR
:
LOG_I
(
"num:%3d, heart rate:%5d bpm, timestamp:%5d"
,
num
,
sensor_data
->
data
.
hr
,
sensor_data
->
timestamp
);
break
;
case
RT_SENSOR_CLASS_TVOC
:
LOG_I
(
"num:%3d, tvoc:%5d ppb, timestamp:%5d"
,
num
,
sensor_data
->
data
.
tvoc
,
sensor_data
->
timestamp
);
break
;
case
RT_SENSOR_CLASS_NOISE
:
LOG_I
(
"num:%3d, noise:%5d, timestamp:%5d"
,
num
,
sensor_data
->
data
.
noise
,
sensor_data
->
timestamp
);
break
;
case
RT_SENSOR_CLASS_STEP
:
LOG_I
(
"num:%3d, step:%5d, timestamp:%5d"
,
num
,
sensor_data
->
data
.
step
,
sensor_data
->
timestamp
);
break
;
case
RT_SENSOR_CLASS_FORCE
:
case
RT_SENSOR_CLASS_FORCE
:
LOG_I
(
"num:%3d, force:%5d, timestamp:%5d"
,
num
,
sensor_data
->
data
.
force
,
sensor_data
->
timestamp
);
LOG_I
(
"num:%3d, force:%5d, timestamp:%5d"
,
num
,
sensor_data
->
data
.
force
,
sensor_data
->
timestamp
);
break
;
break
;
case
RT_SENSOR_CLASS_DUST
:
LOG_I
(
"num:%3d, dust:%5d ug/m3, timestamp:%5d"
,
num
,
sensor_data
->
data
.
dust
,
sensor_data
->
timestamp
);
break
;
case
RT_SENSOR_CLASS_ECO2
:
LOG_I
(
"num:%3d, eco2:%5d ppm, timestamp:%5d"
,
num
,
sensor_data
->
data
.
eco2
,
sensor_data
->
timestamp
);
break
;
default:
default:
break
;
break
;
}
}
...
@@ -301,6 +320,15 @@ static void sensor(int argc, char **argv)
...
@@ -301,6 +320,15 @@ static void sensor(int argc, char **argv)
case
RT_SENSOR_VENDOR_DALLAS
:
case
RT_SENSOR_VENDOR_DALLAS
:
rt_kprintf
(
"vendor :Dallas
\n
"
);
rt_kprintf
(
"vendor :Dallas
\n
"
);
break
;
break
;
case
RT_SENSOR_VENDOR_ASAIR
:
rt_kprintf
(
"vendor :Asair
\n
"
);
break
;
case
RT_SENSOR_VENDOR_SHARP
:
rt_kprintf
(
"vendor :Sharp
\n
"
);
break
;
case
RT_SENSOR_VENDOR_SENSIRION
:
rt_kprintf
(
"vendor :Sensirion
\n
"
);
break
;
}
}
rt_kprintf
(
"model :%s
\n
"
,
info
.
model
);
rt_kprintf
(
"model :%s
\n
"
,
info
.
model
);
switch
(
info
.
unit
)
switch
(
info
.
unit
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录