STM32L486xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_hal_ltdc.c 00004 * @author MCD Application Team 00005 * @brief LTDC HAL module driver. 00006 * This file provides firmware functions to manage the following 00007 * functionalities of the LTDC peripheral: 00008 * + Initialization and de-initialization functions 00009 * + IO operation functions 00010 * + Peripheral Control functions 00011 * + Peripheral State and Errors functions 00012 * 00013 @verbatim 00014 ============================================================================== 00015 ##### How to use this driver ##### 00016 ============================================================================== 00017 [..] 00018 (#) Program the required configuration through the following parameters: 00019 the LTDC timing, the horizontal and vertical polarity, 00020 the pixel clock polarity, Data Enable polarity and the LTDC background color value 00021 using HAL_LTDC_Init() function 00022 00023 (#) Program the required configuration through the following parameters: 00024 the pixel format, the blending factors, input alpha value, the window size 00025 and the image size using HAL_LTDC_ConfigLayer() function for foreground 00026 or/and background layer. 00027 00028 (#) Optionally, configure and enable the CLUT using HAL_LTDC_ConfigCLUT() and 00029 HAL_LTDC_EnableCLUT functions. 00030 00031 (#) Optionally, enable the Dither using HAL_LTDC_EnableDither(). 00032 00033 (#) Optionally, configure and enable the Color keying using HAL_LTDC_ConfigColorKeying() 00034 and HAL_LTDC_EnableColorKeying functions. 00035 00036 (#) Optionally, configure LineInterrupt using HAL_LTDC_ProgramLineEvent() 00037 function 00038 00039 (#) If needed, reconfigure and change the pixel format value, the alpha value 00040 value, the window size, the window position and the layer start address 00041 for foreground or/and background layer using respectively the following 00042 functions: HAL_LTDC_SetPixelFormat(), HAL_LTDC_SetAlpha(), HAL_LTDC_SetWindowSize(), 00043 HAL_LTDC_SetWindowPosition() and HAL_LTDC_SetAddress(). 00044 00045 (#) Variant functions with _NoReload suffix allows to set the LTDC configuration/settings without immediate reload. 00046 This is useful in case when the program requires to modify serval LTDC settings (on one or both layers) 00047 then applying(reload) these settings in one shot by calling the function HAL_LTDC_Reload(). 00048 00049 After calling the _NoReload functions to set different color/format/layer settings, 00050 the program shall call the function HAL_LTDC_Reload() to apply(reload) these settings. 00051 Function HAL_LTDC_Reload() can be called with the parameter ReloadType set to LTDC_RELOAD_IMMEDIATE if 00052 an immediate reload is required. 00053 Function HAL_LTDC_Reload() can be called with the parameter ReloadType set to LTDC_RELOAD_VERTICAL_BLANKING if 00054 the reload should be done in the next vertical blanking period, 00055 this option allows to avoid display flicker by applying the new settings during the vertical blanking period. 00056 00057 00058 (#) To control LTDC state you can use the following function: HAL_LTDC_GetState() 00059 00060 *** LTDC HAL driver macros list *** 00061 ============================================= 00062 [..] 00063 Below the list of most used macros in LTDC HAL driver. 00064 00065 (+) __HAL_LTDC_ENABLE: Enable the LTDC. 00066 (+) __HAL_LTDC_DISABLE: Disable the LTDC. 00067 (+) __HAL_LTDC_LAYER_ENABLE: Enable an LTDC Layer. 00068 (+) __HAL_LTDC_LAYER_DISABLE: Disable an LTDC Layer. 00069 (+) __HAL_LTDC_RELOAD_IMMEDIATE_CONFIG: Reload Layer Configuration. 00070 (+) __HAL_LTDC_GET_FLAG: Get the LTDC pending flags. 00071 (+) __HAL_LTDC_CLEAR_FLAG: Clear the LTDC pending flags. 00072 (+) __HAL_LTDC_ENABLE_IT: Enable the specified LTDC interrupts. 00073 (+) __HAL_LTDC_DISABLE_IT: Disable the specified LTDC interrupts. 00074 (+) __HAL_LTDC_GET_IT_SOURCE: Check whether the specified LTDC interrupt has occurred or not. 00075 00076 00077 *** Callback registration *** 00078 ============================================= 00079 00080 The compilation define USE_HAL_LTDC_REGISTER_CALLBACKS when set to 1 00081 allows the user to configure dynamically the driver callbacks. 00082 Use Function @ref HAL_LTDC_RegisterCallback() to register a callback. 00083 00084 Function @ref HAL_LTDC_RegisterCallback() allows to register following callbacks: 00085 (+) LineEventCallback : LTDC Line Event Callback. 00086 (+) ReloadEventCallback : LTDC Reload Event Callback. 00087 (+) ErrorCallback : LTDC Error Callback 00088 (+) MspInitCallback : LTDC MspInit. 00089 (+) MspDeInitCallback : LTDC MspDeInit. 00090 This function takes as parameters the HAL peripheral handle, the Callback ID 00091 and a pointer to the user callback function. 00092 00093 Use function @ref HAL_LTDC_UnRegisterCallback() to reset a callback to the default 00094 weak function. 00095 @ref HAL_LTDC_UnRegisterCallback takes as parameters the HAL peripheral handle, 00096 and the Callback ID. 00097 This function allows to reset following callbacks: 00098 (+) LineEventCallback : LTDC Line Event Callback. 00099 (+) ReloadEventCallback : LTDC Reload Event Callback. 00100 (+) ErrorCallback : LTDC Error Callback 00101 (+) MspInitCallback : LTDC MspInit. 00102 (+) MspDeInitCallback : LTDC MspDeInit. 00103 00104 By default, after the HAL_LTDC_Init and when the state is HAL_LTDC_STATE_RESET 00105 all callbacks are set to the corresponding weak functions: 00106 examples @ref HAL_LTDC_LineEventCallback(), @ref HAL_LTDC_ErrorCallback(). 00107 Exception done for MspInit and MspDeInit functions that are 00108 reset to the legacy weak function in the HAL_LTDC_Init/ @ref HAL_LTDC_DeInit only when 00109 these callbacks are null (not registered beforehand). 00110 if not, MspInit or MspDeInit are not null, the @ref HAL_LTDC_Init/ @ref HAL_LTDC_DeInit 00111 keep and use the user MspInit/MspDeInit callbacks (registered beforehand) 00112 00113 Callbacks can be registered/unregistered in HAL_LTDC_STATE_READY state only. 00114 Exception done MspInit/MspDeInit that can be registered/unregistered 00115 in HAL_LTDC_STATE_READY or HAL_LTDC_STATE_RESET state, 00116 thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit. 00117 In that case first register the MspInit/MspDeInit user callbacks 00118 using @ref HAL_LTDC_RegisterCallback() before calling @ref HAL_LTDC_DeInit 00119 or HAL_LTDC_Init function. 00120 00121 When The compilation define USE_HAL_LTDC_REGISTER_CALLBACKS is set to 0 or 00122 not defined, the callback registration feature is not available and all callbacks 00123 are set to the corresponding weak functions. 00124 00125 [..] 00126 (@) You can refer to the LTDC HAL driver header file for more useful macros 00127 00128 @endverbatim 00129 ****************************************************************************** 00130 * @attention 00131 * 00132 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> 00133 * 00134 * Redistribution and use in source and binary forms, with or without modification, 00135 * are permitted provided that the following conditions are met: 00136 * 1. Redistributions of source code must retain the above copyright notice, 00137 * this list of conditions and the following disclaimer. 00138 * 2. Redistributions in binary form must reproduce the above copyright notice, 00139 * this list of conditions and the following disclaimer in the documentation 00140 * and/or other materials provided with the distribution. 00141 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00142 * may be used to endorse or promote products derived from this software 00143 * without specific prior written permission. 00144 * 00145 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00146 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00147 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00148 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00149 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00150 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00151 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00152 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00153 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00154 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00155 * 00156 ****************************************************************************** 00157 */ 00158 00159 /* Includes ------------------------------------------------------------------*/ 00160 #include "stm32l4xx_hal.h" 00161 00162 #ifdef HAL_LTDC_MODULE_ENABLED 00163 #if defined (LTDC) 00164 /** @addtogroup STM32L4xx_HAL_Driver 00165 * @{ 00166 */ 00167 00168 /** @defgroup LTDC LTDC 00169 * @brief LTDC HAL module driver 00170 * @{ 00171 */ 00172 00173 00174 /* Private typedef -----------------------------------------------------------*/ 00175 /* Private define ------------------------------------------------------------*/ 00176 /* Private macro -------------------------------------------------------------*/ 00177 /* Private variables ---------------------------------------------------------*/ 00178 /* Private function prototypes -----------------------------------------------*/ 00179 static void LTDC_SetConfig(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx); 00180 /* Private functions ---------------------------------------------------------*/ 00181 00182 /** @defgroup LTDC_Exported_Functions LTDC Exported Functions 00183 * @{ 00184 */ 00185 00186 /** @defgroup LTDC_Exported_Functions_Group1 Initialization and Configuration functions 00187 * @brief Initialization and Configuration functions 00188 * 00189 @verbatim 00190 =============================================================================== 00191 ##### Initialization and Configuration functions ##### 00192 =============================================================================== 00193 [..] This section provides functions allowing to: 00194 (+) Initialize and configure the LTDC 00195 (+) De-initialize the LTDC 00196 00197 @endverbatim 00198 * @{ 00199 */ 00200 00201 /** 00202 * @brief Initialize the LTDC according to the specified parameters in the LTDC_InitTypeDef. 00203 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00204 * the configuration information for the LTDC. 00205 * @retval HAL status 00206 */ 00207 HAL_StatusTypeDef HAL_LTDC_Init(LTDC_HandleTypeDef *hltdc) 00208 { 00209 uint32_t tmp, tmp1; 00210 00211 /* Check the LTDC peripheral state */ 00212 if(hltdc == NULL) 00213 { 00214 return HAL_ERROR; 00215 } 00216 00217 /* Check function parameters */ 00218 assert_param(IS_LTDC_ALL_INSTANCE(hltdc->Instance)); 00219 assert_param(IS_LTDC_HSYNC(hltdc->Init.HorizontalSync)); 00220 assert_param(IS_LTDC_VSYNC(hltdc->Init.VerticalSync)); 00221 assert_param(IS_LTDC_AHBP(hltdc->Init.AccumulatedHBP)); 00222 assert_param(IS_LTDC_AVBP(hltdc->Init.AccumulatedVBP)); 00223 assert_param(IS_LTDC_AAH(hltdc->Init.AccumulatedActiveH)); 00224 assert_param(IS_LTDC_AAW(hltdc->Init.AccumulatedActiveW)); 00225 assert_param(IS_LTDC_TOTALH(hltdc->Init.TotalHeigh)); 00226 assert_param(IS_LTDC_TOTALW(hltdc->Init.TotalWidth)); 00227 assert_param(IS_LTDC_HSPOL(hltdc->Init.HSPolarity)); 00228 assert_param(IS_LTDC_VSPOL(hltdc->Init.VSPolarity)); 00229 assert_param(IS_LTDC_DEPOL(hltdc->Init.DEPolarity)); 00230 assert_param(IS_LTDC_PCPOL(hltdc->Init.PCPolarity)); 00231 00232 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00233 if(hltdc->State == HAL_LTDC_STATE_RESET) 00234 { 00235 /* Allocate lock resource and initialize it */ 00236 hltdc->Lock = HAL_UNLOCKED; 00237 00238 /* Reset the LTDC callback to the legacy weak callbacks */ 00239 hltdc->LineEventCallback = HAL_LTDC_LineEventCallback; /* Legacy weak LineEventCallback */ 00240 hltdc->ReloadEventCallback = HAL_LTDC_ReloadEventCallback; /* Legacy weak ReloadEventCallback */ 00241 hltdc->ErrorCallback = HAL_LTDC_ErrorCallback; /* Legacy weak ErrorCallback */ 00242 00243 if(hltdc->MspInitCallback == NULL) 00244 { 00245 hltdc->MspInitCallback = HAL_LTDC_MspInit; 00246 } 00247 /* Init the low level hardware */ 00248 hltdc->MspInitCallback(hltdc); 00249 } 00250 #else 00251 if(hltdc->State == HAL_LTDC_STATE_RESET) 00252 { 00253 /* Allocate lock resource and initialize it */ 00254 hltdc->Lock = HAL_UNLOCKED; 00255 /* Init the low level hardware */ 00256 HAL_LTDC_MspInit(hltdc); 00257 } 00258 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 00259 00260 /* Change LTDC peripheral state */ 00261 hltdc->State = HAL_LTDC_STATE_BUSY; 00262 00263 /* Configure the HS, VS, DE and PC polarity */ 00264 hltdc->Instance->GCR &= ~(LTDC_GCR_HSPOL | LTDC_GCR_VSPOL | LTDC_GCR_DEPOL | LTDC_GCR_PCPOL); 00265 hltdc->Instance->GCR |= (uint32_t)(hltdc->Init.HSPolarity | hltdc->Init.VSPolarity | \ 00266 hltdc->Init.DEPolarity | hltdc->Init.PCPolarity); 00267 00268 /* Set Synchronization size */ 00269 hltdc->Instance->SSCR &= ~(LTDC_SSCR_VSH | LTDC_SSCR_HSW); 00270 tmp = (hltdc->Init.HorizontalSync << 16U); 00271 hltdc->Instance->SSCR |= (tmp | hltdc->Init.VerticalSync); 00272 00273 /* Set Accumulated Back porch */ 00274 hltdc->Instance->BPCR &= ~(LTDC_BPCR_AVBP | LTDC_BPCR_AHBP); 00275 tmp = (hltdc->Init.AccumulatedHBP << 16U); 00276 hltdc->Instance->BPCR |= (tmp | hltdc->Init.AccumulatedVBP); 00277 00278 /* Set Accumulated Active Width */ 00279 hltdc->Instance->AWCR &= ~(LTDC_AWCR_AAH | LTDC_AWCR_AAW); 00280 tmp = (hltdc->Init.AccumulatedActiveW << 16U); 00281 hltdc->Instance->AWCR |= (tmp | hltdc->Init.AccumulatedActiveH); 00282 00283 /* Set Total Width */ 00284 hltdc->Instance->TWCR &= ~(LTDC_TWCR_TOTALH | LTDC_TWCR_TOTALW); 00285 tmp = (hltdc->Init.TotalWidth << 16U); 00286 hltdc->Instance->TWCR |= (tmp | hltdc->Init.TotalHeigh); 00287 00288 /* Set the background color value */ 00289 tmp = ((uint32_t)(hltdc->Init.Backcolor.Green) << 8U); 00290 tmp1 = ((uint32_t)(hltdc->Init.Backcolor.Red) << 16U); 00291 hltdc->Instance->BCCR &= ~(LTDC_BCCR_BCBLUE | LTDC_BCCR_BCGREEN | LTDC_BCCR_BCRED); 00292 hltdc->Instance->BCCR |= (tmp1 | tmp | hltdc->Init.Backcolor.Blue); 00293 00294 /* Enable the Transfer Error and FIFO underrun interrupts */ 00295 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_TE | LTDC_IT_FU); 00296 00297 /* Enable LTDC by setting LTDCEN bit */ 00298 __HAL_LTDC_ENABLE(hltdc); 00299 00300 /* Initialize the error code */ 00301 hltdc->ErrorCode = HAL_LTDC_ERROR_NONE; 00302 00303 /* Initialize the LTDC state*/ 00304 hltdc->State = HAL_LTDC_STATE_READY; 00305 00306 return HAL_OK; 00307 } 00308 00309 /** 00310 * @brief De-initialize the LTDC peripheral. 00311 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00312 * the configuration information for the LTDC. 00313 * @retval None 00314 */ 00315 00316 HAL_StatusTypeDef HAL_LTDC_DeInit(LTDC_HandleTypeDef *hltdc) 00317 { 00318 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00319 if(hltdc->MspDeInitCallback == NULL) 00320 { 00321 hltdc->MspDeInitCallback = HAL_LTDC_MspDeInit; 00322 } 00323 /* DeInit the low level hardware */ 00324 hltdc->MspDeInitCallback(hltdc); 00325 #else 00326 /* DeInit the low level hardware */ 00327 HAL_LTDC_MspDeInit(hltdc); 00328 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 00329 00330 /* Initialize the error code */ 00331 hltdc->ErrorCode = HAL_LTDC_ERROR_NONE; 00332 00333 /* Initialize the LTDC state*/ 00334 hltdc->State = HAL_LTDC_STATE_RESET; 00335 00336 /* Release Lock */ 00337 __HAL_UNLOCK(hltdc); 00338 00339 return HAL_OK; 00340 } 00341 00342 /** 00343 * @brief Initialize the LTDC MSP. 00344 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00345 * the configuration information for the LTDC. 00346 * @retval None 00347 */ 00348 __weak void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc) 00349 { 00350 /* Prevent unused argument(s) compilation warning */ 00351 UNUSED(hltdc); 00352 00353 /* NOTE : This function should not be modified, when the callback is needed, 00354 the HAL_LTDC_MspInit could be implemented in the user file 00355 */ 00356 } 00357 00358 /** 00359 * @brief De-initialize the LTDC MSP. 00360 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00361 * the configuration information for the LTDC. 00362 * @retval None 00363 */ 00364 __weak void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* hltdc) 00365 { 00366 /* Prevent unused argument(s) compilation warning */ 00367 UNUSED(hltdc); 00368 00369 /* NOTE : This function should not be modified, when the callback is needed, 00370 the HAL_LTDC_MspDeInit could be implemented in the user file 00371 */ 00372 } 00373 00374 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00375 /** 00376 * @brief Register a User LTDC Callback 00377 * To be used instead of the weak predefined callback 00378 * @param hltdc ltdc handle 00379 * @param CallbackID ID of the callback to be registered 00380 * This parameter can be one of the following values: 00381 * @arg @ref HAL_LTDC_LINE_EVENT_CB_ID Line Event Callback ID 00382 * @arg @ref HAL_LTDC_RELOAD_EVENT_CB_ID Reload Event Callback ID 00383 * @arg @ref HAL_LTDC_ERROR_CB_ID Error Callback ID 00384 * @arg @ref HAL_LTDC_MSPINIT_CB_ID MspInit callback ID 00385 * @arg @ref HAL_LTDC_MSPDEINIT_CB_ID MspDeInit callback ID 00386 * @param pCallback pointer to the Callback function 00387 * @retval status 00388 */ 00389 HAL_StatusTypeDef HAL_LTDC_RegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID, pLTDC_CallbackTypeDef pCallback) 00390 { 00391 HAL_StatusTypeDef status = HAL_OK; 00392 00393 if(pCallback == NULL) 00394 { 00395 /* Update the error code */ 00396 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK; 00397 00398 return HAL_ERROR; 00399 } 00400 /* Process locked */ 00401 __HAL_LOCK(hltdc); 00402 00403 if(hltdc->State == HAL_LTDC_STATE_READY) 00404 { 00405 switch (CallbackID) 00406 { 00407 case HAL_LTDC_LINE_EVENT_CB_ID : 00408 hltdc->LineEventCallback = pCallback; 00409 break; 00410 00411 case HAL_LTDC_RELOAD_EVENT_CB_ID : 00412 hltdc->ReloadEventCallback = pCallback; 00413 break; 00414 00415 case HAL_LTDC_ERROR_CB_ID : 00416 hltdc->ErrorCallback = pCallback; 00417 break; 00418 00419 case HAL_LTDC_MSPINIT_CB_ID : 00420 hltdc->MspInitCallback = pCallback; 00421 break; 00422 00423 case HAL_LTDC_MSPDEINIT_CB_ID : 00424 hltdc->MspDeInitCallback = pCallback; 00425 break; 00426 00427 default : 00428 /* Update the error code */ 00429 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK; 00430 /* Return error status */ 00431 status = HAL_ERROR; 00432 break; 00433 } 00434 } 00435 else if(hltdc->State == HAL_LTDC_STATE_RESET) 00436 { 00437 switch (CallbackID) 00438 { 00439 case HAL_LTDC_MSPINIT_CB_ID : 00440 hltdc->MspInitCallback = pCallback; 00441 break; 00442 00443 case HAL_LTDC_MSPDEINIT_CB_ID : 00444 hltdc->MspDeInitCallback = pCallback; 00445 break; 00446 00447 default : 00448 /* Update the error code */ 00449 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK; 00450 /* Return error status */ 00451 status = HAL_ERROR; 00452 break; 00453 } 00454 } 00455 else 00456 { 00457 /* Update the error code */ 00458 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK; 00459 /* Return error status */ 00460 status = HAL_ERROR; 00461 } 00462 00463 /* Release Lock */ 00464 __HAL_UNLOCK(hltdc); 00465 00466 return status; 00467 } 00468 00469 /** 00470 * @brief Unregister an LTDC Callback 00471 * LTDC callabck is redirected to the weak predefined callback 00472 * @param hltdc ltdc handle 00473 * @param CallbackID ID of the callback to be unregistered 00474 * This parameter can be one of the following values: 00475 * @arg @ref HAL_LTDC_LINE_EVENT_CB_ID Line Event Callback ID 00476 * @arg @ref HAL_LTDC_RELOAD_EVENT_CB_ID Reload Event Callback ID 00477 * @arg @ref HAL_LTDC_ERROR_CB_ID Error Callback ID 00478 * @arg @ref HAL_LTDC_MSPINIT_CB_ID MspInit callback ID 00479 * @arg @ref HAL_LTDC_MSPDEINIT_CB_ID MspDeInit callback ID 00480 * @retval status 00481 */ 00482 HAL_StatusTypeDef HAL_LTDC_UnRegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID) 00483 { 00484 HAL_StatusTypeDef status = HAL_OK; 00485 00486 /* Process locked */ 00487 __HAL_LOCK(hltdc); 00488 00489 if(hltdc->State == HAL_LTDC_STATE_READY) 00490 { 00491 switch (CallbackID) 00492 { 00493 case HAL_LTDC_LINE_EVENT_CB_ID : 00494 hltdc->LineEventCallback = HAL_LTDC_LineEventCallback; /* Legacy weak LineEventCallback */ 00495 break; 00496 00497 case HAL_LTDC_RELOAD_EVENT_CB_ID : 00498 hltdc->ReloadEventCallback = HAL_LTDC_ReloadEventCallback; /* Legacy weak ReloadEventCallback */ 00499 break; 00500 00501 case HAL_LTDC_ERROR_CB_ID : 00502 hltdc->ErrorCallback = HAL_LTDC_ErrorCallback; /* Legacy weak ErrorCallback */ 00503 break; 00504 00505 case HAL_LTDC_MSPINIT_CB_ID : 00506 hltdc->MspInitCallback = HAL_LTDC_MspInit; /* Legcay weak MspInit Callback */ 00507 break; 00508 00509 case HAL_LTDC_MSPDEINIT_CB_ID : 00510 hltdc->MspDeInitCallback = HAL_LTDC_MspDeInit; /* Legcay weak MspDeInit Callback */ 00511 break; 00512 00513 default : 00514 /* Update the error code */ 00515 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK; 00516 /* Return error status */ 00517 status = HAL_ERROR; 00518 break; 00519 } 00520 } 00521 else if(hltdc->State == HAL_LTDC_STATE_RESET) 00522 { 00523 switch (CallbackID) 00524 { 00525 case HAL_LTDC_MSPINIT_CB_ID : 00526 hltdc->MspInitCallback = HAL_LTDC_MspInit; /* Legcay weak MspInit Callback */ 00527 break; 00528 00529 case HAL_LTDC_MSPDEINIT_CB_ID : 00530 hltdc->MspDeInitCallback = HAL_LTDC_MspDeInit; /* Legcay weak MspDeInit Callback */ 00531 break; 00532 00533 default : 00534 /* Update the error code */ 00535 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK; 00536 /* Return error status */ 00537 status = HAL_ERROR; 00538 break; 00539 } 00540 } 00541 else 00542 { 00543 /* Update the error code */ 00544 hltdc->ErrorCode |= HAL_LTDC_ERROR_INVALID_CALLBACK; 00545 /* Return error status */ 00546 status = HAL_ERROR; 00547 } 00548 00549 /* Release Lock */ 00550 __HAL_UNLOCK(hltdc); 00551 00552 return status; 00553 } 00554 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 00555 00556 /** 00557 * @} 00558 */ 00559 00560 /** @defgroup LTDC_Exported_Functions_Group2 IO operation functions 00561 * @brief IO operation functions 00562 * 00563 @verbatim 00564 =============================================================================== 00565 ##### IO operation functions ##### 00566 =============================================================================== 00567 [..] This section provides function allowing to: 00568 (+) Handle LTDC interrupt request 00569 00570 @endverbatim 00571 * @{ 00572 */ 00573 /** 00574 * @brief Handle LTDC interrupt request. 00575 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00576 * the configuration information for the LTDC. 00577 * @retval HAL status 00578 */ 00579 void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef *hltdc) 00580 { 00581 uint32_t isrflags = READ_REG(hltdc->Instance->ISR); 00582 uint32_t itsources = READ_REG(hltdc->Instance->IER); 00583 00584 /* Transfer Error Interrupt management ***************************************/ 00585 if(((isrflags & LTDC_ISR_TERRIF) != 0U) && ((itsources & LTDC_IER_TERRIE) != 0U)) 00586 { 00587 /* Disable the transfer Error interrupt */ 00588 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_TE); 00589 00590 /* Clear the transfer error flag */ 00591 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_TE); 00592 00593 /* Update error code */ 00594 hltdc->ErrorCode |= HAL_LTDC_ERROR_TE; 00595 00596 /* Change LTDC state */ 00597 hltdc->State = HAL_LTDC_STATE_ERROR; 00598 00599 /* Process unlocked */ 00600 __HAL_UNLOCK(hltdc); 00601 00602 /* Transfer error Callback */ 00603 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00604 /*Call registered error callback*/ 00605 hltdc->ErrorCallback(hltdc); 00606 #else 00607 /* Call legacy error callback*/ 00608 HAL_LTDC_ErrorCallback(hltdc); 00609 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 00610 } 00611 00612 /* FIFO underrun Interrupt management ***************************************/ 00613 if(((isrflags & LTDC_ISR_FUIF) != 0U) && ((itsources & LTDC_IER_FUIE) != 0U)) 00614 { 00615 /* Disable the FIFO underrun interrupt */ 00616 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_FU); 00617 00618 /* Clear the FIFO underrun flag */ 00619 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_FU); 00620 00621 /* Update error code */ 00622 hltdc->ErrorCode |= HAL_LTDC_ERROR_FU; 00623 00624 /* Change LTDC state */ 00625 hltdc->State = HAL_LTDC_STATE_ERROR; 00626 00627 /* Process unlocked */ 00628 __HAL_UNLOCK(hltdc); 00629 00630 /* Transfer error Callback */ 00631 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00632 /*Call registered error callback*/ 00633 hltdc->ErrorCallback(hltdc); 00634 #else 00635 /* Call legacy error callback*/ 00636 HAL_LTDC_ErrorCallback(hltdc); 00637 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 00638 } 00639 00640 /* Line Interrupt management ************************************************/ 00641 if(((isrflags & LTDC_ISR_LIF) != 0U) && ((itsources & LTDC_IER_LIE) != 0U)) 00642 { 00643 /* Disable the Line interrupt */ 00644 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_LI); 00645 00646 /* Clear the Line interrupt flag */ 00647 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_LI); 00648 00649 /* Change LTDC state */ 00650 hltdc->State = HAL_LTDC_STATE_READY; 00651 00652 /* Process unlocked */ 00653 __HAL_UNLOCK(hltdc); 00654 00655 /* Line interrupt Callback */ 00656 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00657 /*Call registered Line Event callback */ 00658 hltdc->LineEventCallback(hltdc); 00659 #else 00660 /*Call Legacy Line Event callback */ 00661 HAL_LTDC_LineEventCallback(hltdc); 00662 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 00663 } 00664 00665 /* Register reload Interrupt management ***************************************/ 00666 if(((isrflags & LTDC_ISR_RRIF) != 0U) && ((itsources & LTDC_IER_RRIE) != 0U)) 00667 { 00668 /* Disable the register reload interrupt */ 00669 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_RR); 00670 00671 /* Clear the register reload flag */ 00672 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_RR); 00673 00674 /* Change LTDC state */ 00675 hltdc->State = HAL_LTDC_STATE_READY; 00676 00677 /* Process unlocked */ 00678 __HAL_UNLOCK(hltdc); 00679 00680 /* Reload interrupt Callback */ 00681 #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) 00682 /*Call registered reload Event callback */ 00683 hltdc->ReloadEventCallback(hltdc); 00684 #else 00685 /*Call Legacy Reload Event callback */ 00686 HAL_LTDC_ReloadEventCallback(hltdc); 00687 #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ 00688 } 00689 } 00690 00691 /** 00692 * @brief Error LTDC callback. 00693 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00694 * the configuration information for the LTDC. 00695 * @retval None 00696 */ 00697 __weak void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc) 00698 { 00699 /* Prevent unused argument(s) compilation warning */ 00700 UNUSED(hltdc); 00701 00702 /* NOTE : This function should not be modified, when the callback is needed, 00703 the HAL_LTDC_ErrorCallback could be implemented in the user file 00704 */ 00705 } 00706 00707 /** 00708 * @brief Line Event callback. 00709 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00710 * the configuration information for the LTDC. 00711 * @retval None 00712 */ 00713 __weak void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef *hltdc) 00714 { 00715 /* Prevent unused argument(s) compilation warning */ 00716 UNUSED(hltdc); 00717 00718 /* NOTE : This function should not be modified, when the callback is needed, 00719 the HAL_LTDC_LineEventCallback could be implemented in the user file 00720 */ 00721 } 00722 00723 /** 00724 * @brief Reload Event callback. 00725 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00726 * the configuration information for the LTDC. 00727 * @retval None 00728 */ 00729 __weak void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef *hltdc) 00730 { 00731 /* Prevent unused argument(s) compilation warning */ 00732 UNUSED(hltdc); 00733 00734 /* NOTE : This function should not be modified, when the callback is needed, 00735 the HAL_LTDC_ReloadEvenCallback could be implemented in the user file 00736 */ 00737 } 00738 00739 /** 00740 * @} 00741 */ 00742 00743 /** @defgroup LTDC_Exported_Functions_Group3 Peripheral Control functions 00744 * @brief Peripheral Control functions 00745 * 00746 @verbatim 00747 =============================================================================== 00748 ##### Peripheral Control functions ##### 00749 =============================================================================== 00750 [..] This section provides functions allowing to: 00751 (+) Configure the LTDC foreground or/and background parameters. 00752 (+) Set the active layer. 00753 (+) Configure the color keying. 00754 (+) Configure the C-LUT. 00755 (+) Enable / Disable the color keying. 00756 (+) Enable / Disable the C-LUT. 00757 (+) Update the layer position. 00758 (+) Update the layer size. 00759 (+) Update pixel format on the fly. 00760 (+) Update transparency on the fly. 00761 (+) Update address on the fly. 00762 00763 @endverbatim 00764 * @{ 00765 */ 00766 00767 /** 00768 * @brief Configure the LTDC Layer according to the specified 00769 * parameters in the LTDC_InitTypeDef and create the associated handle. 00770 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00771 * the configuration information for the LTDC. 00772 * @param pLayerCfg pointer to a LTDC_LayerCfgTypeDef structure that contains 00773 * the configuration information for the Layer. 00774 * @param LayerIdx LTDC Layer index. 00775 * This parameter can be one of the following values: 00776 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 00777 * @retval HAL status 00778 */ 00779 HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx) 00780 { 00781 /* Check the parameters */ 00782 assert_param(IS_LTDC_LAYER(LayerIdx)); 00783 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0)); 00784 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1)); 00785 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0)); 00786 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1)); 00787 assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg->PixelFormat)); 00788 assert_param(IS_LTDC_ALPHA(pLayerCfg->Alpha)); 00789 assert_param(IS_LTDC_ALPHA(pLayerCfg->Alpha0)); 00790 assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg->BlendingFactor1)); 00791 assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg->BlendingFactor2)); 00792 assert_param(IS_LTDC_CFBLL(pLayerCfg->ImageWidth)); 00793 assert_param(IS_LTDC_CFBLNBR(pLayerCfg->ImageHeight)); 00794 00795 /* Process locked */ 00796 __HAL_LOCK(hltdc); 00797 00798 /* Change LTDC peripheral state */ 00799 hltdc->State = HAL_LTDC_STATE_BUSY; 00800 00801 /* Copy new layer configuration into handle structure */ 00802 hltdc->LayerCfg[LayerIdx] = *pLayerCfg; 00803 00804 /* Configure the LTDC Layer */ 00805 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); 00806 00807 /* Set the Immediate Reload type */ 00808 hltdc->Instance->SRCR = LTDC_SRCR_IMR; 00809 00810 /* Initialize the LTDC state*/ 00811 hltdc->State = HAL_LTDC_STATE_READY; 00812 00813 /* Process unlocked */ 00814 __HAL_UNLOCK(hltdc); 00815 00816 return HAL_OK; 00817 } 00818 00819 /** 00820 * @brief Configure the color keying. 00821 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00822 * the configuration information for the LTDC. 00823 * @param RGBValue the color key value 00824 * @param LayerIdx LTDC Layer index. 00825 * This parameter can be one of the following values: 00826 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 00827 * @retval HAL status 00828 */ 00829 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx) 00830 { 00831 /* Check the parameters */ 00832 assert_param(IS_LTDC_LAYER(LayerIdx)); 00833 00834 /* Process locked */ 00835 __HAL_LOCK(hltdc); 00836 00837 /* Change LTDC peripheral state */ 00838 hltdc->State = HAL_LTDC_STATE_BUSY; 00839 00840 /* Configure the default color values */ 00841 LTDC_LAYER(hltdc, LayerIdx)->CKCR &= ~(LTDC_LxCKCR_CKBLUE | LTDC_LxCKCR_CKGREEN | LTDC_LxCKCR_CKRED); 00842 LTDC_LAYER(hltdc, LayerIdx)->CKCR = RGBValue; 00843 00844 /* Set the Immediate Reload type */ 00845 hltdc->Instance->SRCR = LTDC_SRCR_IMR; 00846 00847 /* Change the LTDC state*/ 00848 hltdc->State = HAL_LTDC_STATE_READY; 00849 00850 /* Process unlocked */ 00851 __HAL_UNLOCK(hltdc); 00852 00853 return HAL_OK; 00854 } 00855 00856 /** 00857 * @brief Load the color lookup table. 00858 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00859 * the configuration information for the LTDC. 00860 * @param pCLUT pointer to the color lookup table address. 00861 * @param CLUTSize the color lookup table size. 00862 * @param LayerIdx LTDC Layer index. 00863 * This parameter can be one of the following values: 00864 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 00865 * @retval HAL status 00866 */ 00867 HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx) 00868 { 00869 uint32_t tmp; 00870 uint32_t counter; 00871 uint32_t *pcolorlut = pCLUT; 00872 /* Check the parameters */ 00873 assert_param(IS_LTDC_LAYER(LayerIdx)); 00874 00875 /* Process locked */ 00876 __HAL_LOCK(hltdc); 00877 00878 /* Change LTDC peripheral state */ 00879 hltdc->State = HAL_LTDC_STATE_BUSY; 00880 00881 for(counter = 0U; (counter < CLUTSize); counter++) 00882 { 00883 if(hltdc->LayerCfg[LayerIdx].PixelFormat == LTDC_PIXEL_FORMAT_AL44) 00884 { 00885 tmp = (((counter + (16U*counter)) << 24U) | ((uint32_t)(*pcolorlut) & 0xFFU) | ((uint32_t)(*pcolorlut) & 0xFF00U) | ((uint32_t)(*pcolorlut) & 0xFF0000U)); 00886 } 00887 else 00888 { 00889 tmp = ((counter << 24U) | ((uint32_t)(*pcolorlut) & 0xFFU) | ((uint32_t)(*pcolorlut) & 0xFF00U) | ((uint32_t)(*pcolorlut) & 0xFF0000U)); 00890 } 00891 00892 pcolorlut++; 00893 00894 /* Specifies the C-LUT address and RGB value */ 00895 LTDC_LAYER(hltdc, LayerIdx)->CLUTWR = tmp; 00896 } 00897 00898 /* Change the LTDC state*/ 00899 hltdc->State = HAL_LTDC_STATE_READY; 00900 00901 /* Process unlocked */ 00902 __HAL_UNLOCK(hltdc); 00903 00904 return HAL_OK; 00905 } 00906 00907 /** 00908 * @brief Enable the color keying. 00909 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00910 * the configuration information for the LTDC. 00911 * @param LayerIdx LTDC Layer index. 00912 * This parameter can be one of the following values: 00913 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 00914 * @retval HAL status 00915 */ 00916 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx) 00917 { 00918 /* Check the parameters */ 00919 assert_param(IS_LTDC_LAYER(LayerIdx)); 00920 00921 /* Process locked */ 00922 __HAL_LOCK(hltdc); 00923 00924 /* Change LTDC peripheral state */ 00925 hltdc->State = HAL_LTDC_STATE_BUSY; 00926 00927 /* Enable LTDC color keying by setting COLKEN bit */ 00928 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_COLKEN; 00929 00930 /* Set the Immediate Reload type */ 00931 hltdc->Instance->SRCR = LTDC_SRCR_IMR; 00932 00933 /* Change the LTDC state*/ 00934 hltdc->State = HAL_LTDC_STATE_READY; 00935 00936 /* Process unlocked */ 00937 __HAL_UNLOCK(hltdc); 00938 00939 return HAL_OK; 00940 } 00941 00942 /** 00943 * @brief Disable the color keying. 00944 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00945 * the configuration information for the LTDC. 00946 * @param LayerIdx LTDC Layer index. 00947 * This parameter can be one of the following values: 00948 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 00949 * @retval HAL status 00950 */ 00951 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx) 00952 { 00953 /* Check the parameters */ 00954 assert_param(IS_LTDC_LAYER(LayerIdx)); 00955 00956 /* Process locked */ 00957 __HAL_LOCK(hltdc); 00958 00959 /* Change LTDC peripheral state */ 00960 hltdc->State = HAL_LTDC_STATE_BUSY; 00961 00962 /* Disable LTDC color keying by setting COLKEN bit */ 00963 LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_COLKEN; 00964 00965 /* Set the Immediate Reload type */ 00966 hltdc->Instance->SRCR = LTDC_SRCR_IMR; 00967 00968 /* Change the LTDC state*/ 00969 hltdc->State = HAL_LTDC_STATE_READY; 00970 00971 /* Process unlocked */ 00972 __HAL_UNLOCK(hltdc); 00973 00974 return HAL_OK; 00975 } 00976 00977 /** 00978 * @brief Enable the color lookup table. 00979 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00980 * the configuration information for the LTDC. 00981 * @param LayerIdx LTDC Layer index. 00982 * This parameter can be one of the following values: 00983 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 00984 * @retval HAL status 00985 */ 00986 HAL_StatusTypeDef HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx) 00987 { 00988 /* Check the parameters */ 00989 assert_param(IS_LTDC_LAYER(LayerIdx)); 00990 00991 /* Process locked */ 00992 __HAL_LOCK(hltdc); 00993 00994 /* Change LTDC peripheral state */ 00995 hltdc->State = HAL_LTDC_STATE_BUSY; 00996 00997 /* Enable LTDC color lookup table by setting CLUTEN bit */ 00998 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_CLUTEN; 00999 01000 /* Set the Immediate Reload type */ 01001 hltdc->Instance->SRCR = LTDC_SRCR_IMR; 01002 01003 /* Change the LTDC state*/ 01004 hltdc->State = HAL_LTDC_STATE_READY; 01005 01006 /* Process unlocked */ 01007 __HAL_UNLOCK(hltdc); 01008 01009 return HAL_OK; 01010 } 01011 01012 /** 01013 * @brief Disable the color lookup table. 01014 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01015 * the configuration information for the LTDC. 01016 * @param LayerIdx LTDC Layer index. 01017 * This parameter can be one of the following values: 01018 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01019 * @retval HAL status 01020 */ 01021 HAL_StatusTypeDef HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx) 01022 { 01023 /* Check the parameters */ 01024 assert_param(IS_LTDC_LAYER(LayerIdx)); 01025 01026 /* Process locked */ 01027 __HAL_LOCK(hltdc); 01028 01029 /* Change LTDC peripheral state */ 01030 hltdc->State = HAL_LTDC_STATE_BUSY; 01031 01032 /* Disable LTDC color lookup table by setting CLUTEN bit */ 01033 LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_CLUTEN; 01034 01035 /* Set the Immediate Reload type */ 01036 hltdc->Instance->SRCR = LTDC_SRCR_IMR; 01037 01038 /* Change the LTDC state*/ 01039 hltdc->State = HAL_LTDC_STATE_READY; 01040 01041 /* Process unlocked */ 01042 __HAL_UNLOCK(hltdc); 01043 01044 return HAL_OK; 01045 } 01046 01047 /** 01048 * @brief Enable Dither. 01049 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01050 * the configuration information for the LTDC. 01051 * @retval HAL status 01052 */ 01053 01054 HAL_StatusTypeDef HAL_LTDC_EnableDither(LTDC_HandleTypeDef *hltdc) 01055 { 01056 /* Process locked */ 01057 __HAL_LOCK(hltdc); 01058 01059 /* Change LTDC peripheral state */ 01060 hltdc->State = HAL_LTDC_STATE_BUSY; 01061 01062 /* Enable Dither by setting DTEN bit */ 01063 LTDC->GCR |= (uint32_t)LTDC_GCR_DEN; 01064 01065 /* Change the LTDC state*/ 01066 hltdc->State = HAL_LTDC_STATE_READY; 01067 01068 /* Process unlocked */ 01069 __HAL_UNLOCK(hltdc); 01070 01071 return HAL_OK; 01072 } 01073 01074 /** 01075 * @brief Disable Dither. 01076 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01077 * the configuration information for the LTDC. 01078 * @retval HAL status 01079 */ 01080 01081 HAL_StatusTypeDef HAL_LTDC_DisableDither(LTDC_HandleTypeDef *hltdc) 01082 { 01083 /* Process locked */ 01084 __HAL_LOCK(hltdc); 01085 01086 /* Change LTDC peripheral state */ 01087 hltdc->State = HAL_LTDC_STATE_BUSY; 01088 01089 /* Disable Dither by setting DTEN bit */ 01090 LTDC->GCR &= ~(uint32_t)LTDC_GCR_DEN; 01091 01092 /* Change the LTDC state*/ 01093 hltdc->State = HAL_LTDC_STATE_READY; 01094 01095 /* Process unlocked */ 01096 __HAL_UNLOCK(hltdc); 01097 01098 return HAL_OK; 01099 } 01100 01101 /** 01102 * @brief Set the LTDC window size. 01103 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01104 * the configuration information for the LTDC. 01105 * @param XSize LTDC Pixel per line 01106 * @param YSize LTDC Line number 01107 * @param LayerIdx LTDC Layer index. 01108 * This parameter can be one of the following values: 01109 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01110 * @retval HAL status 01111 */ 01112 HAL_StatusTypeDef HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx) 01113 { 01114 LTDC_LayerCfgTypeDef *pLayerCfg; 01115 01116 /* Check the parameters (Layers parameters)*/ 01117 assert_param(IS_LTDC_LAYER(LayerIdx)); 01118 assert_param(IS_LTDC_CFBLL(XSize)); 01119 assert_param(IS_LTDC_CFBLNBR(YSize)); 01120 01121 /* Process locked */ 01122 __HAL_LOCK(hltdc); 01123 01124 /* Change LTDC peripheral state */ 01125 hltdc->State = HAL_LTDC_STATE_BUSY; 01126 01127 /* Get layer configuration from handle structure */ 01128 pLayerCfg = &hltdc->LayerCfg[LayerIdx]; 01129 01130 /* update horizontal stop */ 01131 pLayerCfg->WindowX1 = XSize + pLayerCfg->WindowX0; 01132 01133 /* update vertical stop */ 01134 pLayerCfg->WindowY1 = YSize + pLayerCfg->WindowY0; 01135 01136 /* Reconfigures the color frame buffer pitch in byte */ 01137 pLayerCfg->ImageWidth = XSize; 01138 01139 /* Reconfigures the frame buffer line number */ 01140 pLayerCfg->ImageHeight = YSize; 01141 01142 /* Set LTDC parameters */ 01143 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); 01144 01145 /* Set the Immediate Reload type */ 01146 hltdc->Instance->SRCR = LTDC_SRCR_IMR; 01147 01148 /* Change the LTDC state*/ 01149 hltdc->State = HAL_LTDC_STATE_READY; 01150 01151 /* Process unlocked */ 01152 __HAL_UNLOCK(hltdc); 01153 01154 return HAL_OK; 01155 } 01156 01157 /** 01158 * @brief Set the LTDC window position. 01159 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01160 * the configuration information for the LTDC. 01161 * @param X0 LTDC window X offset 01162 * @param Y0 LTDC window Y offset 01163 * @param LayerIdx LTDC Layer index. 01164 * This parameter can be one of the following values: 01165 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01166 * @retval HAL status 01167 */ 01168 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx) 01169 { 01170 LTDC_LayerCfgTypeDef *pLayerCfg; 01171 01172 /* Check the parameters */ 01173 assert_param(IS_LTDC_LAYER(LayerIdx)); 01174 assert_param(IS_LTDC_CFBLL(X0)); 01175 assert_param(IS_LTDC_CFBLNBR(Y0)); 01176 01177 /* Process locked */ 01178 __HAL_LOCK(hltdc); 01179 01180 /* Change LTDC peripheral state */ 01181 hltdc->State = HAL_LTDC_STATE_BUSY; 01182 01183 /* Get layer configuration from handle structure */ 01184 pLayerCfg = &hltdc->LayerCfg[LayerIdx]; 01185 01186 /* update horizontal start/stop */ 01187 pLayerCfg->WindowX0 = X0; 01188 pLayerCfg->WindowX1 = X0 + pLayerCfg->ImageWidth; 01189 01190 /* update vertical start/stop */ 01191 pLayerCfg->WindowY0 = Y0; 01192 pLayerCfg->WindowY1 = Y0 + pLayerCfg->ImageHeight; 01193 01194 /* Set LTDC parameters */ 01195 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); 01196 01197 /* Set the Immediate Reload type */ 01198 hltdc->Instance->SRCR = LTDC_SRCR_IMR; 01199 01200 /* Change the LTDC state*/ 01201 hltdc->State = HAL_LTDC_STATE_READY; 01202 01203 /* Process unlocked */ 01204 __HAL_UNLOCK(hltdc); 01205 01206 return HAL_OK; 01207 } 01208 01209 /** 01210 * @brief Reconfigure the pixel format. 01211 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01212 * the configuration information for the LTDC. 01213 * @param Pixelformat new pixel format value. 01214 * @param LayerIdx LTDC Layer index. 01215 * This parameter can be one of the following values: 01216 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1). 01217 * @retval HAL status 01218 */ 01219 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx) 01220 { 01221 LTDC_LayerCfgTypeDef *pLayerCfg; 01222 01223 /* Check the parameters */ 01224 assert_param(IS_LTDC_PIXEL_FORMAT(Pixelformat)); 01225 assert_param(IS_LTDC_LAYER(LayerIdx)); 01226 01227 /* Process locked */ 01228 __HAL_LOCK(hltdc); 01229 01230 /* Change LTDC peripheral state */ 01231 hltdc->State = HAL_LTDC_STATE_BUSY; 01232 01233 /* Get layer configuration from handle structure */ 01234 pLayerCfg = &hltdc->LayerCfg[LayerIdx]; 01235 01236 /* Reconfigure the pixel format */ 01237 pLayerCfg->PixelFormat = Pixelformat; 01238 01239 /* Set LTDC parameters */ 01240 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); 01241 01242 /* Set the Immediate Reload type */ 01243 hltdc->Instance->SRCR = LTDC_SRCR_IMR; 01244 01245 /* Change the LTDC state*/ 01246 hltdc->State = HAL_LTDC_STATE_READY; 01247 01248 /* Process unlocked */ 01249 __HAL_UNLOCK(hltdc); 01250 01251 return HAL_OK; 01252 } 01253 01254 /** 01255 * @brief Reconfigure the layer alpha value. 01256 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01257 * the configuration information for the LTDC. 01258 * @param Alpha new alpha value. 01259 * @param LayerIdx LTDC Layer index. 01260 * This parameter can be one of the following values: 01261 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01262 * @retval HAL status 01263 */ 01264 HAL_StatusTypeDef HAL_LTDC_SetAlpha(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx) 01265 { 01266 LTDC_LayerCfgTypeDef *pLayerCfg; 01267 01268 /* Check the parameters */ 01269 assert_param(IS_LTDC_ALPHA(Alpha)); 01270 assert_param(IS_LTDC_LAYER(LayerIdx)); 01271 01272 /* Process locked */ 01273 __HAL_LOCK(hltdc); 01274 01275 /* Change LTDC peripheral state */ 01276 hltdc->State = HAL_LTDC_STATE_BUSY; 01277 01278 /* Get layer configuration from handle structure */ 01279 pLayerCfg = &hltdc->LayerCfg[LayerIdx]; 01280 01281 /* Reconfigure the Alpha value */ 01282 pLayerCfg->Alpha = Alpha; 01283 01284 /* Set LTDC parameters */ 01285 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); 01286 01287 /* Set the Immediate Reload type */ 01288 hltdc->Instance->SRCR = LTDC_SRCR_IMR; 01289 01290 /* Change the LTDC state*/ 01291 hltdc->State = HAL_LTDC_STATE_READY; 01292 01293 /* Process unlocked */ 01294 __HAL_UNLOCK(hltdc); 01295 01296 return HAL_OK; 01297 } 01298 /** 01299 * @brief Reconfigure the frame buffer Address. 01300 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01301 * the configuration information for the LTDC. 01302 * @param Address new address value. 01303 * @param LayerIdx LTDC Layer index. 01304 * This parameter can be one of the following values: 01305 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1). 01306 * @retval HAL status 01307 */ 01308 HAL_StatusTypeDef HAL_LTDC_SetAddress(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx) 01309 { 01310 LTDC_LayerCfgTypeDef *pLayerCfg; 01311 01312 /* Check the parameters */ 01313 assert_param(IS_LTDC_LAYER(LayerIdx)); 01314 01315 /* Process locked */ 01316 __HAL_LOCK(hltdc); 01317 01318 /* Change LTDC peripheral state */ 01319 hltdc->State = HAL_LTDC_STATE_BUSY; 01320 01321 /* Get layer configuration from handle structure */ 01322 pLayerCfg = &hltdc->LayerCfg[LayerIdx]; 01323 01324 /* Reconfigure the Address */ 01325 pLayerCfg->FBStartAdress = Address; 01326 01327 /* Set LTDC parameters */ 01328 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); 01329 01330 /* Set the Immediate Reload type */ 01331 hltdc->Instance->SRCR = LTDC_SRCR_IMR; 01332 01333 /* Change the LTDC state*/ 01334 hltdc->State = HAL_LTDC_STATE_READY; 01335 01336 /* Process unlocked */ 01337 __HAL_UNLOCK(hltdc); 01338 01339 return HAL_OK; 01340 } 01341 01342 /** 01343 * @brief Function used to reconfigure the pitch for specific cases where the attached LayerIdx buffer have a width that is 01344 * larger than the one intended to be displayed on screen. Example of a buffer 800x480 attached to layer for which we 01345 * want to read and display on screen only a portion 320x240 taken in the center of the buffer. The pitch in pixels 01346 * will be in that case 800 pixels and not 320 pixels as initially configured by previous call to HAL_LTDC_ConfigLayer(). 01347 * @note This function should be called only after a previous call to HAL_LTDC_ConfigLayer() to modify the default pitch 01348 * configured by HAL_LTDC_ConfigLayer() when required (refer to example described just above). 01349 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01350 * the configuration information for the LTDC. 01351 * @param LinePitchInPixels New line pitch in pixels to configure for LTDC layer 'LayerIdx'. 01352 * @param LayerIdx LTDC layer index concerned by the modification of line pitch. 01353 * @retval HAL status 01354 */ 01355 HAL_StatusTypeDef HAL_LTDC_SetPitch(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx) 01356 { 01357 uint32_t tmp; 01358 uint32_t pitchUpdate; 01359 uint32_t pixelFormat; 01360 01361 /* Check the parameters */ 01362 assert_param(IS_LTDC_LAYER(LayerIdx)); 01363 01364 /* Process locked */ 01365 __HAL_LOCK(hltdc); 01366 01367 /* Change LTDC peripheral state */ 01368 hltdc->State = HAL_LTDC_STATE_BUSY; 01369 01370 /* get LayerIdx used pixel format */ 01371 pixelFormat = hltdc->LayerCfg[LayerIdx].PixelFormat; 01372 01373 if(pixelFormat == LTDC_PIXEL_FORMAT_ARGB8888) 01374 { 01375 tmp = 4U; 01376 } 01377 else if (pixelFormat == LTDC_PIXEL_FORMAT_RGB888) 01378 { 01379 tmp = 3U; 01380 } 01381 else if((pixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \ 01382 (pixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \ 01383 (pixelFormat == LTDC_PIXEL_FORMAT_ARGB1555) || \ 01384 (pixelFormat == LTDC_PIXEL_FORMAT_AL88)) 01385 { 01386 tmp = 2U; 01387 } 01388 else 01389 { 01390 tmp = 1U; 01391 } 01392 01393 pitchUpdate = ((LinePitchInPixels * tmp) << 16U); 01394 01395 /* Clear previously set standard pitch */ 01396 LTDC_LAYER(hltdc, LayerIdx)->CFBLR &= ~LTDC_LxCFBLR_CFBP; 01397 01398 /* Set the Reload type as immediate update of LTDC pitch configured above */ 01399 LTDC->SRCR |= LTDC_SRCR_IMR; 01400 01401 /* Set new line pitch value */ 01402 LTDC_LAYER(hltdc, LayerIdx)->CFBLR |= pitchUpdate; 01403 01404 /* Set the Reload type as immediate update of LTDC pitch configured above */ 01405 LTDC->SRCR |= LTDC_SRCR_IMR; 01406 01407 /* Change the LTDC state*/ 01408 hltdc->State = HAL_LTDC_STATE_READY; 01409 01410 /* Process unlocked */ 01411 __HAL_UNLOCK(hltdc); 01412 01413 return HAL_OK; 01414 } 01415 01416 /** 01417 * @brief Define the position of the line interrupt. 01418 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01419 * the configuration information for the LTDC. 01420 * @param Line Line Interrupt Position. 01421 * @note User application may resort to HAL_LTDC_LineEventCallback() at line interrupt generation. 01422 * @retval HAL status 01423 */ 01424 HAL_StatusTypeDef HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef *hltdc, uint32_t Line) 01425 { 01426 /* Check the parameters */ 01427 assert_param(IS_LTDC_LIPOS(Line)); 01428 01429 /* Process locked */ 01430 __HAL_LOCK(hltdc); 01431 01432 /* Change LTDC peripheral state */ 01433 hltdc->State = HAL_LTDC_STATE_BUSY; 01434 01435 /* Disable the Line interrupt */ 01436 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_LI); 01437 01438 /* Set the Line Interrupt position */ 01439 LTDC->LIPCR = (uint32_t)Line; 01440 01441 /* Enable the Line interrupt */ 01442 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_LI); 01443 01444 /* Change the LTDC state*/ 01445 hltdc->State = HAL_LTDC_STATE_READY; 01446 01447 /* Process unlocked */ 01448 __HAL_UNLOCK(hltdc); 01449 01450 return HAL_OK; 01451 } 01452 01453 /** 01454 * @brief Reload LTDC Layers configuration. 01455 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01456 * the configuration information for the LTDC. 01457 * @param ReloadType This parameter can be one of the following values : 01458 * LTDC_RELOAD_IMMEDIATE : Immediate Reload 01459 * LTDC_RELOAD_VERTICAL_BLANKING : Reload in the next Vertical Blanking 01460 * @note User application may resort to HAL_LTDC_ReloadEventCallback() at reload interrupt generation. 01461 * @retval HAL status 01462 */ 01463 HAL_StatusTypeDef HAL_LTDC_Reload(LTDC_HandleTypeDef *hltdc, uint32_t ReloadType) 01464 { 01465 /* Check the parameters */ 01466 assert_param(IS_LTDC_RELOAD(ReloadType)); 01467 01468 /* Process locked */ 01469 __HAL_LOCK(hltdc); 01470 01471 /* Change LTDC peripheral state */ 01472 hltdc->State = HAL_LTDC_STATE_BUSY; 01473 01474 /* Enable the Reload interrupt */ 01475 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_RR); 01476 01477 /* Apply Reload type */ 01478 hltdc->Instance->SRCR = ReloadType; 01479 01480 /* Change the LTDC state*/ 01481 hltdc->State = HAL_LTDC_STATE_READY; 01482 01483 /* Process unlocked */ 01484 __HAL_UNLOCK(hltdc); 01485 01486 return HAL_OK; 01487 } 01488 01489 /** 01490 * @brief Configure the LTDC Layer according to the specified without reloading 01491 * parameters in the LTDC_InitTypeDef and create the associated handle. 01492 * Variant of the function HAL_LTDC_ConfigLayer without immediate reload. 01493 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01494 * the configuration information for the LTDC. 01495 * @param pLayerCfg pointer to a LTDC_LayerCfgTypeDef structure that contains 01496 * the configuration information for the Layer. 01497 * @param LayerIdx LTDC Layer index. 01498 * This parameter can be one of the following values: 01499 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01500 * @retval HAL status 01501 */ 01502 HAL_StatusTypeDef HAL_LTDC_ConfigLayer_NoReload(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx) 01503 { 01504 /* Check the parameters */ 01505 assert_param(IS_LTDC_LAYER(LayerIdx)); 01506 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0)); 01507 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1)); 01508 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0)); 01509 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1)); 01510 assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg->PixelFormat)); 01511 assert_param(IS_LTDC_ALPHA(pLayerCfg->Alpha)); 01512 assert_param(IS_LTDC_ALPHA(pLayerCfg->Alpha0)); 01513 assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg->BlendingFactor1)); 01514 assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg->BlendingFactor2)); 01515 assert_param(IS_LTDC_CFBLL(pLayerCfg->ImageWidth)); 01516 assert_param(IS_LTDC_CFBLNBR(pLayerCfg->ImageHeight)); 01517 01518 /* Process locked */ 01519 __HAL_LOCK(hltdc); 01520 01521 /* Change LTDC peripheral state */ 01522 hltdc->State = HAL_LTDC_STATE_BUSY; 01523 01524 /* Copy new layer configuration into handle structure */ 01525 hltdc->LayerCfg[LayerIdx] = *pLayerCfg; 01526 01527 /* Configure the LTDC Layer */ 01528 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); 01529 01530 /* Initialize the LTDC state*/ 01531 hltdc->State = HAL_LTDC_STATE_READY; 01532 01533 /* Process unlocked */ 01534 __HAL_UNLOCK(hltdc); 01535 01536 return HAL_OK; 01537 } 01538 01539 /** 01540 * @brief Set the LTDC window size without reloading. 01541 * Variant of the function HAL_LTDC_SetWindowSize without immediate reload. 01542 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01543 * the configuration information for the LTDC. 01544 * @param XSize LTDC Pixel per line 01545 * @param YSize LTDC Line number 01546 * @param LayerIdx LTDC Layer index. 01547 * This parameter can be one of the following values: 01548 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01549 * @retval HAL status 01550 */ 01551 HAL_StatusTypeDef HAL_LTDC_SetWindowSize_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx) 01552 { 01553 LTDC_LayerCfgTypeDef *pLayerCfg; 01554 01555 /* Check the parameters (Layers parameters)*/ 01556 assert_param(IS_LTDC_LAYER(LayerIdx)); 01557 assert_param(IS_LTDC_CFBLL(XSize)); 01558 assert_param(IS_LTDC_CFBLNBR(YSize)); 01559 01560 /* Process locked */ 01561 __HAL_LOCK(hltdc); 01562 01563 /* Change LTDC peripheral state */ 01564 hltdc->State = HAL_LTDC_STATE_BUSY; 01565 01566 /* Get layer configuration from handle structure */ 01567 pLayerCfg = &hltdc->LayerCfg[LayerIdx]; 01568 01569 /* update horizontal stop */ 01570 pLayerCfg->WindowX1 = XSize + pLayerCfg->WindowX0; 01571 01572 /* update vertical stop */ 01573 pLayerCfg->WindowY1 = YSize + pLayerCfg->WindowY0; 01574 01575 /* Reconfigures the color frame buffer pitch in byte */ 01576 pLayerCfg->ImageWidth = XSize; 01577 01578 /* Reconfigures the frame buffer line number */ 01579 pLayerCfg->ImageHeight = YSize; 01580 01581 /* Set LTDC parameters */ 01582 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); 01583 01584 /* Change the LTDC state*/ 01585 hltdc->State = HAL_LTDC_STATE_READY; 01586 01587 /* Process unlocked */ 01588 __HAL_UNLOCK(hltdc); 01589 01590 return HAL_OK; 01591 } 01592 01593 /** 01594 * @brief Set the LTDC window position without reloading. 01595 * Variant of the function HAL_LTDC_SetWindowPosition without immediate reload. 01596 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01597 * the configuration information for the LTDC. 01598 * @param X0 LTDC window X offset 01599 * @param Y0 LTDC window Y offset 01600 * @param LayerIdx LTDC Layer index. 01601 * This parameter can be one of the following values: 01602 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01603 * @retval HAL status 01604 */ 01605 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx) 01606 { 01607 LTDC_LayerCfgTypeDef *pLayerCfg; 01608 01609 /* Check the parameters */ 01610 assert_param(IS_LTDC_LAYER(LayerIdx)); 01611 assert_param(IS_LTDC_CFBLL(X0)); 01612 assert_param(IS_LTDC_CFBLNBR(Y0)); 01613 01614 /* Process locked */ 01615 __HAL_LOCK(hltdc); 01616 01617 /* Change LTDC peripheral state */ 01618 hltdc->State = HAL_LTDC_STATE_BUSY; 01619 01620 /* Get layer configuration from handle structure */ 01621 pLayerCfg = &hltdc->LayerCfg[LayerIdx]; 01622 01623 /* update horizontal start/stop */ 01624 pLayerCfg->WindowX0 = X0; 01625 pLayerCfg->WindowX1 = X0 + pLayerCfg->ImageWidth; 01626 01627 /* update vertical start/stop */ 01628 pLayerCfg->WindowY0 = Y0; 01629 pLayerCfg->WindowY1 = Y0 + pLayerCfg->ImageHeight; 01630 01631 /* Set LTDC parameters */ 01632 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); 01633 01634 /* Change the LTDC state*/ 01635 hltdc->State = HAL_LTDC_STATE_READY; 01636 01637 /* Process unlocked */ 01638 __HAL_UNLOCK(hltdc); 01639 01640 return HAL_OK; 01641 } 01642 01643 /** 01644 * @brief Reconfigure the pixel format without reloading. 01645 * Variant of the function HAL_LTDC_SetPixelFormat without immediate reload. 01646 * @param hltdc pointer to a LTDC_HandleTypeDfef structure that contains 01647 * the configuration information for the LTDC. 01648 * @param Pixelformat new pixel format value. 01649 * @param LayerIdx LTDC Layer index. 01650 * This parameter can be one of the following values: 01651 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1). 01652 * @retval HAL status 01653 */ 01654 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx) 01655 { 01656 LTDC_LayerCfgTypeDef *pLayerCfg; 01657 01658 /* Check the parameters */ 01659 assert_param(IS_LTDC_PIXEL_FORMAT(Pixelformat)); 01660 assert_param(IS_LTDC_LAYER(LayerIdx)); 01661 01662 /* Process locked */ 01663 __HAL_LOCK(hltdc); 01664 01665 /* Change LTDC peripheral state */ 01666 hltdc->State = HAL_LTDC_STATE_BUSY; 01667 01668 /* Get layer configuration from handle structure */ 01669 pLayerCfg = &hltdc->LayerCfg[LayerIdx]; 01670 01671 /* Reconfigure the pixel format */ 01672 pLayerCfg->PixelFormat = Pixelformat; 01673 01674 /* Set LTDC parameters */ 01675 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); 01676 01677 /* Change the LTDC state*/ 01678 hltdc->State = HAL_LTDC_STATE_READY; 01679 01680 /* Process unlocked */ 01681 __HAL_UNLOCK(hltdc); 01682 01683 return HAL_OK; 01684 } 01685 01686 /** 01687 * @brief Reconfigure the layer alpha value without reloading. 01688 * Variant of the function HAL_LTDC_SetAlpha without immediate reload. 01689 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01690 * the configuration information for the LTDC. 01691 * @param Alpha new alpha value. 01692 * @param LayerIdx LTDC Layer index. 01693 * This parameter can be one of the following values: 01694 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01695 * @retval HAL status 01696 */ 01697 HAL_StatusTypeDef HAL_LTDC_SetAlpha_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx) 01698 { 01699 LTDC_LayerCfgTypeDef *pLayerCfg; 01700 01701 /* Check the parameters */ 01702 assert_param(IS_LTDC_ALPHA(Alpha)); 01703 assert_param(IS_LTDC_LAYER(LayerIdx)); 01704 01705 /* Process locked */ 01706 __HAL_LOCK(hltdc); 01707 01708 /* Change LTDC peripheral state */ 01709 hltdc->State = HAL_LTDC_STATE_BUSY; 01710 01711 /* Get layer configuration from handle structure */ 01712 pLayerCfg = &hltdc->LayerCfg[LayerIdx]; 01713 01714 /* Reconfigure the Alpha value */ 01715 pLayerCfg->Alpha = Alpha; 01716 01717 /* Set LTDC parameters */ 01718 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); 01719 01720 /* Change the LTDC state*/ 01721 hltdc->State = HAL_LTDC_STATE_READY; 01722 01723 /* Process unlocked */ 01724 __HAL_UNLOCK(hltdc); 01725 01726 return HAL_OK; 01727 } 01728 01729 /** 01730 * @brief Reconfigure the frame buffer Address without reloading. 01731 * Variant of the function HAL_LTDC_SetAddress without immediate reload. 01732 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01733 * the configuration information for the LTDC. 01734 * @param Address new address value. 01735 * @param LayerIdx LTDC Layer index. 01736 * This parameter can be one of the following values: 01737 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1). 01738 * @retval HAL status 01739 */ 01740 HAL_StatusTypeDef HAL_LTDC_SetAddress_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx) 01741 { 01742 LTDC_LayerCfgTypeDef *pLayerCfg; 01743 01744 /* Check the parameters */ 01745 assert_param(IS_LTDC_LAYER(LayerIdx)); 01746 01747 /* Process locked */ 01748 __HAL_LOCK(hltdc); 01749 01750 /* Change LTDC peripheral state */ 01751 hltdc->State = HAL_LTDC_STATE_BUSY; 01752 01753 /* Get layer configuration from handle structure */ 01754 pLayerCfg = &hltdc->LayerCfg[LayerIdx]; 01755 01756 /* Reconfigure the Address */ 01757 pLayerCfg->FBStartAdress = Address; 01758 01759 /* Set LTDC parameters */ 01760 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); 01761 01762 /* Change the LTDC state*/ 01763 hltdc->State = HAL_LTDC_STATE_READY; 01764 01765 /* Process unlocked */ 01766 __HAL_UNLOCK(hltdc); 01767 01768 return HAL_OK; 01769 } 01770 01771 /** 01772 * @brief Function used to reconfigure the pitch for specific cases where the attached LayerIdx buffer have a width that is 01773 * larger than the one intended to be displayed on screen. Example of a buffer 800x480 attached to layer for which we 01774 * want to read and display on screen only a portion 320x240 taken in the center of the buffer. The pitch in pixels 01775 * will be in that case 800 pixels and not 320 pixels as initially configured by previous call to HAL_LTDC_ConfigLayer(). 01776 * @note This function should be called only after a previous call to HAL_LTDC_ConfigLayer() to modify the default pitch 01777 * configured by HAL_LTDC_ConfigLayer() when required (refer to example described just above). 01778 * Variant of the function HAL_LTDC_SetPitch without immediate reload. 01779 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01780 * the configuration information for the LTDC. 01781 * @param LinePitchInPixels New line pitch in pixels to configure for LTDC layer 'LayerIdx'. 01782 * @param LayerIdx LTDC layer index concerned by the modification of line pitch. 01783 * @retval HAL status 01784 */ 01785 HAL_StatusTypeDef HAL_LTDC_SetPitch_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx) 01786 { 01787 uint32_t tmp; 01788 uint32_t pitchUpdate; 01789 uint32_t pixelFormat; 01790 01791 /* Check the parameters */ 01792 assert_param(IS_LTDC_LAYER(LayerIdx)); 01793 01794 /* Process locked */ 01795 __HAL_LOCK(hltdc); 01796 01797 /* Change LTDC peripheral state */ 01798 hltdc->State = HAL_LTDC_STATE_BUSY; 01799 01800 /* get LayerIdx used pixel format */ 01801 pixelFormat = hltdc->LayerCfg[LayerIdx].PixelFormat; 01802 01803 if(pixelFormat == LTDC_PIXEL_FORMAT_ARGB8888) 01804 { 01805 tmp = 4U; 01806 } 01807 else if (pixelFormat == LTDC_PIXEL_FORMAT_RGB888) 01808 { 01809 tmp = 3U; 01810 } 01811 else if((pixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \ 01812 (pixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \ 01813 (pixelFormat == LTDC_PIXEL_FORMAT_ARGB1555) || \ 01814 (pixelFormat == LTDC_PIXEL_FORMAT_AL88)) 01815 { 01816 tmp = 2U; 01817 } 01818 else 01819 { 01820 tmp = 1U; 01821 } 01822 01823 pitchUpdate = ((LinePitchInPixels * tmp) << 16U); 01824 01825 /* Clear previously set standard pitch */ 01826 LTDC_LAYER(hltdc, LayerIdx)->CFBLR &= ~LTDC_LxCFBLR_CFBP; 01827 01828 /* Set new line pitch value */ 01829 LTDC_LAYER(hltdc, LayerIdx)->CFBLR |= pitchUpdate; 01830 01831 /* Change the LTDC state*/ 01832 hltdc->State = HAL_LTDC_STATE_READY; 01833 01834 /* Process unlocked */ 01835 __HAL_UNLOCK(hltdc); 01836 01837 return HAL_OK; 01838 } 01839 01840 01841 /** 01842 * @brief Configure the color keying without reloading. 01843 * Variant of the function HAL_LTDC_ConfigColorKeying without immediate reload. 01844 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01845 * the configuration information for the LTDC. 01846 * @param RGBValue the color key value 01847 * @param LayerIdx LTDC Layer index. 01848 * This parameter can be one of the following values: 01849 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01850 * @retval HAL status 01851 */ 01852 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx) 01853 { 01854 /* Check the parameters */ 01855 assert_param(IS_LTDC_LAYER(LayerIdx)); 01856 01857 /* Process locked */ 01858 __HAL_LOCK(hltdc); 01859 01860 /* Change LTDC peripheral state */ 01861 hltdc->State = HAL_LTDC_STATE_BUSY; 01862 01863 /* Configure the default color values */ 01864 LTDC_LAYER(hltdc, LayerIdx)->CKCR &= ~(LTDC_LxCKCR_CKBLUE | LTDC_LxCKCR_CKGREEN | LTDC_LxCKCR_CKRED); 01865 LTDC_LAYER(hltdc, LayerIdx)->CKCR = RGBValue; 01866 01867 /* Change the LTDC state*/ 01868 hltdc->State = HAL_LTDC_STATE_READY; 01869 01870 /* Process unlocked */ 01871 __HAL_UNLOCK(hltdc); 01872 01873 return HAL_OK; 01874 } 01875 01876 /** 01877 * @brief Enable the color keying without reloading. 01878 * Variant of the function HAL_LTDC_EnableColorKeying without immediate reload. 01879 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01880 * the configuration information for the LTDC. 01881 * @param LayerIdx LTDC Layer index. 01882 * This parameter can be one of the following values: 01883 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01884 * @retval HAL status 01885 */ 01886 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx) 01887 { 01888 /* Check the parameters */ 01889 assert_param(IS_LTDC_LAYER(LayerIdx)); 01890 01891 /* Process locked */ 01892 __HAL_LOCK(hltdc); 01893 01894 /* Change LTDC peripheral state */ 01895 hltdc->State = HAL_LTDC_STATE_BUSY; 01896 01897 /* Enable LTDC color keying by setting COLKEN bit */ 01898 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_COLKEN; 01899 01900 /* Change the LTDC state*/ 01901 hltdc->State = HAL_LTDC_STATE_READY; 01902 01903 /* Process unlocked */ 01904 __HAL_UNLOCK(hltdc); 01905 01906 return HAL_OK; 01907 } 01908 01909 /** 01910 * @brief Disable the color keying without reloading. 01911 * Variant of the function HAL_LTDC_DisableColorKeying without immediate reload. 01912 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01913 * the configuration information for the LTDC. 01914 * @param LayerIdx LTDC Layer index. 01915 * This parameter can be one of the following values: 01916 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01917 * @retval HAL status 01918 */ 01919 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx) 01920 { 01921 /* Check the parameters */ 01922 assert_param(IS_LTDC_LAYER(LayerIdx)); 01923 01924 /* Process locked */ 01925 __HAL_LOCK(hltdc); 01926 01927 /* Change LTDC peripheral state */ 01928 hltdc->State = HAL_LTDC_STATE_BUSY; 01929 01930 /* Disable LTDC color keying by setting COLKEN bit */ 01931 LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_COLKEN; 01932 01933 /* Change the LTDC state*/ 01934 hltdc->State = HAL_LTDC_STATE_READY; 01935 01936 /* Process unlocked */ 01937 __HAL_UNLOCK(hltdc); 01938 01939 return HAL_OK; 01940 } 01941 01942 /** 01943 * @brief Enable the color lookup table without reloading. 01944 * Variant of the function HAL_LTDC_EnableCLUT without immediate reload. 01945 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01946 * the configuration information for the LTDC. 01947 * @param LayerIdx LTDC Layer index. 01948 * This parameter can be one of the following values: 01949 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01950 * @retval HAL status 01951 */ 01952 HAL_StatusTypeDef HAL_LTDC_EnableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx) 01953 { 01954 /* Check the parameters */ 01955 assert_param(IS_LTDC_LAYER(LayerIdx)); 01956 01957 /* Process locked */ 01958 __HAL_LOCK(hltdc); 01959 01960 /* Change LTDC peripheral state */ 01961 hltdc->State = HAL_LTDC_STATE_BUSY; 01962 01963 /* Disable LTDC color lookup table by setting CLUTEN bit */ 01964 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_CLUTEN; 01965 01966 /* Change the LTDC state*/ 01967 hltdc->State = HAL_LTDC_STATE_READY; 01968 01969 /* Process unlocked */ 01970 __HAL_UNLOCK(hltdc); 01971 01972 return HAL_OK; 01973 } 01974 01975 /** 01976 * @brief Disable the color lookup table without reloading. 01977 * Variant of the function HAL_LTDC_DisableCLUT without immediate reload. 01978 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 01979 * the configuration information for the LTDC. 01980 * @param LayerIdx LTDC Layer index. 01981 * This parameter can be one of the following values: 01982 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 01983 * @retval HAL status 01984 */ 01985 HAL_StatusTypeDef HAL_LTDC_DisableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx) 01986 { 01987 /* Check the parameters */ 01988 assert_param(IS_LTDC_LAYER(LayerIdx)); 01989 01990 /* Process locked */ 01991 __HAL_LOCK(hltdc); 01992 01993 /* Change LTDC peripheral state */ 01994 hltdc->State = HAL_LTDC_STATE_BUSY; 01995 01996 /* Disable LTDC color lookup table by setting CLUTEN bit */ 01997 LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_CLUTEN; 01998 01999 /* Change the LTDC state*/ 02000 hltdc->State = HAL_LTDC_STATE_READY; 02001 02002 /* Process unlocked */ 02003 __HAL_UNLOCK(hltdc); 02004 02005 return HAL_OK; 02006 } 02007 02008 /** 02009 * @} 02010 */ 02011 02012 /** @defgroup LTDC_Exported_Functions_Group4 Peripheral State and Errors functions 02013 * @brief Peripheral State and Errors functions 02014 * 02015 @verbatim 02016 =============================================================================== 02017 ##### Peripheral State and Errors functions ##### 02018 =============================================================================== 02019 [..] 02020 This subsection provides functions allowing to 02021 (+) Check the LTDC handle state. 02022 (+) Get the LTDC handle error code. 02023 02024 @endverbatim 02025 * @{ 02026 */ 02027 02028 /** 02029 * @brief Return the LTDC handle state. 02030 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 02031 * the configuration information for the LTDC. 02032 * @retval HAL state 02033 */ 02034 HAL_LTDC_StateTypeDef HAL_LTDC_GetState(LTDC_HandleTypeDef *hltdc) 02035 { 02036 return hltdc->State; 02037 } 02038 02039 /** 02040 * @brief Return the LTDC handle error code. 02041 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 02042 * the configuration information for the LTDC. 02043 * @retval LTDC Error Code 02044 */ 02045 uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc) 02046 { 02047 return hltdc->ErrorCode; 02048 } 02049 02050 /** 02051 * @} 02052 */ 02053 02054 /** 02055 * @} 02056 */ 02057 02058 /** @defgroup LTDC_Private_Functions LTDC Private Functions 02059 * @{ 02060 */ 02061 02062 /** 02063 * @brief Configure the LTDC peripheral 02064 * @param hltdc Pointer to a LTDC_HandleTypeDef structure that contains 02065 * the configuration information for the LTDC. 02066 * @param pLayerCfg Pointer LTDC Layer Configuration structure 02067 * @param LayerIdx LTDC Layer index. 02068 * This parameter can be one of the following values: LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1) 02069 * @retval None 02070 */ 02071 static void LTDC_SetConfig(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx) 02072 { 02073 uint32_t tmp; 02074 uint32_t tmp1; 02075 uint32_t tmp2; 02076 02077 /* Configure the horizontal start and stop position */ 02078 tmp = ((pLayerCfg->WindowX1 + ((hltdc->Instance->BPCR & LTDC_BPCR_AHBP) >> 16U)) << 16U); 02079 LTDC_LAYER(hltdc, LayerIdx)->WHPCR &= ~(LTDC_LxWHPCR_WHSTPOS | LTDC_LxWHPCR_WHSPPOS); 02080 LTDC_LAYER(hltdc, LayerIdx)->WHPCR = ((pLayerCfg->WindowX0 + ((hltdc->Instance->BPCR & LTDC_BPCR_AHBP) >> 16U) + 1U) | tmp); 02081 02082 /* Configure the vertical start and stop position */ 02083 tmp = ((pLayerCfg->WindowY1 + (hltdc->Instance->BPCR & LTDC_BPCR_AVBP)) << 16U); 02084 LTDC_LAYER(hltdc, LayerIdx)->WVPCR &= ~(LTDC_LxWVPCR_WVSTPOS | LTDC_LxWVPCR_WVSPPOS); 02085 LTDC_LAYER(hltdc, LayerIdx)->WVPCR = ((pLayerCfg->WindowY0 + (hltdc->Instance->BPCR & LTDC_BPCR_AVBP) + 1U) | tmp); 02086 02087 /* Specifies the pixel format */ 02088 LTDC_LAYER(hltdc, LayerIdx)->PFCR &= ~(LTDC_LxPFCR_PF); 02089 LTDC_LAYER(hltdc, LayerIdx)->PFCR = (pLayerCfg->PixelFormat); 02090 02091 /* Configure the default color values */ 02092 tmp = ((uint32_t)(pLayerCfg->Backcolor.Green) << 8U); 02093 tmp1 = ((uint32_t)(pLayerCfg->Backcolor.Red) << 16U); 02094 tmp2 = (pLayerCfg->Alpha0 << 24U); 02095 LTDC_LAYER(hltdc, LayerIdx)->DCCR &= ~(LTDC_LxDCCR_DCBLUE | LTDC_LxDCCR_DCGREEN | LTDC_LxDCCR_DCRED | LTDC_LxDCCR_DCALPHA); 02096 LTDC_LAYER(hltdc, LayerIdx)->DCCR = (pLayerCfg->Backcolor.Blue | tmp | tmp1 | tmp2); 02097 02098 /* Specifies the constant alpha value */ 02099 LTDC_LAYER(hltdc, LayerIdx)->CACR &= ~(LTDC_LxCACR_CONSTA); 02100 LTDC_LAYER(hltdc, LayerIdx)->CACR = (pLayerCfg->Alpha); 02101 02102 /* Specifies the blending factors */ 02103 LTDC_LAYER(hltdc, LayerIdx)->BFCR &= ~(LTDC_LxBFCR_BF2 | LTDC_LxBFCR_BF1); 02104 LTDC_LAYER(hltdc, LayerIdx)->BFCR = (pLayerCfg->BlendingFactor1 | pLayerCfg->BlendingFactor2); 02105 02106 /* Configure the color frame buffer start address */ 02107 LTDC_LAYER(hltdc, LayerIdx)->CFBAR &= ~(LTDC_LxCFBAR_CFBADD); 02108 LTDC_LAYER(hltdc, LayerIdx)->CFBAR = (pLayerCfg->FBStartAdress); 02109 02110 if(pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888) 02111 { 02112 tmp = 4U; 02113 } 02114 else if (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_RGB888) 02115 { 02116 tmp = 3U; 02117 } 02118 else if((pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \ 02119 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \ 02120 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB1555) || \ 02121 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_AL88)) 02122 { 02123 tmp = 2U; 02124 } 02125 else 02126 { 02127 tmp = 1U; 02128 } 02129 02130 /* Configure the color frame buffer pitch in byte */ 02131 LTDC_LAYER(hltdc, LayerIdx)->CFBLR &= ~(LTDC_LxCFBLR_CFBLL | LTDC_LxCFBLR_CFBP); 02132 LTDC_LAYER(hltdc, LayerIdx)->CFBLR = (((pLayerCfg->ImageWidth * tmp) << 16U) | (((pLayerCfg->WindowX1 - pLayerCfg->WindowX0) * tmp) + 3U)); 02133 /* Configure the frame buffer line number */ 02134 LTDC_LAYER(hltdc, LayerIdx)->CFBLNR &= ~(LTDC_LxCFBLNR_CFBLNBR); 02135 LTDC_LAYER(hltdc, LayerIdx)->CFBLNR = (pLayerCfg->ImageHeight); 02136 02137 /* Enable LTDC_Layer by setting LEN bit */ 02138 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_LEN; 02139 } 02140 02141 /** 02142 * @} 02143 */ 02144 02145 02146 /** 02147 * @} 02148 */ 02149 02150 02151 /** 02152 * @} 02153 */ 02154 02155 #endif /* LTDC */ 02156 #endif /* HAL_LTDC_MODULE_ENABLED */ 02157 02158 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/