Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2345VOR
rt-thread
提交
6fe83d4a
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,发现更多精彩内容 >>
提交
6fe83d4a
编写于
5月 11, 2022
作者:
mysterywolf
提交者:
guo
5月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[lvgl][stm32f407] 优化LVGL初始化流程
上级
1b4f16f7
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
50 addition
and
149 deletion
+50
-149
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/demo/SConscript
.../stm32f407-atk-explorer/applications/lvgl/demo/SConscript
+2
-1
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/demo/lv_demo.c
...2/stm32f407-atk-explorer/applications/lvgl/demo/lv_demo.c
+18
-0
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/demo/lv_demo_calendar.c
...07-atk-explorer/applications/lvgl/demo/lv_demo_calendar.c
+0
-1
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/demo/lv_demo_calendar.h
...07-atk-explorer/applications/lvgl/demo/lv_demo_calendar.h
+0
-6
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_demo.c
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_demo.c
+0
-65
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_port_disp.h
...2/stm32f407-atk-explorer/applications/lvgl/lv_port_disp.h
+0
-23
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_port_indev.c
.../stm32f407-atk-explorer/applications/lvgl/lv_port_indev.c
+3
-3
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_port_indev.h
.../stm32f407-atk-explorer/applications/lvgl/lv_port_indev.h
+0
-28
bsp/stm32/stm32f407-atk-explorer/board/Kconfig
bsp/stm32/stm32f407-atk-explorer/board/Kconfig
+10
-4
bsp/stm32/stm32f407-atk-explorer/board/SConscript
bsp/stm32/stm32f407-atk-explorer/board/SConscript
+1
-1
bsp/stm32/stm32f407-atk-explorer/board/ports/drv_lcd.c
bsp/stm32/stm32f407-atk-explorer/board/ports/drv_lcd.c
+1
-1
bsp/stm32/stm32f407-atk-explorer/board/ports/touch/drv_touch.c
...tm32/stm32f407-atk-explorer/board/ports/touch/drv_touch.c
+15
-16
未找到文件。
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/demo/SConscript
浏览文件 @
6fe83d4a
...
@@ -12,5 +12,6 @@ for d in list:
...
@@ -12,5 +12,6 @@ for d in list:
if
os
.
path
.
isfile
(
os
.
path
.
join
(
path
,
'SConscript'
)):
if
os
.
path
.
isfile
(
os
.
path
.
join
(
path
,
'SConscript'
)):
group
=
group
+
SConscript
(
os
.
path
.
join
(
d
,
'SConscript'
))
group
=
group
+
SConscript
(
os
.
path
.
join
(
d
,
'SConscript'
))
group
=
group
+
DefineGroup
(
'LVGL-port'
,
src
,
depend
=
[
'BSP_USING_LVGL'
],
CPPPATH
=
CPPPATH
)
group
=
group
+
DefineGroup
(
'LVGL-demo'
,
src
,
depend
=
[
'BSP_USING_LVGL'
,
'BSP_USING_LVGL_DEMO'
],
CPPPATH
=
CPPPATH
)
Return
(
'group'
)
Return
(
'group'
)
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/demo/lv_demo.c
0 → 100644
浏览文件 @
6fe83d4a
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-17 Meco Man first version
* 2022-05-10 Meco Man improve rt-thread initialization process
*/
#include <lvgl.h>
void
lv_user_gui_init
(
void
)
{
/* display demo; you may replace with your LVGL application at here */
extern
void
lv_demo_calendar
(
void
);
lv_demo_calendar
();
}
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/demo/lv_demo_calendar.c
浏览文件 @
6fe83d4a
#include <lvgl.h>
#include <lvgl.h>
#include "lv_demo_calendar.h"
#include <board.h>
#include <board.h>
#include <drv_lcd.h>
#include <drv_lcd.h>
...
...
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/demo/lv_demo_calendar.h
已删除
100644 → 0
浏览文件 @
1b4f16f7
#ifndef __LV_DEMO_CALENDAR_H__
#define __LV_DEMO_CALENDAR_H__
void
lv_demo_calendar
(
void
);
#endif
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_demo.c
已删除
100644 → 0
浏览文件 @
1b4f16f7
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-17 Meco Man First version
*/
#include <rtthread.h>
#include <lvgl.h>
#include <lv_port_indev.h>
#include <lv_demo_calendar.h>
#define DBG_TAG "LVGL.demo"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#ifndef LV_THREAD_STACK_SIZE
#define LV_THREAD_STACK_SIZE 4096
#endif
#ifndef LV_THREAD_PRIO
#define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
#endif
static
void
lvgl_thread
(
void
*
parameter
)
{
/*assign buttons to coordinates*/
const
lv_point_t
points_array
[]
=
{{
200
,
35
},{
0
,
0
},{
70
,
35
},{
0
,
0
}};
lv_indev_set_button_points
(
button_indev
,
points_array
);
/* display demo; you may replace with your LVGL application at here */
#ifdef PKG_USING_LV_MUSIC_DEMO
extern
void
lv_demo_music
(
void
);
lv_demo_music
();
#else
lv_demo_calendar
();
#endif
/* handle the tasks of LVGL */
while
(
1
)
{
lv_task_handler
();
rt_thread_mdelay
(
10
);
}
}
static
int
lvgl_demo_init
(
void
)
{
rt_thread_t
tid
;
rt_device_t
lcd
=
RT_NULL
;
lcd
=
rt_device_find
(
"lcd"
);
rt_device_init
(
lcd
);
tid
=
rt_thread_create
(
"LVGL"
,
lvgl_thread
,
RT_NULL
,
LV_THREAD_STACK_SIZE
,
LV_THREAD_PRIO
,
0
);
if
(
tid
==
RT_NULL
)
{
LOG_E
(
"Fail to create 'LVGL' thread"
);
}
rt_thread_startup
(
tid
);
return
0
;
}
INIT_APP_EXPORT
(
lvgl_demo_init
);
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_port_disp.h
已删除
100644 → 0
浏览文件 @
1b4f16f7
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-18 Meco Man The first version
*/
#ifndef LV_PORT_DISP_H
#define LV_PORT_DISP_H
#ifdef __cplusplus
extern
"C"
{
#endif
void
lv_port_disp_init
(
void
);
#ifdef __cplusplus
}
/*extern "C"*/
#endif
#endif
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_port_indev.c
浏览文件 @
6fe83d4a
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
#include <board.h>
#include <board.h>
#include <drv_lcd.h>
#include <drv_lcd.h>
lv_indev_t
*
touch_indev
;
static
lv_indev_state_t
last_state
=
LV_INDEV_STATE_REL
;
static
lv_indev_state_t
last_state
=
LV_INDEV_STATE_REL
;
static
rt_int16_t
last_x
=
0
;
static
rt_int16_t
last_x
=
0
;
static
rt_int16_t
last_y
=
0
;
static
rt_int16_t
last_y
=
0
;
...
@@ -31,8 +33,6 @@ void lv_port_indev_input(rt_int16_t x, rt_int16_t y, lv_indev_state_t state)
...
@@ -31,8 +33,6 @@ void lv_port_indev_input(rt_int16_t x, rt_int16_t y, lv_indev_state_t state)
last_y
=
x
;
last_y
=
x
;
}
}
lv_indev_t
*
button_indev
;
void
lv_port_indev_init
(
void
)
void
lv_port_indev_init
(
void
)
{
{
static
lv_indev_drv_t
indev_drv
;
static
lv_indev_drv_t
indev_drv
;
...
@@ -42,5 +42,5 @@ void lv_port_indev_init(void)
...
@@ -42,5 +42,5 @@ void lv_port_indev_init(void)
indev_drv
.
read_cb
=
input_read
;
indev_drv
.
read_cb
=
input_read
;
/*Register the driver in LVGL and save the created input device object*/
/*Register the driver in LVGL and save the created input device object*/
button
_indev
=
lv_indev_drv_register
(
&
indev_drv
);
touch
_indev
=
lv_indev_drv_register
(
&
indev_drv
);
}
}
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_port_indev.h
已删除
100644 → 0
浏览文件 @
1b4f16f7
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-18 Meco Man The first version
*/
#ifndef LV_PORT_INDEV_H
#define LV_PORT_INDEV_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <lv_hal_indev.h>
extern
lv_indev_t
*
button_indev
;
void
lv_port_indev_init
(
void
);
void
lv_port_indev_input
(
rt_int16_t
x
,
rt_int16_t
y
,
lv_indev_state_t
state
);
#ifdef __cplusplus
}
/*extern "C"*/
#endif
#endif
bsp/stm32/stm32f407-atk-explorer/board/Kconfig
浏览文件 @
6fe83d4a
...
@@ -38,12 +38,12 @@ menu "Onboard Peripheral Drivers"
...
@@ -38,12 +38,12 @@ menu "Onboard Peripheral Drivers"
select BSP_USING_FMC
select BSP_USING_FMC
default n
default n
config BSP_USING_
MCU
_LCD
config BSP_USING_
ONBOARD
_LCD
bool "Enable ATK LCD"
bool "Enable ATK LCD"
select BSP_USING_SRAM
select BSP_USING_SRAM
default n
default n
if BSP_USING_
MCU
_LCD
if BSP_USING_
ONBOARD
_LCD
config BSP_USING_
MCU
_LCD_TEST
config BSP_USING_
ONBOARD
_LCD_TEST
bool "Enable lcd fill test"
bool "Enable lcd fill test"
default y
default y
endif
endif
...
@@ -60,11 +60,17 @@ menu "Onboard Peripheral Drivers"
...
@@ -60,11 +60,17 @@ menu "Onboard Peripheral Drivers"
config BSP_USING_LVGL
config BSP_USING_LVGL
bool "Enable LVGL for LCD"
bool "Enable LVGL for LCD"
select BSP_USING_
MCU
_LCD
select BSP_USING_
ONBOARD
_LCD
select BSP_USING_TOUCH
select BSP_USING_TOUCH
select PKG_USING_LVGL
select PKG_USING_LVGL
default n
default n
if BSP_USING_LVGL
config BSP_USING_LVGL_DEMO
bool "Enable LVGL demo"
default n
endif
config BSP_USING_SPI_FLASH
config BSP_USING_SPI_FLASH
bool "Enable SPI FLASH (W25Q128 spi1)"
bool "Enable SPI FLASH (W25Q128 spi1)"
select BSP_USING_SPI
select BSP_USING_SPI
...
...
bsp/stm32/stm32f407-atk-explorer/board/SConscript
浏览文件 @
6fe83d4a
...
@@ -29,7 +29,7 @@ if GetDepend(['BSP_USING_FS']):
...
@@ -29,7 +29,7 @@ if GetDepend(['BSP_USING_FS']):
if
GetDepend
([
'BSP_USING_SRAM'
]):
if
GetDepend
([
'BSP_USING_SRAM'
]):
src
+=
Glob
(
'ports/drv_sram.c'
)
src
+=
Glob
(
'ports/drv_sram.c'
)
if
GetDepend
([
'BSP_USING_
MCU
_LCD'
]):
if
GetDepend
([
'BSP_USING_
ONBOARD
_LCD'
]):
src
+=
Glob
(
'ports/drv_lcd.c'
)
src
+=
Glob
(
'ports/drv_lcd.c'
)
if
GetDepend
([
'BSP_USING_TOUCH'
]):
if
GetDepend
([
'BSP_USING_TOUCH'
]):
...
...
bsp/stm32/stm32f407-atk-explorer/board/ports/drv_lcd.c
浏览文件 @
6fe83d4a
...
@@ -1945,7 +1945,7 @@ int drv_lcd_hw_init(void)
...
@@ -1945,7 +1945,7 @@ int drv_lcd_hw_init(void)
}
}
INIT_DEVICE_EXPORT
(
drv_lcd_hw_init
);
INIT_DEVICE_EXPORT
(
drv_lcd_hw_init
);
#ifdef BSP_USING_
MCU
_LCD_TEST
#ifdef BSP_USING_
ONBOARD
_LCD_TEST
void
lcd_auto_fill
(
void
*
para
)
void
lcd_auto_fill
(
void
*
para
)
{
{
int
num
=
(
int
)
para
;
int
num
=
(
int
)
para
;
...
...
bsp/stm32/stm32f407-atk-explorer/board/ports/touch/drv_touch.c
浏览文件 @
6fe83d4a
...
@@ -8,9 +8,18 @@
...
@@ -8,9 +8,18 @@
* 2018-02-08 Zhangyihong the first version
* 2018-02-08 Zhangyihong the first version
*/
*/
#include <rtconfig.h>
#ifdef BSP_USING_TOUCH
#include "drv_touch.h"
#include "drv_touch.h"
#include <string.h>
#include <string.h>
#ifdef BSP_USING_TOUCH
#define DBG_ENABLE
#define DBG_SECTION_NAME "touch"
#define DBG_LEVEL DBG_INFO
#define DBG_COLOR
#include <rtdbg.h>
#ifdef PKG_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include <rtgui/event.h>
#include <rtgui/event.h>
#include <rtgui/rtgui_server.h>
#include <rtgui/rtgui_server.h>
...
@@ -18,20 +27,14 @@
...
@@ -18,20 +27,14 @@
#include <littlevgl2rtt.h>
#include <littlevgl2rtt.h>
#elif defined(PKG_USING_LVGL)
#elif defined(PKG_USING_LVGL)
#include <lvgl.h>
#include <lvgl.h>
#include <lv_port_indev.h>
extern
void
lv_port_indev_input
(
rt_int16_t
x
,
rt_int16_t
y
,
lv_indev_state_t
state
);
static
rt_bool_t
touch_down
=
RT_FALSE
;
static
rt_bool_t
touch_down
=
RT_FALSE
;
#endif
#endif
/* PKG_USING_GUIENGINE */
#define BSP_TOUCH_SAMPLE_HZ (50)
#define DBG_ENABLE
#define BSP_TOUCH_SAMPLE_HZ (50)
#define DBG_SECTION_NAME "TOUCH"
#define DBG_LEVEL DBG_INFO
#define DBG_COLOR
#include <rtdbg.h>
static
rt_list_t
driver_list
;
static
rt_list_t
driver_list
;
void
rt_touch_drivers_register
(
touch_drv_t
drv
)
void
rt_touch_drivers_register
(
touch_drv_t
drv
)
{
{
rt_list_insert_before
(
&
driver_list
,
&
drv
->
list
);
rt_list_insert_before
(
&
driver_list
,
&
drv
->
list
);
...
@@ -44,7 +47,6 @@ static void post_down_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
...
@@ -44,7 +47,6 @@ static void post_down_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
emouse
.
parent
.
sender
=
RT_NULL
;
emouse
.
parent
.
sender
=
RT_NULL
;
emouse
.
wid
=
RT_NULL
;
emouse
.
wid
=
RT_NULL
;
emouse
.
parent
.
type
=
RTGUI_EVENT_MOUSE_BUTTON
;
emouse
.
parent
.
type
=
RTGUI_EVENT_MOUSE_BUTTON
;
emouse
.
button
=
RTGUI_MOUSE_BUTTON_LEFT
|
RTGUI_MOUSE_BUTTON_DOWN
;
emouse
.
button
=
RTGUI_MOUSE_BUTTON_LEFT
|
RTGUI_MOUSE_BUTTON_DOWN
;
emouse
.
x
=
x
;
emouse
.
x
=
x
;
...
@@ -67,7 +69,6 @@ static void post_motion_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
...
@@ -67,7 +69,6 @@ static void post_motion_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
emouse
.
parent
.
sender
=
RT_NULL
;
emouse
.
parent
.
sender
=
RT_NULL
;
emouse
.
wid
=
RT_NULL
;
emouse
.
wid
=
RT_NULL
;
emouse
.
button
=
RTGUI_MOUSE_BUTTON_LEFT
|
RTGUI_MOUSE_BUTTON_DOWN
;
emouse
.
button
=
RTGUI_MOUSE_BUTTON_LEFT
|
RTGUI_MOUSE_BUTTON_DOWN
;
emouse
.
parent
.
type
=
RTGUI_EVENT_MOUSE_MOTION
;
emouse
.
parent
.
type
=
RTGUI_EVENT_MOUSE_MOTION
;
emouse
.
x
=
x
;
emouse
.
x
=
x
;
...
@@ -79,7 +80,7 @@ static void post_motion_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
...
@@ -79,7 +80,7 @@ static void post_motion_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
littlevgl2rtt_send_input_event
(
x
,
y
,
LITTLEVGL2RTT_INPUT_MOVE
);
littlevgl2rtt_send_input_event
(
x
,
y
,
LITTLEVGL2RTT_INPUT_MOVE
);
#elif defined(PKG_USING_LVGL)
#elif defined(PKG_USING_LVGL)
lv_port_indev_input
(
x
,
y
,
(
touch_down
==
RT_TRUE
)
?
LV_INDEV_STATE_PR
:
LV_INDEV_STATE_REL
);
lv_port_indev_input
(
x
,
y
,
(
touch_down
==
RT_TRUE
)
?
LV_INDEV_STATE_PR
:
LV_INDEV_STATE_REL
);
#endif
#endif
/* PKG_USING_GUIENGINE */
}
}
static
void
post_up_event
(
rt_uint16_t
x
,
rt_uint16_t
y
,
rt_tick_t
ts
)
static
void
post_up_event
(
rt_uint16_t
x
,
rt_uint16_t
y
,
rt_tick_t
ts
)
...
@@ -89,7 +90,6 @@ static void post_up_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
...
@@ -89,7 +90,6 @@ static void post_up_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
emouse
.
parent
.
sender
=
RT_NULL
;
emouse
.
parent
.
sender
=
RT_NULL
;
emouse
.
wid
=
RT_NULL
;
emouse
.
wid
=
RT_NULL
;
emouse
.
parent
.
type
=
RTGUI_EVENT_MOUSE_BUTTON
;
emouse
.
parent
.
type
=
RTGUI_EVENT_MOUSE_BUTTON
;
emouse
.
button
=
RTGUI_MOUSE_BUTTON_LEFT
|
RTGUI_MOUSE_BUTTON_UP
;
emouse
.
button
=
RTGUI_MOUSE_BUTTON_LEFT
|
RTGUI_MOUSE_BUTTON_UP
;
emouse
.
x
=
x
;
emouse
.
x
=
x
;
...
@@ -102,7 +102,7 @@ static void post_up_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
...
@@ -102,7 +102,7 @@ static void post_up_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
#elif defined(PKG_USING_LVGL)
#elif defined(PKG_USING_LVGL)
touch_down
=
RT_FALSE
;
touch_down
=
RT_FALSE
;
lv_port_indev_input
(
x
,
y
,
(
touch_down
==
RT_TRUE
)
?
LV_INDEV_STATE_PR
:
LV_INDEV_STATE_REL
);
lv_port_indev_input
(
x
,
y
,
(
touch_down
==
RT_TRUE
)
?
LV_INDEV_STATE_PR
:
LV_INDEV_STATE_REL
);
#endif
#endif
/* PKG_USING_GUIENGINE */
}
}
static
void
touch_thread_entry
(
void
*
parameter
)
static
void
touch_thread_entry
(
void
*
parameter
)
...
@@ -204,5 +204,4 @@ static int touc_bg_init(void)
...
@@ -204,5 +204,4 @@ static int touc_bg_init(void)
}
}
INIT_APP_EXPORT
(
touc_bg_init
);
INIT_APP_EXPORT
(
touc_bg_init
);
#endif
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录