2 ******************************************************************************
\r
3 * @file stm32f7xx_hal_ltdc.c
\r
4 * @author MCD Application Team
\r
6 * @date 24-March-2015
\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 /** @defgroup LTDC LTDC
\r
106 * @brief LTDC HAL module driver
\r
110 #ifdef HAL_LTDC_MODULE_ENABLED
\r
112 /* Private typedef -----------------------------------------------------------*/
\r
113 /* Private define ------------------------------------------------------------*/
\r
114 /* Private macro -------------------------------------------------------------*/
\r
115 /* Private variables ---------------------------------------------------------*/
\r
116 /* Private function prototypes -----------------------------------------------*/
\r
117 static void LTDC_SetConfig(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx);
\r
118 /* Private functions ---------------------------------------------------------*/
\r
120 /** @defgroup LTDC_Exported_Functions LTDC Exported Functions
\r
124 /** @defgroup LTDC_Exported_Functions_Group1 Initialization and Configuration functions
\r
125 * @brief Initialization and Configuration functions
\r
128 ===============================================================================
\r
129 ##### Initialization and Configuration functions #####
\r
130 ===============================================================================
\r
131 [..] This section provides functions allowing to:
\r
132 (+) Initialize and configure the LTDC
\r
133 (+) De-initialize the LTDC
\r
140 * @brief Initializes the LTDC according to the specified
\r
141 * parameters in the LTDC_InitTypeDef and create the associated handle.
\r
142 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
143 * the configuration information for the LTDC.
\r
144 * @retval HAL status
\r
146 HAL_StatusTypeDef HAL_LTDC_Init(LTDC_HandleTypeDef *hltdc)
\r
148 uint32_t tmp = 0, tmp1 = 0;
\r
150 /* Check the LTDC peripheral state */
\r
156 /* Check function parameters */
\r
157 assert_param(IS_LTDC_ALL_INSTANCE(hltdc->Instance));
\r
158 assert_param(IS_LTDC_HSYNC(hltdc->Init.HorizontalSync));
\r
159 assert_param(IS_LTDC_VSYNC(hltdc->Init.VerticalSync));
\r
160 assert_param(IS_LTDC_AHBP(hltdc->Init.AccumulatedHBP));
\r
161 assert_param(IS_LTDC_AVBP(hltdc->Init.AccumulatedVBP));
\r
162 assert_param(IS_LTDC_AAH(hltdc->Init.AccumulatedActiveH));
\r
163 assert_param(IS_LTDC_AAW(hltdc->Init.AccumulatedActiveW));
\r
164 assert_param(IS_LTDC_TOTALH(hltdc->Init.TotalHeigh));
\r
165 assert_param(IS_LTDC_TOTALW(hltdc->Init.TotalWidth));
\r
166 assert_param(IS_LTDC_HSPOL(hltdc->Init.HSPolarity));
\r
167 assert_param(IS_LTDC_VSPOL(hltdc->Init.VSPolarity));
\r
168 assert_param(IS_LTDC_DEPOL(hltdc->Init.DEPolarity));
\r
169 assert_param(IS_LTDC_PCPOL(hltdc->Init.PCPolarity));
\r
171 if(hltdc->State == HAL_LTDC_STATE_RESET)
\r
173 /* Init the low level hardware */
\r
174 HAL_LTDC_MspInit(hltdc);
\r
177 /* Change LTDC peripheral state */
\r
178 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
180 /* Configures the HS, VS, DE and PC polarity */
\r
181 hltdc->Instance->GCR &= ~(LTDC_GCR_HSPOL | LTDC_GCR_VSPOL | LTDC_GCR_DEPOL | LTDC_GCR_PCPOL);
\r
182 hltdc->Instance->GCR |= (uint32_t)(hltdc->Init.HSPolarity | hltdc->Init.VSPolarity | \
\r
183 hltdc->Init.DEPolarity | hltdc->Init.PCPolarity);
\r
185 /* Sets Synchronization size */
\r
186 hltdc->Instance->SSCR &= ~(LTDC_SSCR_VSH | LTDC_SSCR_HSW);
\r
187 tmp = (hltdc->Init.HorizontalSync << 16);
\r
188 hltdc->Instance->SSCR |= (tmp | hltdc->Init.VerticalSync);
\r
190 /* Sets Accumulated Back porch */
\r
191 hltdc->Instance->BPCR &= ~(LTDC_BPCR_AVBP | LTDC_BPCR_AHBP);
\r
192 tmp = (hltdc->Init.AccumulatedHBP << 16);
\r
193 hltdc->Instance->BPCR |= (tmp | hltdc->Init.AccumulatedVBP);
\r
195 /* Sets Accumulated Active Width */
\r
196 hltdc->Instance->AWCR &= ~(LTDC_AWCR_AAH | LTDC_AWCR_AAW);
\r
197 tmp = (hltdc->Init.AccumulatedActiveW << 16);
\r
198 hltdc->Instance->AWCR |= (tmp | hltdc->Init.AccumulatedActiveH);
\r
200 /* Sets Total Width */
\r
201 hltdc->Instance->TWCR &= ~(LTDC_TWCR_TOTALH | LTDC_TWCR_TOTALW);
\r
202 tmp = (hltdc->Init.TotalWidth << 16);
\r
203 hltdc->Instance->TWCR |= (tmp | hltdc->Init.TotalHeigh);
\r
205 /* Sets the background color value */
\r
206 tmp = ((uint32_t)(hltdc->Init.Backcolor.Green) << 8);
\r
207 tmp1 = ((uint32_t)(hltdc->Init.Backcolor.Red) << 16);
\r
208 hltdc->Instance->BCCR &= ~(LTDC_BCCR_BCBLUE | LTDC_BCCR_BCGREEN | LTDC_BCCR_BCRED);
\r
209 hltdc->Instance->BCCR |= (tmp1 | tmp | hltdc->Init.Backcolor.Blue);
\r
211 /* Enable the transfer Error interrupt */
\r
212 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_TE);
\r
214 /* Enable the FIFO underrun interrupt */
\r
215 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_FU);
\r
217 /* Enable LTDC by setting LTDCEN bit */
\r
218 __HAL_LTDC_ENABLE(hltdc);
\r
220 /* Initialize the error code */
\r
221 hltdc->ErrorCode = HAL_LTDC_ERROR_NONE;
\r
223 /* Initialize the LTDC state*/
\r
224 hltdc->State = HAL_LTDC_STATE_READY;
\r
230 * @brief Deinitializes the LTDC peripheral registers to their default reset
\r
232 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
233 * the configuration information for the LTDC.
\r
237 HAL_StatusTypeDef HAL_LTDC_DeInit(LTDC_HandleTypeDef *hltdc)
\r
239 /* DeInit the low level hardware */
\r
240 HAL_LTDC_MspDeInit(hltdc);
\r
242 /* Initialize the error code */
\r
243 hltdc->ErrorCode = HAL_LTDC_ERROR_NONE;
\r
245 /* Initialize the LTDC state*/
\r
246 hltdc->State = HAL_LTDC_STATE_RESET;
\r
249 __HAL_UNLOCK(hltdc);
\r
255 * @brief Initializes the LTDC MSP.
\r
256 * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains
\r
257 * the configuration information for the LTDC.
\r
260 __weak void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)
\r
262 /* NOTE : This function Should not be modified, when the callback is needed,
\r
263 the HAL_LTDC_MspInit could be implemented in the user file
\r
268 * @brief DeInitializes the LTDC MSP.
\r
269 * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains
\r
270 * the configuration information for the LTDC.
\r
273 __weak void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* hltdc)
\r
275 /* NOTE : This function Should not be modified, when the callback is needed,
\r
276 the HAL_LTDC_MspDeInit could be implemented in the user file
\r
284 /** @defgroup LTDC_Exported_Functions_Group2 IO operation functions
\r
285 * @brief IO operation functions
\r
288 ===============================================================================
\r
289 ##### IO operation functions #####
\r
290 ===============================================================================
\r
291 [..] This section provides function allowing to:
\r
292 (+) Handle LTDC interrupt request
\r
298 * @brief Handles LTDC interrupt request.
\r
299 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
300 * the configuration information for the LTDC.
\r
301 * @retval HAL status
\r
303 void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef *hltdc)
\r
305 /* Transfer Error Interrupt management ***************************************/
\r
306 if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_TE) != RESET)
\r
308 if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_TE) != RESET)
\r
310 /* Disable the transfer Error interrupt */
\r
311 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_TE);
\r
313 /* Clear the transfer error flag */
\r
314 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_TE);
\r
316 /* Update error code */
\r
317 hltdc->ErrorCode |= HAL_LTDC_ERROR_TE;
\r
319 /* Change LTDC state */
\r
320 hltdc->State = HAL_LTDC_STATE_ERROR;
\r
322 /* Process unlocked */
\r
323 __HAL_UNLOCK(hltdc);
\r
325 /* Transfer error Callback */
\r
326 HAL_LTDC_ErrorCallback(hltdc);
\r
329 /* FIFO underrun Interrupt management ***************************************/
\r
330 if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_FU) != RESET)
\r
332 if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_FU) != RESET)
\r
334 /* Disable the FIFO underrun interrupt */
\r
335 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_FU);
\r
337 /* Clear the FIFO underrun flag */
\r
338 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_FU);
\r
340 /* Update error code */
\r
341 hltdc->ErrorCode |= HAL_LTDC_ERROR_FU;
\r
343 /* Change LTDC state */
\r
344 hltdc->State = HAL_LTDC_STATE_ERROR;
\r
346 /* Process unlocked */
\r
347 __HAL_UNLOCK(hltdc);
\r
349 /* Transfer error Callback */
\r
350 HAL_LTDC_ErrorCallback(hltdc);
\r
353 /* Line Interrupt management ************************************************/
\r
354 if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_LI) != RESET)
\r
356 if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_LI) != RESET)
\r
358 /* Disable the Line interrupt */
\r
359 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_LI);
\r
361 /* Clear the Line interrupt flag */
\r
362 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_LI);
\r
364 /* Change LTDC state */
\r
365 hltdc->State = HAL_LTDC_STATE_READY;
\r
367 /* Process unlocked */
\r
368 __HAL_UNLOCK(hltdc);
\r
370 /* Line interrupt Callback */
\r
371 HAL_LTDC_LineEvenCallback(hltdc);
\r
377 * @brief Error LTDC callback.
\r
378 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
379 * the configuration information for the LTDC.
\r
382 __weak void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc)
\r
384 /* NOTE : This function Should not be modified, when the callback is needed,
\r
385 the HAL_LTDC_ErrorCallback could be implemented in the user file
\r
390 * @brief Line Event callback.
\r
391 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
392 * the configuration information for the LTDC.
\r
395 __weak void HAL_LTDC_LineEvenCallback(LTDC_HandleTypeDef *hltdc)
\r
397 /* NOTE : This function Should not be modified, when the callback is needed,
\r
398 the HAL_LTDC_LineEvenCallback could be implemented in the user file
\r
406 /** @defgroup LTDC_Exported_Functions_Group3 Peripheral Control functions
\r
407 * @brief Peripheral Control functions
\r
410 ===============================================================================
\r
411 ##### Peripheral Control functions #####
\r
412 ===============================================================================
\r
413 [..] This section provides functions allowing to:
\r
414 (+) Configure the LTDC foreground or/and background parameters.
\r
415 (+) Set the active layer.
\r
416 (+) Configure the color keying.
\r
417 (+) Configure the C-LUT.
\r
418 (+) Enable / Disable the color keying.
\r
419 (+) Enable / Disable the C-LUT.
\r
420 (+) Update the layer position.
\r
421 (+) Update the layer size.
\r
422 (+) Update pixel format on the fly.
\r
423 (+) Update transparency on the fly.
\r
424 (+) Update address on the fly.
\r
431 * @brief Configure the LTDC Layer according to the specified
\r
432 * parameters in the LTDC_InitTypeDef and create the associated handle.
\r
433 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
434 * the configuration information for the LTDC.
\r
435 * @param pLayerCfg: pointer to a LTDC_LayerCfgTypeDef structure that contains
\r
436 * the configuration information for the Layer.
\r
437 * @param LayerIdx: LTDC Layer index.
\r
438 * This parameter can be one of the following values:
\r
440 * @retval HAL status
\r
442 HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx)
\r
444 /* Process locked */
\r
447 /* Change LTDC peripheral state */
\r
448 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
450 /* Check the parameters */
\r
451 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
452 assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg->PixelFormat));
\r
453 assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg->BlendingFactor1));
\r
454 assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg->BlendingFactor2));
\r
455 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
\r
456 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
\r
457 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
\r
458 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
\r
459 assert_param(IS_LTDC_ALPHA(pLayerCfg->Alpha0));
\r
460 assert_param(IS_LTDC_CFBLL(pLayerCfg->ImageWidth));
\r
461 assert_param(IS_LTDC_CFBLNBR(pLayerCfg->ImageHeight));
\r
463 /* Copy new layer configuration into handle structure */
\r
464 hltdc->LayerCfg[LayerIdx] = *pLayerCfg;
\r
466 /* Configure the LTDC Layer */
\r
467 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
\r
469 /* Sets the Reload type */
\r
470 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
472 /* Initialize the LTDC state*/
\r
473 hltdc->State = HAL_LTDC_STATE_READY;
\r
475 /* Process unlocked */
\r
476 __HAL_UNLOCK(hltdc);
\r
482 * @brief Configure the color keying.
\r
483 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
484 * the configuration information for the LTDC.
\r
485 * @param RGBValue: the color key value
\r
486 * @param LayerIdx: LTDC Layer index.
\r
487 * This parameter can be one of the following values:
\r
489 * @retval HAL status
\r
491 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx)
\r
493 /* Process locked */
\r
496 /* Change LTDC peripheral state */
\r
497 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
499 /* Check the parameters */
\r
500 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
502 /* Configures the default color values */
\r
503 LTDC_LAYER(hltdc, LayerIdx)->CKCR &= ~(LTDC_LxCKCR_CKBLUE | LTDC_LxCKCR_CKGREEN | LTDC_LxCKCR_CKRED);
\r
504 LTDC_LAYER(hltdc, LayerIdx)->CKCR = RGBValue;
\r
506 /* Sets the Reload type */
\r
507 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
509 /* Change the LTDC state*/
\r
510 hltdc->State = HAL_LTDC_STATE_READY;
\r
512 /* Process unlocked */
\r
513 __HAL_UNLOCK(hltdc);
\r
519 * @brief Load the color lookup table.
\r
520 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
521 * the configuration information for the LTDC.
\r
522 * @param pCLUT: pointer to the color lookup table address.
\r
523 * @param CLUTSize: the color lookup table size.
\r
524 * @param LayerIdx: LTDC Layer index.
\r
525 * This parameter can be one of the following values:
\r
527 * @retval HAL status
\r
529 HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx)
\r
532 uint32_t counter = 0;
\r
533 uint32_t pcounter = 0;
\r
535 /* Process locked */
\r
538 /* Change LTDC peripheral state */
\r
539 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
541 /* Check the parameters */
\r
542 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
544 for(counter = 0; (counter < CLUTSize); counter++)
\r
546 if(hltdc->LayerCfg[LayerIdx].PixelFormat == LTDC_PIXEL_FORMAT_AL44)
\r
548 tmp = (((counter + 16*counter) << 24) | ((uint32_t)(*pCLUT) & 0xFF) | ((uint32_t)(*pCLUT) & 0xFF00) | ((uint32_t)(*pCLUT) & 0xFF0000));
\r
552 tmp = ((counter << 24) | ((uint32_t)(*pCLUT) & 0xFF) | ((uint32_t)(*pCLUT) & 0xFF00) | ((uint32_t)(*pCLUT) & 0xFF0000));
\r
554 pcounter = (uint32_t)pCLUT + sizeof(*pCLUT);
\r
555 pCLUT = (uint32_t *)pcounter;
\r
557 /* Specifies the C-LUT address and RGB value */
\r
558 LTDC_LAYER(hltdc, LayerIdx)->CLUTWR = tmp;
\r
561 /* Change the LTDC state*/
\r
562 hltdc->State = HAL_LTDC_STATE_READY;
\r
564 /* Process unlocked */
\r
565 __HAL_UNLOCK(hltdc);
\r
571 * @brief Enable the color keying.
\r
572 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
573 * the configuration information for the LTDC.
\r
574 * @param LayerIdx: LTDC Layer index.
\r
575 * This parameter can be one of the following values:
\r
577 * @retval HAL status
\r
579 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
\r
581 /* Process locked */
\r
584 /* Change LTDC peripheral state */
\r
585 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
587 /* Check the parameters */
\r
588 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
590 /* Enable LTDC color keying by setting COLKEN bit */
\r
591 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_COLKEN;
\r
593 /* Sets the Reload type */
\r
594 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
596 /* Change the LTDC state*/
\r
597 hltdc->State = HAL_LTDC_STATE_READY;
\r
599 /* Process unlocked */
\r
600 __HAL_UNLOCK(hltdc);
\r
606 * @brief Disable the color keying.
\r
607 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
608 * the configuration information for the LTDC.
\r
609 * @param LayerIdx: LTDC Layer index.
\r
610 * This parameter can be one of the following values:
\r
612 * @retval HAL status
\r
614 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
\r
616 /* Process locked */
\r
619 /* Change LTDC peripheral state */
\r
620 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
622 /* Check the parameters */
\r
623 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
625 /* Disable LTDC color keying by setting COLKEN bit */
\r
626 LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_COLKEN;
\r
628 /* Sets the Reload type */
\r
629 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
631 /* Change the LTDC state*/
\r
632 hltdc->State = HAL_LTDC_STATE_READY;
\r
634 /* Process unlocked */
\r
635 __HAL_UNLOCK(hltdc);
\r
641 * @brief Enable the color lookup table.
\r
642 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
643 * the configuration information for the LTDC.
\r
644 * @param LayerIdx: LTDC Layer index.
\r
645 * This parameter can be one of the following values:
\r
647 * @retval HAL status
\r
649 HAL_StatusTypeDef HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
\r
652 /* Process locked */
\r
655 /* Change LTDC peripheral state */
\r
656 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
658 /* Check the parameters */
\r
659 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
661 /* Disable LTDC color lookup table by setting CLUTEN bit */
\r
662 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_CLUTEN;
\r
664 /* Sets the Reload type */
\r
665 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
667 /* Change the LTDC state*/
\r
668 hltdc->State = HAL_LTDC_STATE_READY;
\r
670 /* Process unlocked */
\r
671 __HAL_UNLOCK(hltdc);
\r
677 * @brief Disable the color lookup table.
\r
678 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
679 * the configuration information for the LTDC.
\r
680 * @param LayerIdx: LTDC Layer index.
\r
681 * This parameter can be one of the following values:
\r
683 * @retval HAL status
\r
685 HAL_StatusTypeDef HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
\r
688 /* Process locked */
\r
691 /* Change LTDC peripheral state */
\r
692 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
694 /* Check the parameters */
\r
695 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
697 /* Disable LTDC color lookup table by setting CLUTEN bit */
\r
698 LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_CLUTEN;
\r
700 /* Sets the Reload type */
\r
701 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
703 /* Change the LTDC state*/
\r
704 hltdc->State = HAL_LTDC_STATE_READY;
\r
706 /* Process unlocked */
\r
707 __HAL_UNLOCK(hltdc);
\r
713 * @brief Enables Dither.
\r
714 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
715 * the configuration information for the LTDC.
\r
716 * @retval HAL status
\r
719 HAL_StatusTypeDef HAL_LTDC_EnableDither(LTDC_HandleTypeDef *hltdc)
\r
721 /* Process locked */
\r
724 /* Change LTDC peripheral state */
\r
725 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
727 /* Enable Dither by setting DTEN bit */
\r
728 LTDC->GCR |= (uint32_t)LTDC_GCR_DTEN;
\r
730 /* Change the LTDC state*/
\r
731 hltdc->State = HAL_LTDC_STATE_READY;
\r
733 /* Process unlocked */
\r
734 __HAL_UNLOCK(hltdc);
\r
740 * @brief Disables Dither.
\r
741 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
742 * the configuration information for the LTDC.
\r
743 * @retval HAL status
\r
746 HAL_StatusTypeDef HAL_LTDC_DisableDither(LTDC_HandleTypeDef *hltdc)
\r
748 /* Process locked */
\r
751 /* Change LTDC peripheral state */
\r
752 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
754 /* Disable Dither by setting DTEN bit */
\r
755 LTDC->GCR &= ~(uint32_t)LTDC_GCR_DTEN;
\r
757 /* Change the LTDC state*/
\r
758 hltdc->State = HAL_LTDC_STATE_READY;
\r
760 /* Process unlocked */
\r
761 __HAL_UNLOCK(hltdc);
\r
767 * @brief Set the LTDC window size.
\r
768 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
769 * the configuration information for the LTDC.
\r
770 * @param XSize: LTDC Pixel per line
\r
771 * @param YSize: LTDC Line number
\r
772 * @param LayerIdx: LTDC Layer index.
\r
773 * This parameter can be one of the following values:
\r
775 * @retval HAL status
\r
777 HAL_StatusTypeDef HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx)
\r
779 LTDC_LayerCfgTypeDef *pLayerCfg;
\r
781 /* Process locked */
\r
784 /* Change LTDC peripheral state */
\r
785 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
787 /* Get layer configuration from handle structure */
\r
788 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
\r
790 /* Check the parameters (Layers parameters)*/
\r
791 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
792 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
\r
793 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
\r
794 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
\r
795 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
\r
796 assert_param(IS_LTDC_CFBLL(XSize));
\r
797 assert_param(IS_LTDC_CFBLNBR(YSize));
\r
799 /* update horizontal start/stop */
\r
800 pLayerCfg->WindowX0 = 0;
\r
801 pLayerCfg->WindowX1 = XSize + pLayerCfg->WindowX0;
\r
803 /* update vertical start/stop */
\r
804 pLayerCfg->WindowY0 = 0;
\r
805 pLayerCfg->WindowY1 = YSize + pLayerCfg->WindowY0;
\r
807 /* Reconfigures the color frame buffer pitch in byte */
\r
808 pLayerCfg->ImageWidth = XSize;
\r
810 /* Reconfigures the frame buffer line number */
\r
811 pLayerCfg->ImageHeight = YSize;
\r
813 /* Set LTDC parameters */
\r
814 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
\r
816 /* Sets the Reload type */
\r
817 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
819 /* Change the LTDC state*/
\r
820 hltdc->State = HAL_LTDC_STATE_READY;
\r
822 /* Process unlocked */
\r
823 __HAL_UNLOCK(hltdc);
\r
829 * @brief Set the LTDC window position.
\r
830 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
831 * the configuration information for the LTDC.
\r
832 * @param X0: LTDC window X offset
\r
833 * @param Y0: LTDC window Y offset
\r
834 * @param LayerIdx: LTDC Layer index.
\r
835 * This parameter can be one of the following values:
\r
837 * @retval HAL status
\r
839 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx)
\r
841 LTDC_LayerCfgTypeDef *pLayerCfg;
\r
843 /* Process locked */
\r
846 /* Change LTDC peripheral state */
\r
847 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
849 /* Get layer configuration from handle structure */
\r
850 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
\r
852 /* Check the parameters */
\r
853 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
854 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
\r
855 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
\r
856 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
\r
857 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
\r
859 /* update horizontal start/stop */
\r
860 pLayerCfg->WindowX0 = X0;
\r
861 pLayerCfg->WindowX1 = X0 + pLayerCfg->ImageWidth;
\r
863 /* update vertical start/stop */
\r
864 pLayerCfg->WindowY0 = Y0;
\r
865 pLayerCfg->WindowY1 = Y0 + pLayerCfg->ImageHeight;
\r
867 /* Set LTDC parameters */
\r
868 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
\r
870 /* Sets the Reload type */
\r
871 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
873 /* Change the LTDC state*/
\r
874 hltdc->State = HAL_LTDC_STATE_READY;
\r
876 /* Process unlocked */
\r
877 __HAL_UNLOCK(hltdc);
\r
883 * @brief Reconfigure the pixel format.
\r
884 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
885 * the configuration information for the LTDC.
\r
886 * @param Pixelformat: new pixel format value.
\r
887 * @param LayerIdx: LTDC Layer index.
\r
888 * This parameter can be one of the following values:
\r
890 * @retval HAL status
\r
892 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx)
\r
894 LTDC_LayerCfgTypeDef *pLayerCfg;
\r
896 /* Process locked */
\r
899 /* Change LTDC peripheral state */
\r
900 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
902 /* Check the parameters */
\r
903 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
904 assert_param(IS_LTDC_PIXEL_FORMAT(Pixelformat));
\r
906 /* Get layer configuration from handle structure */
\r
907 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
\r
909 /* Reconfigure the pixel format */
\r
910 pLayerCfg->PixelFormat = Pixelformat;
\r
912 /* Set LTDC parameters */
\r
913 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
\r
915 /* Sets the Reload type */
\r
916 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
918 /* Change the LTDC state*/
\r
919 hltdc->State = HAL_LTDC_STATE_READY;
\r
921 /* Process unlocked */
\r
922 __HAL_UNLOCK(hltdc);
\r
928 * @brief Reconfigure the layer alpha value.
\r
929 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
930 * the configuration information for the LTDC.
\r
931 * @param Alpha: new alpha value.
\r
932 * @param LayerIdx: LTDC Layer index.
\r
933 * This parameter can be one of the following values:
\r
935 * @retval HAL status
\r
937 HAL_StatusTypeDef HAL_LTDC_SetAlpha(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx)
\r
939 LTDC_LayerCfgTypeDef *pLayerCfg;
\r
941 /* Process locked */
\r
944 /* Change LTDC peripheral state */
\r
945 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
947 /* Check the parameters */
\r
948 assert_param(IS_LTDC_ALPHA(Alpha));
\r
949 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
951 /* Get layer configuration from handle structure */
\r
952 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
\r
954 /* Reconfigure the Alpha value */
\r
955 pLayerCfg->Alpha = Alpha;
\r
957 /* Set LTDC parameters */
\r
958 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
\r
960 /* Sets the Reload type */
\r
961 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
963 /* Change the LTDC state*/
\r
964 hltdc->State = HAL_LTDC_STATE_READY;
\r
966 /* Process unlocked */
\r
967 __HAL_UNLOCK(hltdc);
\r
972 * @brief Reconfigure the frame buffer Address.
\r
973 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
974 * the configuration information for the LTDC.
\r
975 * @param Address: new address value.
\r
976 * @param LayerIdx: LTDC Layer index.
\r
977 * This parameter can be one of the following values:
\r
979 * @retval HAL status
\r
981 HAL_StatusTypeDef HAL_LTDC_SetAddress(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx)
\r
983 LTDC_LayerCfgTypeDef *pLayerCfg;
\r
985 /* Process locked */
\r
988 /* Change LTDC peripheral state */
\r
989 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
991 /* Check the parameters */
\r
992 assert_param(IS_LTDC_LAYER(LayerIdx));
\r
994 /* Get layer configuration from handle structure */
\r
995 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
\r
997 /* Reconfigure the Address */
\r
998 pLayerCfg->FBStartAdress = Address;
\r
1000 /* Set LTDC parameters */
\r
1001 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
\r
1003 /* Sets the Reload type */
\r
1004 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
\r
1006 /* Change the LTDC state*/
\r
1007 hltdc->State = HAL_LTDC_STATE_READY;
\r
1009 /* Process unlocked */
\r
1010 __HAL_UNLOCK(hltdc);
\r
1016 * @brief Define the position of the line interrupt .
\r
1017 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
1018 * the configuration information for the LTDC.
\r
1019 * @param Line: Line Interrupt Position.
\r
1020 * @retval HAL status
\r
1022 HAL_StatusTypeDef HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef *hltdc, uint32_t Line)
\r
1024 /* Process locked */
\r
1025 __HAL_LOCK(hltdc);
\r
1027 /* Change LTDC peripheral state */
\r
1028 hltdc->State = HAL_LTDC_STATE_BUSY;
\r
1030 /* Check the parameters */
\r
1031 assert_param(IS_LTDC_LIPOS(Line));
\r
1033 /* Enable the Line interrupt */
\r
1034 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_LI);
\r
1036 /* Sets the Line Interrupt position */
\r
1037 LTDC->LIPCR = (uint32_t)Line;
\r
1039 /* Change the LTDC state*/
\r
1040 hltdc->State = HAL_LTDC_STATE_READY;
\r
1042 /* Process unlocked */
\r
1043 __HAL_UNLOCK(hltdc);
\r
1052 /** @defgroup LTDC_Exported_Functions_Group4 Peripheral State and Errors functions
\r
1053 * @brief Peripheral State and Errors functions
\r
1056 ===============================================================================
\r
1057 ##### Peripheral State and Errors functions #####
\r
1058 ===============================================================================
\r
1060 This subsection provides functions allowing to
\r
1061 (+) Check the LTDC state.
\r
1062 (+) Get error code.
\r
1069 * @brief Return the LTDC state
\r
1070 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
\r
1071 * the configuration information for the LTDC.
\r
1072 * @retval HAL state
\r
1074 HAL_LTDC_StateTypeDef HAL_LTDC_GetState(LTDC_HandleTypeDef *hltdc)
\r
1076 return hltdc->State;
\r
1080 * @brief Return the LTDC error code
\r
1081 * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains
\r
1082 * the configuration information for the LTDC.
\r
1083 * @retval LTDC Error Code
\r
1085 uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc)
\r
1087 return hltdc->ErrorCode;
\r
1095 * @brief Configures the LTDC peripheral
\r
1096 * @param hltdc : Pointer to a LTDC_HandleTypeDef structure that contains
\r
1097 * the configuration information for the LTDC.
\r
1098 * @param pLayerCfg: Pointer LTDC Layer Configuration structure
\r
1099 * @param LayerIdx: LTDC Layer index.
\r
1100 * This parameter can be one of the following values: 0 or 1
\r
1103 static void LTDC_SetConfig(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx)
\r
1106 uint32_t tmp1 = 0;
\r
1107 uint32_t tmp2 = 0;
\r
1109 /* Configures the horizontal start and stop position */
\r
1110 tmp = ((pLayerCfg->WindowX1 + ((hltdc->Instance->BPCR & LTDC_BPCR_AHBP) >> 16)) << 16);
\r
1111 LTDC_LAYER(hltdc, LayerIdx)->WHPCR &= ~(LTDC_LxWHPCR_WHSTPOS | LTDC_LxWHPCR_WHSPPOS);
\r
1112 LTDC_LAYER(hltdc, LayerIdx)->WHPCR = ((pLayerCfg->WindowX0 + ((hltdc->Instance->BPCR & LTDC_BPCR_AHBP) >> 16) + 1) | tmp);
\r
1114 /* Configures the vertical start and stop position */
\r
1115 tmp = ((pLayerCfg->WindowY1 + (hltdc->Instance->BPCR & LTDC_BPCR_AVBP)) << 16);
\r
1116 LTDC_LAYER(hltdc, LayerIdx)->WVPCR &= ~(LTDC_LxWVPCR_WVSTPOS | LTDC_LxWVPCR_WVSPPOS);
\r
1117 LTDC_LAYER(hltdc, LayerIdx)->WVPCR = ((pLayerCfg->WindowY0 + (hltdc->Instance->BPCR & LTDC_BPCR_AVBP) + 1) | tmp);
\r
1119 /* Specifies the pixel format */
\r
1120 LTDC_LAYER(hltdc, LayerIdx)->PFCR &= ~(LTDC_LxPFCR_PF);
\r
1121 LTDC_LAYER(hltdc, LayerIdx)->PFCR = (pLayerCfg->PixelFormat);
\r
1123 /* Configures the default color values */
\r
1124 tmp = ((uint32_t)(pLayerCfg->Backcolor.Green) << 8);
\r
1125 tmp1 = ((uint32_t)(pLayerCfg->Backcolor.Red) << 16);
\r
1126 tmp2 = (pLayerCfg->Alpha0 << 24);
\r
1127 LTDC_LAYER(hltdc, LayerIdx)->DCCR &= ~(LTDC_LxDCCR_DCBLUE | LTDC_LxDCCR_DCGREEN | LTDC_LxDCCR_DCRED | LTDC_LxDCCR_DCALPHA);
\r
1128 LTDC_LAYER(hltdc, LayerIdx)->DCCR = (pLayerCfg->Backcolor.Blue | tmp | tmp1 | tmp2);
\r
1130 /* Specifies the constant alpha value */
\r
1131 LTDC_LAYER(hltdc, LayerIdx)->CACR &= ~(LTDC_LxCACR_CONSTA);
\r
1132 LTDC_LAYER(hltdc, LayerIdx)->CACR = (pLayerCfg->Alpha);
\r
1134 /* Specifies the blending factors */
\r
1135 LTDC_LAYER(hltdc, LayerIdx)->BFCR &= ~(LTDC_LxBFCR_BF2 | LTDC_LxBFCR_BF1);
\r
1136 LTDC_LAYER(hltdc, LayerIdx)->BFCR = (pLayerCfg->BlendingFactor1 | pLayerCfg->BlendingFactor2);
\r
1138 /* Configures the color frame buffer start address */
\r
1139 LTDC_LAYER(hltdc, LayerIdx)->CFBAR &= ~(LTDC_LxCFBAR_CFBADD);
\r
1140 LTDC_LAYER(hltdc, LayerIdx)->CFBAR = (pLayerCfg->FBStartAdress);
\r
1142 if(pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888)
\r
1146 else if (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_RGB888)
\r
1150 else if((pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \
\r
1151 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \
\r
1152 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB1555) || \
\r
1153 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_AL88))
\r
1162 /* Configures the color frame buffer pitch in byte */
\r
1163 LTDC_LAYER(hltdc, LayerIdx)->CFBLR &= ~(LTDC_LxCFBLR_CFBLL | LTDC_LxCFBLR_CFBP);
\r
1164 LTDC_LAYER(hltdc, LayerIdx)->CFBLR = (((pLayerCfg->ImageWidth * tmp) << 16) | (((pLayerCfg->WindowX1 - pLayerCfg->WindowX0) * tmp) + 3));
\r
1166 /* Configures the frame buffer line number */
\r
1167 LTDC_LAYER(hltdc, LayerIdx)->CFBLNR &= ~(LTDC_LxCFBLNR_CFBLNBR);
\r
1168 LTDC_LAYER(hltdc, LayerIdx)->CFBLNR = (pLayerCfg->ImageHeight);
\r
1170 /* Enable LTDC_Layer by setting LEN bit */
\r
1171 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_LEN;
\r
1178 #endif /* HAL_LTDC_MODULE_ENABLED */
\r
1187 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r