Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yunke120
rt-thread
提交
9458791c
R
rt-thread
项目概览
yunke120
/
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,发现更多精彩内容 >>
提交
9458791c
编写于
2月 12, 2019
作者:
G
guozhanxin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add const keyword for sensor ops
上级
eae43943
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
13 deletion
+13
-13
components/drivers/sensors/sensor.h
components/drivers/sensors/sensor.h
+13
-13
未找到文件。
components/drivers/sensors/sensor.h
浏览文件 @
9458791c
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Date Author Notes
* Date Author Notes
* 2019-01-31 flybreak first version
* 2019-01-31 flybreak first version
*/
*/
#ifndef __SENSOR_H__
#ifndef __SENSOR_H__
#define __SENSOR_H__
#define __SENSOR_H__
...
@@ -45,7 +45,7 @@ extern "C" {
...
@@ -45,7 +45,7 @@ extern "C" {
#define RT_SEN_CLASS_NOISE (11)
/* Noise Loudness */
#define RT_SEN_CLASS_NOISE (11)
/* Noise Loudness */
#define RT_SEN_CLASS_STEP (12)
/* Step sensor */
#define RT_SEN_CLASS_STEP (12)
/* Step sensor */
/* Sensor vendor types */
/* Sensor vendor types */
#define RT_SEN_VENDOR_UNKNOWN (0)
#define RT_SEN_VENDOR_UNKNOWN (0)
#define RT_SEN_VENDOR_STM (1)
/* STMicroelectronics */
#define RT_SEN_VENDOR_STM (1)
/* STMicroelectronics */
...
@@ -54,7 +54,7 @@ extern "C" {
...
@@ -54,7 +54,7 @@ extern "C" {
#define RT_SEN_VENDOR_SEMTECH (4)
/* Semtech */
#define RT_SEN_VENDOR_SEMTECH (4)
/* Semtech */
#define RT_SEN_VENDOR_GOERTEK (5)
/* Goertek */
#define RT_SEN_VENDOR_GOERTEK (5)
/* Goertek */
/* Sensor unit types */
/* Sensor unit types */
#define RT_SEN_UNIT_NONE (0)
#define RT_SEN_UNIT_NONE (0)
#define RT_SEN_UNIT_MG (1)
/* Accelerometer unit: mG */
#define RT_SEN_UNIT_MG (1)
/* Accelerometer unit: mG */
...
@@ -75,7 +75,7 @@ extern "C" {
...
@@ -75,7 +75,7 @@ extern "C" {
#define RT_SEN_INTF_UART (1 << 2)
#define RT_SEN_INTF_UART (1 << 2)
#define RT_SEN_INTF_ONEWIRE (1 << 3)
#define RT_SEN_INTF_ONEWIRE (1 << 3)
/* Sensor power mode types */
/* Sensor power mode types */
#define RT_SEN_POWER_NONE (0)
#define RT_SEN_POWER_NONE (0)
#define RT_SEN_POWER_DOWN (1)
/* power down mode */
#define RT_SEN_POWER_DOWN (1)
/* power down mode */
...
@@ -133,15 +133,15 @@ struct rt_sensor_config
...
@@ -133,15 +133,15 @@ struct rt_sensor_config
struct
rt_sensor_device
struct
rt_sensor_device
{
{
struct
rt_device
parent
;
/* The standard device */
struct
rt_device
parent
;
/* The standard device */
struct
rt_sensor_info
info
;
/* The sensor info data */
struct
rt_sensor_info
info
;
/* The sensor info data */
struct
rt_sensor_config
config
;
/* The sensor config data */
struct
rt_sensor_config
config
;
/* The sensor config data */
void
*
data_buf
;
/* The buf of the data received */
void
*
data_buf
;
/* The buf of the data received */
rt_size_t
data_len
;
/* The size of the data received */
rt_size_t
data_len
;
/* The size of the data received */
struct
rt_sensor_ops
*
ops
;
/* The sensor ops */
const
struct
rt_sensor_ops
*
ops
;
/* The sensor ops */
struct
rt_sensor_module
*
module
;
/* The sensor module */
struct
rt_sensor_module
*
module
;
/* The sensor module */
};
};
typedef
struct
rt_sensor_device
*
rt_sensor_t
;
typedef
struct
rt_sensor_device
*
rt_sensor_t
;
...
@@ -149,7 +149,7 @@ typedef struct rt_sensor_device *rt_sensor_t;
...
@@ -149,7 +149,7 @@ typedef struct rt_sensor_device *rt_sensor_t;
struct
rt_sensor_module
struct
rt_sensor_module
{
{
rt_mutex_t
lock
;
/* The module lock */
rt_mutex_t
lock
;
/* The module lock */
rt_sensor_t
sen
[
RT_SEN_MODULE_MAX
];
/* The module contains a list of sensors */
rt_sensor_t
sen
[
RT_SEN_MODULE_MAX
];
/* The module contains a list of sensors */
rt_uint8_t
sen_num
;
/* Number of sensors contained in the module */
rt_uint8_t
sen_num
;
/* Number of sensors contained in the module */
};
};
...
@@ -180,7 +180,7 @@ struct rt_sensor_data
...
@@ -180,7 +180,7 @@ struct rt_sensor_data
rt_int32_t
tvoc
;
/* TVOC. unit: permillage */
rt_int32_t
tvoc
;
/* TVOC. unit: permillage */
rt_int32_t
noise
;
/* Noise Loudness. unit: HZ */
rt_int32_t
noise
;
/* Noise Loudness. unit: HZ */
rt_uint32_t
step
;
/* Step sensor. unit: 1 */
rt_uint32_t
step
;
/* Step sensor. unit: 1 */
}
data
;
}
data
;
};
};
struct
rt_sensor_ops
struct
rt_sensor_ops
...
@@ -190,9 +190,9 @@ struct rt_sensor_ops
...
@@ -190,9 +190,9 @@ struct rt_sensor_ops
};
};
int
rt_hw_sensor_register
(
rt_sensor_t
sensor
,
int
rt_hw_sensor_register
(
rt_sensor_t
sensor
,
const
char
*
name
,
const
char
*
name
,
rt_uint32_t
flag
,
rt_uint32_t
flag
,
void
*
data
);
void
*
data
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录