Exemple #1
0
/**
  * @brief  Init camera frame buffer with fixed color in format RGB565
  *         to a LCD display frame buffer line in format ARGB8888 using DMA2D service.
  * @param  sizeX: Size in X of rectangular region of the Camera frame buffer to initialize (in pixels unit)
  * @param  sizeX: Size in X of rectangular region of the Camera frame buffer to initialize (in pixels unit)
  * @param  argb_Value : Initialization value (pattern ARGB8888) to be applied to all rectangular region selected.
  * @retval Status CAMERA_OK or CAMERA_ERROR
  */
static uint32_t CameraFrameBufferRgb565_Init(uint32_t sizeX, uint32_t sizeY, uint32_t argb8888_Value)
{
  HAL_StatusTypeDef hal_status = HAL_OK;
  uint32_t status = CAMERA_ERROR;

  if((sizeX <= CAMERA_VGA_RES_X) && (sizeY <= CAMERA_VGA_RES_Y))
  {
    /* Register to memory mode with RGB565 as colorMode */
    hdma2d_camera.Init.Mode         = DMA2D_R2M; /* Mode Register to Memory */
    hdma2d_camera.Init.ColorMode    = DMA2D_RGB565; /* Output color mode */
    hdma2d_camera.Init.OutputOffset = 0x0; /* No offset in output */

    /* Set callback functions on transfer complete and transfer error */
    hdma2d_camera.XferCpltCallback  = Camera_FrameBuffer_Init_TransferComplete;
    hdma2d_camera.XferErrorCallback = Camera_FrameBuffer_Init_TransferError;

    hdma2d_camera.Instance = DMA2D;

    hal_status = HAL_DMA2D_Init(&hdma2d_camera);
    ASSERT(hal_status != HAL_OK);

    hal_status = HAL_DMA2D_Start_IT(&hdma2d_camera,
                                    argb8888_Value, /* Color value in Register to Memory DMA2D mode */
                                    (uint32_t)CAMERA_FRAME_BUFFER,  /* DMA2D output buffer */
                                    sizeX,  /* width of buffer in pixels */
                                    sizeY); /* height of buffer in lines */
    ASSERT(hal_status != HAL_OK);

    status = CAMERA_OK;
  }

  return (status);
}
Exemple #2
0
/**
 * @brief   Main program
 * @param  None
 * @retval None
 */
int main(void)
{
  HAL_StatusTypeDef hal_status = HAL_OK;
  uint8_t  lcd_status = LCD_OK;

  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, instruction and Data caches
       - Systick timer is configured by default as source of time base, but user
         can eventually implement his proper time base source (a general purpose
         timer for example or other time source), keeping in mind that Time base
         duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
         handled in milliseconds basis.
       - Set NVIC Group Priority to 4
       - Low Level Initialization: global MSP (MCU Support Package) initialization
   */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Wait until MFX is ready after reset */
  HAL_Delay(100);

  /* Configure LED1, LED2 and LED3 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);

  /*##-1- Initialize the SDRAM  ##############################################*/
  BSP_SDRAM_Init();

  /*##-2- Initialize the LCD #################################################*/

  /* Proceed to LTDC, DSI initialization and LCD screen initialization
   * with the configuration filled in above */
  lcd_status = BSP_LCD_Init();
  LCD_LayerDefaultInit(1, (uint32_t)&aBufferResult);
  BSP_LCD_SelectLayer(1);
  
  OnError_Handler(lcd_status != LCD_OK);

  HAL_Delay(100);

  /*##-3- DMA2D configuration ################################################*/
  DMA2D_Config();

  /*##-4- Start DMA2D transfer ###############################################*/  
  hal_status = HAL_DMA2D_Start_IT(&Dma2dHandle,
      (uint32_t)LCD_COLOR_GREEN, /* Fill the DMA2D output register with this color */
      (uint32_t)&aBufferResult,    /* DMA2D output register */
      LAYER_SIZE_X,
      LAYER_SIZE_Y);
  OnError_Handler(hal_status != HAL_OK);

  while (1)
  {
    ;
  }
}
Exemple #3
0
/**
 * @brief   Main program
 * @param  None
 * @retval None
 */
int main(void)
{
  HAL_StatusTypeDef hal_status = HAL_OK;
  uint8_t  lcd_status = LCD_OK;

  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, instruction and Data caches
       - Systick timer is configured by default as source of time base, but user
         can eventually implement his proper time base source (a general purpose
         timer for example or other time source), keeping in mind that Time base
         duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
         handled in milliseconds basis.
       - Set NVIC Group Priority to 4
       - Low Level Initialization: global MSP (MCU Support Package) initialization
   */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Wait until MFX is ready after reset */
  HAL_Delay(100);

  /* Configure LED1, LED2 and LED3 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);

  /*##-1- Initialize the LCD #################################################*/

  /* Proceed to LTDC, DSI initialization and LCD screen initialization
   * with the configuration filled in above */
  lcd_status = BSP_LCD_Init();
  LCD_LayerDefaultInit(0, (uint32_t)&ARGB8888_300x120);  //Background layer shows original image, on top of the screen
  LCD_LayerDefaultInit(1, (uint32_t)&aBufferResult);     //Forground layer shows converted image, on bottom of the screen
  BSP_LCD_SelectLayer(1);

  OnError_Handler(lcd_status != LCD_OK);

  HAL_Delay(100);

  /*##-2- DMA2D configuration ################################################*/
  DMA2D_Config();

  /*##-3- Start DMA2D transfer ###############################################*/  
  hal_status = HAL_DMA2D_Start_IT(&Dma2dHandle,
      (uint32_t)&ARGB8888_300x120, /* Input image 300x120 of format ARGB8888 (32 bpp) */
      (uint32_t)&aBufferResult,    /* Output image of same size 300x120 after conversion by PFC in ARGB4444 (16 bpp) */
      LAYER_SIZE_X,
      LAYER_SIZE_Y);
  OnError_Handler(hal_status != HAL_OK);

  while (1)
  {
    ;
  }
}
Exemple #4
0
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{       
  /* Example description.
     ------------------------------------------
  This example provides a description of how to configure DMA2D periph in 
  Memory_to_Memory with pixel format conversion transfer mode and display the 
  result on LCD.
  In this case two images will be displayed on the LCD, original image before 
  the pixel format conversion and the transferred data after pixel format conversion
  In this example the pixel format conversion is done from RGB565 to ARGB8888 
  and you can see on LCD the difference between the two images
   */  

  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, instruction and Data caches
       - Configure the Systick to generate an interrupt each 1 msec
       - Set NVIC Group Priority to 4
       - Global MSP (MCU Support Package) initialization
     */
  HAL_Init();
  
  /* Configure the system clock to 180 MHz */
  SystemClock_Config();

  /* Configure LED1, LED2 and LED3 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  
  /*##-1- LCD Configuration ##################################################*/
  LCD_Config();
  
  /*##-2- DMA2D configuration ################################################*/
  DMA2D_Config(); 
  
  /*##-3- Start DMA2D transfer ###############################################*/  
  if(HAL_DMA2D_Start_IT(&Dma2dHandle, (uint32_t)&RGB565_300x120, (uint32_t)&aBufferResult, 300, 120) != HAL_OK)
  {
    /* Initialization Error */
    Error_Handler(); 
  }

  /* Infinite loop */
  while (1)
  {
  }
}
Exemple #5
0
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, instruction and Data caches
       - Configure the Systick to generate an interrupt each 1 msec
       - Set NVIC Group Priority to 4
       - Global MSP (MCU Support Package) initialization
     */
  HAL_Init();
  
  /* Configure the system clock to 180 MHz */
  SystemClock_Config(); 

  /* Configure LED1, LED2 and LED3 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  
  /*##-1- LCD Configuration ##################################################*/
  LCD_Config();  
  
  /*##-2- DMA2D configuration ################################################*/
  DMA2D_Config();
  
  /*##-3- Start DMA2D transfer ###############################################*/  
  if(HAL_DMA2D_Start_IT(&Dma2dHandle, (uint32_t)&RGB565_150x150, (uint32_t)&aBufferResult, 150, 150) != HAL_OK)
  {
    /* Initialization Error */
    Error_Handler(); 
  }

  /* Infinite loop */  
  while (1)
  {
  }
}
Exemple #6
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /* Enable the CPU Cache */
  CPU_CACHE_Enable();
	
  /* STM32F7xx HAL library initialization:
       - Configure the Flash ART accelerator on ITCM interface
       - Systick timer is configured by default as source of time base, but user 
         can eventually implement his proper time base source (a general purpose 
         timer for example or other time source), keeping in mind that Time base 
         duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
         handled in milliseconds basis.
       - Set NVIC Group Priority to 4
       - Low Level Initialization
     */
  HAL_Init();

  /* Configure the system clock to 216 MHz */
  SystemClock_Config();

  /* Configure LED1, LED2, LED3 and LED4 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  BSP_LED_Init(LED4);

  /*##-1- Configure the DMA2D Mode, Output Color Mode and output offset #############*/
  Dma2dHandle.Init.Mode         = DMA2D_M2M; /* Mode Memory To Memory */
  Dma2dHandle.Init.ColorMode    = DMA2D_ARGB4444; /* Output color mode is ARGB4444 : 16 bpp */
  Dma2dHandle.Init.OutputOffset = 0x0; /* No offset on output */

  /*##-2- DMA2D Callbacks Configuration ######################################*/
  Dma2dHandle.XferCpltCallback  = TransferComplete;
  Dma2dHandle.XferErrorCallback = TransferError;
  
  /*##-3- Foreground Layer Configuration ###########################################*/
  Dma2dHandle.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA; /* Keep original Alpha from ARGB4444 input */
  Dma2dHandle.LayerCfg[1].InputAlpha = 0xFF; /* Fully opaque */
  Dma2dHandle.LayerCfg[1].InputColorMode = CM_ARGB4444; /* Input color is ARGB4444 : 16 bpp */
  Dma2dHandle.LayerCfg[1].InputOffset = 0x0; /* No offset in input */

  Dma2dHandle.Instance = DMA2D;

  /*##-4- DMA2D Initialisation ###############################################*/
  if(HAL_DMA2D_Init(&Dma2dHandle) != HAL_OK)
  {
    /* Initialization Error */
    Error_Handler();
  }

  /* Configure Foreground layer (ie layer 1) */
  if(HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1) != HAL_OK)
  {
    /* Initialization Error */
    Error_Handler();
  }

  /*##-5- Start DMA2D transfer ###############################################*/
  if(HAL_DMA2D_Start_IT(&Dma2dHandle,                       
                        (uint32_t)&aBufferInput,  /* Source memory buffer      */ 
                        (uint32_t)&aBufferResult, /* Destination memory buffer */
                        LAYER_SIZE_X,             /* Width of the 2D memory transfer in pixels */
                        LAYER_SIZE_Y)             /* Height of the 2D memory transfer in lines */
     != HAL_OK)
  {
    /* Initialization Error */
    Error_Handler();
  }
  
  /*##-6- Wait for the end of the transfer ###################################*/  
  /*  Before starting a new transfer, you need to check the current state of   
      the peripheral; if it’s busy you need to wait for the end of current
      transfer before starting a new one.
      For simplicity reasons, this example is just waiting till the end of the 
      transfer, but application may perform other tasks while transfer operation
      is ongoing. */  
  while (HAL_DMA2D_GetState(&Dma2dHandle) != HAL_DMA2D_STATE_READY)
  {
  } 

  /*##-7- Check transfer correctness #########################################*/
  if(Buffercmp(aBufferInput, 
               aBufferResult, 
               ((LAYER_SIZE_X * LAYER_SIZE_Y * LAYER_NB_BYTES_PER_PIXEL) / 4)) == ERROR)
  {
    /* KO */
    /* Turn on LED2 */
    BSP_LED_On(LED2);
  }
  else
  {
    /* OK */
    /* Turn on LED4 */
    BSP_LED_On(LED4);
  }

  while (1) { ; } 
}
Exemple #7
0
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  RCC_PeriphCLKInitTypeDef  PeriphClkInitStruct;

  /* Enable the CPU Cache */
  CPU_CACHE_Enable();
  
  /* STM32F7xx HAL library initialization:
       - Configure the Flash ART accelerator on ITCM interface
       - Systick timer is configured by default as source of time base, but user 
         can eventually implement his proper time base source (a general purpose 
         timer for example or other time source), keeping in mind that Time base 
         duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
         handled in milliseconds basis.
       - Set NVIC Group Priority to 4
       - Low Level Initialization
     */
  HAL_Init();
  
  /* Configure the system clock */
  SystemClock_Config(); 

  /*## LTDC Clock Configuration ###########################################*/  
  if(stmpe811_ts_drv.ReadID(TS_I2C_ADDRESS) == STMPE811_ID)
  {
    /* LCD clock configuration */
    /* LCD clock configuration */
    /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
    /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */
    /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/5 = 38.4 Mhz */
    /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_4 = 38.4/4 = 9.6Mhz */
    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
    PeriphClkInitStruct.PLLSAI.PLLSAIN = 192;
    PeriphClkInitStruct.PLLSAI.PLLSAIR = 5;
    PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_4;
    HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);  
    
  }
  else
  {
    /* LCD clock configuration */
    /* LCD clock configuration */
    /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
    /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 151 Mhz */
    /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 151/3 = 50.3 Mhz */
    /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_2 = 50.3/2 = 25.16Mhz */
    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
    PeriphClkInitStruct.PLLSAI.PLLSAIN = 151;
    PeriphClkInitStruct.PLLSAI.PLLSAIR = 3;
    PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
    HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); 
  } 
    
  /* Configure LED1, LED2 and LED3 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  
  /*##-1- LCD Configuration ##################################################*/
  LCD_Config();  
  
  /*##-2- DMA2D configuration ################################################*/
  DMA2D_Config();
  
  /*##-3- Start DMA2D transfer ###############################################*/  
  if(HAL_DMA2D_Start_IT(&Dma2dHandle, 
                        (uint32_t)&ARGB4444_150x150, /* Source buffer in format ARGB4444 and size 150x150      */
                        (uint32_t)&aBufferResult,    /* Destination buffer in format ARGB4444 and size 150x150 */
                        LAYER_SIZE_X, /* width in pixels  */
                        LAYER_SIZE_Y) /* height in pixels */
     != HAL_OK)
  {
    /* Initialization Error */
    Error_Handler(); 
  }
  
  while (1) { ; }
}
Exemple #8
0
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{       
  RCC_PeriphCLKInitTypeDef  PeriphClkInitStruct;
  HAL_StatusTypeDef hal_status = HAL_OK;
  /* Configure the MPU attributes as Write Through */
  MPU_Config();

  /* Enable the CPU Cache */
  CPU_CACHE_Enable();
  
  /* STM32F7xx HAL library initialization:
       - Configure the Flash prefetch
       - Systick timer is configured by default as source of time base, but user 
         can eventually implement his proper time base source (a general purpose 
         timer for example or other time source), keeping in mind that Time base 
         duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
         handled in milliseconds basis.
       - Set NVIC Group Priority to 4
       - Low Level Initialization
     */
  HAL_Init();
  
  /* Configure the system clock */
  SystemClock_Config();


  /*## LTDC Clock Configuration ###########################################*/  
  /* LCD clock configuration */
  /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
  /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */
  /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/5 = 38.4 Mhz */
  /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_4 = 38.4/4 = 9.6Mhz */
  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
  PeriphClkInitStruct.PLLSAI.PLLSAIN = 192;
  PeriphClkInitStruct.PLLSAI.PLLSAIR = 5;
  PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_4;
  HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);  
    
  /* Configure LED1 */
  BSP_LED_Init(LED1);
  
  /*##-1- LCD Configuration ##################################################*/
  LCD_Config();    
  
  /*##-2- DMA2D configuration ################################################*/
  DMA2D_Config(); 
  
  /*##-3- Start DMA2D transfer ###############################################*/  
  hal_status = HAL_DMA2D_Start_IT(&Dma2dHandle, 
                        (uint32_t)&ARGB8888_300x120, /* Input image 300x120 of format ARGB8888 (32 bpp) */
                        (uint32_t)&aBufferResult,    /* Output image of same size 300x120 after conversion by PFC in ARGB4444 (16 bpp) */
                        LAYER_SIZE_X,
                        LAYER_SIZE_Y);
  OnError_Handler(hal_status != HAL_OK);

  
  while (1) 
  { 
    ; 
  }
}
Exemple #9
0
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  blended_image_ready = 0;
  HAL_StatusTypeDef hal_status = HAL_OK;
  uint8_t  lcd_status = LCD_OK;
  LcdResX    = WVGA_RES_X; /* WVGA landscape */
  LcdResY    = WVGA_RES_Y;
  blended_image_ready = 0;
  offset_address_area_blended_image_in_lcd_buffer =  ((((LcdResY - LAYER_SIZE_Y) / 2) * LcdResX)
                                                     + ((LcdResX - LAYER_SIZE_X) / 2))
                                                     * ARGB8888_BYTE_PER_PIXEL;

  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, instruction and Data caches
       - Systick timer is configured by default as source of time base, but user
         can eventually implement his proper time base source (a general purpose
         timer for example or other time source), keeping in mind that Time base
         duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
         handled in milliseconds basis.
       - Set NVIC Group Priority to 4
       - Low Level Initialization: global MSP (MCU Support Package) initialization
     */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Wait until MFX is ready after reset */
  HAL_Delay(100);

  /* Configure LED1, LED2 and LED3 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);

  /*##-1- Initialize the LCD #################################################*/

  /* Proceed to LTDC, DSI initialization and LCD screen initialization
   * with the configuration filled in above */
  lcd_status = BSP_LCD_Init();
  BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);   
  OnError_Handler(lcd_status != LCD_OK);

  /* Prepare using DMA2D the 800x480 LCD frame buffer to display background color black */
  /* and title of the example                                                           */
  BSP_LCD_Clear(LCD_COLOR_BLACK);
  BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
  BSP_LCD_SetBackColor(LCD_COLOR_BLUE);
  BSP_LCD_SetFont(&Font16);

  /* Print example description */
  BSP_LCD_DisplayStringAt(0, 440, (uint8_t *)"DMA2D_MemToMemWithLCD example", CENTER_MODE);

  HAL_Delay(100);

  /*##-2- DMA2D configuration ################################################*/
  DMA2D_Config();

  /*##-3- Start DMA2D transfer ###############################################*/
  hal_status =  HAL_DMA2D_Start_IT(&Dma2dHandle,
                       (uint32_t)&ARGB4444_150x150, /* Source buffer in format ARGB4444 and size 150x150      */
                       (uint32_t)&aBufferResult,    /* Destination buffer in format ARGB4444 and size 150x150 */
                       LAYER_SIZE_X, /* width in pixels  */
                       LAYER_SIZE_Y); /* height in pixels */
  OnError_Handler(hal_status != HAL_OK);

  /*##-4- Copy blended image in center of LCD frame buffer ################################################*/
  /* Wait until blended image is ready to be displayed */
  while(blended_image_ready == 0) {;}

  /* Blocking copy Blended image buffer to LCD frame buffer center area */
  /* Using the DMA2D in polling mode                            */
  lcd_status = CopyBlendedBufferToLcdFrameBuffer((void*)&(aBufferResult[0]),
                                                 (void*)(LCD_FRAME_BUFFER + offset_address_area_blended_image_in_lcd_buffer),
                                                 LAYER_SIZE_X,
                                                 LAYER_SIZE_Y);
  while (1)
  {
  }
}
Exemple #10
0
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{
    /* STM32F4xx HAL library initialization:
         - Configure the Flash prefetch, instruction and Data caches
         - Configure the Systick to generate an interrupt each 1 msec
         - Set NVIC Group Priority to 4
         - Global MSP (MCU Support Package) initialization
       */
    HAL_Init();

    /* Configure the system clock */
    SystemClock_Config();

    /* Configure LED1, LED2, LED3 and LED4 */
    BSP_LED_Init(LED1);
    BSP_LED_Init(LED2);
    BSP_LED_Init(LED3);
    BSP_LED_Init(LED4);

    /*##-1- Configure the DMA2D Mode, Color Mode and output offset #############*/
    Dma2dHandle.Init.Mode         = DMA2D_M2M;
    Dma2dHandle.Init.ColorMode    = DMA2D_ARGB8888;
    Dma2dHandle.Init.OutputOffset = 0x0;

    /*##-2- DMA2D Callbacks Configuration ######################################*/
    Dma2dHandle.XferCpltCallback  = TransferComplete;
    Dma2dHandle.XferErrorCallback = TransferError;

    /*##-3- Foreground Configuration ###########################################*/
    Dma2dHandle.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
    Dma2dHandle.LayerCfg[1].InputAlpha = 0xFF;
    Dma2dHandle.LayerCfg[1].InputColorMode = CM_ARGB4444;
    Dma2dHandle.LayerCfg[1].InputOffset = 0x0;

    Dma2dHandle.Instance          = DMA2D;

    /*##-4- DMA2D Initialisation ###############################################*/
    if(HAL_DMA2D_Init(&Dma2dHandle) != HAL_OK)
    {
        /* Initialization Error */
        Error_Handler();
    }

    if(HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1) != HAL_OK)
    {
        /* Initialization Error */
        Error_Handler();
    }

    /*##-5- Start DMA2D transfer ###############################################*/
    if(HAL_DMA2D_Start_IT(&Dma2dHandle, (uint32_t)&aBufferInput, (uint32_t)&aBufferResult, 16, 32) != HAL_OK)
    {
        /* Initialization Error */
        Error_Handler();
    }

    /*##-6- Check transfer correctness #########################################*/
    if(Buffercmp(aBufferInput, aBufferResult, 256) == ERROR)
    {
        /* KO */
        /* Turn on LD2 */
        BSP_LED_On(LED2);
    }
    else
    {
        /* OK */
        /* Turn on LD4 */
        BSP_LED_On(LED4);
    }

    while (1)
    {
    }
}