Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2345VOR
rt-thread
提交
48d7cf4a
R
rt-thread
项目概览
2345VOR
/
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,发现更多精彩内容 >>
提交
48d7cf4a
编写于
12月 25, 2020
作者:
T
tyustli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【修改】解耦 touch 和 pin
上级
9a59737b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
8 deletion
+28
-8
components/drivers/Kconfig
components/drivers/Kconfig
+5
-0
components/drivers/touch/touch.c
components/drivers/touch/touch.c
+18
-8
components/drivers/touch/touch.h
components/drivers/touch/touch.h
+5
-0
未找到文件。
components/drivers/Kconfig
浏览文件 @
48d7cf4a
...
...
@@ -291,6 +291,11 @@ endif
config RT_USING_TOUCH
bool "Using Touch device drivers"
default n
if RT_USING_TOUCH
config RT_TOUCH_PIN_IRQ
bool "touch irq use pin irq"
default n
endif
menuconfig RT_USING_HWCRYPTO
bool "Using Hardware Crypto drivers"
...
...
components/drivers/touch/touch.c
浏览文件 @
48d7cf4a
...
...
@@ -16,12 +16,9 @@
#include <rtdbg.h>
/* ISR for touch interrupt */
static
void
irq_callback
(
void
*
args
)
void
rt_hw_touch_isr
(
rt_touch_t
touch
)
{
rt_touch_t
touch
;
touch
=
(
rt_touch_t
)
args
;
RT_ASSERT
(
touch
);
if
(
touch
->
parent
.
rx_indicate
==
RT_NULL
)
{
return
;
...
...
@@ -35,9 +32,17 @@ static void irq_callback(void *args)
touch
->
parent
.
rx_indicate
(
&
touch
->
parent
,
1
);
}
#ifdef RT_TOUCH_PIN_IRQ
static
void
touch_irq_callback
(
void
*
param
)
{
rt_hw_touch_isr
((
rt_touch_t
)
param
);
}
#endif
/* touch interrupt initialization function */
static
rt_err_t
rt_touch_irq_init
(
rt_touch_t
touch
)
{
#ifdef RT_TOUCH_PIN_IRQ
if
(
touch
->
config
.
irq_pin
.
pin
==
RT_PIN_NONE
)
{
return
-
RT_EINVAL
;
...
...
@@ -47,18 +52,19 @@ static rt_err_t rt_touch_irq_init(rt_touch_t touch)
if
(
touch
->
config
.
irq_pin
.
mode
==
PIN_MODE_INPUT_PULLDOWN
)
{
rt_pin_attach_irq
(
touch
->
config
.
irq_pin
.
pin
,
PIN_IRQ_MODE_RISING
,
irq_callback
,
(
void
*
)
touch
);
rt_pin_attach_irq
(
touch
->
config
.
irq_pin
.
pin
,
PIN_IRQ_MODE_RISING
,
touch_
irq_callback
,
(
void
*
)
touch
);
}
else
if
(
touch
->
config
.
irq_pin
.
mode
==
PIN_MODE_INPUT_PULLUP
)
{
rt_pin_attach_irq
(
touch
->
config
.
irq_pin
.
pin
,
PIN_IRQ_MODE_FALLING
,
irq_callback
,
(
void
*
)
touch
);
rt_pin_attach_irq
(
touch
->
config
.
irq_pin
.
pin
,
PIN_IRQ_MODE_FALLING
,
touch_
irq_callback
,
(
void
*
)
touch
);
}
else
if
(
touch
->
config
.
irq_pin
.
mode
==
PIN_MODE_INPUT
)
{
rt_pin_attach_irq
(
touch
->
config
.
irq_pin
.
pin
,
PIN_IRQ_MODE_RISING_FALLING
,
irq_callback
,
(
void
*
)
touch
);
rt_pin_attach_irq
(
touch
->
config
.
irq_pin
.
pin
,
PIN_IRQ_MODE_RISING_FALLING
,
touch_
irq_callback
,
(
void
*
)
touch
);
}
rt_pin_irq_enable
(
touch
->
config
.
irq_pin
.
pin
,
PIN_IRQ_ENABLE
);
#endif
return
RT_EOK
;
}
...
...
@@ -66,19 +72,23 @@ static rt_err_t rt_touch_irq_init(rt_touch_t touch)
/* touch interrupt enable */
static
void
rt_touch_irq_enable
(
rt_touch_t
touch
)
{
#ifdef RT_TOUCH_PIN_IRQ
if
(
touch
->
config
.
irq_pin
.
pin
!=
RT_PIN_NONE
)
{
rt_pin_irq_enable
(
touch
->
config
.
irq_pin
.
pin
,
RT_TRUE
);
}
#endif
}
/* touch interrupt disable */
static
void
rt_touch_irq_disable
(
rt_touch_t
touch
)
{
#ifdef RT_TOUCH_PIN_IRQ
if
(
touch
->
config
.
irq_pin
.
pin
!=
RT_PIN_NONE
)
{
rt_pin_irq_enable
(
touch
->
config
.
irq_pin
.
pin
,
RT_FALSE
);
}
#endif
}
static
rt_err_t
rt_touch_open
(
rt_device_t
dev
,
rt_uint16_t
oflag
)
...
...
components/drivers/touch/touch.h
浏览文件 @
48d7cf4a
...
...
@@ -66,7 +66,9 @@ struct rt_touch_info
struct
rt_touch_config
{
#ifdef RT_TOUCH_PIN_IRQ
struct
rt_device_pin_mode
irq_pin
;
/* Interrupt pin, The purpose of this pin is to notification read data */
#endif
char
*
dev_name
;
/* The name of the communication device */
void
*
user_data
;
};
...
...
@@ -103,6 +105,9 @@ int rt_hw_touch_register(rt_touch_t touch,
rt_uint32_t
flag
,
void
*
data
);
/* if you doesn't use pin device. you must call this function in your touch irq callback */
void
rt_hw_touch_isr
(
rt_touch_t
touch
);
#ifdef __cplusplus
}
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录