AN4943
4
Chrom-ART Accelerator™ (DMA2D) configuration in
STM32CubeL4
4.1
LCD partial refresh
An example configuring the DMA2D for an LCD partial refresh is provided in the
STM32Cube examples:
STM32Cube_FW_L4\Firmware\Projects\STM32L496G-Discovery\Examples\DMA2D\
DMA2D_MemToMemWithLCD.
The code used to configure and start the DMA2D is shown below:
/* Configure LCD before image display: set first pixel position and image
size */
/* the position of the partial refreshed window is defined here. A rectangle
in the middle of the screen */
LCD_ImagePreparation((ST7789H2_LCD_PIXEL_WIDTH - LAYER_SIZE_X)/2,
(ST7789H2_LCD_PIXEL_HEIGHT - LAYER_SIZE_Y)/2, LAYER_SIZE_X, LAYER_SIZE_Y);
/*##-2- DMA2D configuration
################################################*/
DMA2D_Config();
/*##-3- Start DMA2D transfer
###############################################*/
hal_status = HAL_DMA2D_Start_IT(&Dma2dHandle,
(uint32_t)&RGB565_240x160,
240x160 */
(uint32_t)&(LCD_ADDR->REG),
1, LAYER_SIZE_Y * LAYER_SIZE_X); /* number of pixel to transfer */
OnError_Handler(hal_status != HAL_OK);
...
...
...
/**
* @brief DMA2D configuration.
* @note
*
*
*
*
* @retval
*
None
*/
static void DMA2D_Config(void)
{
HAL_StatusTypeDef hal_status = HAL_OK;
/* Configure the DMA2D Mode, color Mode and output offset */
Dma2dHandle.Init.Mode
Chrom-ART Accelerator™ (DMA2D) configuration in STM32CubeL4
This function configure the DMA2D peripheral :
1) Configure the transfer mode : memory to memory
2) Configure the output color mode as RGB565
3) Configure the transfer from FLASH to SRAM
4) Configure the data size : 240x160 (pixels)
DocID029937 Rev 2
/* Source buffer in format RGB565 and size
/* LCD data address */
= DMA2D_M2M; /* DMA2D Mode memory to memory */
11/22
21
Need help?
Do you have a question about the STM32L496 Series and is the answer not in the manual?