先楫官方工程师干货: HPM6700/6400 的显示控制系统(LCD和2D图形加速单元、LVGL)
<section powered-by="xiumi.us" style=" justify-content: center; display: flex; flex-flow: row nowrap; box-sizing: border-box; visibility: visible"><section style=" vertical-align: top; align-self: flex-start; flex: 0 0 auto; border-bottom: 1px solid rgb(95, 145, 183); border-bottom-right-radius: 0px; box-sizing: border-box; visibility: visible">
<section powered-by="xiumi.us" style="justify-content: center; display: flex; flex-flow: row nowrap; box-sizing: border-box; visibility: visible">
<section style=" vertical-align: top; align-self: flex-start; flex: 100 100 0%; box-sizing: border-box; visibility: visible">
<section powered-by="xiumi.us" style="transform: perspective(0px); transform-style: flat; box-sizing: border-box; visibility: visible">
<section style=" transform: rotateX(180deg); box-sizing: border-box; visibility: visible">
<section style=" vertical-align: top; overflow: hidden; background-color: rgb(214, 72, 87); box-sizing: border-box; visibility: visible"><svg style=" vertical-align: top; visibility: visible" viewbox="0 0 1 1"></svg></section>
</section>
</section>
</section>
<section style=" vertical-align: top; flex: 0 0 auto; box-sizing: border-box; visibility: visible">
<section powered-by="xiumi.us" style=" box-sizing: border-box; visibility: visible">
<section style=" color: rgb(95, 145, 183); box-sizing: border-box; visibility: visible">
<p style="white-space: normal; box-sizing: border-box; visibility: visible"><strong style="box-sizing: border-box; visibility: visible">简 介</strong></p>
</section>
</section>
</section>
<section style=" vertical-align: top; align-self: flex-start; flex: 100 100 0%; box-sizing: border-box; visibility: visible">
<section powered-by="xiumi.us" style=" box-sizing: border-box; visibility: visible">
<section style=" vertical-align: top; overflow: hidden; background-color: rgb(95, 145, 183); box-sizing: border-box; visibility: visible"><svg style=" vertical-align: top; visibility: visible" viewbox="0 0 1 1"></svg></section>
</section>
</section>
</section>
</section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box; visibility: visible">
<p style=" white-space: normal; box-sizing: border-box; visibility: visible"> </p>
<p style="visibility: visible"><strong style="visibility: visible">HPM6700/6400系列</strong> MCU来自上海先楫半导体科技有限公司的高性能实时RISC-V微控制器,为工业自动化及边缘计算应用提供了极大的算力、高效的控制能力及丰富的多媒体功能。HPM6700/6400自带的显示控制系统,包括LCD控制器及2D图形加速单元,性能也非常强悍,可以轻松驱动1366x768高分辨率的LCD屏,且可达到60fps的高刷新帧率。</p>
<p style="visibility: visible"> </p>
<p style="white-space: normal; box-sizing: border-box; visibility: visible">本文主要介绍了 <strong style="visibility: visible">HPM6700/6400 </strong>的显示控制系统,包括LCD控制器和2D图形加速单元,并使用LVGL图形库开发的应用示例,方便开发者快速开发。</p>
<p style="white-space: normal; box-sizing: border-box; visibility: visible"> </p>
</section>
<section powered-by="xiumi.us" style=" justify-content: center; display: flex; flex-flow: row nowrap; box-sizing: border-box; visibility: visible">
<section style=" vertical-align: top; align-self: flex-start; flex: 0 0 auto; border-bottom: 1px solid rgb(95, 145, 183); border-bottom-right-radius: 0px; box-sizing: border-box; visibility: visible">
<section powered-by="xiumi.us" style="justify-content: center; display: flex; flex-flow: row nowrap; box-sizing: border-box; visibility: visible">
<section style=" vertical-align: top; align-self: flex-start; flex: 100 100 0%; box-sizing: border-box; visibility: visible">
<section powered-by="xiumi.us" style="transform: perspective(0px); transform-style: flat; box-sizing: border-box; visibility: visible">
<section style=" transform: rotateX(180deg); box-sizing: border-box; visibility: visible">
<section style=" vertical-align: top; overflow: hidden; background-color: rgb(214, 72, 87); box-sizing: border-box; visibility: visible"><svg style=" vertical-align: top; visibility: visible" viewbox="0 0 1 1"></svg></section>
</section>
</section>
</section>
<section style=" vertical-align: top; flex: 0 0 auto; box-sizing: border-box; visibility: visible">
<section powered-by="xiumi.us" style=" box-sizing: border-box; visibility: visible">
<section style=" color: rgb(95, 145, 183); box-sizing: border-box; visibility: visible">
<p style="white-space: normal; box-sizing: border-box; visibility: visible"><strong style="box-sizing: border-box; visibility: visible"> </strong><strong style="box-sizing: border-box; visibility: visible">LCD 控制器 (LCDC)</strong></p>
</section>
</section>
</section>
<section style=" vertical-align: top; align-self: flex-start; flex: 100 100 0%; box-sizing: border-box; visibility: visible">
<section powered-by="xiumi.us" style=" box-sizing: border-box; visibility: visible">
<section style=" vertical-align: top; overflow: hidden; background-color: rgb(95, 145, 183); box-sizing: border-box; visibility: visible"><svg style=" vertical-align: top; visibility: visible" viewbox="0 0 1 1"></svg></section>
</section>
</section>
</section>
</section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box; visibility: visible">
<p style="white-space: normal; box-sizing: border-box; visibility: visible"> </p>
<p style="white-space: normal; box-sizing: border-box; visibility: visible"><strong style="visibility: visible">HPM6700/6400系列 </strong>的图形显示接口 LCDC 支持连接多种不同种类,不同分辨率的 LCD(TFT) 显示屏。LCDC 支持 24 位并行数据线,支持时钟信号 PCLK,支持 HSYNC 和 VSYNC 同步信号。LCDC 可以作为总线主设备读取片上和片外的存储器的图像数据,并发送到外部显示屏上。LCDC 的特性如下:</p>
<p style="white-space: normal; box-sizing: border-box; visibility: visible"> </p>
<ul style="list-style-type: disc; visibility: visible">
<li style="visibility: visible">
<p style="white-space: normal; box-sizing: border-box; visibility: visible">支持多达 24 位 RGB 显示接口;</p>
</li>
<li style="visibility: visible">
<p style="white-space: normal; box-sizing: border-box; visibility: visible">内置 DMA,作为总线主设备读取显存数据;</p>
</li>
<li style="visibility: visible">
<p style="white-space: normal; box-sizing: border-box; visibility: visible">支持可配置的分辨率显示屏,刷新率可达 1366x768, 60 fps;</p>
</li>
<li style="visibility: visible">
<p style="white-space: normal; box-sizing: border-box; visibility: visible">支持多种数据格式输入 ARGB8888,RGB565,YUV422/YCbCr422,Y8,1bpp,2bpp,4bpp 和 8bpp;</p>
</li>
<li>
<p style="white-space: normal;box-sizing: border-box">支持多达8 个图层 Alpha Blending(混合叠加),其中 2 个主图层支持逐行 YUV422/YCbCr422;</p>
</li>
<li>
<p style="white-space: normal;box-sizing: border-box">支持最大 pixclk 为 85MHz 。</p>
</li>
</ul>
<p style="white-space: normal;box-sizing: border-box"> </p>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
</section>
<p powered-by="xiumi.us" style="white-space: normal;box-sizing: border-box"><em style="box-sizing: border-box">LCDC 功能框图</em></p>
<p powered-by="xiumi.us" style="white-space: normal;box-sizing: border-box"> </p>
<section powered-by="xiumi.us" style="justify-content: center;display: flex;flex-flow: row nowrap;box-sizing: border-box">
<section style="vertical-align: top;align-self: flex-start;flex: 0 0 auto;border-bottom: 1px solid rgb(95, 145, 183);border-bottom-right-radius: 0px;box-sizing: border-box">
<section powered-by="xiumi.us" style="justify-content: center;display: flex;flex-flow: row nowrap;box-sizing: border-box">
<section style="vertical-align: top;align-self: flex-start;flex: 100 100 0%;box-sizing: border-box">
<section powered-by="xiumi.us" style="transform: perspective(0px);transform-style: flat;box-sizing: border-box">
<section style="transform: rotateX(180deg);box-sizing: border-box">
<section style="vertical-align: top;overflow: hidden;background-color: rgb(214, 72, 87);box-sizing: border-box"><svg style="vertical-align:top" viewbox="0 0 1 1"></svg></section>
</section>
</section>
</section>
<section style="vertical-align: top;flex: 0 0 auto;box-sizing: border-box">
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="color: rgb(95, 145, 183);box-sizing: border-box">
<p style="white-space: normal;box-sizing: border-box"><strong style="box-sizing: border-box">2D 图形加速单元 (PDMA)</strong></p>
</section>
</section>
</section>
<section style="vertical-align: top;align-self: flex-start;flex: 100 100 0%;box-sizing: border-box">
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: top;overflow: hidden;background-color: rgb(95, 145, 183);box-sizing: border-box"><svg style="vertical-align:top" viewbox="0 0 1 1"></svg></section>
</section>
</section>
</section>
</section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<p style="white-space: normal;box-sizing: border-box"> </p>
<ul style="list-style-type: disc">
<li>
<p style="white-space: normal;box-sizing: border-box">本产品支持 1 个 2D 图形加速单元 PDMA。PDMA 支持处理逐行图像数据,支持按像素处理多种尺寸,多种颜色格式的图形;</p>
</li>
<li>
<p style="white-space: normal;box-sizing: border-box">支持同时取2个图层的数据,每个图层独立启用控制;</p>
</li>
<li>
<p style="white-space: normal;box-sizing: border-box">支持图像格式转换,包括ARGB8888,RGB565,YUV422H1P 图像转换;</p>
</li>
<li>
<p style="white-space: normal;box-sizing: border-box">支持图像0°/90°/180°/270°旋转;</p>
</li>
<li>
<p style="white-space: normal;box-sizing: border-box">支持水平、垂直的翻转;</p>
</li>
<li>
<p style="white-space: normal;box-sizing: border-box">支持图像缩放,X/Y拉伸、压缩;</p>
</li>
<li>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<p style="white-space: normal;box-sizing: border-box">支持图像截图。</p>
</section>
</li>
</ul>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"> </section>
<section style="vertical-align: middle;box-sizing: border-box"><em>PDMA功能框图</em></section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"> </section>
</section>
<section powered-by="xiumi.us" style="justify-content: center;display: flex;flex-flow: row nowrap;box-sizing: border-box">
<section style="vertical-align: top;align-self: flex-start;flex: 0 0 auto;border-bottom: 1px solid rgb(95, 145, 183);border-bottom-right-radius: 0px;box-sizing: border-box">
<section powered-by="xiumi.us" style="justify-content: center;display: flex;flex-flow: row nowrap;box-sizing: border-box">
<section style="vertical-align: top;align-self: flex-start;flex: 100 100 0%;box-sizing: border-box">
<section powered-by="xiumi.us" style="transform: perspective(0px);transform-style: flat;box-sizing: border-box">
<section style="transform: rotateX(180deg);box-sizing: border-box">
<section style="vertical-align: top;overflow: hidden;background-color: rgb(214, 72, 87);box-sizing: border-box"><svg style="vertical-align:top" viewbox="0 0 1 1"></svg></section>
</section>
</section>
</section>
<section style="vertical-align: top;flex: 0 0 auto;box-sizing: border-box">
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="color: rgb(95, 145, 183);box-sizing: border-box">
<p style="white-space: normal;box-sizing: border-box"><strong style="box-sizing: border-box">LVGL 应用开发</strong></p>
</section>
</section>
</section>
<section style="vertical-align: top;align-self: flex-start;flex: 100 100 0%;box-sizing: border-box">
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: top;overflow: hidden;background-color: rgb(95, 145, 183);box-sizing: border-box"><svg style="vertical-align:top" viewbox="0 0 1 1"></svg></section>
</section>
</section>
</section>
</section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<p style="box-sizing: border-box"> </p>
<p style="box-sizing: border-box"><strong>1. LVGL 介绍</strong></p>
<p style="box-sizing: border-box"> </p>
<p style="box-sizing: border-box">LVGL(轻巧而多功能的图形库)是一个免费的开放源代码图形库,它提供创建具有易于使用的图形元素,精美的视觉效果和低内存占用的嵌入式GUI所需的一切。</p>
<p style="box-sizing: border-box"> </p>
<p style="box-sizing: border-box"><strong>主要特性:</strong></p>
<ul style="list-style-type: disc">
<li>
<p style="box-sizing: border-box">功能强大的构建块,例如按钮,图表,列表,滑块,图像等;</p>
</li>
<li>
<p style="box-sizing: border-box">带有动画,抗锯齿,不透明,平滑滚动的高级图形各种输入设备,例如触摸板,鼠标,键盘,编码器等;</p>
</li>
<li>
<p style="box-sizing: border-box">支持UTF-8编码的多语言;</p>
</li>
<li>
<p style="box-sizing: border-box">多显示器支持,如TFT,单色显示器;</p>
</li>
<li>
<p style="box-sizing: border-box">完全可定制的图形元素;</p>
</li>
<li>
<p style="box-sizing: border-box">独立于任何微控制器或显示器使用的硬件;</p>
</li>
<li>
<p style="box-sizing: border-box">可扩展以使用很少的内存(64 KB闪存,16 KB RAM)进行操作;</p>
</li>
<li>
<p style="box-sizing: border-box">操作系统,支持外部存储器和GPU,但不是必需的;</p>
</li>
<li>
<p style="box-sizing: border-box">单帧缓冲区操作,即使具有高级图形效果;</p>
</li>
<li>
<p style="box-sizing: border-box">用C语言编写,以实现最大的兼容性(与C ++兼容);</p>
</li>
<li>
<p style="box-sizing: border-box">模拟器可在没有嵌入式硬件的PC上进行嵌入式GUI设计。</p>
</li>
<li >
<p style="box-sizing: border-box">可移植到MicroPython;</p>
</li>
<li >
<p style="box-sizing: border-box">可快速上手的教程、示例、主题;</p>
</li>
<li >
<p style="box-sizing: border-box">丰富的文档教程;</p>
</li>
<li >
<p style="box-sizing: border-box">在MIT许可下免费和开源。</p>
</li>
</ul>
<p style="box-sizing: border-box"> </p>
<p style="box-sizing: border-box"><strong>2. LVGL移植适配</strong></p>
<p style="box-sizing: border-box"> </p>
<p style="box-sizing: border-box"><strong>官方已经移植和适配好了LVGL,代码结构如下:</strong></p>
<p style="box-sizing: border-box"> </p>
<p>▸./lvgl 库本身</p>
<p>▸./lv_drivers 显示和输入设备驱动程序</p>
<p>▸./lv_examples 示例和演示</p>
<p>▸Lvgl官方网站 (https://docs.lvgl.io)</p>
<p>▸Lvgl官方博客站点(https://blog.lvgl.io)</p>
<p>▸Sim在线模拟器网站(https://sim.lvgl.io)</p>
<p>▸lv_sim_... 适用于各种IDE和平台的模拟器项目</p>
<p>▸lv_port_... 移植到其他开发板</p>
<p>▸lv_binding_... 绑定到其他语言</p>
<p>▸lv _… 移植到其他平台</p>
<p style="box-sizing: border-box"> </p>
<p style="box-sizing: border-box">其中,lvgl,lv_examples和lv_drivers是最受维护、关注的核心存储库。</p>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong style="box-sizing: border-box">lv_drivers显示接口:</strong></p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box">要设置显示,必须初始化 lv_disp_draw_buf_t 和 lv_disp_drv_t 变量。</p>
<p style="white-space: normal;box-sizing: border-box">lv_disp_draw_buf_t 保存显示缓冲区信息的结构体</p>
<p style="white-space: normal;box-sizing: border-box">lv_disp_drv_t HAL要注册的显示驱动程序、与显示交互并处理与图形相关的结构体、回调函数。</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong style="box-sizing: border-box">显示缓冲器:</strong></p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong>关于缓冲区大小,有 3 种情况:</strong></p>
<p style="white-space: normal;box-sizing: border-box"><strong>(1)一个缓冲区:</strong>LVGL将屏幕的内保存到缓冲区中并将其发送到显示器。缓冲区可以小于屏幕。在这种情况下,较大的区域将被重画成多个部分。如果只有很小的区域发生变化(例如按下按钮),则只会刷新该部分的区域。</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong>(2)两个非屏幕大小的缓冲区:</strong> 具有两个缓冲区的 LVGL 可以将其中一个作为显示缓冲区,而另一缓冲区的内容发送到后台显示。应该使用 DMA 或其他硬件将数据传输到显示器,以让CPU同时绘图。这样,渲染和刷新并行处理。与 一个缓冲区 的情况类似,如果缓冲区小于要刷新的区域,LVGL将按块绘制显示内容</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong>(3)两个屏幕大小的缓冲区:</strong> 与两个非屏幕大小的缓冲区相反,LVGL将始终提供整个屏幕的内容,而不仅仅是块。这样,驱动程序可以简单地将帧缓冲区的地址更改为从 LVGL 接收的缓冲区。因此,当MCU具有 LCD/TFT 接口且帧缓冲区只是 RAM 中的一个位置时,这种方法的效果很好。</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong style="box-sizing: border-box">显示驱动器:</strong></p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box">一旦缓冲区初始化准备就绪,就需要初始化显示驱动程序。</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box">lv_disp_drv_t的初始化,需要使用 lv_disp_drv_init(&disp_drv) 进行初始化。最后,要为 LVGL 注册显示设备,需要调用lv_disp_drv_register(&disp_drv)。</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong>在最简单的情况下,仅需要设置 lv_disp_drv_t 的以下两个字段:</strong></p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box">▸draw_buf 指向已初始化的 lv_disp_buf_t 变量的指针。</p>
<p> </p>
<p>▸flush_cb 回调函数,用于将缓冲区的内容复制到显示的特定区域。刷新准备就绪后,需要调用lv_disp_flush_ready()。LVGL可能会以多个块呈现屏幕,因此多次调用flush_cb。使用 lv_disp_flush_is_last() 可以查看哪块是最后渲染的。</p>
<p style="white-space: normal;box-sizing: border-box;letter-spacing: 1px"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong>其中,有一些可选的数据字段:</strong></p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box">▸hor_res 显示器的水平分辨率。(默认为 lv_conf.h 中的 LV_HOR_RES_MAX )</p>
<p style="white-space: normal;box-sizing: border-box">▸ver_res 显示器的垂直分辨率。(默认为 lv_conf.h 中的 LV_VER_RES_MAX )</p>
<p style="white-space: normal;box-sizing: border-box">▸color_chroma_key 色彩键控支持透明色。(默认为 lv_conf.h 中的 LV_COLOR_TRANSP )</p>
<p style="white-space: normal;box-sizing: border-box">▸user_data 驱动程序的自定义用户数据。可以在 lv_conf.h 中修改其类型。</p>
<p style="white-space: normal;box-sizing: border-box">▸anti-aliasing 使用抗锯齿(anti-aliasing)(边缘平滑)。缺省情况下默认为 lv_conf.h 中的 LV_ANTIALIAS 。</p>
<p style="white-space: normal;box-sizing: border-box">▸rotated 如果 1 交换 hor_res 和 ver_res 。两种情况下 LVGL 的绘制方向相同(从上到下的线条),因此还需要重新配置驱动程序以更改显示器的填充方向。</p>
<p style="white-space: normal;box-sizing: border-box">▸screen_transp 如果为 1 ,则屏幕可以具有透明或不透明的样式。需要在 lv_conf.h 中启用 LV_COLOR_SCREEN_TRANSP 。</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong>要使用GPU,可以使用以下回调:</strong></p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box">▸gpu_fill_cb 用颜色填充内存中的区域。</p>
<p style="white-space: normal;box-sizing: border-box">▸gpu_blend_cb 使用不透明度混合两个内存缓冲区。</p>
<p style="white-space: normal;box-sizing: border-box">▸gpu_wait_cb 如果在 GPU 仍在运行 LVGL 的情况下返回了任何 GPU 函数,则在需要确保GPU渲染就绪时将使用此函数。</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong>其他一些可选的回调,使单色、灰度或其他非标准RGB显示一起使用时更轻松、优化:</strong></p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box">▸rounder_cb 四舍五入要重绘的区域的坐标。例如。2x2像素可以转换为2x8。如果显示控制器只能刷新特定高度或宽度的区域(对于单色显示器,通常为8 px高),则可以使用它。</p>
<p style="white-space: normal;box-sizing: border-box">▸set_px_cb 编写显示缓冲区的自定义函数。如果显示器具有特殊的颜色格式,则可用于更紧凑地存储像素。(例如1位单色,2位灰度等)。这样,lv_disp_buf_t中使用的缓冲区可以较小,以仅保留给定区域大小所需的位数。set_px_cb不能与两个屏幕大小的缓冲区一起显示缓冲区配置。</p>
<p style="white-space: normal;box-sizing: border-box">▸monitor_cb 回调函数告诉在多少时间内刷新了多少像素。</p>
<p style="white-space: normal;box-sizing: border-box">▸clean_dcache_cb 清除与显示相关的所有缓存的回调</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong style="box-sizing: border-box">lv_drivers显示接口:</strong></p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong>要设置输入设备,必须初始化 lv_indev_drv_t 变量,</strong><strong>类型 (indev_drv.type)可以是:</strong></p>
<p style="white-space: normal;box-sizing: border-box">▸LV_INDEV_TYPE_POINTER 触摸板或鼠标</p>
<p style="white-space: normal;box-sizing: border-box">▸LV_INDEV_TYPE_KEYPAD 键盘或小键盘</p>
<p style="white-space: normal;box-sizing: border-box">▸LV_INDEV_TYPE_ENCODER 带有左,右,推动选项的编码器</p>
<p style="white-space: normal;box-sizing: border-box">▸LV_INDEV_TYPE_BUTTON 外部按钮按下屏幕</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong>3. 应用开发</strong></p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box">LVGL图形库功能控件有很多,这里不在详细介绍,详细API介绍查阅LVGL官网。</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong> LVGL主要控件功能有:</strong></p>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong>使用 lvgl 图形库之前,我们还必须初始化 lvgl 以及相关其他组件。初始化的顺序为:</strong></p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box">▸调用 lv_init() 初始化 lvgl 库;</p>
<p style="white-space: normal;box-sizing: border-box">▸初始化驱动程序;</p>
<p style="white-space: normal;box-sizing: border-box">▸在 LVGL 中注册显示和输入设备驱动程序;</p>
<p style="white-space: normal;box-sizing: border-box">▸在中断中每隔 x毫秒 调用 lv_tick_inc(x) 用以告知 lvgl 经过的时间;</p>
<p style="white-space: normal;box-sizing: border-box">▸每隔 x毫秒 定期调用 lv_task_handler() 用以处理与 lvgl 相关的任务。</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong style="box-sizing: border-box">SquareLine_Studio设计器:</strong></p>
<p style="white-space: normal;box-sizing: border-box"><em>(1)创建项目</em></p>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<p style="box-sizing: border-box"> </p>
<p style="box-sizing: border-box"><em>(2)控件布局设计</em></p>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<p style="box-sizing: border-box"> </p>
<p style="box-sizing: border-box"><em>(3)代码生成</em></p>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
</section>
<p powered-by="xiumi.us" style="box-sizing: border-box;letter-spacing: 1px"><em>(4)代码适配工程</em></p>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
</section>
<p powered-by="xiumi.us" style="box-sizing: border-box;letter-spacing: 1px"> </p>
<p powered-by="xiumi.us" style="box-sizing: border-box;letter-spacing: 1px"><em>(5)添加事件响应代码</em></p>
<p powered-by="xiumi.us" style="white-space: normal;box-sizing: border-box"><strong>运行效果:</strong></p>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"><strong>性能测试:</strong></p>
<ul style="list-style-type: disc">
<li>
<p style="white-space: normal;box-sizing: border-box">fps帧率:每秒钟LCD图形刷新的帧数;</p>
</li>
<li>
<p style="white-space: normal;box-sizing: border-box">LVGL会通过内部的tick,定时去刷屏幕;</p>
</li>
<li>
<p style="white-space: normal;box-sizing: border-box">10即1000ms/10ms=100FPS;</p>
</li>
<li>
<p style="white-space: normal;box-sizing: border-box">这个宏定义限定了LVGL刷屏帧率的上限,设定满帧100帧;</p>
</li>
<li>
<p style="white-space: normal;box-sizing: border-box">使用全尺寸双buffer。</p>
</li>
</ul>
<p style="white-space: normal;box-sizing: border-box"> </p>
</section>
<p powered-by="xiumi.us" style="white-space: normal;box-sizing: border-box"><strong>实测结果:</strong></p>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
</section>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: middle;box-sizing: border-box"></section>
<section style="vertical-align: middle;box-sizing: border-box"> </section>
</section>
<p powered-by="xiumi.us" style="white-space: normal;box-sizing: border-box"> </p>
<section powered-by="xiumi.us" style="justify-content: center;display: flex;flex-flow: row nowrap;box-sizing: border-box">
<section style="vertical-align: top;align-self: flex-start;flex: 0 0 auto;border-bottom: 1px solid rgb(95, 145, 183);border-bottom-right-radius: 0px;box-sizing: border-box">
<section powered-by="xiumi.us" style="justify-content: center;display: flex;flex-flow: row nowrap;box-sizing: border-box">
<section style="vertical-align: top;align-self: flex-start;flex: 100 100 0%;box-sizing: border-box">
<section powered-by="xiumi.us" style="transform: perspective(0px);transform-style: flat;box-sizing: border-box">
<section style="transform: rotateX(180deg);box-sizing: border-box">
<section style="vertical-align: top;overflow: hidden;background-color: rgb(214, 72, 87);box-sizing: border-box"><svg style="vertical-align:top" viewbox="0 0 1 1"></svg></section>
</section>
</section>
</section>
<section style="vertical-align: top;flex: 0 0 auto;box-sizing: border-box">
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="color: rgb(95, 145, 183);box-sizing: border-box">
<p style="white-space: normal;box-sizing: border-box"><strong style="box-sizing: border-box">总 结</strong></p>
</section>
</section>
</section>
<section style="vertical-align: top;align-self: flex-start;flex: 100 100 0%;box-sizing: border-box">
<section powered-by="xiumi.us" style="box-sizing: border-box">
<section style="vertical-align: top;overflow: hidden;background-color: rgb(95, 145, 183);box-sizing: border-box"><svg style="vertical-align:top" viewbox="0 0 1 1"></svg></section>
</section>
</section>
</section>
</section>
</section>
<p powered-by="xiumi.us" style="white-space: normal;box-sizing: border-box"> </p>
<section powered-by="xiumi.us" style="box-sizing: border-box">
<p style="white-space: normal;box-sizing: border-box">本文介绍了 <strong>HPM6700/6400 LCD 控制器和2D图形加速单元模块,同时介绍了 LVGL 图形界面库功能及移植适配要点,并基于 LVGL 图形界面库开发驱动点亮LCD屏的应用示例</strong>。根据实测结果,<strong>LCD 帧率可达到60fps</strong>。官方 HPM-SDK 已将LVGL图形库移植适配完成,也提供了基于 LVGL 的demo示例,用户可以非常便捷的使用HPM6700/6400 SDK 来完成LCD相关的应用开发。</p>
<p style="white-space: normal;box-sizing: border-box"> </p>
<p style="white-space: normal;box-sizing: border-box"> </p>
</section>
<p>LVGL(轻巧而多功能的图形库)是一个免费的开放源代码图形库,它提供创建具有易于使用的图形元素,精美的视觉效果和低内存占用的嵌入式GUI所需的一切。</p>
<p>虽然用过几次,还是不熟练,感谢分享!</p>
<p>LVGL(轻巧而多功能的图形库)是一个免费的开放源代码图形库,看来可以用HPM6750MINI评估板来学习LVGL了。</p>
<p>你好 我们现在用6750 有用2D加速旋转屏幕的教程吗</p>
eew_mhnstv 发表于 2024-9-23 18:02
你好 我们现在用6750 有用2D加速旋转屏幕的教程吗
<p>帮你问了下先楫官网,官方回复:可以看下hpm_sdk/samples/drivers/pdma例子</p>
<p> </p>
<p>2024.6.28更新:HPM SDK v1.6.0<br />
链接:https://pan.baidu.com/s/1RaYHOD7xk7fnotmgLpoAlA?pwd=xk2n<br />
提取码:xk2n 复制这段内容打开「百度网盘APP 即可获取」</p>
<p> </p>
<p>多谢分享!多谢分享!多谢分享!多谢分享!多谢分享!</p>
页:
[1]