Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
452fbf85
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,发现更多精彩内容 >>
提交
452fbf85
编写于
10月 23, 2021
作者:
mysterywolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[lvgl][stm32l475] update demo
上级
dd12843e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
19 deletion
+45
-19
bsp/stm32/stm32l475-atk-pandora/board/ports/lvgl/lv_conf.h
bsp/stm32/stm32l475-atk-pandora/board/ports/lvgl/lv_conf.h
+1
-0
bsp/stm32/stm32l475-atk-pandora/board/ports/lvgl/lv_demo.c
bsp/stm32/stm32l475-atk-pandora/board/ports/lvgl/lv_demo.c
+44
-19
未找到文件。
bsp/stm32/stm32l475-atk-pandora/board/ports/lvgl/lv_conf.h
浏览文件 @
452fbf85
...
...
@@ -12,5 +12,6 @@
#define LV_CONF_H
#define LV_COLOR_16_SWAP 1
#define LV_USE_PERF_MONITOR 1
#endif
bsp/stm32/stm32l475-atk-pandora/board/ports/lvgl/lv_demo.c
浏览文件 @
452fbf85
...
...
@@ -12,7 +12,7 @@
#define DBG_TAG "LVGL"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#include <drv_lcd.h>
#include <lv_port_indev.h>
#ifndef LV_THREAD_STACK_SIZE
...
...
@@ -23,34 +23,59 @@
#define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
#endif
static
void
btn_event_cb
(
lv_event_t
*
e
)
static
void
event_handler
(
lv_event_t
*
e
)
{
lv_event_code_t
code
=
lv_event_get_code
(
e
);
lv_obj_t
*
btn
=
lv_event_get_target
(
e
);
if
(
code
==
LV_EVENT_CLICKED
)
{
static
uint8_t
cnt
=
0
;
cnt
++
;
/*Get the first child of the button which is the label and change its text*/
lv_obj_t
*
label
=
lv_obj_get_child
(
btn
,
0
);
lv_label_set_text_fmt
(
label
,
"WK_UP: %d"
,
cnt
);
lv_obj_t
*
obj
=
lv_event_get_target
(
e
);
if
(
code
==
LV_EVENT_VALUE_CHANGED
)
{
lv_calendar_date_t
date
;
if
(
lv_calendar_get_pressed_date
(
obj
,
&
date
))
{
LV_LOG_USER
(
"Clicked date: %02d.%02d.%d"
,
date
.
day
,
date
.
month
,
date
.
year
);
}
}
}
void
lv_example_calendar_1
(
void
)
{
lv_obj_t
*
calendar
=
lv_calendar_create
(
lv_scr_act
());
lv_obj_set_size
(
calendar
,
LCD_W
,
LCD_H
);
lv_obj_align
(
calendar
,
LV_ALIGN_CENTER
,
0
,
60
);
lv_obj_add_event_cb
(
calendar
,
event_handler
,
LV_EVENT_ALL
,
NULL
);
lv_calendar_set_today_date
(
calendar
,
2021
,
02
,
23
);
lv_calendar_set_showed_date
(
calendar
,
2021
,
02
);
/*Highlight a few days*/
static
lv_calendar_date_t
highlighted_days
[
3
];
/*Only its pointer will be saved so should be static*/
highlighted_days
[
0
].
year
=
2021
;
highlighted_days
[
0
].
month
=
02
;
highlighted_days
[
0
].
day
=
6
;
highlighted_days
[
1
].
year
=
2021
;
highlighted_days
[
1
].
month
=
02
;
highlighted_days
[
1
].
day
=
11
;
highlighted_days
[
2
].
year
=
2022
;
highlighted_days
[
2
].
month
=
02
;
highlighted_days
[
2
].
day
=
22
;
lv_calendar_set_highlighted_dates
(
calendar
,
highlighted_days
,
3
);
#if LV_USE_CALENDAR_HEADER_DROPDOWN
lv_calendar_header_dropdown_create
(
lv_scr_act
(),
calendar
);
#elif LV_USE_CALENDAR_HEADER_ARROW
lv_calendar_header_arrow_create
(
lv_scr_act
(),
calendar
,
25
);
#endif
}
static
void
lvgl_thread
(
void
*
parameter
)
{
/*assign buttons to coordinates*/
const
lv_point_t
points_array
[]
=
{{
0
,
0
},{
0
,
0
},{
0
,
0
},{
70
,
35
}};
const
lv_point_t
points_array
[]
=
{{
200
,
35
},{
0
,
0
},{
70
,
35
},{
0
,
0
}};
lv_indev_set_button_points
(
button_indev
,
points_array
);
lv_obj_t
*
btn
=
lv_btn_create
(
lv_scr_act
());
/*Add a button the current screen*/
lv_obj_set_pos
(
btn
,
10
,
10
);
/*Set its position*/
lv_obj_set_size
(
btn
,
120
,
50
);
/*Set its size*/
lv_obj_add_event_cb
(
btn
,
btn_event_cb
,
LV_EVENT_ALL
,
NULL
);
/*Assign a callback to the button*/
lv_obj_t
*
label
=
lv_label_create
(
btn
);
/*Add a label to the button*/
lv_label_set_text
(
label
,
"WK_UP: 0"
);
/*Set the labels text*/
lv_obj_center
(
label
);
lv_example_calendar_1
();
while
(
1
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录