163 #include "stm32h7xx_hal.h"
169 #ifdef HAL_LTDC_MODULE_ENABLED
184 static void LTDC_SetConfig(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx);
224 assert_param(IS_LTDC_HSYNC(hltdc->Init.HorizontalSync));
228 assert_param(IS_LTDC_AAH(hltdc->Init.AccumulatedActiveH));
229 assert_param(IS_LTDC_AAW(hltdc->Init.AccumulatedActiveW));
237 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
238 if (hltdc->State == HAL_LTDC_STATE_RESET)
244 hltdc->LineEventCallback = HAL_LTDC_LineEventCallback;
245 hltdc->ReloadEventCallback = HAL_LTDC_ReloadEventCallback;
246 hltdc->ErrorCallback = HAL_LTDC_ErrorCallback;
248 if (hltdc->MspInitCallback ==
NULL)
250 hltdc->MspInitCallback = HAL_LTDC_MspInit;
253 hltdc->MspInitCallback(hltdc);
256 if (hltdc->State == HAL_LTDC_STATE_RESET)
261 HAL_LTDC_MspInit(hltdc);
266 hltdc->State = HAL_LTDC_STATE_BUSY;
270 hltdc->Instance->GCR |= (uint32_t)(hltdc->Init.HSPolarity | hltdc->Init.VSPolarity | \
271 hltdc->Init.DEPolarity | hltdc->Init.PCPolarity);
275 tmp = (hltdc->Init.HorizontalSync << 16U);
276 hltdc->Instance->SSCR |= (tmp | hltdc->Init.VerticalSync);
280 tmp = (hltdc->Init.AccumulatedHBP << 16U);
281 hltdc->Instance->BPCR |= (tmp | hltdc->Init.AccumulatedVBP);
285 tmp = (hltdc->Init.AccumulatedActiveW << 16U);
286 hltdc->Instance->AWCR |= (tmp | hltdc->Init.AccumulatedActiveH);
290 tmp = (hltdc->Init.TotalWidth << 16U);
291 hltdc->Instance->TWCR |= (tmp | hltdc->Init.TotalHeigh);
294 tmp = ((uint32_t)(hltdc->Init.Backcolor.Green) << 8U);
295 tmp1 = ((uint32_t)(hltdc->Init.Backcolor.Red) << 16U);
297 hltdc->Instance->BCCR |= (tmp1 | tmp | hltdc->Init.Backcolor.Blue);
300 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_TE | LTDC_IT_FU);
303 __HAL_LTDC_ENABLE(hltdc);
306 hltdc->ErrorCode = HAL_LTDC_ERROR_NONE;
309 hltdc->State = HAL_LTDC_STATE_READY;
323 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
324 if (hltdc->MspDeInitCallback ==
NULL)
326 hltdc->MspDeInitCallback = HAL_LTDC_MspDeInit;
329 hltdc->MspDeInitCallback(hltdc);
332 HAL_LTDC_MspDeInit(hltdc);
336 hltdc->ErrorCode = HAL_LTDC_ERROR_NONE;
339 hltdc->State = HAL_LTDC_STATE_RESET;
353 __weak
void HAL_LTDC_MspInit(LTDC_HandleTypeDef *hltdc)
369 __weak
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
379 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
394 HAL_StatusTypeDef HAL_LTDC_RegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID, pLTDC_CallbackTypeDef pCallback)
398 if (pCallback ==
NULL)
401 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK;
408 if (hltdc->State == HAL_LTDC_STATE_READY)
412 case HAL_LTDC_LINE_EVENT_CB_ID :
413 hltdc->LineEventCallback = pCallback;
416 case HAL_LTDC_RELOAD_EVENT_CB_ID :
417 hltdc->ReloadEventCallback = pCallback;
420 case HAL_LTDC_ERROR_CB_ID :
421 hltdc->ErrorCallback = pCallback;
424 case HAL_LTDC_MSPINIT_CB_ID :
425 hltdc->MspInitCallback = pCallback;
428 case HAL_LTDC_MSPDEINIT_CB_ID :
429 hltdc->MspDeInitCallback = pCallback;
434 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK;
440 else if (hltdc->State == HAL_LTDC_STATE_RESET)
444 case HAL_LTDC_MSPINIT_CB_ID :
445 hltdc->MspInitCallback = pCallback;
448 case HAL_LTDC_MSPDEINIT_CB_ID :
449 hltdc->MspDeInitCallback = pCallback;
454 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK;
463 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK;
487 HAL_StatusTypeDef HAL_LTDC_UnRegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID)
494 if (hltdc->State == HAL_LTDC_STATE_READY)
498 case HAL_LTDC_LINE_EVENT_CB_ID :
499 hltdc->LineEventCallback = HAL_LTDC_LineEventCallback;
502 case HAL_LTDC_RELOAD_EVENT_CB_ID :
503 hltdc->ReloadEventCallback = HAL_LTDC_ReloadEventCallback;
506 case HAL_LTDC_ERROR_CB_ID :
507 hltdc->ErrorCallback = HAL_LTDC_ErrorCallback;
510 case HAL_LTDC_MSPINIT_CB_ID :
511 hltdc->MspInitCallback = HAL_LTDC_MspInit;
514 case HAL_LTDC_MSPDEINIT_CB_ID :
515 hltdc->MspDeInitCallback = HAL_LTDC_MspDeInit;
520 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK;
526 else if (hltdc->State == HAL_LTDC_STATE_RESET)
530 case HAL_LTDC_MSPINIT_CB_ID :
531 hltdc->MspInitCallback = HAL_LTDC_MspInit;
534 case HAL_LTDC_MSPDEINIT_CB_ID :
535 hltdc->MspDeInitCallback = HAL_LTDC_MspDeInit;
540 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK;
549 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK;
584 void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef *hltdc)
586 uint32_t isrflags =
READ_REG(hltdc->Instance->ISR);
587 uint32_t itsources =
READ_REG(hltdc->Instance->IER);
593 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_TE);
596 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_TE);
599 hltdc->ErrorCode |= HAL_LTDC_ERROR_TE;
602 hltdc->State = HAL_LTDC_STATE_ERROR;
608 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
610 hltdc->ErrorCallback(hltdc);
613 HAL_LTDC_ErrorCallback(hltdc);
621 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_FU);
624 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_FU);
627 hltdc->ErrorCode |= HAL_LTDC_ERROR_FU;
630 hltdc->State = HAL_LTDC_STATE_ERROR;
636 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
638 hltdc->ErrorCallback(hltdc);
641 HAL_LTDC_ErrorCallback(hltdc);
649 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_LI);
652 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_LI);
655 hltdc->State = HAL_LTDC_STATE_READY;
661 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
663 hltdc->LineEventCallback(hltdc);
666 HAL_LTDC_LineEventCallback(hltdc);
674 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_RR);
677 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_RR);
680 hltdc->State = HAL_LTDC_STATE_READY;
686 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
688 hltdc->ReloadEventCallback(hltdc);
691 HAL_LTDC_ReloadEventCallback(hltdc);
702 __weak
void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc)
718 __weak
void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef *hltdc)
734 __weak
void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef *hltdc)
784 HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx)
792 assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg->PixelFormat));
795 assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg->BlendingFactor1));
796 assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg->BlendingFactor2));
804 hltdc->State = HAL_LTDC_STATE_BUSY;
807 hltdc->LayerCfg[LayerIdx] = *pLayerCfg;
810 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
816 hltdc->State = HAL_LTDC_STATE_READY;
834 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx)
843 hltdc->State = HAL_LTDC_STATE_BUSY;
847 LTDC_LAYER(hltdc, LayerIdx)->CKCR = RGBValue;
853 hltdc->State = HAL_LTDC_STATE_READY;
872 HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx)
876 uint32_t *pcolorlut = pCLUT;
884 hltdc->State = HAL_LTDC_STATE_BUSY;
886 for (counter = 0U; (counter < CLUTSize); counter++)
888 if (hltdc->LayerCfg[LayerIdx].PixelFormat == LTDC_PIXEL_FORMAT_AL44)
890 tmp = (((counter + (16U*counter)) << 24U) | ((uint32_t)(*pcolorlut) & 0xFFU) | ((uint32_t)(*pcolorlut) & 0xFF00U) | ((uint32_t)(*pcolorlut) & 0xFF0000U));
894 tmp = ((counter << 24U) | ((uint32_t)(*pcolorlut) & 0xFFU) | ((uint32_t)(*pcolorlut) & 0xFF00U) | ((uint32_t)(*pcolorlut) & 0xFF0000U));
900 LTDC_LAYER(hltdc, LayerIdx)->CLUTWR = tmp;
904 hltdc->State = HAL_LTDC_STATE_READY;
921 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
930 hltdc->State = HAL_LTDC_STATE_BUSY;
939 hltdc->State = HAL_LTDC_STATE_READY;
956 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
965 hltdc->State = HAL_LTDC_STATE_BUSY;
974 hltdc->State = HAL_LTDC_STATE_READY;
991 HAL_StatusTypeDef HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
1000 hltdc->State = HAL_LTDC_STATE_BUSY;
1009 hltdc->State = HAL_LTDC_STATE_READY;
1026 HAL_StatusTypeDef HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
1035 hltdc->State = HAL_LTDC_STATE_BUSY;
1044 hltdc->State = HAL_LTDC_STATE_READY;
1065 hltdc->State = HAL_LTDC_STATE_BUSY;
1071 hltdc->State = HAL_LTDC_STATE_READY;
1092 hltdc->State = HAL_LTDC_STATE_BUSY;
1098 hltdc->State = HAL_LTDC_STATE_READY;
1117 HAL_StatusTypeDef HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx)
1119 LTDC_LayerCfgTypeDef *pLayerCfg;
1130 hltdc->State = HAL_LTDC_STATE_BUSY;
1133 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
1136 pLayerCfg->WindowX1 = XSize + pLayerCfg->WindowX0;
1139 pLayerCfg->WindowY1 = YSize + pLayerCfg->WindowY0;
1142 pLayerCfg->ImageWidth = XSize;
1145 pLayerCfg->ImageHeight = YSize;
1148 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
1154 hltdc->State = HAL_LTDC_STATE_READY;
1173 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx)
1175 LTDC_LayerCfgTypeDef *pLayerCfg;
1186 hltdc->State = HAL_LTDC_STATE_BUSY;
1189 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
1192 pLayerCfg->WindowX0 = X0;
1193 pLayerCfg->WindowX1 = X0 + pLayerCfg->ImageWidth;
1196 pLayerCfg->WindowY0 = Y0;
1197 pLayerCfg->WindowY1 = Y0 + pLayerCfg->ImageHeight;
1200 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
1206 hltdc->State = HAL_LTDC_STATE_READY;
1224 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx)
1226 LTDC_LayerCfgTypeDef *pLayerCfg;
1236 hltdc->State = HAL_LTDC_STATE_BUSY;
1239 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
1242 pLayerCfg->PixelFormat = Pixelformat;
1245 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
1251 hltdc->State = HAL_LTDC_STATE_READY;
1269 HAL_StatusTypeDef HAL_LTDC_SetAlpha(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx)
1271 LTDC_LayerCfgTypeDef *pLayerCfg;
1281 hltdc->State = HAL_LTDC_STATE_BUSY;
1284 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
1287 pLayerCfg->Alpha = Alpha;
1290 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
1296 hltdc->State = HAL_LTDC_STATE_READY;
1313 HAL_StatusTypeDef HAL_LTDC_SetAddress(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx)
1315 LTDC_LayerCfgTypeDef *pLayerCfg;
1324 hltdc->State = HAL_LTDC_STATE_BUSY;
1327 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
1330 pLayerCfg->FBStartAdress = Address;
1333 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
1339 hltdc->State = HAL_LTDC_STATE_READY;
1360 HAL_StatusTypeDef HAL_LTDC_SetPitch(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx)
1363 uint32_t pitchUpdate;
1364 uint32_t pixelFormat;
1373 hltdc->State = HAL_LTDC_STATE_BUSY;
1376 pixelFormat = hltdc->LayerCfg[LayerIdx].PixelFormat;
1378 if (pixelFormat == LTDC_PIXEL_FORMAT_ARGB8888)
1382 else if (pixelFormat == LTDC_PIXEL_FORMAT_RGB888)
1386 else if ((pixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \
1387 (pixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \
1388 (pixelFormat == LTDC_PIXEL_FORMAT_ARGB1555) || \
1389 (pixelFormat == LTDC_PIXEL_FORMAT_AL88))
1398 pitchUpdate = ((LinePitchInPixels * tmp) << 16U);
1407 LTDC_LAYER(hltdc, LayerIdx)->CFBLR |= pitchUpdate;
1413 hltdc->State = HAL_LTDC_STATE_READY;
1429 HAL_StatusTypeDef HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef *hltdc, uint32_t Line)
1438 hltdc->State = HAL_LTDC_STATE_BUSY;
1441 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_LI);
1444 LTDC->LIPCR = (uint32_t)Line;
1447 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_LI);
1450 hltdc->State = HAL_LTDC_STATE_READY;
1468 HAL_StatusTypeDef HAL_LTDC_Reload(LTDC_HandleTypeDef *hltdc, uint32_t ReloadType)
1477 hltdc->State = HAL_LTDC_STATE_BUSY;
1480 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_RR);
1483 hltdc->Instance->SRCR = ReloadType;
1486 hltdc->State = HAL_LTDC_STATE_READY;
1507 HAL_StatusTypeDef HAL_LTDC_ConfigLayer_NoReload(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx)
1515 assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg->PixelFormat));
1518 assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg->BlendingFactor1));
1519 assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg->BlendingFactor2));
1527 hltdc->State = HAL_LTDC_STATE_BUSY;
1530 hltdc->LayerCfg[LayerIdx] = *pLayerCfg;
1533 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
1536 hltdc->State = HAL_LTDC_STATE_READY;
1556 HAL_StatusTypeDef HAL_LTDC_SetWindowSize_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx)
1558 LTDC_LayerCfgTypeDef *pLayerCfg;
1569 hltdc->State = HAL_LTDC_STATE_BUSY;
1572 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
1575 pLayerCfg->WindowX1 = XSize + pLayerCfg->WindowX0;
1578 pLayerCfg->WindowY1 = YSize + pLayerCfg->WindowY0;
1581 pLayerCfg->ImageWidth = XSize;
1584 pLayerCfg->ImageHeight = YSize;
1587 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
1590 hltdc->State = HAL_LTDC_STATE_READY;
1610 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx)
1612 LTDC_LayerCfgTypeDef *pLayerCfg;
1623 hltdc->State = HAL_LTDC_STATE_BUSY;
1626 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
1629 pLayerCfg->WindowX0 = X0;
1630 pLayerCfg->WindowX1 = X0 + pLayerCfg->ImageWidth;
1633 pLayerCfg->WindowY0 = Y0;
1634 pLayerCfg->WindowY1 = Y0 + pLayerCfg->ImageHeight;
1637 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
1640 hltdc->State = HAL_LTDC_STATE_READY;
1659 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx)
1661 LTDC_LayerCfgTypeDef *pLayerCfg;
1671 hltdc->State = HAL_LTDC_STATE_BUSY;
1674 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
1677 pLayerCfg->PixelFormat = Pixelformat;
1680 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
1683 hltdc->State = HAL_LTDC_STATE_READY;
1702 HAL_StatusTypeDef HAL_LTDC_SetAlpha_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx)
1704 LTDC_LayerCfgTypeDef *pLayerCfg;
1714 hltdc->State = HAL_LTDC_STATE_BUSY;
1717 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
1720 pLayerCfg->Alpha = Alpha;
1723 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
1726 hltdc->State = HAL_LTDC_STATE_READY;
1745 HAL_StatusTypeDef HAL_LTDC_SetAddress_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx)
1747 LTDC_LayerCfgTypeDef *pLayerCfg;
1756 hltdc->State = HAL_LTDC_STATE_BUSY;
1759 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
1762 pLayerCfg->FBStartAdress = Address;
1765 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
1768 hltdc->State = HAL_LTDC_STATE_READY;
1790 HAL_StatusTypeDef HAL_LTDC_SetPitch_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx)
1793 uint32_t pitchUpdate;
1794 uint32_t pixelFormat;
1803 hltdc->State = HAL_LTDC_STATE_BUSY;
1806 pixelFormat = hltdc->LayerCfg[LayerIdx].PixelFormat;
1808 if (pixelFormat == LTDC_PIXEL_FORMAT_ARGB8888)
1812 else if (pixelFormat == LTDC_PIXEL_FORMAT_RGB888)
1816 else if ((pixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \
1817 (pixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \
1818 (pixelFormat == LTDC_PIXEL_FORMAT_ARGB1555) || \
1819 (pixelFormat == LTDC_PIXEL_FORMAT_AL88))
1828 pitchUpdate = ((LinePitchInPixels * tmp) << 16U);
1834 LTDC_LAYER(hltdc, LayerIdx)->CFBLR |= pitchUpdate;
1837 hltdc->State = HAL_LTDC_STATE_READY;
1857 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx)
1866 hltdc->State = HAL_LTDC_STATE_BUSY;
1870 LTDC_LAYER(hltdc, LayerIdx)->CKCR = RGBValue;
1873 hltdc->State = HAL_LTDC_STATE_READY;
1891 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
1900 hltdc->State = HAL_LTDC_STATE_BUSY;
1906 hltdc->State = HAL_LTDC_STATE_READY;
1924 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
1933 hltdc->State = HAL_LTDC_STATE_BUSY;
1939 hltdc->State = HAL_LTDC_STATE_READY;
1957 HAL_StatusTypeDef HAL_LTDC_EnableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
1966 hltdc->State = HAL_LTDC_STATE_BUSY;
1972 hltdc->State = HAL_LTDC_STATE_READY;
1990 HAL_StatusTypeDef HAL_LTDC_DisableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
1999 hltdc->State = HAL_LTDC_STATE_BUSY;
2005 hltdc->State = HAL_LTDC_STATE_READY;
2039 HAL_LTDC_StateTypeDef HAL_LTDC_GetState(LTDC_HandleTypeDef *hltdc)
2041 return hltdc->State;
2050 uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc)
2052 return hltdc->ErrorCode;
2076 static void LTDC_SetConfig(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx)
2083 tmp = ((pLayerCfg->WindowX1 + ((hltdc->Instance->BPCR &
LTDC_BPCR_AHBP) >> 16U)) << 16U);
2085 LTDC_LAYER(hltdc, LayerIdx)->WHPCR = ((pLayerCfg->WindowX0 + ((hltdc->Instance->BPCR &
LTDC_BPCR_AHBP) >> 16U) + 1U) | tmp);
2088 tmp = ((pLayerCfg->WindowY1 + (hltdc->Instance->BPCR &
LTDC_BPCR_AVBP)) << 16U);
2090 LTDC_LAYER(hltdc, LayerIdx)->WVPCR = ((pLayerCfg->WindowY0 + (hltdc->Instance->BPCR &
LTDC_BPCR_AVBP) + 1U) | tmp);
2094 LTDC_LAYER(hltdc, LayerIdx)->PFCR = (pLayerCfg->PixelFormat);
2097 tmp = ((uint32_t)(pLayerCfg->Backcolor.Green) << 8U);
2098 tmp1 = ((uint32_t)(pLayerCfg->Backcolor.Red) << 16U);
2099 tmp2 = (pLayerCfg->Alpha0 << 24U);
2101 LTDC_LAYER(hltdc, LayerIdx)->DCCR = (pLayerCfg->Backcolor.Blue | tmp | tmp1 | tmp2);
2105 LTDC_LAYER(hltdc, LayerIdx)->CACR = (pLayerCfg->Alpha);
2109 LTDC_LAYER(hltdc, LayerIdx)->BFCR = (pLayerCfg->BlendingFactor1 | pLayerCfg->BlendingFactor2);
2113 LTDC_LAYER(hltdc, LayerIdx)->CFBAR = (pLayerCfg->FBStartAdress);
2115 if (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888)
2119 else if (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_RGB888)
2123 else if ((pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \
2124 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \
2125 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB1555) || \
2126 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_AL88))
2137 LTDC_LAYER(hltdc, LayerIdx)->CFBLR = (((pLayerCfg->ImageWidth * tmp) << 16U) | (((pLayerCfg->WindowX1 - pLayerCfg->WindowX0) * tmp) + 7U));
2140 LTDC_LAYER(hltdc, LayerIdx)->CFBLNR = (pLayerCfg->ImageHeight);