Description
What MCU/Processor/Board and compiler are you using?
I use waveshare’s STM32F746 core board and 7inch Capacitive Touch LCD(F).
Keil MDK 5.24.
What do you want to achieve?
Port the disp_flush function with LTDC controller.
What have you tried so far?
I referenced the lv_port_stm32f746_disco_sw4stm32 project, but it was unsuccessful.
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
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*/
SCB_InvalidateICache();
SCB_CleanInvalidateDCache();
Copy_Buffer((const uint32_t *)color_p, my_fb, area->x1, area->y1, lv_area_get_width(area), lv_area_get_height(area));
/* IMPORTANT!!!
* Inform the graphics library that you are ready with the flushing*/
lv_disp_flush_ready(disp_drv);
}
{
uint32_t x_address = (hLtdcHandler.LayerCfg[ActiveLayer].FBStartAdress) + 2*(BSP_LCD_GetXSize()*y + x);
uint32_t source = (uint32_t)pSrc;
/* Register to memory mode with ARGB8888 as color Mode */
hDma2dHandler.Init.Mode = DMA2D_R2M;
if(hLtdcHandler.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565)
{ /* RGB565 format */
hDma2dHandler.Init.ColorMode = DMA2D_RGB565;
}
else
{ /* ARGB8888 format */
hDma2dHandler.Init.ColorMode = DMA2D_ARGB8888;
}
hDma2dHandler.Init.OutputOffset = BSP_LCD_GetXSize() - xSize;
hDma2dHandler.Instance = DMA2D;
/* DMA2D Initialization */
if(HAL_DMA2D_Init(&hDma2dHandler) == HAL_OK)
{
if(HAL_DMA2D_ConfigLayer(&hDma2dHandler, ActiveLayer) == HAL_OK)
{
if (HAL_DMA2D_Start(&hDma2dHandler, source, x_address, xSize, ySize) == HAL_OK)
{
/* Polling For DMA transfer */
HAL_DMA2D_PollForTransfer(&hDma2dHandler, 10);
}
}
}
}
Screenshot and/or video
I’m not sure if something is missing, but it looks like the objects are all created, but the colors are not quite right.I use the demo example.