cancel
Showing results for 
Search instead for 
Did you mean: 

Hardware 2D DMA with color key

Ahmed Tolba
Associate II
Posted on June 10, 2018 at 01:35

Hi,

I'm using 2D DMA to draw sprites on the screen, but there is a surronding black color around the sprites.

So I have enabled the layer color key, and its not working, still there is a black rectangle around it.

BSP_LCD_SetColorKeying_NoReload(ActiveLayer, 0x0000);

void ConvertLineToRGB565(void * pSrc, void * pDst, uint32_t xSize, uint32_t ColorMode)

{

/* Configure the DMA2D Mode, Color Mode and output offset */

Dma2dHandler.Init.Mode = DMA2D_M2M_PFC ;//DMA2D_M2M_PFC;

Dma2dHandler.Init.ColorMode = DMA2D_RGB565;

Dma2dHandler.Init.OutputOffset = 0;

/* Foreground Configuration */

Dma2dHandler.LayerCfg[ActiveLayer].AlphaMode = DMA2D_NO_MODIF_ALPHA;

Dma2dHandler.LayerCfg[ActiveLayer].InputAlpha = 0x00;

Dma2dHandler.LayerCfg[ActiveLayer].InputColorMode = ColorMode;

Dma2dHandler.LayerCfg[ActiveLayer].InputOffset = 0;

Dma2dHandler.Instance = DMA2D;

/* DMA2D Initialization */

if(HAL_DMA2D_Init(&Dma2dHandler) == HAL_OK)

{

if(HAL_DMA2D_ConfigLayer(&Dma2dHandler, 1) == HAL_OK)

{

if (HAL_DMA2D_Start(&Dma2dHandler, (uint32_t)pSrc, (uint32_t)pDst, xSize, 1) == HAL_OK)

{

/* Polling For DMA transfer */

HAL_DMA2D_PollForTransfer(&Dma2dHandler, 10);

}

}

}

}
0 REPLIES 0