Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_77017786
rt-thread
提交
e9bbc2e3
R
rt-thread
项目概览
2301_77017786
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e9bbc2e3
编写于
4月 08, 2023
作者:
mysterywolf
提交者:
mysterywolf
4月 08, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[adc] modify adc channel data type from rt_uint32_t to rt_int8_t
上级
c8956357
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
14 deletion
+14
-14
components/drivers/include/drivers/adc.h
components/drivers/include/drivers/adc.h
+10
-10
components/drivers/misc/adc.c
components/drivers/misc/adc.c
+4
-4
未找到文件。
components/drivers/include/drivers/adc.h
浏览文件 @
e9bbc2e3
...
...
@@ -12,17 +12,18 @@
#ifndef __ADC_H__
#define __ADC_H__
#include <rtthread.h>
#define RT_ADC_INTERN_CH_TEMPER
((rt_uint32_t)
-1)
#define RT_ADC_INTERN_CH_VREF
((rt_uint32_t)
-2)
#define RT_ADC_INTERN_CH_VBAT
((rt_uint32_t)
-3)
#define RT_ADC_INTERN_CH_TEMPER
(
-1)
#define RT_ADC_INTERN_CH_VREF
(
-2)
#define RT_ADC_INTERN_CH_VBAT
(
-3)
struct
rt_adc_device
;
struct
rt_adc_ops
{
rt_err_t
(
*
enabled
)(
struct
rt_adc_device
*
device
,
rt_
uint32
_t
channel
,
rt_bool_t
enabled
);
rt_err_t
(
*
convert
)(
struct
rt_adc_device
*
device
,
rt_
uint32
_t
channel
,
rt_uint32_t
*
value
);
rt_err_t
(
*
enabled
)(
struct
rt_adc_device
*
device
,
rt_
int8
_t
channel
,
rt_bool_t
enabled
);
rt_err_t
(
*
convert
)(
struct
rt_adc_device
*
device
,
rt_
int8
_t
channel
,
rt_uint32_t
*
value
);
rt_uint8_t
(
*
get_resolution
)(
struct
rt_adc_device
*
device
);
rt_int16_t
(
*
get_vref
)
(
struct
rt_adc_device
*
device
);
};
...
...
@@ -43,10 +44,9 @@ typedef enum
}
rt_adc_cmd_t
;
rt_err_t
rt_hw_adc_register
(
rt_adc_device_t
adc
,
const
char
*
name
,
const
struct
rt_adc_ops
*
ops
,
const
void
*
user_data
);
rt_uint32_t
rt_adc_read
(
rt_adc_device_t
dev
,
rt_uint32_t
channel
);
rt_err_t
rt_adc_enable
(
rt_adc_device_t
dev
,
rt_uint32_t
channel
);
rt_err_t
rt_adc_disable
(
rt_adc_device_t
dev
,
rt_uint32_t
channel
);
rt_int16_t
rt_adc_voltage
(
rt_adc_device_t
dev
,
rt_uint32_t
channel
);
rt_uint32_t
rt_adc_read
(
rt_adc_device_t
dev
,
rt_int8_t
channel
);
rt_err_t
rt_adc_enable
(
rt_adc_device_t
dev
,
rt_int8_t
channel
);
rt_err_t
rt_adc_disable
(
rt_adc_device_t
dev
,
rt_int8_t
channel
);
rt_int16_t
rt_adc_voltage
(
rt_adc_device_t
dev
,
rt_int8_t
channel
);
#endif
/* __ADC_H__ */
components/drivers/misc/adc.c
浏览文件 @
e9bbc2e3
...
...
@@ -115,7 +115,7 @@ rt_err_t rt_hw_adc_register(rt_adc_device_t device, const char *name, const stru
return
result
;
}
rt_uint32_t
rt_adc_read
(
rt_adc_device_t
dev
,
rt_
uint32
_t
channel
)
rt_uint32_t
rt_adc_read
(
rt_adc_device_t
dev
,
rt_
int8
_t
channel
)
{
rt_uint32_t
value
;
...
...
@@ -126,7 +126,7 @@ rt_uint32_t rt_adc_read(rt_adc_device_t dev, rt_uint32_t channel)
return
value
;
}
rt_err_t
rt_adc_enable
(
rt_adc_device_t
dev
,
rt_
uint32
_t
channel
)
rt_err_t
rt_adc_enable
(
rt_adc_device_t
dev
,
rt_
int8
_t
channel
)
{
rt_err_t
result
=
RT_EOK
;
...
...
@@ -144,7 +144,7 @@ rt_err_t rt_adc_enable(rt_adc_device_t dev, rt_uint32_t channel)
return
result
;
}
rt_err_t
rt_adc_disable
(
rt_adc_device_t
dev
,
rt_
uint32
_t
channel
)
rt_err_t
rt_adc_disable
(
rt_adc_device_t
dev
,
rt_
int8
_t
channel
)
{
rt_err_t
result
=
RT_EOK
;
...
...
@@ -162,7 +162,7 @@ rt_err_t rt_adc_disable(rt_adc_device_t dev, rt_uint32_t channel)
return
result
;
}
rt_int16_t
rt_adc_voltage
(
rt_adc_device_t
dev
,
rt_
uint32
_t
channel
)
rt_int16_t
rt_adc_voltage
(
rt_adc_device_t
dev
,
rt_
int8
_t
channel
)
{
rt_uint32_t
value
=
0
;
rt_int16_t
vref
=
0
,
voltage
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录