/** * @brief Main program * @param None * @retval None */ int main(void) { uint32_t tobuttom = 0; uint32_t totop = 0; /* 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 LED3 */ BSP_LED_Init(LED3); /*##-1- LCD Configuration ##################################################*/ /* Configure 2 layers w/ Blending and CLUT loading for layer 1 */ LCD_Config(); /*##-2- CLUT Configuration #################################################*/ HAL_LTDC_ConfigCLUT(&LtdcHandle, (uint32_t *)L8_320x240_CLUT, 256, 0); /*##-3- Enable CLUT For Layer 1 ############################################*/ HAL_LTDC_EnableCLUT(&LtdcHandle, 0); /* Infinite loop */ while (1) { for (tobuttom = 0; tobuttom < 32; tobuttom++) { /* move the picture */ /* reconfigure the layer1 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, (tobuttom*5), (tobuttom), 0); /* reconfigure the layer2 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, (160 - (tobuttom*5)), (32 - tobuttom), 1); HAL_Delay(50); } HAL_Delay(500); for (totop = 0; totop < 32; totop++) { /* move the picture */ /* reconfigure the layer1 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, (160 - (totop*5)), (32 - (totop)), 0); /* reconfigure the layer2 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, (totop*5), totop, 1); HAL_Delay(50); } HAL_Delay(500); } }
/** * @brief Line Event callback. * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains * the configuration information for the specified LTDC. * @retval None */ void HAL_LTDC_LineEvenCallback(LTDC_HandleTypeDef *hltdc) { if(Pending == 1) { /* reconfigure the layer1 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, Xpos1, Ypos1, 0); /* reconfigure the layer2 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, Xpos2, Ypos2, 1); Pending = 0; } /* Reconfigure line event */ HAL_LTDC_ProgramLineEvent(hltdc, 0); }
/** * @brief Main program * @param None * @retval None */ int main(void) { uint32_t tobuttom = 0; uint32_t totop = 0; /* 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 LED3 */ BSP_LED_Init(LED3); /*##-1- LCD Configuration ##################################################*/ /* Configure 2 layers w/ Blending */ LCD_Config(); while (1) { for (tobuttom = 1; tobuttom < 41; tobuttom++) { /* move the picture */ /* reconfigure the layer1 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, 0, (tobuttom*4), 0); /* reconfigure the layer2 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, 0, (160 - (tobuttom*4)), 1); HAL_Delay(50); } HAL_Delay(500); for (totop = 1; totop < 41; totop++) { /* move the picture */ /* reconfigure the layer1 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, 0, (160 - (totop*4)), 0); /* reconfigure the layer2 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, 0, (totop*4), 1); HAL_Delay(50); } HAL_Delay(500); } }
/** * @brief Sets display window. * @param LayerIndex: Layer index * @param Xpos: LCD X position * @param Ypos: LCD Y position * @param Width: LCD window width * @param Height: LCD window height * @retval None */ void BSP_LCD_SetLayerWindow(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) { /* Reconfigure the layer size */ HAL_LTDC_SetWindowSize(&hLtdcHandler, Width, Height, LayerIndex); /* Reconfigure the layer position */ HAL_LTDC_SetWindowPosition(&hLtdcHandler, Xpos, Ypos, LayerIndex); }
/** * @brief Main program * @param None * @retval None */ int main(void) { RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; uint32_t toBottom = 0; uint32_t toTop = 0; /* 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(); /*## 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 = 192 Mhz */ /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/2 = 96 Mhz */ /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_4 = 96/4 = 24Mhz */ PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC; PeriphClkInitStruct.PLLSAI.PLLSAIN = 192; PeriphClkInitStruct.PLLSAI.PLLSAIR = 2; PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_4; HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); } /* Configure LED3 */ BSP_LED_Init(LED3); /*##-1- LCD Configuration ##################################################*/ /* Configure 2 layers w/ Blending and CLUT loading for layer 1 */ LCD_Config(); /*##-2- CLUT Configuration #################################################*/ HAL_LTDC_ConfigCLUT(&LtdcHandle, (uint32_t *)L8_320x240_CLUT, 256, 0); /*##-3- Enable CLUT For Layer 1 ############################################*/ HAL_LTDC_EnableCLUT(&LtdcHandle, 0); while (1) { for (toBottom = 0; toBottom < 32; toBottom++) { /* move the picture */ /* reconfigure the layer1 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, (toBottom*5), (toBottom), 0); /* reconfigure the layer2 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, (160 - (toBottom*5)), (32 - toBottom), 1); HAL_Delay(50); } HAL_Delay(500); for (toTop = 0; toTop < 32; toTop++) { /* move the picture */ /* reconfigure the layer1 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, (160 - (toTop*5)), (32 - (toTop)), 0); /* reconfigure the layer2 position */ HAL_LTDC_SetWindowPosition(&LtdcHandle, (toTop*5), toTop, 1); HAL_Delay(50); } HAL_Delay(500); } }