FMC+DAM驱动LVGL刷屏

编程入门 行业动态 更新时间:2024-10-27 01:28:16

FMC+DAM驱动LVGL<a href=https://www.elefans.com/category/jswz/34/1764215.html style=刷屏"/>

FMC+DAM驱动LVGL刷屏

前提条件

使用FMC驱动LCD刷屏

LVGL移植

开启DMA

需要开启MEMTOMEMDMA。

开启MPU

有MPU时需要

使能I-cache D-cache时

使用DMA传输数据时要保证数据的完整行和准确性

修改代码

逻辑

等待DMA传输完成然后再刷屏。

修改

  1. 在DMA初始化函数中最后添加

    注册DMA传输完成调用函数。

HAL_DMA_RegisterCallback(&hdma_memtomem_dma2_stream0, HAL_DMA_XFER_CPLT_CB_ID, LVGL_LCD_FSMC_DMA_pCallback);
  1. 修改disp_flush函数
/*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.*/
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{/*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*///     LCD_ShowPicture(area->x1, area->y1, area->x2 - area->x1+1, area->y2- area->y1+1, (uint16_t *)color_p);LCD_Address_Set(area->x1,area->y1,area->x2,area->y2); //写地址HAL_DMA_Start_IT(&hdma_memtomem_dma2_stream0, (uint32_t)color_p, Bank1_LCD_DATA, ((area->x2+1) - area->x1) * ((area->y2+1) - area->y1)); //写数据/*IMPORTANT!!!
//     *Inform the graphics library that you are ready with the flushing*/
//    lv_disp_flush_ready(disp_drv);
}
  1. 添加刷屏函数

    刷屏函数

void LVGL_LCD_FSMC_DMA_pCallback(DMA_HandleTypeDef *_hdma)
{lv_disp_flush_ready(&disp_drv);
}

更多推荐

FMC+DAM驱动LVGL刷屏

本文发布于:2023-11-16 17:49:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630515.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:刷屏   FMC   DAM   LVGL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!