Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
61bca24c
R
rt-thread
项目概览
BaiXuePrincess
/
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,发现更多精彩内容 >>
提交
61bca24c
编写于
10月 03, 2018
作者:
xuzhuoyi96
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bsp][stm32f429-disco] Change touch exec from hard timer to thread
上级
18e0e0fc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
29 deletion
+43
-29
bsp/stm32f429-disco/applications/application.c
bsp/stm32f429-disco/applications/application.c
+42
-0
bsp/stm32f429-disco/drivers/board.c
bsp/stm32f429-disco/drivers/board.c
+0
-4
bsp/stm32f429-disco/drivers/drv_touch.c
bsp/stm32f429-disco/drivers/drv_touch.c
+1
-25
未找到文件。
bsp/stm32f429-disco/applications/application.c
浏览文件 @
61bca24c
...
...
@@ -32,8 +32,40 @@
#include <gdb_stub.h>
#endif
#include "drv_touch.h"
#ifdef PKG_USING_LITTLEVGL2RTT
#include "littlevgl2rtt.h"
#endif
static
void
rt_touch_thread_entry
(
void
*
parameter
)
{
int16_t
x
;
int16_t
y
;
struct
touch_state
ts
;
while
(
1
)
{
touch_get_state
(
&
ts
);
#ifdef PKG_USING_LITTLEVGL2RTT
if
(
ts
.
pressed
)
{
x
=
(
3706
-
ts
.
x
)
/
14
;
y
=
(
-
461
+
ts
.
y
)
/
10
.
5
;
littlevgl2rtt_send_input_event
(
x
,
y
,
LITTLEVGL2RTT_INPUT_DOWN
);
}
else
littlevgl2rtt_send_input_event
(
-
1
,
-
1
,
LITTLEVGL2RTT_INPUT_UP
);
#endif
rt_thread_mdelay
(
100
);
}
}
void
rt_init_thread_entry
(
void
*
parameter
)
{
rt_thread_t
tid
;
/* GDB STUB */
#ifdef RT_USING_GDB
gdb_set_device
(
"uart6"
);
...
...
@@ -58,6 +90,16 @@ void rt_init_thread_entry(void* parameter)
rt_components_init
();
rt_device_t
tscreen
=
rt_device_find
(
"touch"
);
rt_device_open
(
tscreen
,
RT_DEVICE_FLAG_RDWR
);
tid
=
rt_thread_create
(
"touch"
,
rt_touch_thread_entry
,
RT_NULL
,
1024
,
4
,
20
);
if
(
tid
!=
RT_NULL
)
rt_thread_startup
(
tid
);
}
int
rt_application_init
()
...
...
bsp/stm32f429-disco/drivers/board.c
浏览文件 @
61bca24c
...
...
@@ -160,10 +160,6 @@ void rt_hw_board_init()
lcd
=
rt_device_find
(
"lcd"
);
rtgui_graphic_set_device
(
lcd
);
#endif
rt_device_t
tscreen
=
rt_device_find
(
"touch"
);
rt_device_open
(
tscreen
,
RT_DEVICE_FLAG_RDWR
);
rt_timer_start
((
rt_timer_t
)
tscreen
->
user_data
);
}
...
...
bsp/stm32f429-disco/drivers/drv_touch.c
浏览文件 @
61bca24c
...
...
@@ -213,26 +213,6 @@ void touch_show_state()
}
MSH_CMD_EXPORT
(
touch_show_state
,
show
screen
coordinate
in
touching
);
static
void
touch_timer
(
void
*
parameter
)
{
int16_t
x
;
int16_t
y
;
struct
touch_state
ts
;
touch_get_state
(
&
ts
);
#ifdef PKG_USING_LITTLEVGL2RTT
if
(
ts
.
pressed
)
{
x
=
(
3706
-
ts
.
x
)
/
14
;
y
=
(
-
461
+
ts
.
y
)
/
10
.
5
;
littlevgl2rtt_send_input_event
(
x
,
y
,
LITTLEVGL2RTT_INPUT_DOWN
);
}
else
littlevgl2rtt_send_input_event
(
-
1
,
-
1
,
LITTLEVGL2RTT_INPUT_UP
);
#endif
}
static
int
rt_hw_touch_init
(
void
)
{
static
struct
rt_device
touch
;
...
...
@@ -240,11 +220,7 @@ static int rt_hw_touch_init(void)
/* init device structure */
touch
.
type
=
RT_Device_Class_Unknown
;
touch
.
init
=
stmpe811_touch_init
;
/* create 1/8 second timer */
touch
.
user_data
=
rt_timer_create
(
"touch"
,
touch_timer
,
RT_NULL
,
RT_TICK_PER_SECOND
/
8
,
RT_TIMER_FLAG_PERIODIC
);
touch
.
user_data
=
RT_NULL
;
/* register touch device to RT-Thread */
rt_device_register
(
&
touch
,
"touch"
,
RT_DEVICE_FLAG_RDWR
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录