/** * @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) { ; } }
/** * @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) { ; } }