Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
AdRainty
rt-thread
提交
c850054a
R
rt-thread
项目概览
AdRainty
/
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,发现更多精彩内容 >>
未验证
提交
c850054a
编写于
7月 08, 2022
作者:
L
liYang~
提交者:
GitHub
7月 08, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Docking lvgl touch driver using package (#6149)
* Docking lvgl touch driver using package
上级
07a2e8c3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
65 addition
and
111 deletion
+65
-111
bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c
...tm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c
+58
-15
bsp/stm32/stm32f469-st-disco/board/Kconfig
bsp/stm32/stm32f469-st-disco/board/Kconfig
+7
-7
bsp/stm32/stm32f469-st-disco/board/ports/touch/SConscript
bsp/stm32/stm32f469-st-disco/board/ports/touch/SConscript
+0
-3
bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch_ft6x36.c
...2/stm32f469-st-disco/board/ports/touch/drv_touch_ft6x36.c
+0
-86
未找到文件。
bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c
浏览文件 @
c850054a
/*
/*
* Copyright (c) 2006-202
1
, RT-Thread Development Team
* Copyright (c) 2006-202
2
, RT-Thread Development Team
*
*
* SPDX-License-Identifier: Apache-2.0
* SPDX-License-Identifier: Apache-2.0
*
*
* Change Logs:
* Change Logs:
* Date Author Notes
* Date Author Notes
* 202
1-10-18 Meco Man
The first version
* 202
2-07-07 liYony
The first version
*/
*/
#include <lvgl.h>
#include <lvgl.h>
#include <rtdevice.h>
#include <rtdevice.h>
#include <lcd_port.h>
#include <lcd_port.h>
static
lv_indev_state_t
last_state
=
LV_INDEV_STATE_REL
;
#define DBG_TAG "LVGL.port.indev"
static
rt_int16_t
last_x
=
0
;
#define DBG_LVL DBG_INFO
static
rt_int16_t
last_y
=
0
;
#include <rtdbg.h>
/* Include the package header files you are using */
#ifdef BSP_USING_TOUCH_FT6X36
#include "ft6236.h"
#endif
/* BSP_USING_TOUCH_FT6X36 */
/* Touch chip connection information */
#define BSP_TOUCH_I2C_BUS_NAME "i2c1"
#define BSP_TOUCH_I2C_RESET_PIN 119
/* PH.7 */
/* RT-Thread touch device name */
#define TOUCH_DEV_NAME "touch"
lv_indev_t
*
touch_indev
;
lv_indev_t
*
touch_indev
;
rt_device_t
touch_dev
;
struct
rt_touch_data
*
read_data
;
static
void
input_read
(
lv_indev_drv_t
*
indev_drv
,
lv_indev_data_t
*
data
)
static
void
input_read
(
lv_indev_drv_t
*
indev_drv
,
lv_indev_data_t
*
data
)
{
{
data
->
point
.
x
=
last_x
;
rt_device_read
(
touch_dev
,
0
,
read_data
,
1
);
data
->
point
.
y
=
last_y
;
data
->
state
=
last_state
;
}
void
lv_port_indev_input
(
rt_int16_t
x
,
rt_int16_t
y
,
lv_indev_state_t
state
)
if
(
read_data
->
event
==
RT_TOUCH_EVENT_NONE
)
{
return
;
last_state
=
state
;
last_x
=
x
;
/* Since the origin of the LCD screen and the origin of the touch screen are
last_y
=
LCD_HEIGHT
-
y
;
* different, the parameters passed in here need to be simply converted. */
#ifdef BSP_USING_TOUCH_FT6X36
data
->
point
.
x
=
read_data
->
y_coordinate
;
data
->
point
.
y
=
LCD_HEIGHT
-
read_data
->
x_coordinate
;
#endif
/* BSP_USING_TOUCH_FT6X36 */
if
(
read_data
->
event
==
RT_TOUCH_EVENT_DOWN
)
data
->
state
=
LV_INDEV_STATE_PR
;
if
(
read_data
->
event
==
RT_TOUCH_EVENT_MOVE
)
data
->
state
=
LV_INDEV_STATE_PR
;
if
(
read_data
->
event
==
RT_TOUCH_EVENT_UP
)
data
->
state
=
LV_INDEV_STATE_REL
;
}
}
void
lv_port_indev_init
(
void
)
void
lv_port_indev_init
(
void
)
...
@@ -43,3 +63,26 @@ void lv_port_indev_init(void)
...
@@ -43,3 +63,26 @@ void lv_port_indev_init(void)
/*Register the driver in LVGL and save the created input device object*/
/*Register the driver in LVGL and save the created input device object*/
touch_indev
=
lv_indev_drv_register
(
&
indev_drv
);
touch_indev
=
lv_indev_drv_register
(
&
indev_drv
);
}
}
static
int
lv_hw_touch_init
(
void
)
{
struct
rt_touch_config
cfg
;
#ifdef BSP_USING_TOUCH_FT6X36
cfg
.
dev_name
=
BSP_TOUCH_I2C_BUS_NAME
;
rt_hw_ft6236_init
(
TOUCH_DEV_NAME
,
&
cfg
,
BSP_TOUCH_I2C_RESET_PIN
);
#endif
/* BSP_USING_TOUCH_FT6X36 */
touch_dev
=
rt_device_find
(
TOUCH_DEV_NAME
);
if
(
rt_device_open
(
touch_dev
,
RT_DEVICE_FLAG_RDONLY
)
!=
RT_EOK
)
{
LOG_E
(
"Can't open touch device:%s"
,
TOUCH_DEV_NAME
);
return
-
RT_ERROR
;
}
read_data
=
(
struct
rt_touch_data
*
)
rt_calloc
(
1
,
sizeof
(
struct
rt_touch_data
));
return
RT_EOK
;
}
INIT_COMPONENT_EXPORT
(
lv_hw_touch_init
);
bsp/stm32/stm32f469-st-disco/board/Kconfig
浏览文件 @
c850054a
...
@@ -15,6 +15,13 @@ menu "Onboard Peripheral Drivers"
...
@@ -15,6 +15,13 @@ menu "Onboard Peripheral Drivers"
select BSP_USING_TOUCH
select BSP_USING_TOUCH
default n
default n
if BSP_USING_LVGL
config BSP_USING_LVGL_DEMO
bool "Enable LVGL demo"
select PKG_USING_LV_MUSIC_DEMO
default n
endif
config BSP_USING_ARDUINO
config BSP_USING_ARDUINO
bool "Support Arduino"
bool "Support Arduino"
select PKG_USING_RTDUINO
select PKG_USING_RTDUINO
...
@@ -39,13 +46,6 @@ menu "Onboard Peripheral Drivers"
...
@@ -39,13 +46,6 @@ menu "Onboard Peripheral Drivers"
imply RTDUINO_USING_ADAFRUIT
imply RTDUINO_USING_ADAFRUIT
imply RTDUINO_USING_MSTIMER2
imply RTDUINO_USING_MSTIMER2
default n
default n
if BSP_USING_LVGL
config BSP_USING_LVGL_DEMO
bool "Enable LVGL demo"
select PKG_USING_LV_MUSIC_DEMO
default n
endif
config BSP_USING_SDRAM
config BSP_USING_SDRAM
bool "Enable SDRAM"
bool "Enable SDRAM"
...
...
bsp/stm32/stm32f469-st-disco/board/ports/touch/SConscript
浏览文件 @
c850054a
...
@@ -7,9 +7,6 @@ if GetDepend(['BSP_USING_TOUCH_FT6206']):
...
@@ -7,9 +7,6 @@ if GetDepend(['BSP_USING_TOUCH_FT6206']):
src
+=
Glob
(
'drv_touch.c'
)
src
+=
Glob
(
'drv_touch.c'
)
src
+=
Glob
(
'drv_touch_ft6206.c'
)
src
+=
Glob
(
'drv_touch_ft6206.c'
)
if
GetDepend
([
'BSP_USING_TOUCH_FT6X36'
]):
src
+=
Glob
(
'drv_touch_ft6x36.c'
)
CPPPATH
=
[
cwd
]
CPPPATH
=
[
cwd
]
group
=
DefineGroup
(
'Drivers'
,
src
,
depend
=
[
''
],
CPPPATH
=
CPPPATH
)
group
=
DefineGroup
(
'Drivers'
,
src
,
depend
=
[
''
],
CPPPATH
=
CPPPATH
)
...
...
bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch_ft6x36.c
已删除
100644 → 0
浏览文件 @
07a2e8c3
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-06-29 solar the first version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include "touch.h"
#include "lcd_port.h"
#include "drv_common.h"
#define DBG_TAG "ft6236"
#define DBG_LVL DBG_LOG
#include <rtdbg.h>
#ifdef BSP_USING_TOUCH_FT6X36
#include "ft6236.h"
#define BSP_TOUCH_I2C_BUS_NAME "i2c1"
#define BSP_TOUCH_I2C_RESET_PIN 119
/* PH.7 */
#ifdef PKG_USING_LVGL
#include <lvgl.h>
extern
void
lv_port_indev_input
(
rt_int16_t
x
,
rt_int16_t
y
,
lv_indev_state_t
state
);
#endif
/* PKG_USING_LVGL */
rt_thread_t
ft6236_thread
;
rt_device_t
touch
;
void
ft6236_thread_entry
(
void
*
parameter
)
{
struct
rt_touch_data
*
read_data
;
read_data
=
(
struct
rt_touch_data
*
)
rt_calloc
(
1
,
sizeof
(
struct
rt_touch_data
));
while
(
1
)
{
rt_device_read
(
touch
,
0
,
read_data
,
1
);
#ifdef PKG_USING_LVGL
/* Since the origin of the LCD screen and the origin of the touch screen are
* different, the parameters passed in here need to be simply converted. */
if
(
read_data
->
event
==
RT_TOUCH_EVENT_DOWN
)
lv_port_indev_input
(
read_data
->
y_coordinate
,
read_data
->
x_coordinate
,
LV_INDEV_STATE_PR
);
if
(
read_data
->
event
==
RT_TOUCH_EVENT_MOVE
)
lv_port_indev_input
(
read_data
->
y_coordinate
,
read_data
->
x_coordinate
,
LV_INDEV_STATE_PR
);
if
(
read_data
->
event
==
RT_TOUCH_EVENT_UP
)
lv_port_indev_input
(
read_data
->
y_coordinate
,
read_data
->
x_coordinate
,
LV_INDEV_STATE_REL
);
#endif
/* PKG_USING_LVGL */
if
(
read_data
->
event
!=
RT_TOUCH_EVENT_NONE
)
LOG_I
(
"LCD point x: %03d y: %03d"
,
read_data
->
y_coordinate
,
LCD_HEIGHT
-
read_data
->
x_coordinate
);
rt_thread_delay
(
10
);
}
}
int
ft6236_for_lvgl
(
void
)
{
struct
rt_touch_config
cfg
;
cfg
.
dev_name
=
BSP_TOUCH_I2C_BUS_NAME
;
rt_hw_ft6236_init
(
"touch"
,
&
cfg
,
BSP_TOUCH_I2C_RESET_PIN
);
touch
=
rt_device_find
(
"touch"
);
rt_device_open
(
touch
,
RT_DEVICE_FLAG_RDONLY
);
ft6236_thread
=
rt_thread_create
(
"touch"
,
ft6236_thread_entry
,
RT_NULL
,
1024
,
10
,
20
);
if
(
ft6236_thread
==
RT_NULL
)
{
LOG_D
(
"create ft6236 thread err"
);
return
-
RT_ENOMEM
;
}
rt_thread_startup
(
ft6236_thread
);
return
RT_EOK
;
}
INIT_ENV_EXPORT
(
ft6236_for_lvgl
);
#endif
/* BSP_USING_TOUCH_FT6X36 */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录