HAL DMA2D How to Use ¶
- group DMA2D_How_To_Use
-
How to use the DMA2D HAL module driver ¶
The DMA2D HAL driver can be used as follows: ¶
-
Declare a hal_dma2d_handle_t handle structure, for example: hal_dma2d_handle_t hdma2d;
-
Initialize the DMA2D low level resources :
-
Enable the DMA2D interface clock (if not enabled in HAL_DMA2D_Init() when USE_HAL_DMA2D_CLK_ENABLE_MODEL set to HAL_CLK_ENABLE_NO)
-
-
Use HAL_DMA2D_Init() function to initialize the DMA2D handle and associate the physical instance.
For DMA2D transfer:
-
Configure the DMA2D driver according to the desired transfer mode by setting one of the following structure :
-
hal_dma2d_blending_config_t : for a DMA2D transfer with blending of the foreground and background input images
-
hal_dma2d_blending_fixed_color_config_t : for a DMA2D transfer with blending of one of the input sources image (on the foreground or background) and a fixed color on the other input
-
hal_dma2d_mem_copy_config_t : for a DMA2D transfer aiming to copy an image with or without Pixel Format Conversion
-
hal_dma2d_mem_fill_config_t : for a DMA2D transfer aiming to fill an area with a fixed color
-
-
Then call one of the following dedicated configuration API
-
HAL_DMA2D_SetConfigMemCopy() ; to configure a transfer for memory-to-memory without Pixel Format Conversion.
-
HAL_DMA2D_SetConfigMemCopyPFC() ; to configure a transfer for memory-to-memory with Pixel Format Conversion.
-
HAL_DMA2D_SetConfigMemFill() ; to configure a transfer for memory fill with a fixed color.
-
HAL_DMA2D_SetConfigBlending() ; to configure a transfer with bending of the two input (foreground and background)
-
HAL_DMA2D_SetConfigBlendingFixFGColor() ; to configure a transfer for bending an image from the background input with a fixed color on the foreground input
-
HAL_DMA2D_SetConfigBlendingFixBGColor() ; to configure a transfer for bending an image from the foreground input with a fixed color on the background input
-
-
And finally start the DMA2D transfer by calling HAL_DMA2D_Start() or HAL_DMA2D_Start_IT()
For DMA2D CLUT Loading:
-
Configure the DMA2D CLUT configuration structure hal_dma2d_clut_config_t
-
And start the DMA2D CLUT by calling HAL_DMA2D_StartCLUTLoad() or HAL_DMA2D_StartCLUTLoad_IT()
Callback registration ¶
When the compilation flag USE_HAL_DMA2D_REGISTER_CALLBACKS is set to 1, use Functions HAL_DMA2D_RegisterXxxCallback() to register an interrupt callback.
When the compilation flag is set to 0 or not defined, the callback registration feature is not available and all callbacks are set to the corresponding weak functions.
-