Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
okll00
rt-thread
提交
bfebcac4
R
rt-thread
项目概览
okll00
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
bfebcac4
编写于
9月 12, 2020
作者:
B
Bernard Xiong
提交者:
GitHub
9月 12, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3903 from luhuadong/develop
[sensor] support GPS/GNSS sensor class
上级
de0bb6f9
6c25b839
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
1 deletion
+15
-1
components/drivers/sensors/sensor.c
components/drivers/sensors/sensor.c
+2
-1
components/drivers/sensors/sensor.h
components/drivers/sensors/sensor.h
+10
-0
components/drivers/sensors/sensor_cmd.c
components/drivers/sensors/sensor_cmd.c
+3
-0
未找到文件。
components/drivers/sensors/sensor.c
浏览文件 @
bfebcac4
...
...
@@ -34,7 +34,8 @@ static char *const sensor_name_str[] =
"step_"
,
/* Step sensor */
"forc_"
,
/* Force sensor */
"dust_"
,
/* Dust sensor */
"eco2_"
/* eCO2 sensor */
"eco2_"
,
/* eCO2 sensor */
"gnss_"
/* GPS/GNSS sensor */
};
/* Sensor interrupt correlation function */
...
...
components/drivers/sensors/sensor.h
浏览文件 @
bfebcac4
...
...
@@ -47,6 +47,7 @@ extern "C" {
#define RT_SENSOR_CLASS_FORCE (13)
/* Force sensor */
#define RT_SENSOR_CLASS_DUST (14)
/* Dust sensor */
#define RT_SENSOR_CLASS_ECO2 (15)
/* eCO2 sensor */
#define RT_SENSOR_CLASS_GNSS (16)
/* GPS/GNSS sensor */
/* Sensor vendor types */
...
...
@@ -84,6 +85,8 @@ extern "C" {
#define RT_SENSOR_UNIT_MN (13)
/* Force unit: mN */
#define RT_SENSOR_UNIT_PPM (14)
/* Concentration unit: ppm */
#define RT_SENSOR_UNIT_PPB (15)
/* Concentration unit: ppb */
#define RT_SENSOR_UNIT_DMS (16)
/* Coordinates unit: DMS */
#define RT_SENSOR_UNIT_DD (17)
/* Coordinates unit: DD */
/* Sensor communication interface types */
...
...
@@ -184,6 +187,12 @@ struct sensor_3_axis
rt_int32_t
z
;
};
struct
coordinates
{
double
longitude
;
double
latitude
;
};
struct
rt_sensor_data
{
rt_uint32_t
timestamp
;
/* The timestamp when the data was received */
...
...
@@ -193,6 +202,7 @@ struct rt_sensor_data
struct
sensor_3_axis
acce
;
/* Accelerometer. unit: mG */
struct
sensor_3_axis
gyro
;
/* Gyroscope. unit: mdps */
struct
sensor_3_axis
mag
;
/* Magnetometer. unit: mGauss */
struct
coordinates
coord
;
/* Coordinates unit: degrees */
rt_int32_t
temp
;
/* Temperature. unit: dCelsius */
rt_int32_t
humi
;
/* Relative humidity. unit: permillage */
rt_int32_t
baro
;
/* Pressure. unit: pascal (Pa) */
...
...
components/drivers/sensors/sensor_cmd.c
浏览文件 @
bfebcac4
...
...
@@ -34,6 +34,9 @@ static void sensor_show_data(rt_size_t num, rt_sensor_t sensor, struct rt_sensor
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
);
break
;
case
RT_SENSOR_CLASS_GNSS
:
LOG_I
(
"num:%3d, lon:%5d, lat:%5d, timestamp:%5d"
,
num
,
sensor_data
->
data
.
coord
.
longitude
,
sensor_data
->
data
.
coord
.
latitude
,
sensor_data
->
timestamp
);
break
;
case
RT_SENSOR_CLASS_TEMP
:
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
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录