Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
天中雨水
rt-thread
提交
5f6729e1
R
rt-thread
项目概览
天中雨水
/
rt-thread
该项目与 Fork 源项目分叉
Fork自
RT-Thread / rt-thread
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5f6729e1
编写于
12月 15, 2021
作者:
mysterywolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[qemu][lvgl] 优化lvgl显示驱动
上级
1390f7d1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
86 deletion
+21
-86
bsp/qemu-vexpress-a9/drivers/Kconfig
bsp/qemu-vexpress-a9/drivers/Kconfig
+0
-2
bsp/qemu-vexpress-a9/drivers/drv_clcd.c
bsp/qemu-vexpress-a9/drivers/drv_clcd.c
+1
-1
bsp/qemu-vexpress-a9/drivers/lvgl/lv_port_disp.c
bsp/qemu-vexpress-a9/drivers/lvgl/lv_port_disp.c
+20
-83
未找到文件。
bsp/qemu-vexpress-a9/drivers/Kconfig
浏览文件 @
5f6729e1
...
...
@@ -36,12 +36,10 @@ config BSP_DRV_MOUSE
if BSP_DRV_CLCD
config BSP_LCD_WIDTH
int "Width of LCD panel"
default 480 if PKG_USING_LV_MUSIC_DEMO
default 640
config BSP_LCD_HEIGHT
int "Height of LCD panel"
default 272 if PKG_USING_LV_MUSIC_DEMO
default 480
endif
...
...
bsp/qemu-vexpress-a9/drivers/drv_clcd.c
浏览文件 @
5f6729e1
...
...
@@ -109,7 +109,7 @@ int drv_clcd_hw_init(void)
_lcd
.
width
=
CLCD_WIDTH
;
_lcd
.
height
=
CLCD_HEIGHT
;
_lcd
.
fb
=
rt_malloc
(
_lcd
.
width
*
_lcd
.
height
*
2
);
_lcd
.
fb
=
rt_malloc
_align
(
_lcd
.
width
*
_lcd
.
height
*
2
,
3
2
);
if
(
_lcd
.
fb
==
NULL
)
{
rt_kprintf
(
"initialize frame buffer failed!
\n
"
);
...
...
bsp/qemu-vexpress-a9/drivers/lvgl/lv_port_disp.c
浏览文件 @
5f6729e1
...
...
@@ -13,18 +13,11 @@
/*A static or global variable to store the buffers*/
static
lv_disp_draw_buf_t
disp_buf
;
rt_device_t
lcd_device
=
0
;
static
rt_device_t
lcd_device
=
0
;
static
struct
rt_device_graphic_info
info
;
static
lv_disp_drv_t
disp_drv
;
/*Descriptor of a display driver*/
typedef
struct
{
uint8_t
blue
;
uint8_t
green
;
uint8_t
red
;
}
lv_color24_t
;
static
void
color_to16_maybe
(
lv_color16_t
*
dst
,
lv_color_t
*
src
)
{
#if (LV_COLOR_DEPTH == 16)
...
...
@@ -36,13 +29,6 @@ static void color_to16_maybe(lv_color16_t *dst, lv_color_t *src)
#endif
}
static
void
color_to24
(
lv_color24_t
*
dst
,
lv_color_t
*
src
)
{
dst
->
blue
=
src
->
ch
.
blue
;
dst
->
green
=
src
->
ch
.
green
;
dst
->
red
=
src
->
ch
.
red
;
}
/*Flush the content of the internal buffer the specific area on the display
*You can use DMA or any hardware acceleration to do this operation in the background but
*'lv_disp_flush_ready()' has to be called when finished.*/
...
...
@@ -75,76 +61,19 @@ static void lcd_fb_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_colo
uint32_t
y
;
long
int
location
=
0
;
/* 8 bit per pixel */
if
(
info
.
bits_per_pixel
==
8
)
{
uint8_t
*
fbp8
=
(
uint8_t
*
)
info
.
framebuffer
;
//TODO color convert maybe
for
(
y
=
act_y1
;
y
<=
act_y2
;
y
++
)
{
for
(
x
=
act_x1
;
x
<=
act_x2
;
x
++
)
{
location
=
(
x
)
+
(
y
)
*
info
.
width
;
fbp8
[
location
]
=
color_p
->
full
;
color_p
++
;
}
color_p
+=
x2
-
act_x2
;
}
}
/* 16 bit per pixel */
else
if
(
info
.
bits_per_pixel
==
16
)
{
lv_color16_t
*
fbp16
=
(
lv_color16_t
*
)
info
.
framebuffer
;
lv_color16_t
*
fbp16
=
(
lv_color16_t
*
)
info
.
framebuffer
;
for
(
y
=
act_y1
;
y
<=
act_y2
;
y
++
)
{
for
(
x
=
act_x1
;
x
<=
act_x2
;
x
++
)
{
location
=
(
x
)
+
(
y
)
*
info
.
width
;
color_to16_maybe
(
&
fbp16
[
location
],
color_p
);
color_p
++
;
}
color_p
+=
x2
-
act_x2
;
}
}
/* 24 bit per pixel */
else
if
(
info
.
bits_per_pixel
==
24
)
for
(
y
=
act_y1
;
y
<=
act_y2
;
y
++
)
{
lv_color24_t
*
fbp24
=
(
lv_color24_t
*
)
info
.
framebuffer
;
for
(
y
=
act_y1
;
y
<=
act_y2
;
y
++
)
for
(
x
=
act_x1
;
x
<=
act_x2
;
x
++
)
{
for
(
x
=
act_x1
;
x
<=
act_x2
;
x
++
)
{
location
=
(
x
)
+
(
y
)
*
info
.
width
;
color_to24
(
&
fbp24
[
location
],
color_p
);
color_p
++
;
}
color_p
+=
x2
-
act_x2
;
location
=
(
x
)
+
(
y
)
*
info
.
width
;
color_to16_maybe
(
&
fbp16
[
location
],
color_p
);
color_p
++
;
}
}
/* 32 bit per pixel */
else
if
(
info
.
bits_per_pixel
==
32
)
{
uint32_t
*
fbp32
=
(
uint32_t
*
)
info
.
framebuffer
;
//TODO
for
(
y
=
act_y1
;
y
<=
act_y2
;
y
++
)
{
for
(
x
=
act_x1
;
x
<=
act_x2
;
x
++
)
{
location
=
(
x
)
+
(
y
)
*
info
.
width
;
fbp32
[
location
]
=
color_p
->
full
;
color_p
++
;
}
color_p
+=
x2
-
act_x2
;
}
color_p
+=
x2
-
act_x2
;
}
struct
rt_device_rect_info
rect_info
;
...
...
@@ -161,7 +90,7 @@ static void lcd_fb_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_colo
void
lv_port_disp_init
(
void
)
{
rt_err_t
result
;
lv_color_t
*
fbuf
;
lv_color_t
*
fbuf
1
,
*
fbuf2
;
lcd_device
=
rt_device_find
(
"lcd"
);
if
(
lcd_device
==
0
)
...
...
@@ -187,15 +116,23 @@ void lv_port_disp_init(void)
RT_ASSERT
(
info
.
bits_per_pixel
==
8
||
info
.
bits_per_pixel
==
16
||
info
.
bits_per_pixel
==
24
||
info
.
bits_per_pixel
==
32
);
fbuf
=
rt_malloc
(
info
.
width
*
info
.
height
/
10
);
if
(
!
fbuf
)
fbuf1
=
rt_malloc_align
(
info
.
width
*
info
.
height
*
sizeof
(
lv_color_t
),
32
);
if
(
fbuf1
==
RT_NULL
)
{
rt_kprintf
(
"Error: alloc disp buf fail
\n
"
);
return
;
}
fbuf2
=
rt_malloc_align
(
info
.
width
*
info
.
height
*
sizeof
(
lv_color_t
),
32
);
if
(
fbuf2
==
RT_NULL
)
{
rt_kprintf
(
"Error: alloc disp buf fail
\n
"
);
rt_free
(
fbuf1
);
return
;
}
/*Initialize `disp_buf` with the buffer(s). With only one buffer use NULL instead buf_2 */
lv_disp_draw_buf_init
(
&
disp_buf
,
fbuf
,
RT_NULL
,
info
.
width
*
10
);
lv_disp_draw_buf_init
(
&
disp_buf
,
fbuf
1
,
fbuf2
,
info
.
width
*
info
.
height
);
lv_disp_drv_init
(
&
disp_drv
);
/*Basic initialization*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录