2 ******************************************************************************
\r
3 * @file stm32f7xx_hal_ltdc.c
\r
4 * @author MCD Application Team
\r
7 * @brief LTDC HAL module driver.
\r
8 * This file provides firmware functions to manage the following
\r
9 * functionalities of the LTDC peripheral:
\r
10 * + Initialization and de-initialization functions
\r
11 * + IO operation functions
\r
12 * + Peripheral Control functions
\r
13 * + Peripheral State and Errors functions
\r
16 ==============================================================================
\r
17 ##### How to use this driver #####
\r
18 ==============================================================================
\r
20 (#) Program the required configuration through the following parameters:
\r
21 the LTDC timing, the horizontal and vertical polarity,
\r
22 the pixel clock polarity, Data Enable polarity and the LTDC background color value
\r
23 using HAL_LTDC_Init() function
\r
25 (#) Program the required configuration through the following parameters:
\r
26 the pixel format, the blending factors, input alpha value, the window size
\r
27 and the image size using HAL_LTDC_ConfigLayer() function for foreground
\r
28 or/and background layer.
\r
30 (#) Optionally, configure and enable the CLUT using HAL_LTDC_ConfigCLUT() and
\r
31 HAL_LTDC_EnableCLUT functions.
\r
33 (#) Optionally, enable the Dither using HAL_LTDC_EnableDither().
\r
35 (#) Optionally, configure and enable the Color keying using HAL_LTDC_ConfigColorKeying()
\r
36 and HAL_LTDC_EnableColorKeying functions.
\r
38 (#) Optionally, configure LineInterrupt using HAL_LTDC_ProgramLineEvent()
\r
41 (#) If needed, reconfigure and change the pixel format value, the alpha value
\r
42 value, the window size, the window position and the layer start address
\r
43 for foreground or/and background layer using respectively the following
\r
44 functions: HAL_LTDC_SetPixelFormat(), HAL_LTDC_SetAlpha(), HAL_LTDC_SetWindowSize(),
\r
45 HAL_LTDC_SetWindowPosition(), HAL_LTDC_SetAddress.
\r
47 (#) To control LTDC state you can use the following function: HAL_LTDC_GetState()
\r
49 *** LTDC HAL driver macros list ***
\r
50 =============================================
\r
52 Below the list of most used macros in LTDC HAL driver.
\r
54 (+) __HAL_LTDC_ENABLE: Enable the LTDC.
\r
55 (+) __HAL_LTDC_DISABLE: Disable the LTDC.
\r
56 (+) __HAL_LTDC_LAYER_ENABLE: Enable the LTDC Layer.
\r
57 (+) __HAL_LTDC_LAYER_DISABLE: Disable the LTDC Layer.
\r
58 (+) __HAL_LTDC_RELOAD_CONFIG: Reload Layer Configuration.
\r
59 (+) __HAL_LTDC_GET_FLAG: Get the LTDC pending flags.
\r
60 (+) __HAL_LTDC_CLEAR_FLAG: Clear the LTDC pending flags.
\r
61 (+) __HAL_LTDC_ENABLE_IT: Enable the specified LTDC interrupts.
\r
62 (+) __HAL_LTDC_DISABLE_IT: Disable the specified LTDC interrupts.
\r
63 (+) __HAL_LTDC_GET_IT_SOURCE: Check whether the specified LTDC interrupt has occurred or not.
\r
66 (@) You can refer to the LTDC HAL driver header file for more useful macros
\r
69 ******************************************************************************
\r
72 * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
\r
74 * Redistribution and use in source and binary forms, with or without modification,
\r
75 * are permitted provided that the following conditions are met:
\r
76 * 1. Redistributions of source code must retain the above copyright notice,
\r
77 * this list of conditions and the following disclaimer.
\r
78 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
79 * this list of conditions and the following disclaimer in the documentation
\r
80 * and/or other materials provided with the distribution.
\r
81 * 3. Neither the name of STMicroelectronics nor the names of its contributors
\r
82 * may be used to endorse or promote products derived from this software
\r
83 * without specific prior written permission.
\r
85 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
\r
86 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
87 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
\r
88 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
\r
89 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
90 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
\r
91 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
\r
92 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
\r
93 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
\r
94 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
96 ******************************************************************************
\r
99 /* Includes ------------------------------------------------------------------*/
\r
100 #include "stm32f7xx_hal.h"
\r
102 /** @addtogroup STM32F7xx_HAL_Driver
\r
105 #if defined(STM32F756xx) || defined(STM32F746xx)
\r
107 /** @defgroup LTDC LTDC
\r
108 * @brief LTDC HAL module driver
\r
112 #ifdef HAL_LTDC_MODULE_ENABLED
\r
114 /* Private typedef -----------------------------------------------------------*/
\r
115 /* Private define ------------------------------------------------------------*/
\r
116 /* Private macro -------------------------------------------------------------*/
\r
117 /* Private variables ---------------------------------------------------------*/
\r
118 /* Private function prototypes -----------------------------------------------*/
\r
119 static void LTDC_SetConfig(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx);
\r
120 /* Private functions ---------------------------------------------------------*/
\r
122 /** @defgroup LTDC_Exported_Functions LTDC Exported Functions
\r
126 /** @defgroup LTDC_Exported_Functions_Group1 Initialization and Configuration functions
\r
127 * @brief Initialization and Configuration functions
\r
130 ===============================================================================
\r
131 ##### Initialization and Configuration functions #####
\r
132 ===============================================================================
\r
133 [..] This section provides functions allowing to:
\r
134 (+) Initialize and configure the LTDC
\r
135 (+) De-initialize the LTDC
\r
142 * @brief Initializes the LTDC according to the specified
\r
143 * parameters in the LTDC_InitTypeDef and create the associated handle.
\r
144 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
145 * the configuration information for the LTDC.
\r
146 * @retval HAL status
\r
148 HAL_StatusTypeDef HAL_LTDC_Init(LTDC_HandleTypeDef *hltdc)
\r
150 uint32_t tmp = 0, tmp1 = 0;
\r
152 /* Check the LTDC peripheral state */
\r
158 /* Check function parameters */
\r
159 assert_param(IS_LTDC_ALL_INSTANCE(hltdc->Instance));
\r
160 assert_param(IS_LTDC_HSYNC(hltdc->Init.HorizontalSync));
\r
161 assert_param(IS_LTDC_VSYNC(hltdc->Init.VerticalSync));
\r
162 assert_param(IS_LTDC_AHBP(hltdc->Init.AccumulatedHBP));
\r
163 assert_param(IS_LTDC_AVBP(hltdc->Init.AccumulatedVBP));
\r
164 assert_param(IS_LTDC_AAH(hltdc->Init.AccumulatedActiveH));
\r
165 assert_param(IS_LTDC_AAW(hltdc->Init.AccumulatedActiveW));
\r
166 assert_param(IS_LTDC_TOTALH(hltdc->Init.TotalHeigh));
\r
167 assert_param(IS_LTDC_TOTALW(hltdc->Init.TotalWidth));
\r
168 assert_param(IS_LTDC_HSPOL(hltdc->Init.HSPolarity));
\r
169 assert_param(IS_LTDC_VSPOL(hltdc->Init.VSPolarity));
\r
170 assert_param(IS_LTDC_DEPOL(hltdc->Init.DEPolarity));
\r
171 assert_param(IS_LTDC_PCPOL(hltdc->Init.PCPolarity));
\r
173 if(hltdc->State == HAL_LTDC_STATE_RESET)
\r
175 /* Allocate lock resource and initialize it */
\r
176 hltdc->Lock = HAL_UNLOCKED;
\r
177 /* Init the low level hardware */
\r
178 HAL_LTDC_MspInit(hltdc);
\r
181 /* Change LTDC peripheral state */
\r
182 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
184 /* Configures the HS, VS, DE and PC polarity */
\r
185 hltdc->Instance->GCR &= ~(LTDC_GCR_HSPOL | LTDC_GCR_VSPOL | LTDC_GCR_DEPOL | LTDC_GCR_PCPOL);
\r
186 hltdc->Instance->GCR |= (uint32_t)(hltdc->Init.HSPolarity | hltdc->Init.VSPolarity | \
\r
187 hltdc->Init.DEPolarity | hltdc->Init.PCPolarity);
\r
189 /* Sets Synchronization size */
\r
190 hltdc->Instance->SSCR &= ~(LTDC_SSCR_VSH | LTDC_SSCR_HSW);
\r
191 tmp = (hltdc->Init.HorizontalSync << 16);
\r
192 hltdc->Instance->SSCR |= (tmp | hltdc->Init.VerticalSync);
\r
194 /* Sets Accumulated Back porch */
\r
195 hltdc->Instance->BPCR &= ~(LTDC_BPCR_AVBP | LTDC_BPCR_AHBP);
\r
196 tmp = (hltdc->Init.AccumulatedHBP << 16);
\r
197 hltdc->Instance->BPCR |= (tmp | hltdc->Init.AccumulatedVBP);
\r
199 /* Sets Accumulated Active Width */
\r
200 hltdc->Instance->AWCR &= ~(LTDC_AWCR_AAH | LTDC_AWCR_AAW);
\r
201 tmp = (hltdc->Init.AccumulatedActiveW << 16);
\r
202 hltdc->Instance->AWCR |= (tmp | hltdc->Init.AccumulatedActiveH);
\r
204 /* Sets Total Width */
\r
205 hltdc->Instance->TWCR &= ~(LTDC_TWCR_TOTALH | LTDC_TWCR_TOTALW);
\r
206 tmp = (hltdc->Init.TotalWidth << 16);
\r
207 hltdc->Instance->TWCR |= (tmp | hltdc->Init.TotalHeigh);
\r
209 /* Sets the background color value */
\r
210 tmp = ((uint32_t)(hltdc->Init.Backcolor.Green) << 8);
\r
211 tmp1 = ((uint32_t)(hltdc->Init.Backcolor.Red) << 16);
\r
212 hltdc->Instance->BCCR &= ~(LTDC_BCCR_BCBLUE | LTDC_BCCR_BCGREEN | LTDC_BCCR_BCRED);
\r
213 hltdc->Instance->BCCR |= (tmp1 | tmp | hltdc->Init.Backcolor.Blue);
\r
215 /* Enable the transfer Error interrupt */
\r
216 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_TE);
\r
218 /* Enable the FIFO underrun interrupt */
\r
219 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_FU);
\r
221 /* Enable LTDC by setting LTDCEN bit */
\r
222 __HAL_LTDC_ENABLE(hltdc);
\r
224 /* Initialize the error code */
\r
225 hltdc->ErrorCode = HAL_LTDC_ERROR_NONE;
\r
227 /* Initialize the LTDC state*/
\r
228 hltdc->State = HAL_LTDC_STATE_READY;
\r
234 * @brief Deinitializes the LTDC peripheral registers to their default reset
\r
236 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
237 * the configuration information for the LTDC.
\r
241 HAL_StatusTypeDef HAL_LTDC_DeInit(LTDC_HandleTypeDef *hltdc)
\r
243 /* DeInit the low level hardware */
\r
244 HAL_LTDC_MspDeInit(hltdc);
\r
246 /* Initialize the error code */
\r
247 hltdc->ErrorCode = HAL_LTDC_ERROR_NONE;
\r
249 /* Initialize the LTDC state*/
\r
250 hltdc->State = HAL_LTDC_STATE_RESET;
\r
253 __HAL_UNLOCK(hltdc);
\r
259 * @brief Initializes the LTDC MSP.
\r
260 * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains
\r
261 * the configuration information for the LTDC.
\r
264 __weak void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)
\r
266 /* NOTE : This function Should not be modified, when the callback is needed,
\r
267 the HAL_LTDC_MspInit could be implemented in the user file
\r
272 * @brief DeInitializes the LTDC MSP.
\r
273 * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains
\r
274 * the configuration information for the LTDC.
\r
277 __weak void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* hltdc)
\r
279 /* NOTE : This function Should not be modified, when the callback is needed,
\r
280 the HAL_LTDC_MspDeInit could be implemented in the user file
\r
288 /** @defgroup LTDC_Exported_Functions_Group2 IO operation functions
\r
289 * @brief IO operation functions
\r
292 ===============================================================================
\r
293 ##### IO operation functions #####
\r
294 ===============================================================================
\r
295 [..] This section provides function allowing to:
\r
296 (+) Handle LTDC interrupt request
\r
302 * @brief Handles LTDC interrupt request.
\r
303 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
304 * the configuration information for the LTDC.
\r
305 * @retval HAL status
\r
307 void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef *hltdc)
\r
309 /* Transfer Error Interrupt management ***************************************/
\r
310 if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_TE) != RESET)
\r
312 if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_TE) != RESET)
\r
314 /* Disable the transfer Error interrupt */
\r
315 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_TE);
\r
317 /* Clear the transfer error flag */
\r
318 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_TE);
\r
320 /* Update error code */
\r
321 hltdc->ErrorCode |= HAL_LTDC_ERROR_TE;
\r
323 /* Change LTDC state */
\r
324 hltdc->State = HAL_LTDC_STATE_ERROR;
\r
326 /* Process unlocked */
\r
327 __HAL_UNLOCK(hltdc);
\r
329 /* Transfer error Callback */
\r
330 HAL_LTDC_ErrorCallback(hltdc);
\r
333 /* FIFO underrun Interrupt management ***************************************/
\r
334 if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_FU) != RESET)
\r
336 if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_FU) != RESET)
\r
338 /* Disable the FIFO underrun interrupt */
\r
339 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_FU);
\r
341 /* Clear the FIFO underrun flag */
\r
342 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_FU);
\r
344 /* Update error code */
\r
345 hltdc->ErrorCode |= HAL_LTDC_ERROR_FU;
\r
347 /* Change LTDC state */
\r
348 hltdc->State = HAL_LTDC_STATE_ERROR;
\r
350 /* Process unlocked */
\r
351 __HAL_UNLOCK(hltdc);
\r
353 /* Transfer error Callback */
\r
354 HAL_LTDC_ErrorCallback(hltdc);
\r
357 /* Line Interrupt management ************************************************/
\r
358 if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_LI) != RESET)
\r
360 if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_LI) != RESET)
\r
362 /* Disable the Line interrupt */
\r
363 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_LI);
\r
365 /* Clear the Line interrupt flag */
\r
366 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_LI);
\r
368 /* Change LTDC state */
\r
369 hltdc->State = HAL_LTDC_STATE_READY;
\r
371 /* Process unlocked */
\r
372 __HAL_UNLOCK(hltdc);
\r
374 /* Line interrupt Callback */
\r
375 HAL_LTDC_LineEvenCallback(hltdc);
\r
381 * @brief Error LTDC callback.
\r
382 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
383 * the configuration information for the LTDC.
\r
386 __weak void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc)
\r
388 /* NOTE : This function Should not be modified, when the callback is needed,
\r
389 the HAL_LTDC_ErrorCallback could be implemented in the user file
\r
394 * @brief Line Event callback.
\r
395 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
396 * the configuration information for the LTDC.
\r
399 __weak void HAL_LTDC_LineEvenCallback(LTDC_HandleTypeDef *hltdc)
\r
401 /* NOTE : This function Should not be modified, when the callback is needed,
\r
402 the HAL_LTDC_LineEvenCallback could be implemented in the user file
\r
410 /** @defgroup LTDC_Exported_Functions_Group3 Peripheral Control functions
\r
411 * @brief Peripheral Control functions
\r
414 ===============================================================================
\r
415 ##### Peripheral Control functions #####
\r
416 ===============================================================================
\r
417 [..] This section provides functions allowing to:
\r
418 (+) Configure the LTDC foreground or/and background parameters.
\r
419 (+) Set the active layer.
\r
420 (+) Configure the color keying.
\r
421 (+) Configure the C-LUT.
\r
422 (+) Enable / Disable the color keying.
\r
423 (+) Enable / Disable the C-LUT.
\r
424 (+) Update the layer position.
\r
425 (+) Update the layer size.
\r
426 (+) Update pixel format on the fly.
\r
427 (+) Update transparency on the fly.
\r
428 (+) Update address on the fly.
\r
435 * @brief Configure the LTDC Layer according to the specified
\r
436 * parameters in the LTDC_InitTypeDef and create the associated handle.
\r
437 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
438 * the configuration information for the LTDC.
\r
439 * @param pLayerCfg: pointer to a LTDC_LayerCfgTypeDef structure that contains
\r
440 * the configuration information for the Layer.
\r
441 * @param LayerIdx: LTDC Layer index.
\r
442 * This parameter can be one of the following values:
\r
444 * @retval HAL status
\r
446 HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx)
\r
448 /* Process locked */
\r
451 /* Change LTDC peripheral state */
\r
452 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
454 /* Check the parameters */
\r
455 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
456 assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg->PixelFormat));
\r
457 assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg->BlendingFactor1));
\r
458 assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg->BlendingFactor2));
\r
459 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
\r
460 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
\r
461 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
\r
462 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
\r
463 assert_param(IS_LTDC_ALPHA(pLayerCfg->Alpha0));
\r
464 assert_param(IS_LTDC_CFBLL(pLayerCfg->ImageWidth));
\r
465 assert_param(IS_LTDC_CFBLNBR(pLayerCfg->ImageHeight));
\r
467 /* Copy new layer configuration into handle structure */
\r
468 hltdc->LayerCfg[LayerIdx] = *pLayerCfg;
\r
470 /* Configure the LTDC Layer */
\r
471 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
\r
473 /* Sets the Reload type */
\r
474 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
476 /* Initialize the LTDC state*/
\r
477 hltdc->State = HAL_LTDC_STATE_READY;
\r
479 /* Process unlocked */
\r
480 __HAL_UNLOCK(hltdc);
\r
486 * @brief Configure the color keying.
\r
487 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
488 * the configuration information for the LTDC.
\r
489 * @param RGBValue: the color key value
\r
490 * @param LayerIdx: LTDC Layer index.
\r
491 * This parameter can be one of the following values:
\r
493 * @retval HAL status
\r
495 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx)
\r
497 /* Process locked */
\r
500 /* Change LTDC peripheral state */
\r
501 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
503 /* Check the parameters */
\r
504 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
506 /* Configures the default color values */
\r
507 LTDC_LAYER(hltdc, LayerIdx)->CKCR &= ~(LTDC_LxCKCR_CKBLUE | LTDC_LxCKCR_CKGREEN | LTDC_LxCKCR_CKRED);
\r
508 LTDC_LAYER(hltdc, LayerIdx)->CKCR = RGBValue;
\r
510 /* Sets the Reload type */
\r
511 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
513 /* Change the LTDC state*/
\r
514 hltdc->State = HAL_LTDC_STATE_READY;
\r
516 /* Process unlocked */
\r
517 __HAL_UNLOCK(hltdc);
\r
523 * @brief Load the color lookup table.
\r
524 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
525 * the configuration information for the LTDC.
\r
526 * @param pCLUT: pointer to the color lookup table address.
\r
527 * @param CLUTSize: the color lookup table size.
\r
528 * @param LayerIdx: LTDC Layer index.
\r
529 * This parameter can be one of the following values:
\r
531 * @retval HAL status
\r
533 HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx)
\r
536 uint32_t counter = 0;
\r
537 uint32_t pcounter = 0;
\r
539 /* Process locked */
\r
542 /* Change LTDC peripheral state */
\r
543 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
545 /* Check the parameters */
\r
546 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
548 for(counter = 0; (counter < CLUTSize); counter++)
\r
550 if(hltdc->LayerCfg[LayerIdx].PixelFormat == LTDC_PIXEL_FORMAT_AL44)
\r
552 tmp = (((counter + 16*counter) << 24) | ((uint32_t)(*pCLUT) & 0xFF) | ((uint32_t)(*pCLUT) & 0xFF00) | ((uint32_t)(*pCLUT) & 0xFF0000));
\r
556 tmp = ((counter << 24) | ((uint32_t)(*pCLUT) & 0xFF) | ((uint32_t)(*pCLUT) & 0xFF00) | ((uint32_t)(*pCLUT) & 0xFF0000));
\r
558 pcounter = (uint32_t)pCLUT + sizeof(*pCLUT);
\r
559 pCLUT = (uint32_t *)pcounter;
\r
561 /* Specifies the C-LUT address and RGB value */
\r
562 LTDC_LAYER(hltdc, LayerIdx)->CLUTWR = tmp;
\r
565 /* Change the LTDC state*/
\r
566 hltdc->State = HAL_LTDC_STATE_READY;
\r
568 /* Process unlocked */
\r
569 __HAL_UNLOCK(hltdc);
\r
575 * @brief Enable the color keying.
\r
576 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
577 * the configuration information for the LTDC.
\r
578 * @param LayerIdx: LTDC Layer index.
\r
579 * This parameter can be one of the following values:
\r
581 * @retval HAL status
\r
583 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
\r
585 /* Process locked */
\r
588 /* Change LTDC peripheral state */
\r
589 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
591 /* Check the parameters */
\r
592 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
594 /* Enable LTDC color keying by setting COLKEN bit */
\r
595 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_COLKEN;
\r
597 /* Sets the Reload type */
\r
598 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
600 /* Change the LTDC state*/
\r
601 hltdc->State = HAL_LTDC_STATE_READY;
\r
603 /* Process unlocked */
\r
604 __HAL_UNLOCK(hltdc);
\r
610 * @brief Disable the color keying.
\r
611 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
612 * the configuration information for the LTDC.
\r
613 * @param LayerIdx: LTDC Layer index.
\r
614 * This parameter can be one of the following values:
\r
616 * @retval HAL status
\r
618 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
\r
620 /* Process locked */
\r
623 /* Change LTDC peripheral state */
\r
624 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
626 /* Check the parameters */
\r
627 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
629 /* Disable LTDC color keying by setting COLKEN bit */
\r
630 LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_COLKEN;
\r
632 /* Sets the Reload type */
\r
633 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
635 /* Change the LTDC state*/
\r
636 hltdc->State = HAL_LTDC_STATE_READY;
\r
638 /* Process unlocked */
\r
639 __HAL_UNLOCK(hltdc);
\r
645 * @brief Enable the color lookup table.
\r
646 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
647 * the configuration information for the LTDC.
\r
648 * @param LayerIdx: LTDC Layer index.
\r
649 * This parameter can be one of the following values:
\r
651 * @retval HAL status
\r
653 HAL_StatusTypeDef HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
\r
656 /* Process locked */
\r
659 /* Change LTDC peripheral state */
\r
660 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
662 /* Check the parameters */
\r
663 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
665 /* Disable LTDC color lookup table by setting CLUTEN bit */
\r
666 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_CLUTEN;
\r
668 /* Sets the Reload type */
\r
669 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
671 /* Change the LTDC state*/
\r
672 hltdc->State = HAL_LTDC_STATE_READY;
\r
674 /* Process unlocked */
\r
675 __HAL_UNLOCK(hltdc);
\r
681 * @brief Disable the color lookup table.
\r
682 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
683 * the configuration information for the LTDC.
\r
684 * @param LayerIdx: LTDC Layer index.
\r
685 * This parameter can be one of the following values:
\r
687 * @retval HAL status
\r
689 HAL_StatusTypeDef HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
\r
692 /* Process locked */
\r
695 /* Change LTDC peripheral state */
\r
696 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
698 /* Check the parameters */
\r
699 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
701 /* Disable LTDC color lookup table by setting CLUTEN bit */
\r
702 LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_CLUTEN;
\r
704 /* Sets the Reload type */
\r
705 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
707 /* Change the LTDC state*/
\r
708 hltdc->State = HAL_LTDC_STATE_READY;
\r
710 /* Process unlocked */
\r
711 __HAL_UNLOCK(hltdc);
\r
717 * @brief Enables Dither.
\r
718 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
719 * the configuration information for the LTDC.
\r
720 * @retval HAL status
\r
723 HAL_StatusTypeDef HAL_LTDC_EnableDither(LTDC_HandleTypeDef *hltdc)
\r
725 /* Process locked */
\r
728 /* Change LTDC peripheral state */
\r
729 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
731 /* Enable Dither by setting DTEN bit */
\r
732 LTDC->GCR |= (uint32_t)LTDC_GCR_DTEN;
\r
734 /* Change the LTDC state*/
\r
735 hltdc->State = HAL_LTDC_STATE_READY;
\r
737 /* Process unlocked */
\r
738 __HAL_UNLOCK(hltdc);
\r
744 * @brief Disables Dither.
\r
745 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
746 * the configuration information for the LTDC.
\r
747 * @retval HAL status
\r
750 HAL_StatusTypeDef HAL_LTDC_DisableDither(LTDC_HandleTypeDef *hltdc)
\r
752 /* Process locked */
\r
755 /* Change LTDC peripheral state */
\r
756 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
758 /* Disable Dither by setting DTEN bit */
\r
759 LTDC->GCR &= ~(uint32_t)LTDC_GCR_DTEN;
\r
761 /* Change the LTDC state*/
\r
762 hltdc->State = HAL_LTDC_STATE_READY;
\r
764 /* Process unlocked */
\r
765 __HAL_UNLOCK(hltdc);
\r
771 * @brief Set the LTDC window size.
\r
772 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
773 * the configuration information for the LTDC.
\r
774 * @param XSize: LTDC Pixel per line
\r
775 * @param YSize: LTDC Line number
\r
776 * @param LayerIdx: LTDC Layer index.
\r
777 * This parameter can be one of the following values:
\r
779 * @retval HAL status
\r
781 HAL_StatusTypeDef HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx)
\r
783 LTDC_LayerCfgTypeDef *pLayerCfg;
\r
785 /* Process locked */
\r
788 /* Change LTDC peripheral state */
\r
789 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
791 /* Get layer configuration from handle structure */
\r
792 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
\r
794 /* Check the parameters (Layers parameters)*/
\r
795 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
796 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
\r
797 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
\r
798 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
\r
799 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
\r
800 assert_param(IS_LTDC_CFBLL(XSize));
\r
801 assert_param(IS_LTDC_CFBLNBR(YSize));
\r
803 /* update horizontal start/stop */
\r
804 pLayerCfg->WindowX0 = 0;
\r
805 pLayerCfg->WindowX1 = XSize + pLayerCfg->WindowX0;
\r
807 /* update vertical start/stop */
\r
808 pLayerCfg->WindowY0 = 0;
\r
809 pLayerCfg->WindowY1 = YSize + pLayerCfg->WindowY0;
\r
811 /* Reconfigures the color frame buffer pitch in byte */
\r
812 pLayerCfg->ImageWidth = XSize;
\r
814 /* Reconfigures the frame buffer line number */
\r
815 pLayerCfg->ImageHeight = YSize;
\r
817 /* Set LTDC parameters */
\r
818 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
\r
820 /* Sets the Reload type */
\r
821 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
823 /* Change the LTDC state*/
\r
824 hltdc->State = HAL_LTDC_STATE_READY;
\r
826 /* Process unlocked */
\r
827 __HAL_UNLOCK(hltdc);
\r
833 * @brief Set the LTDC window position.
\r
834 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
835 * the configuration information for the LTDC.
\r
836 * @param X0: LTDC window X offset
\r
837 * @param Y0: LTDC window Y offset
\r
838 * @param LayerIdx: LTDC Layer index.
\r
839 * This parameter can be one of the following values:
\r
841 * @retval HAL status
\r
843 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx)
\r
845 LTDC_LayerCfgTypeDef *pLayerCfg;
\r
847 /* Process locked */
\r
850 /* Change LTDC peripheral state */
\r
851 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
853 /* Get layer configuration from handle structure */
\r
854 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
\r
856 /* Check the parameters */
\r
857 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
858 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
\r
859 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
\r
860 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
\r
861 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
\r
863 /* update horizontal start/stop */
\r
864 pLayerCfg->WindowX0 = X0;
\r
865 pLayerCfg->WindowX1 = X0 + pLayerCfg->ImageWidth;
\r
867 /* update vertical start/stop */
\r
868 pLayerCfg->WindowY0 = Y0;
\r
869 pLayerCfg->WindowY1 = Y0 + pLayerCfg->ImageHeight;
\r
871 /* Set LTDC parameters */
\r
872 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
\r
874 /* Sets the Reload type */
\r
875 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
877 /* Change the LTDC state*/
\r
878 hltdc->State = HAL_LTDC_STATE_READY;
\r
880 /* Process unlocked */
\r
881 __HAL_UNLOCK(hltdc);
\r
887 * @brief Reconfigure the pixel format.
\r
888 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
889 * the configuration information for the LTDC.
\r
890 * @param Pixelformat: new pixel format value.
\r
891 * @param LayerIdx: LTDC Layer index.
\r
892 * This parameter can be one of the following values:
\r
894 * @retval HAL status
\r
896 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx)
\r
898 LTDC_LayerCfgTypeDef *pLayerCfg;
\r
900 /* Process locked */
\r
903 /* Change LTDC peripheral state */
\r
904 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
906 /* Check the parameters */
\r
907 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
908 assert_param(IS_LTDC_PIXEL_FORMAT(Pixelformat));
\r
910 /* Get layer configuration from handle structure */
\r
911 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
\r
913 /* Reconfigure the pixel format */
\r
914 pLayerCfg->PixelFormat = Pixelformat;
\r
916 /* Set LTDC parameters */
\r
917 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
\r
919 /* Sets the Reload type */
\r
920 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
922 /* Change the LTDC state*/
\r
923 hltdc->State = HAL_LTDC_STATE_READY;
\r
925 /* Process unlocked */
\r
926 __HAL_UNLOCK(hltdc);
\r
932 * @brief Reconfigure the layer alpha value.
\r
933 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
934 * the configuration information for the LTDC.
\r
935 * @param Alpha: new alpha value.
\r
936 * @param LayerIdx: LTDC Layer index.
\r
937 * This parameter can be one of the following values:
\r
939 * @retval HAL status
\r
941 HAL_StatusTypeDef HAL_LTDC_SetAlpha(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx)
\r
943 LTDC_LayerCfgTypeDef *pLayerCfg;
\r
945 /* Process locked */
\r
948 /* Change LTDC peripheral state */
\r
949 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
951 /* Check the parameters */
\r
952 assert_param(IS_LTDC_ALPHA(Alpha));
\r
953 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
955 /* Get layer configuration from handle structure */
\r
956 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
\r
958 /* Reconfigure the Alpha value */
\r
959 pLayerCfg->Alpha = Alpha;
\r
961 /* Set LTDC parameters */
\r
962 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
\r
964 /* Sets the Reload type */
\r
965 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
967 /* Change the LTDC state*/
\r
968 hltdc->State = HAL_LTDC_STATE_READY;
\r
970 /* Process unlocked */
\r
971 __HAL_UNLOCK(hltdc);
\r
976 * @brief Reconfigure the frame buffer Address.
\r
977 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
978 * the configuration information for the LTDC.
\r
979 * @param Address: new address value.
\r
980 * @param LayerIdx: LTDC Layer index.
\r
981 * This parameter can be one of the following values:
\r
983 * @retval HAL status
\r
985 HAL_StatusTypeDef HAL_LTDC_SetAddress(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx)
\r
987 LTDC_LayerCfgTypeDef *pLayerCfg;
\r
989 /* Process locked */
\r
992 /* Change LTDC peripheral state */
\r
993 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
995 /* Check the parameters */
\r
996 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
998 /* Get layer configuration from handle structure */
\r
999 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
\r
1001 /* Reconfigure the Address */
\r
1002 pLayerCfg->FBStartAdress = Address;
\r
1004 /* Set LTDC parameters */
\r
1005 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
\r
1007 /* Sets the Reload type */
\r
1008 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
1010 /* Change the LTDC state*/
\r
1011 hltdc->State = HAL_LTDC_STATE_READY;
\r
1013 /* Process unlocked */
\r
1014 __HAL_UNLOCK(hltdc);
\r
1020 * @brief Define the position of the line interrupt .
\r
1021 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
1022 * the configuration information for the LTDC.
\r
1023 * @param Line: Line Interrupt Position.
\r
1024 * @retval HAL status
\r
1026 HAL_StatusTypeDef HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef *hltdc, uint32_t Line)
\r
1028 /* Process locked */
\r
1029 __HAL_LOCK(hltdc);
\r
1031 /* Change LTDC peripheral state */
\r
1032 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
1034 /* Check the parameters */
\r
1035 assert_param(IS_LTDC_LIPOS(Line));
\r
1037 /* Enable the Line interrupt */
\r
1038 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_LI);
\r
1040 /* Sets the Line Interrupt position */
\r
1041 LTDC->LIPCR = (uint32_t)Line;
\r
1043 /* Change the LTDC state*/
\r
1044 hltdc->State = HAL_LTDC_STATE_READY;
\r
1046 /* Process unlocked */
\r
1047 __HAL_UNLOCK(hltdc);
\r
1056 /** @defgroup LTDC_Exported_Functions_Group4 Peripheral State and Errors functions
\r
1057 * @brief Peripheral State and Errors functions
\r
1060 ===============================================================================
\r
1061 ##### Peripheral State and Errors functions #####
\r
1062 ===============================================================================
\r
1064 This subsection provides functions allowing to
\r
1065 (+) Check the LTDC state.
\r
1066 (+) Get error code.
\r
1073 * @brief Return the LTDC state
\r
1074 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
1075 * the configuration information for the LTDC.
\r
1076 * @retval HAL state
\r
1078 HAL_LTDC_StateTypeDef HAL_LTDC_GetState(LTDC_HandleTypeDef *hltdc)
\r
1080 return hltdc->State;
\r
1084 * @brief Return the LTDC error code
\r
1085 * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains
\r
1086 * the configuration information for the LTDC.
\r
1087 * @retval LTDC Error Code
\r
1089 uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc)
\r
1091 return hltdc->ErrorCode;
\r
1099 * @brief Configures the LTDC peripheral
\r
1100 * @param hltdc : Pointer to a LTDC_HandleTypeDef structure that contains
\r
1101 * the configuration information for the LTDC.
\r
1102 * @param pLayerCfg: Pointer LTDC Layer Configuration structure
\r
1103 * @param LayerIdx: LTDC Layer index.
\r
1104 * This parameter can be one of the following values: 0 or 1
\r
1107 static void LTDC_SetConfig(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx)
\r
1110 uint32_t tmp1 = 0;
\r
1111 uint32_t tmp2 = 0;
\r
1113 /* Configures the horizontal start and stop position */
\r
1114 tmp = ((pLayerCfg->WindowX1 + ((hltdc->Instance->BPCR & LTDC_BPCR_AHBP) >> 16)) << 16);
\r
1115 LTDC_LAYER(hltdc, LayerIdx)->WHPCR &= ~(LTDC_LxWHPCR_WHSTPOS | LTDC_LxWHPCR_WHSPPOS);
\r
1116 LTDC_LAYER(hltdc, LayerIdx)->WHPCR = ((pLayerCfg->WindowX0 + ((hltdc->Instance->BPCR & LTDC_BPCR_AHBP) >> 16) + 1) | tmp);
\r
1118 /* Configures the vertical start and stop position */
\r
1119 tmp = ((pLayerCfg->WindowY1 + (hltdc->Instance->BPCR & LTDC_BPCR_AVBP)) << 16);
\r
1120 LTDC_LAYER(hltdc, LayerIdx)->WVPCR &= ~(LTDC_LxWVPCR_WVSTPOS | LTDC_LxWVPCR_WVSPPOS);
\r
1121 LTDC_LAYER(hltdc, LayerIdx)->WVPCR = ((pLayerCfg->WindowY0 + (hltdc->Instance->BPCR & LTDC_BPCR_AVBP) + 1) | tmp);
\r
1123 /* Specifies the pixel format */
\r
1124 LTDC_LAYER(hltdc, LayerIdx)->PFCR &= ~(LTDC_LxPFCR_PF);
\r
1125 LTDC_LAYER(hltdc, LayerIdx)->PFCR = (pLayerCfg->PixelFormat);
\r
1127 /* Configures the default color values */
\r
1128 tmp = ((uint32_t)(pLayerCfg->Backcolor.Green) << 8);
\r
1129 tmp1 = ((uint32_t)(pLayerCfg->Backcolor.Red) << 16);
\r
1130 tmp2 = (pLayerCfg->Alpha0 << 24);
\r
1131 LTDC_LAYER(hltdc, LayerIdx)->DCCR &= ~(LTDC_LxDCCR_DCBLUE | LTDC_LxDCCR_DCGREEN | LTDC_LxDCCR_DCRED | LTDC_LxDCCR_DCALPHA);
\r
1132 LTDC_LAYER(hltdc, LayerIdx)->DCCR = (pLayerCfg->Backcolor.Blue | tmp | tmp1 | tmp2);
\r
1134 /* Specifies the constant alpha value */
\r
1135 LTDC_LAYER(hltdc, LayerIdx)->CACR &= ~(LTDC_LxCACR_CONSTA);
\r
1136 LTDC_LAYER(hltdc, LayerIdx)->CACR = (pLayerCfg->Alpha);
\r
1138 /* Specifies the blending factors */
\r
1139 LTDC_LAYER(hltdc, LayerIdx)->BFCR &= ~(LTDC_LxBFCR_BF2 | LTDC_LxBFCR_BF1);
\r
1140 LTDC_LAYER(hltdc, LayerIdx)->BFCR = (pLayerCfg->BlendingFactor1 | pLayerCfg->BlendingFactor2);
\r
1142 /* Configures the color frame buffer start address */
\r
1143 LTDC_LAYER(hltdc, LayerIdx)->CFBAR &= ~(LTDC_LxCFBAR_CFBADD);
\r
1144 LTDC_LAYER(hltdc, LayerIdx)->CFBAR = (pLayerCfg->FBStartAdress);
\r
1146 if(pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888)
\r
1150 else if (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_RGB888)
\r
1154 else if((pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \
\r
1155 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \
\r
1156 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB1555) || \
\r
1157 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_AL88))
\r
1166 /* Configures the color frame buffer pitch in byte */
\r
1167 LTDC_LAYER(hltdc, LayerIdx)->CFBLR &= ~(LTDC_LxCFBLR_CFBLL | LTDC_LxCFBLR_CFBP);
\r
1168 LTDC_LAYER(hltdc, LayerIdx)->CFBLR = (((pLayerCfg->ImageWidth * tmp) << 16) | (((pLayerCfg->WindowX1 - pLayerCfg->WindowX0) * tmp) + 3));
\r
1170 /* Configures the frame buffer line number */
\r
1171 LTDC_LAYER(hltdc, LayerIdx)->CFBLNR &= ~(LTDC_LxCFBLNR_CFBLNBR);
\r
1172 LTDC_LAYER(hltdc, LayerIdx)->CFBLNR = (pLayerCfg->ImageHeight);
\r
1174 /* Enable LTDC_Layer by setting LEN bit */
\r
1175 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_LEN;
\r
1182 #endif /* HAL_LTDC_MODULE_ENABLED */
\r
1187 #endif /* STM32F756xx || STM32F746xx */
\r
1193 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r