Chrom-ART Accelerator™ (DMA2D) configuration in STM32CubeL4
Dma2dHandle.Init.ColorMode
is RGB565: 16 bpp */
Dma2dHandle.Init.OutputOffset = 0x0; /* No offset in output */
Dma2dHandle.Init.RedBlueSwap
the output image */
Dma2dHandle.Init.AlphaInverted = DMA2D_REGULAR_ALPHA;
inversion for the output image */
/* DMA2D Callbacks configuration */
Dma2dHandle.XferCpltCallback
Dma2dHandle.XferErrorCallback = TransferError;
/* Foreground configuration: Layer 1 */
Dma2dHandle.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
Dma2dHandle.LayerCfg[1].InputAlpha = 0xFF; /* Fully opaque */
Dma2dHandle.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565; /* Foreground
layer format is RGB565 : 16 bpp */
Dma2dHandle.LayerCfg[1].InputOffset = 0x0; /* No offset in input */
Dma2dHandle.LayerCfg[1].RedBlueSwap
swap for the input foreground image */
Dma2dHandle.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA;
inversion for the input foreground image */
Dma2dHandle.Instance = DMA2D;
/* DMA2D initialization */
hal_status = HAL_DMA2D_Init(&Dma2dHandle);
OnError_Handler(hal_status != HAL_OK);
hal_status = HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1);
OnError_Handler(hal_status != HAL_OK);
}
A full refresh is of course done in the same way but initializing the LCD 1
the image size to the LCD size.
LCD_ImagePreparation(0, 0, ST7789H2_LCD_PIXEL_WIDTH,
ST7789H2_LCD_PIXEL_HEIGHT);
And changing the number of pixels to be transferred in the DMA2D start command:
hal_status =
(uint32_t)&RGB565_240x240,
240x240 */
(uint32_t)&(LCD_ADDR->REG),
1, ST7789H2_LCD_PIXEL_HEIGHT * ST7789H2_LCD_PIXEL_WIDTH); /* number of
pixel to transfer
OnError_Handler(hal_status != HAL_OK);
12/22
= DMA2D_OUTPUT_RGB565; /* Output color mode
= DMA2D_RB_REGULAR;
= TransferComplete;
HAL_DMA2D_Start_IT(&Dma2dHandle,
/* Source buffer in format RGB565 and size
/* LCD data address */
*/
DocID029937 Rev 2
= DMA2D_RB_REGULAR;
AN4943
/* No R&B swap for
/* No alpha
/* No R&B
/* No alpha
st
pixel at (0, 0) and
Need help?
Do you have a question about the STM32L496 Series and is the answer not in the manual?