2 ******************************************************************************
3 * @file stm32f7xx_hal_ltdc.c
4 * @author MCD Application Team
7 * @brief LTDC HAL module driver.
8 * This file provides firmware functions to manage the following
9 * functionalities of the LTDC peripheral:
10 * + Initialization and de-initialization functions
11 * + IO operation functions
12 * + Peripheral Control functions
13 * + Peripheral State and Errors functions
16 ==============================================================================
17 ##### How to use this driver #####
18 ==============================================================================
20 (#) Program the required configuration through the following parameters:
21 the LTDC timing, the horizontal and vertical polarity,
22 the pixel clock polarity, Data Enable polarity and the LTDC background color value
23 using HAL_LTDC_Init() function
25 (#) Program the required configuration through the following parameters:
26 the pixel format, the blending factors, input alpha value, the window size
27 and the image size using HAL_LTDC_ConfigLayer() function for foreground
28 or/and background layer.
30 (#) Optionally, configure and enable the CLUT using HAL_LTDC_ConfigCLUT() and
31 HAL_LTDC_EnableCLUT functions.
33 (#) Optionally, enable the Dither using HAL_LTDC_EnableDither().
35 (#) Optionally, configure and enable the Color keying using HAL_LTDC_ConfigColorKeying()
36 and HAL_LTDC_EnableColorKeying functions.
38 (#) Optionally, configure LineInterrupt using HAL_LTDC_ProgramLineEvent()
41 (#) If needed, reconfigure and change the pixel format value, the alpha value
42 value, the window size, the window position and the layer start address
43 for foreground or/and background layer using respectively the following
44 functions: HAL_LTDC_SetPixelFormat(), HAL_LTDC_SetAlpha(), HAL_LTDC_SetWindowSize(),
45 HAL_LTDC_SetWindowPosition(), HAL_LTDC_SetAddress.
47 (#) Variant functions with "_NoReload" post fix allows to set the LTDC configuration/settings without immediate reload.
48 This is useful in case when the program requires to modify serval LTDC settings (on one or both layers)
49 then applying(reload) these settings in one shot by calling the function "HAL_LTDC_Reload"
51 After calling the "_NoReload" functions to set different color/format/layer settings,
52 the program can call the function "HAL_LTDC_Reload" To apply(Reload) these settings.
53 Function "HAL_LTDC_Reload" can be called with the parameter "ReloadType"
54 set to LTDC_RELOAD_IMMEDIATE if an immediate reload is required.
55 Function "HAL_LTDC_Reload" can be called with the parameter "ReloadType"
56 set to LTDC_RELOAD_VERTICAL_BLANKING if the reload should be done in the next vertical blanking period,
57 this option allows to avoid display flicker by applying the new settings during the vertical blanking period.
60 (#) To control LTDC state you can use the following function: HAL_LTDC_GetState()
62 *** LTDC HAL driver macros list ***
63 =============================================
65 Below the list of most used macros in LTDC HAL driver.
67 (+) __HAL_LTDC_ENABLE: Enable the LTDC.
68 (+) __HAL_LTDC_DISABLE: Disable the LTDC.
69 (+) __HAL_LTDC_LAYER_ENABLE: Enable the LTDC Layer.
70 (+) __HAL_LTDC_LAYER_DISABLE: Disable the LTDC Layer.
71 (+) __HAL_LTDC_RELOAD_CONFIG: Reload Layer Configuration.
72 (+) __HAL_LTDC_GET_FLAG: Get the LTDC pending flags.
73 (+) __HAL_LTDC_CLEAR_FLAG: Clear the LTDC pending flags.
74 (+) __HAL_LTDC_ENABLE_IT: Enable the specified LTDC interrupts.
75 (+) __HAL_LTDC_DISABLE_IT: Disable the specified LTDC interrupts.
76 (+) __HAL_LTDC_GET_IT_SOURCE: Check whether the specified LTDC interrupt has occurred or not.
79 (@) You can refer to the LTDC HAL driver header file for more useful macros
82 ******************************************************************************
85 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
87 * Redistribution and use in source and binary forms, with or without modification,
88 * are permitted provided that the following conditions are met:
89 * 1. Redistributions of source code must retain the above copyright notice,
90 * this list of conditions and the following disclaimer.
91 * 2. Redistributions in binary form must reproduce the above copyright notice,
92 * this list of conditions and the following disclaimer in the documentation
93 * and/or other materials provided with the distribution.
94 * 3. Neither the name of STMicroelectronics nor the names of its contributors
95 * may be used to endorse or promote products derived from this software
96 * without specific prior written permission.
98 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
99 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
100 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
101 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
102 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
103 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
104 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
105 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
106 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
107 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
109 ******************************************************************************
112 /* Includes ------------------------------------------------------------------*/
113 #include "stm32f7xx_hal.h"
115 /** @addtogroup STM32F7xx_HAL_Driver
118 #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
120 /** @defgroup LTDC LTDC
121 * @brief LTDC HAL module driver
125 #ifdef HAL_LTDC_MODULE_ENABLED
127 /* Private typedef -----------------------------------------------------------*/
128 /* Private define ------------------------------------------------------------*/
129 /* Private macro -------------------------------------------------------------*/
130 /* Private variables ---------------------------------------------------------*/
131 /* Private function prototypes -----------------------------------------------*/
132 static void LTDC_SetConfig(LTDC_HandleTypeDef
*hltdc
, LTDC_LayerCfgTypeDef
*pLayerCfg
, uint32_t LayerIdx
);
133 /* Private functions ---------------------------------------------------------*/
135 /** @defgroup LTDC_Exported_Functions LTDC Exported Functions
139 /** @defgroup LTDC_Exported_Functions_Group1 Initialization and Configuration functions
140 * @brief Initialization and Configuration functions
143 ===============================================================================
144 ##### Initialization and Configuration functions #####
145 ===============================================================================
146 [..] This section provides functions allowing to:
147 (+) Initialize and configure the LTDC
148 (+) De-initialize the LTDC
155 * @brief Initializes the LTDC according to the specified
156 * parameters in the LTDC_InitTypeDef and create the associated handle.
157 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
158 * the configuration information for the LTDC.
161 HAL_StatusTypeDef
HAL_LTDC_Init(LTDC_HandleTypeDef
*hltdc
)
163 uint32_t tmp
= 0, tmp1
= 0;
165 /* Check the LTDC peripheral state */
171 /* Check function parameters */
172 assert_param(IS_LTDC_ALL_INSTANCE(hltdc
->Instance
));
173 assert_param(IS_LTDC_HSYNC(hltdc
->Init
.HorizontalSync
));
174 assert_param(IS_LTDC_VSYNC(hltdc
->Init
.VerticalSync
));
175 assert_param(IS_LTDC_AHBP(hltdc
->Init
.AccumulatedHBP
));
176 assert_param(IS_LTDC_AVBP(hltdc
->Init
.AccumulatedVBP
));
177 assert_param(IS_LTDC_AAH(hltdc
->Init
.AccumulatedActiveH
));
178 assert_param(IS_LTDC_AAW(hltdc
->Init
.AccumulatedActiveW
));
179 assert_param(IS_LTDC_TOTALH(hltdc
->Init
.TotalHeigh
));
180 assert_param(IS_LTDC_TOTALW(hltdc
->Init
.TotalWidth
));
181 assert_param(IS_LTDC_HSPOL(hltdc
->Init
.HSPolarity
));
182 assert_param(IS_LTDC_VSPOL(hltdc
->Init
.VSPolarity
));
183 assert_param(IS_LTDC_DEPOL(hltdc
->Init
.DEPolarity
));
184 assert_param(IS_LTDC_PCPOL(hltdc
->Init
.PCPolarity
));
186 if(hltdc
->State
== HAL_LTDC_STATE_RESET
)
188 /* Allocate lock resource and initialize it */
189 hltdc
->Lock
= HAL_UNLOCKED
;
190 /* Init the low level hardware */
191 HAL_LTDC_MspInit(hltdc
);
194 /* Change LTDC peripheral state */
195 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
197 /* Configures the HS, VS, DE and PC polarity */
198 hltdc
->Instance
->GCR
&= ~(LTDC_GCR_HSPOL
| LTDC_GCR_VSPOL
| LTDC_GCR_DEPOL
| LTDC_GCR_PCPOL
);
199 hltdc
->Instance
->GCR
|= (uint32_t)(hltdc
->Init
.HSPolarity
| hltdc
->Init
.VSPolarity
| \
200 hltdc
->Init
.DEPolarity
| hltdc
->Init
.PCPolarity
);
202 /* Sets Synchronization size */
203 hltdc
->Instance
->SSCR
&= ~(LTDC_SSCR_VSH
| LTDC_SSCR_HSW
);
204 tmp
= (hltdc
->Init
.HorizontalSync
<< 16);
205 hltdc
->Instance
->SSCR
|= (tmp
| hltdc
->Init
.VerticalSync
);
207 /* Sets Accumulated Back porch */
208 hltdc
->Instance
->BPCR
&= ~(LTDC_BPCR_AVBP
| LTDC_BPCR_AHBP
);
209 tmp
= (hltdc
->Init
.AccumulatedHBP
<< 16);
210 hltdc
->Instance
->BPCR
|= (tmp
| hltdc
->Init
.AccumulatedVBP
);
212 /* Sets Accumulated Active Width */
213 hltdc
->Instance
->AWCR
&= ~(LTDC_AWCR_AAH
| LTDC_AWCR_AAW
);
214 tmp
= (hltdc
->Init
.AccumulatedActiveW
<< 16);
215 hltdc
->Instance
->AWCR
|= (tmp
| hltdc
->Init
.AccumulatedActiveH
);
217 /* Sets Total Width */
218 hltdc
->Instance
->TWCR
&= ~(LTDC_TWCR_TOTALH
| LTDC_TWCR_TOTALW
);
219 tmp
= (hltdc
->Init
.TotalWidth
<< 16);
220 hltdc
->Instance
->TWCR
|= (tmp
| hltdc
->Init
.TotalHeigh
);
222 /* Sets the background color value */
223 tmp
= ((uint32_t)(hltdc
->Init
.Backcolor
.Green
) << 8);
224 tmp1
= ((uint32_t)(hltdc
->Init
.Backcolor
.Red
) << 16);
225 hltdc
->Instance
->BCCR
&= ~(LTDC_BCCR_BCBLUE
| LTDC_BCCR_BCGREEN
| LTDC_BCCR_BCRED
);
226 hltdc
->Instance
->BCCR
|= (tmp1
| tmp
| hltdc
->Init
.Backcolor
.Blue
);
228 /* Enable the transfer Error interrupt */
229 __HAL_LTDC_ENABLE_IT(hltdc
, LTDC_IT_TE
);
231 /* Enable the FIFO underrun interrupt */
232 __HAL_LTDC_ENABLE_IT(hltdc
, LTDC_IT_FU
);
234 /* Enable LTDC by setting LTDCEN bit */
235 __HAL_LTDC_ENABLE(hltdc
);
237 /* Initialize the error code */
238 hltdc
->ErrorCode
= HAL_LTDC_ERROR_NONE
;
240 /* Initialize the LTDC state*/
241 hltdc
->State
= HAL_LTDC_STATE_READY
;
247 * @brief Deinitializes the LTDC peripheral registers to their default reset
249 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
250 * the configuration information for the LTDC.
254 HAL_StatusTypeDef
HAL_LTDC_DeInit(LTDC_HandleTypeDef
*hltdc
)
256 /* DeInit the low level hardware */
257 HAL_LTDC_MspDeInit(hltdc
);
259 /* Initialize the error code */
260 hltdc
->ErrorCode
= HAL_LTDC_ERROR_NONE
;
262 /* Initialize the LTDC state*/
263 hltdc
->State
= HAL_LTDC_STATE_RESET
;
272 * @brief Initializes the LTDC MSP.
273 * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains
274 * the configuration information for the LTDC.
277 __weak
void HAL_LTDC_MspInit(LTDC_HandleTypeDef
* hltdc
)
279 /* Prevent unused argument(s) compilation warning */
282 /* NOTE : This function Should not be modified, when the callback is needed,
283 the HAL_LTDC_MspInit could be implemented in the user file
288 * @brief DeInitializes the LTDC MSP.
289 * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains
290 * the configuration information for the LTDC.
293 __weak
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef
* hltdc
)
295 /* Prevent unused argument(s) compilation warning */
298 /* NOTE : This function Should not be modified, when the callback is needed,
299 the HAL_LTDC_MspDeInit could be implemented in the user file
307 /** @defgroup LTDC_Exported_Functions_Group2 IO operation functions
308 * @brief IO operation functions
311 ===============================================================================
312 ##### IO operation functions #####
313 ===============================================================================
314 [..] This section provides function allowing to:
315 (+) Handle LTDC interrupt request
321 * @brief Handles LTDC interrupt request.
322 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
323 * the configuration information for the LTDC.
326 void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef
*hltdc
)
328 /* Transfer Error Interrupt management ***************************************/
329 if(__HAL_LTDC_GET_FLAG(hltdc
, LTDC_FLAG_TE
) != RESET
)
331 if(__HAL_LTDC_GET_IT_SOURCE(hltdc
, LTDC_IT_TE
) != RESET
)
333 /* Disable the transfer Error interrupt */
334 __HAL_LTDC_DISABLE_IT(hltdc
, LTDC_IT_TE
);
336 /* Clear the transfer error flag */
337 __HAL_LTDC_CLEAR_FLAG(hltdc
, LTDC_FLAG_TE
);
339 /* Update error code */
340 hltdc
->ErrorCode
|= HAL_LTDC_ERROR_TE
;
342 /* Change LTDC state */
343 hltdc
->State
= HAL_LTDC_STATE_ERROR
;
345 /* Process unlocked */
348 /* Transfer error Callback */
349 HAL_LTDC_ErrorCallback(hltdc
);
352 /* FIFO underrun Interrupt management ***************************************/
353 if(__HAL_LTDC_GET_FLAG(hltdc
, LTDC_FLAG_FU
) != RESET
)
355 if(__HAL_LTDC_GET_IT_SOURCE(hltdc
, LTDC_IT_FU
) != RESET
)
357 /* Disable the FIFO underrun interrupt */
358 __HAL_LTDC_DISABLE_IT(hltdc
, LTDC_IT_FU
);
360 /* Clear the FIFO underrun flag */
361 __HAL_LTDC_CLEAR_FLAG(hltdc
, LTDC_FLAG_FU
);
363 /* Update error code */
364 hltdc
->ErrorCode
|= HAL_LTDC_ERROR_FU
;
366 /* Change LTDC state */
367 hltdc
->State
= HAL_LTDC_STATE_ERROR
;
369 /* Process unlocked */
372 /* Transfer error Callback */
373 HAL_LTDC_ErrorCallback(hltdc
);
376 /* Line Interrupt management ************************************************/
377 if(__HAL_LTDC_GET_FLAG(hltdc
, LTDC_FLAG_LI
) != RESET
)
379 if(__HAL_LTDC_GET_IT_SOURCE(hltdc
, LTDC_IT_LI
) != RESET
)
381 /* Disable the Line interrupt */
382 __HAL_LTDC_DISABLE_IT(hltdc
, LTDC_IT_LI
);
384 /* Clear the Line interrupt flag */
385 __HAL_LTDC_CLEAR_FLAG(hltdc
, LTDC_FLAG_LI
);
387 /* Change LTDC state */
388 hltdc
->State
= HAL_LTDC_STATE_READY
;
390 /* Process unlocked */
393 /* Line interrupt Callback */
394 HAL_LTDC_LineEvenCallback(hltdc
);
397 /* Register reload Interrupt management ***************************************/
398 if(__HAL_LTDC_GET_FLAG(hltdc
, LTDC_FLAG_RR
) != RESET
)
400 if(__HAL_LTDC_GET_IT_SOURCE(hltdc
, LTDC_IT_RR
) != RESET
)
402 /* Disable the register reload interrupt */
403 __HAL_LTDC_DISABLE_IT(hltdc
, LTDC_IT_RR
);
405 /* Clear the register reload flag */
406 __HAL_LTDC_CLEAR_FLAG(hltdc
, LTDC_FLAG_RR
);
408 /* Change LTDC state */
409 hltdc
->State
= HAL_LTDC_STATE_READY
;
411 /* Process unlocked */
414 /* Register reload interrupt Callback */
415 HAL_LTDC_ReloadEventCallback(hltdc
);
421 * @brief Error LTDC callback.
422 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
423 * the configuration information for the LTDC.
426 __weak
void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef
*hltdc
)
428 /* Prevent unused argument(s) compilation warning */
431 /* NOTE : This function Should not be modified, when the callback is needed,
432 the HAL_LTDC_ErrorCallback could be implemented in the user file
437 * @brief Line Event callback.
438 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
439 * the configuration information for the LTDC.
442 __weak
void HAL_LTDC_LineEvenCallback(LTDC_HandleTypeDef
*hltdc
)
444 /* Prevent unused argument(s) compilation warning */
447 /* NOTE : This function Should not be modified, when the callback is needed,
448 the HAL_LTDC_LineEvenCallback could be implemented in the user file
453 * @brief Reload Event callback.
454 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
455 * the configuration information for the LTDC.
458 __weak
void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef
*hltdc
)
460 /* Prevent unused argument(s) compilation warning */
463 /* NOTE : This function Should not be modified, when the callback is needed,
464 the HAL_LTDC_ReloadEvenCallback could be implemented in the user file
472 /** @defgroup LTDC_Exported_Functions_Group3 Peripheral Control functions
473 * @brief Peripheral Control functions
476 ===============================================================================
477 ##### Peripheral Control functions #####
478 ===============================================================================
479 [..] This section provides functions allowing to:
480 (+) Configure the LTDC foreground or/and background parameters.
481 (+) Set the active layer.
482 (+) Configure the color keying.
483 (+) Configure the C-LUT.
484 (+) Enable / Disable the color keying.
485 (+) Enable / Disable the C-LUT.
486 (+) Update the layer position.
487 (+) Update the layer size.
488 (+) Update pixel format on the fly.
489 (+) Update transparency on the fly.
490 (+) Update address on the fly.
497 * @brief Configure the LTDC Layer according to the specified
498 * parameters in the LTDC_InitTypeDef and create the associated handle.
499 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
500 * the configuration information for the LTDC.
501 * @param pLayerCfg: pointer to a LTDC_LayerCfgTypeDef structure that contains
502 * the configuration information for the Layer.
503 * @param LayerIdx: LTDC Layer index.
504 * This parameter can be one of the following values:
508 HAL_StatusTypeDef
HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef
*hltdc
, LTDC_LayerCfgTypeDef
*pLayerCfg
, uint32_t LayerIdx
)
513 /* Change LTDC peripheral state */
514 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
516 /* Check the parameters */
517 assert_param(IS_LTDC_LAYER(LayerIdx
));
518 assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg
->PixelFormat
));
519 assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg
->BlendingFactor1
));
520 assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg
->BlendingFactor2
));
521 assert_param(IS_LTDC_HCONFIGST(pLayerCfg
->WindowX0
));
522 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg
->WindowX1
));
523 assert_param(IS_LTDC_VCONFIGST(pLayerCfg
->WindowY0
));
524 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg
->WindowY1
));
525 assert_param(IS_LTDC_ALPHA(pLayerCfg
->Alpha0
));
526 assert_param(IS_LTDC_CFBLL(pLayerCfg
->ImageWidth
));
527 assert_param(IS_LTDC_CFBLNBR(pLayerCfg
->ImageHeight
));
529 /* Copy new layer configuration into handle structure */
530 hltdc
->LayerCfg
[LayerIdx
] = *pLayerCfg
;
532 /* Configure the LTDC Layer */
533 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
535 /* Sets the Reload type */
536 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
538 /* Initialize the LTDC state*/
539 hltdc
->State
= HAL_LTDC_STATE_READY
;
541 /* Process unlocked */
548 * @brief Configure the color keying.
549 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
550 * the configuration information for the LTDC.
551 * @param RGBValue: the color key value
552 * @param LayerIdx: LTDC Layer index.
553 * This parameter can be one of the following values:
557 HAL_StatusTypeDef
HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef
*hltdc
, uint32_t RGBValue
, uint32_t LayerIdx
)
562 /* Change LTDC peripheral state */
563 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
565 /* Check the parameters */
566 assert_param(IS_LTDC_LAYER(LayerIdx
));
568 /* Configures the default color values */
569 LTDC_LAYER(hltdc
, LayerIdx
)->CKCR
&= ~(LTDC_LxCKCR_CKBLUE
| LTDC_LxCKCR_CKGREEN
| LTDC_LxCKCR_CKRED
);
570 LTDC_LAYER(hltdc
, LayerIdx
)->CKCR
= RGBValue
;
572 /* Sets the Reload type */
573 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
575 /* Change the LTDC state*/
576 hltdc
->State
= HAL_LTDC_STATE_READY
;
578 /* Process unlocked */
585 * @brief Load the color lookup table.
586 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
587 * the configuration information for the LTDC.
588 * @param pCLUT: pointer to the color lookup table address.
589 * @param CLUTSize: the color lookup table size.
590 * @param LayerIdx: LTDC Layer index.
591 * This parameter can be one of the following values:
595 HAL_StatusTypeDef
HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef
*hltdc
, uint32_t *pCLUT
, uint32_t CLUTSize
, uint32_t LayerIdx
)
598 uint32_t counter
= 0;
599 uint32_t pcounter
= 0;
604 /* Change LTDC peripheral state */
605 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
607 /* Check the parameters */
608 assert_param(IS_LTDC_LAYER(LayerIdx
));
610 for(counter
= 0; (counter
< CLUTSize
); counter
++)
612 if(hltdc
->LayerCfg
[LayerIdx
].PixelFormat
== LTDC_PIXEL_FORMAT_AL44
)
614 tmp
= (((counter
+ 16*counter
) << 24) | ((uint32_t)(*pCLUT
) & 0xFF) | ((uint32_t)(*pCLUT
) & 0xFF00) | ((uint32_t)(*pCLUT
) & 0xFF0000));
618 tmp
= ((counter
<< 24) | ((uint32_t)(*pCLUT
) & 0xFF) | ((uint32_t)(*pCLUT
) & 0xFF00) | ((uint32_t)(*pCLUT
) & 0xFF0000));
620 pcounter
= (uint32_t)pCLUT
+ sizeof(*pCLUT
);
621 pCLUT
= (uint32_t *)pcounter
;
623 /* Specifies the C-LUT address and RGB value */
624 LTDC_LAYER(hltdc
, LayerIdx
)->CLUTWR
= tmp
;
627 /* Change the LTDC state*/
628 hltdc
->State
= HAL_LTDC_STATE_READY
;
630 /* Process unlocked */
637 * @brief Enable the color keying.
638 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
639 * the configuration information for the LTDC.
640 * @param LayerIdx: LTDC Layer index.
641 * This parameter can be one of the following values:
645 HAL_StatusTypeDef
HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
650 /* Change LTDC peripheral state */
651 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
653 /* Check the parameters */
654 assert_param(IS_LTDC_LAYER(LayerIdx
));
656 /* Enable LTDC color keying by setting COLKEN bit */
657 LTDC_LAYER(hltdc
, LayerIdx
)->CR
|= (uint32_t)LTDC_LxCR_COLKEN
;
659 /* Sets the Reload type */
660 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
662 /* Change the LTDC state*/
663 hltdc
->State
= HAL_LTDC_STATE_READY
;
665 /* Process unlocked */
672 * @brief Disable the color keying.
673 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
674 * the configuration information for the LTDC.
675 * @param LayerIdx: LTDC Layer index.
676 * This parameter can be one of the following values:
680 HAL_StatusTypeDef
HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
685 /* Change LTDC peripheral state */
686 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
688 /* Check the parameters */
689 assert_param(IS_LTDC_LAYER(LayerIdx
));
691 /* Disable LTDC color keying by setting COLKEN bit */
692 LTDC_LAYER(hltdc
, LayerIdx
)->CR
&= ~(uint32_t)LTDC_LxCR_COLKEN
;
694 /* Sets the Reload type */
695 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
697 /* Change the LTDC state*/
698 hltdc
->State
= HAL_LTDC_STATE_READY
;
700 /* Process unlocked */
707 * @brief Enable the color lookup table.
708 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
709 * the configuration information for the LTDC.
710 * @param LayerIdx: LTDC Layer index.
711 * This parameter can be one of the following values:
715 HAL_StatusTypeDef
HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
721 /* Change LTDC peripheral state */
722 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
724 /* Check the parameters */
725 assert_param(IS_LTDC_LAYER(LayerIdx
));
727 /* Disable LTDC color lookup table by setting CLUTEN bit */
728 LTDC_LAYER(hltdc
, LayerIdx
)->CR
|= (uint32_t)LTDC_LxCR_CLUTEN
;
730 /* Sets the Reload type */
731 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
733 /* Change the LTDC state*/
734 hltdc
->State
= HAL_LTDC_STATE_READY
;
736 /* Process unlocked */
743 * @brief Disable the color lookup table.
744 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
745 * the configuration information for the LTDC.
746 * @param LayerIdx: LTDC Layer index.
747 * This parameter can be one of the following values:
751 HAL_StatusTypeDef
HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
757 /* Change LTDC peripheral state */
758 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
760 /* Check the parameters */
761 assert_param(IS_LTDC_LAYER(LayerIdx
));
763 /* Disable LTDC color lookup table by setting CLUTEN bit */
764 LTDC_LAYER(hltdc
, LayerIdx
)->CR
&= ~(uint32_t)LTDC_LxCR_CLUTEN
;
766 /* Sets the Reload type */
767 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
769 /* Change the LTDC state*/
770 hltdc
->State
= HAL_LTDC_STATE_READY
;
772 /* Process unlocked */
779 * @brief Enables Dither.
780 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
781 * the configuration information for the LTDC.
785 HAL_StatusTypeDef
HAL_LTDC_EnableDither(LTDC_HandleTypeDef
*hltdc
)
790 /* Change LTDC peripheral state */
791 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
793 /* Enable Dither by setting DTEN bit */
794 LTDC
->GCR
|= (uint32_t)LTDC_GCR_DEN
;
796 /* Change the LTDC state*/
797 hltdc
->State
= HAL_LTDC_STATE_READY
;
799 /* Process unlocked */
806 * @brief Disables Dither.
807 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
808 * the configuration information for the LTDC.
812 HAL_StatusTypeDef
HAL_LTDC_DisableDither(LTDC_HandleTypeDef
*hltdc
)
817 /* Change LTDC peripheral state */
818 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
820 /* Disable Dither by setting DTEN bit */
821 LTDC
->GCR
&= ~(uint32_t)LTDC_GCR_DEN
;
823 /* Change the LTDC state*/
824 hltdc
->State
= HAL_LTDC_STATE_READY
;
826 /* Process unlocked */
833 * @brief Set the LTDC window size.
834 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
835 * the configuration information for the LTDC.
836 * @param XSize: LTDC Pixel per line
837 * @param YSize: LTDC Line number
838 * @param LayerIdx: LTDC Layer index.
839 * This parameter can be one of the following values:
843 HAL_StatusTypeDef
HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef
*hltdc
, uint32_t XSize
, uint32_t YSize
, uint32_t LayerIdx
)
845 LTDC_LayerCfgTypeDef
*pLayerCfg
;
850 /* Change LTDC peripheral state */
851 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
853 /* Get layer configuration from handle structure */
854 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
856 /* Check the parameters (Layers parameters)*/
857 assert_param(IS_LTDC_LAYER(LayerIdx
));
858 assert_param(IS_LTDC_HCONFIGST(pLayerCfg
->WindowX0
));
859 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg
->WindowX1
));
860 assert_param(IS_LTDC_VCONFIGST(pLayerCfg
->WindowY0
));
861 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg
->WindowY1
));
862 assert_param(IS_LTDC_CFBLL(XSize
));
863 assert_param(IS_LTDC_CFBLNBR(YSize
));
865 /* update horizontal start/stop */
866 pLayerCfg
->WindowX0
= 0;
867 pLayerCfg
->WindowX1
= XSize
+ pLayerCfg
->WindowX0
;
869 /* update vertical start/stop */
870 pLayerCfg
->WindowY0
= 0;
871 pLayerCfg
->WindowY1
= YSize
+ pLayerCfg
->WindowY0
;
873 /* Reconfigures the color frame buffer pitch in byte */
874 pLayerCfg
->ImageWidth
= XSize
;
876 /* Reconfigures the frame buffer line number */
877 pLayerCfg
->ImageHeight
= YSize
;
879 /* Set LTDC parameters */
880 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
882 /* Sets the Reload type */
883 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
885 /* Change the LTDC state*/
886 hltdc
->State
= HAL_LTDC_STATE_READY
;
888 /* Process unlocked */
895 * @brief Set the LTDC window position.
896 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
897 * the configuration information for the LTDC.
898 * @param X0: LTDC window X offset
899 * @param Y0: LTDC window Y offset
900 * @param LayerIdx: LTDC Layer index.
901 * This parameter can be one of the following values:
905 HAL_StatusTypeDef
HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef
*hltdc
, uint32_t X0
, uint32_t Y0
, uint32_t LayerIdx
)
907 LTDC_LayerCfgTypeDef
*pLayerCfg
;
912 /* Change LTDC peripheral state */
913 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
915 /* Get layer configuration from handle structure */
916 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
918 /* Check the parameters */
919 assert_param(IS_LTDC_LAYER(LayerIdx
));
920 assert_param(IS_LTDC_HCONFIGST(pLayerCfg
->WindowX0
));
921 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg
->WindowX1
));
922 assert_param(IS_LTDC_VCONFIGST(pLayerCfg
->WindowY0
));
923 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg
->WindowY1
));
925 /* update horizontal start/stop */
926 pLayerCfg
->WindowX0
= X0
;
927 pLayerCfg
->WindowX1
= X0
+ pLayerCfg
->ImageWidth
;
929 /* update vertical start/stop */
930 pLayerCfg
->WindowY0
= Y0
;
931 pLayerCfg
->WindowY1
= Y0
+ pLayerCfg
->ImageHeight
;
933 /* Set LTDC parameters */
934 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
936 /* Sets the Reload type */
937 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
939 /* Change the LTDC state*/
940 hltdc
->State
= HAL_LTDC_STATE_READY
;
942 /* Process unlocked */
949 * @brief Reconfigure the pixel format.
950 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
951 * the configuration information for the LTDC.
952 * @param Pixelformat: new pixel format value.
953 * @param LayerIdx: LTDC Layer index.
954 * This parameter can be one of the following values:
958 HAL_StatusTypeDef
HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef
*hltdc
, uint32_t Pixelformat
, uint32_t LayerIdx
)
960 LTDC_LayerCfgTypeDef
*pLayerCfg
;
965 /* Change LTDC peripheral state */
966 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
968 /* Check the parameters */
969 assert_param(IS_LTDC_LAYER(LayerIdx
));
970 assert_param(IS_LTDC_PIXEL_FORMAT(Pixelformat
));
972 /* Get layer configuration from handle structure */
973 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
975 /* Reconfigure the pixel format */
976 pLayerCfg
->PixelFormat
= Pixelformat
;
978 /* Set LTDC parameters */
979 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
981 /* Sets the Reload type */
982 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
984 /* Change the LTDC state*/
985 hltdc
->State
= HAL_LTDC_STATE_READY
;
987 /* Process unlocked */
994 * @brief Reconfigure the layer alpha value.
995 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
996 * the configuration information for the LTDC.
997 * @param Alpha: new alpha value.
998 * @param LayerIdx: LTDC Layer index.
999 * This parameter can be one of the following values:
1001 * @retval HAL status
1003 HAL_StatusTypeDef
HAL_LTDC_SetAlpha(LTDC_HandleTypeDef
*hltdc
, uint32_t Alpha
, uint32_t LayerIdx
)
1005 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1007 /* Process locked */
1010 /* Change LTDC peripheral state */
1011 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1013 /* Check the parameters */
1014 assert_param(IS_LTDC_ALPHA(Alpha
));
1015 assert_param(IS_LTDC_LAYER(LayerIdx
));
1017 /* Get layer configuration from handle structure */
1018 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1020 /* Reconfigure the Alpha value */
1021 pLayerCfg
->Alpha
= Alpha
;
1023 /* Set LTDC parameters */
1024 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1026 /* Sets the Reload type */
1027 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
1029 /* Change the LTDC state*/
1030 hltdc
->State
= HAL_LTDC_STATE_READY
;
1032 /* Process unlocked */
1033 __HAL_UNLOCK(hltdc
);
1038 * @brief Reconfigure the frame buffer Address.
1039 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1040 * the configuration information for the LTDC.
1041 * @param Address: new address value.
1042 * @param LayerIdx: LTDC Layer index.
1043 * This parameter can be one of the following values:
1045 * @retval HAL status
1047 HAL_StatusTypeDef
HAL_LTDC_SetAddress(LTDC_HandleTypeDef
*hltdc
, uint32_t Address
, uint32_t LayerIdx
)
1049 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1051 /* Process locked */
1054 /* Change LTDC peripheral state */
1055 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1057 /* Check the parameters */
1058 assert_param(IS_LTDC_LAYER(LayerIdx
));
1060 /* Get layer configuration from handle structure */
1061 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1063 /* Reconfigure the Address */
1064 pLayerCfg
->FBStartAdress
= Address
;
1066 /* Set LTDC parameters */
1067 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1069 /* Sets the Reload type */
1070 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
1072 /* Change the LTDC state*/
1073 hltdc
->State
= HAL_LTDC_STATE_READY
;
1075 /* Process unlocked */
1076 __HAL_UNLOCK(hltdc
);
1082 * @brief Function used to reconfigure the pitch for specific cases where the attached LayerIdx buffer have a width that is
1083 * larger than the one intended to be displayed on screen. Example of a buffer 800x480 attached to layer for which we
1084 * want to read and display on screen only a portion 320x240 taken in the center of the buffer. The pitch in pixels
1085 * will be in that case 800 pixels and not 320 pixels as initially configured by previous call to HAL_LTDC_ConfigLayer().
1086 * Note : this function should be called only after a previous call to HAL_LTDC_ConfigLayer() to modify the default pitch
1087 * configured by HAL_LTDC_ConfigLayer() when required (refer to example described just above).
1088 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1089 * the configuration information for the LTDC.
1090 * @param LinePitchInPixels: New line pitch in pixels to configure for LTDC layer 'LayerIdx'.
1091 * @param LayerIdx: LTDC layer index concerned by the modification of line pitch.
1092 * @retval HAL status
1094 HAL_StatusTypeDef
HAL_LTDC_SetPitch(LTDC_HandleTypeDef
*hltdc
, uint32_t LinePitchInPixels
, uint32_t LayerIdx
)
1097 uint32_t pitchUpdate
= 0;
1098 uint32_t pixelFormat
= 0;
1100 /* Process locked */
1103 /* Change LTDC peripheral state */
1104 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1106 /* Check the parameters */
1107 assert_param(IS_LTDC_LAYER(LayerIdx
));
1109 /* get LayerIdx used pixel format */
1110 pixelFormat
= hltdc
->LayerCfg
[LayerIdx
].PixelFormat
;
1112 if(pixelFormat
== LTDC_PIXEL_FORMAT_ARGB8888
)
1116 else if (pixelFormat
== LTDC_PIXEL_FORMAT_RGB888
)
1120 else if((pixelFormat
== LTDC_PIXEL_FORMAT_ARGB4444
) || \
1121 (pixelFormat
== LTDC_PIXEL_FORMAT_RGB565
) || \
1122 (pixelFormat
== LTDC_PIXEL_FORMAT_ARGB1555
) || \
1123 (pixelFormat
== LTDC_PIXEL_FORMAT_AL88
))
1132 pitchUpdate
= ((LinePitchInPixels
* tmp
) << 16);
1134 /* Clear previously set standard pitch */
1135 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLR
&= ~LTDC_LxCFBLR_CFBP
;
1137 /* Sets the Reload type as immediate update of LTDC pitch configured above */
1138 LTDC
->SRCR
|= LTDC_SRCR_IMR
;
1140 /* Set new line pitch value */
1141 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLR
|= pitchUpdate
;
1143 /* Sets the Reload type as immediate update of LTDC pitch configured above */
1144 LTDC
->SRCR
|= LTDC_SRCR_IMR
;
1146 /* Change the LTDC state*/
1147 hltdc
->State
= HAL_LTDC_STATE_READY
;
1149 /* Process unlocked */
1150 __HAL_UNLOCK(hltdc
);
1156 * @brief Define the position of the line interrupt.
1157 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1158 * the configuration information for the LTDC.
1159 * @param Line: Line Interrupt Position.
1160 * @retval HAL status
1162 HAL_StatusTypeDef
HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef
*hltdc
, uint32_t Line
)
1164 /* Process locked */
1167 /* Change LTDC peripheral state */
1168 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1170 /* Check the parameters */
1171 assert_param(IS_LTDC_LIPOS(Line
));
1173 /* Enable the Line interrupt */
1174 __HAL_LTDC_ENABLE_IT(hltdc
, LTDC_IT_LI
);
1176 /* Sets the Line Interrupt position */
1177 LTDC
->LIPCR
= (uint32_t)Line
;
1179 /* Change the LTDC state*/
1180 hltdc
->State
= HAL_LTDC_STATE_READY
;
1182 /* Process unlocked */
1183 __HAL_UNLOCK(hltdc
);
1189 * @brief LTDC configuration reload.
1190 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1191 * the configuration information for the LTDC.
1192 * @param ReloadType: This parameter can be one of the following values :
1193 * LTDC_RELOAD_IMMEDIATE : Immediate Reload
1194 * LTDC_RELOAD_VERTICAL_BLANKING : Reload in the next Vertical Blanking
1195 * @retval HAL status
1197 HAL_StatusTypeDef
HAL_LTDC_Reload(LTDC_HandleTypeDef
*hltdc
, uint32_t ReloadType
)
1199 assert_param(IS_LTDC_RELAOD(ReloadType
));
1201 /* Process locked */
1204 /* Change LTDC peripheral state */
1205 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1207 /* Enable the Reload interrupt */
1208 __HAL_LTDC_ENABLE_IT(hltdc
, LTDC_IT_RR
);
1210 /* Apply Reload type */
1211 hltdc
->Instance
->SRCR
= ReloadType
;
1213 /* Change the LTDC state*/
1214 hltdc
->State
= HAL_LTDC_STATE_READY
;
1216 /* Process unlocked */
1217 __HAL_UNLOCK(hltdc
);
1223 * @brief Configure the LTDC Layer according to the specified without reloading
1224 * parameters in the LTDC_InitTypeDef and create the associated handle.
1225 * Variant of the function HAL_LTDC_ConfigLayer without immediate reload
1226 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1227 * the configuration information for the LTDC.
1228 * @param pLayerCfg: pointer to a LTDC_LayerCfgTypeDef structure that contains
1229 * the configuration information for the Layer.
1230 * @param LayerIdx: LTDC Layer index.
1231 * This parameter can be one of the following values:
1233 * @retval HAL status
1235 HAL_StatusTypeDef
HAL_LTDC_ConfigLayer_NoReload(LTDC_HandleTypeDef
*hltdc
, LTDC_LayerCfgTypeDef
*pLayerCfg
, uint32_t LayerIdx
)
1237 /* Process locked */
1240 /* Change LTDC peripheral state */
1241 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1243 /* Check the parameters */
1244 assert_param(IS_LTDC_LAYER(LayerIdx
));
1245 assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg
->PixelFormat
));
1246 assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg
->BlendingFactor1
));
1247 assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg
->BlendingFactor2
));
1248 assert_param(IS_LTDC_HCONFIGST(pLayerCfg
->WindowX0
));
1249 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg
->WindowX1
));
1250 assert_param(IS_LTDC_VCONFIGST(pLayerCfg
->WindowY0
));
1251 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg
->WindowY1
));
1252 assert_param(IS_LTDC_ALPHA(pLayerCfg
->Alpha0
));
1253 assert_param(IS_LTDC_CFBLL(pLayerCfg
->ImageWidth
));
1254 assert_param(IS_LTDC_CFBLNBR(pLayerCfg
->ImageHeight
));
1256 /* Copy new layer configuration into handle structure */
1257 hltdc
->LayerCfg
[LayerIdx
] = *pLayerCfg
;
1259 /* Configure the LTDC Layer */
1260 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1262 /* Do not Sets the Reload */
1264 /* Initialize the LTDC state*/
1265 hltdc
->State
= HAL_LTDC_STATE_READY
;
1267 /* Process unlocked */
1268 __HAL_UNLOCK(hltdc
);
1274 * @brief Set the LTDC window size without reloading.
1275 * Variant of the function HAL_LTDC_SetWindowSize without immediate reload
1276 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1277 * the configuration information for the LTDC.
1278 * @param XSize: LTDC Pixel per line
1279 * @param YSize: LTDC Line number
1280 * @param LayerIdx: LTDC Layer index.
1281 * This parameter can be one of the following values:
1283 * @retval HAL status
1285 HAL_StatusTypeDef
HAL_LTDC_SetWindowSize_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t XSize
, uint32_t YSize
, uint32_t LayerIdx
)
1287 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1289 /* Process locked */
1292 /* Change LTDC peripheral state */
1293 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1295 /* Get layer configuration from handle structure */
1296 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1298 /* Check the parameters (Layers parameters)*/
1299 assert_param(IS_LTDC_LAYER(LayerIdx
));
1300 assert_param(IS_LTDC_HCONFIGST(pLayerCfg
->WindowX0
));
1301 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg
->WindowX1
));
1302 assert_param(IS_LTDC_VCONFIGST(pLayerCfg
->WindowY0
));
1303 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg
->WindowY1
));
1304 assert_param(IS_LTDC_CFBLL(XSize
));
1305 assert_param(IS_LTDC_CFBLNBR(YSize
));
1307 /* update horizontal start/stop */
1308 pLayerCfg
->WindowX0
= 0;
1309 pLayerCfg
->WindowX1
= XSize
+ pLayerCfg
->WindowX0
;
1311 /* update vertical start/stop */
1312 pLayerCfg
->WindowY0
= 0;
1313 pLayerCfg
->WindowY1
= YSize
+ pLayerCfg
->WindowY0
;
1315 /* Reconfigures the color frame buffer pitch in byte */
1316 pLayerCfg
->ImageWidth
= XSize
;
1318 /* Reconfigures the frame buffer line number */
1319 pLayerCfg
->ImageHeight
= YSize
;
1321 /* Set LTDC parameters */
1322 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1324 /* Do not Sets the Reload */
1326 /* Change the LTDC state*/
1327 hltdc
->State
= HAL_LTDC_STATE_READY
;
1329 /* Process unlocked */
1330 __HAL_UNLOCK(hltdc
);
1336 * @brief Set the LTDC window position without reloading.
1337 * Variant of the function HAL_LTDC_SetWindowPosition without immediate reload
1338 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1339 * the configuration information for the LTDC.
1340 * @param X0: LTDC window X offset
1341 * @param Y0: LTDC window Y offset
1342 * @param LayerIdx: LTDC Layer index.
1343 * This parameter can be one of the following values:
1345 * @retval HAL status
1347 HAL_StatusTypeDef
HAL_LTDC_SetWindowPosition_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t X0
, uint32_t Y0
, uint32_t LayerIdx
)
1349 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1351 /* Process locked */
1354 /* Change LTDC peripheral state */
1355 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1357 /* Get layer configuration from handle structure */
1358 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1360 /* Check the parameters */
1361 assert_param(IS_LTDC_LAYER(LayerIdx
));
1362 assert_param(IS_LTDC_HCONFIGST(pLayerCfg
->WindowX0
));
1363 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg
->WindowX1
));
1364 assert_param(IS_LTDC_VCONFIGST(pLayerCfg
->WindowY0
));
1365 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg
->WindowY1
));
1367 /* update horizontal start/stop */
1368 pLayerCfg
->WindowX0
= X0
;
1369 pLayerCfg
->WindowX1
= X0
+ pLayerCfg
->ImageWidth
;
1371 /* update vertical start/stop */
1372 pLayerCfg
->WindowY0
= Y0
;
1373 pLayerCfg
->WindowY1
= Y0
+ pLayerCfg
->ImageHeight
;
1375 /* Set LTDC parameters */
1376 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1378 /* Do not Sets the Reload */
1380 /* Change the LTDC state*/
1381 hltdc
->State
= HAL_LTDC_STATE_READY
;
1383 /* Process unlocked */
1384 __HAL_UNLOCK(hltdc
);
1390 * @brief Reconfigure the pixel format without reloading.
1391 * Variant of the function HAL_LTDC_SetPixelFormat without immediate reload
1392 * @param hltdc: pointer to a LTDC_HandleTypeDfef structure that contains
1393 * the configuration information for the LTDC.
1394 * @param Pixelformat: new pixel format value.
1395 * @param LayerIdx: LTDC Layer index.
1396 * This parameter can be one of the following values:
1398 * @retval HAL status
1400 HAL_StatusTypeDef
HAL_LTDC_SetPixelFormat_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t Pixelformat
, uint32_t LayerIdx
)
1402 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1404 /* Process locked */
1407 /* Change LTDC peripheral state */
1408 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1410 /* Check the parameters */
1411 assert_param(IS_LTDC_LAYER(LayerIdx
));
1412 assert_param(IS_LTDC_PIXEL_FORMAT(Pixelformat
));
1414 /* Get layer configuration from handle structure */
1415 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1417 /* Reconfigure the pixel format */
1418 pLayerCfg
->PixelFormat
= Pixelformat
;
1420 /* Set LTDC parameters */
1421 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1423 /* Do not Sets the Reload */
1425 /* Change the LTDC state*/
1426 hltdc
->State
= HAL_LTDC_STATE_READY
;
1428 /* Process unlocked */
1429 __HAL_UNLOCK(hltdc
);
1435 * @brief Reconfigure the layer alpha value without reloading.
1436 * Variant of the function HAL_LTDC_SetAlpha without immediate reload
1437 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1438 * the configuration information for the LTDC.
1439 * @param Alpha: new alpha value.
1440 * @param LayerIdx: LTDC Layer index.
1441 * This parameter can be one of the following values:
1443 * @retval HAL status
1445 HAL_StatusTypeDef
HAL_LTDC_SetAlpha_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t Alpha
, uint32_t LayerIdx
)
1447 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1449 /* Process locked */
1452 /* Change LTDC peripheral state */
1453 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1455 /* Check the parameters */
1456 assert_param(IS_LTDC_ALPHA(Alpha
));
1457 assert_param(IS_LTDC_LAYER(LayerIdx
));
1459 /* Get layer configuration from handle structure */
1460 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1462 /* Reconfigure the Alpha value */
1463 pLayerCfg
->Alpha
= Alpha
;
1465 /* Set LTDC parameters */
1466 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1468 /* Do not Sets the Reload */
1470 /* Change the LTDC state*/
1471 hltdc
->State
= HAL_LTDC_STATE_READY
;
1473 /* Process unlocked */
1474 __HAL_UNLOCK(hltdc
);
1480 * @brief Reconfigure the frame buffer Address without reloading.
1481 * Variant of the function HAL_LTDC_SetAddress without immediate reload
1482 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1483 * the configuration information for the LTDC.
1484 * @param Address: new address value.
1485 * @param LayerIdx: LTDC Layer index.
1486 * This parameter can be one of the following values:
1488 * @retval HAL status
1490 HAL_StatusTypeDef
HAL_LTDC_SetAddress_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t Address
, uint32_t LayerIdx
)
1492 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1494 /* Process locked */
1497 /* Change LTDC peripheral state */
1498 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1500 /* Check the parameters */
1501 assert_param(IS_LTDC_LAYER(LayerIdx
));
1503 /* Get layer configuration from handle structure */
1504 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1506 /* Reconfigure the Address */
1507 pLayerCfg
->FBStartAdress
= Address
;
1509 /* Set LTDC parameters */
1510 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1512 /* Do not Sets the Reload */
1514 /* Change the LTDC state*/
1515 hltdc
->State
= HAL_LTDC_STATE_READY
;
1517 /* Process unlocked */
1518 __HAL_UNLOCK(hltdc
);
1524 * @brief Function used to reconfigure the pitch for specific cases where the attached LayerIdx buffer have a width that is
1525 * larger than the one intended to be displayed on screen. Example of a buffer 800x480 attached to layer for which we
1526 * want to read and display on screen only a portion 320x240 taken in the center of the buffer. The pitch in pixels
1527 * will be in that case 800 pixels and not 320 pixels as initially configured by previous call to HAL_LTDC_ConfigLayer().
1528 * Note : this function should be called only after a previous call to HAL_LTDC_ConfigLayer() to modify the default pitch
1529 * configured by HAL_LTDC_ConfigLayer() when required (refer to example described just above).
1530 * Variant of the function HAL_LTDC_SetPitch without immediate reload
1531 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1532 * the configuration information for the LTDC.
1533 * @param LinePitchInPixels: New line pitch in pixels to configure for LTDC layer 'LayerIdx'.
1534 * @param LayerIdx: LTDC layer index concerned by the modification of line pitch.
1535 * @retval HAL status
1537 HAL_StatusTypeDef
HAL_LTDC_SetPitch_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t LinePitchInPixels
, uint32_t LayerIdx
)
1540 uint32_t pitchUpdate
= 0;
1541 uint32_t pixelFormat
= 0;
1543 /* Process locked */
1546 /* Change LTDC peripheral state */
1547 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1549 /* Check the parameters */
1550 assert_param(IS_LTDC_LAYER(LayerIdx
));
1552 /* get LayerIdx used pixel format */
1553 pixelFormat
= hltdc
->LayerCfg
[LayerIdx
].PixelFormat
;
1555 if(pixelFormat
== LTDC_PIXEL_FORMAT_ARGB8888
)
1559 else if (pixelFormat
== LTDC_PIXEL_FORMAT_RGB888
)
1563 else if((pixelFormat
== LTDC_PIXEL_FORMAT_ARGB4444
) || \
1564 (pixelFormat
== LTDC_PIXEL_FORMAT_RGB565
) || \
1565 (pixelFormat
== LTDC_PIXEL_FORMAT_ARGB1555
) || \
1566 (pixelFormat
== LTDC_PIXEL_FORMAT_AL88
))
1575 pitchUpdate
= ((LinePitchInPixels
* tmp
) << 16);
1577 /* Clear previously set standard pitch */
1578 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLR
&= ~LTDC_LxCFBLR_CFBP
;
1580 /* Set new line pitch value */
1581 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLR
|= pitchUpdate
;
1583 /* Do not Sets the Reload */
1585 /* Change the LTDC state*/
1586 hltdc
->State
= HAL_LTDC_STATE_READY
;
1588 /* Process unlocked */
1589 __HAL_UNLOCK(hltdc
);
1596 * @brief Configure the color keying without reloading.
1597 * Variant of the function HAL_LTDC_ConfigColorKeying without immediate reload
1598 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1599 * the configuration information for the LTDC.
1600 * @param RGBValue: the color key value
1601 * @param LayerIdx: LTDC Layer index.
1602 * This parameter can be one of the following values:
1604 * @retval HAL status
1606 HAL_StatusTypeDef
HAL_LTDC_ConfigColorKeying_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t RGBValue
, uint32_t LayerIdx
)
1608 /* Process locked */
1611 /* Change LTDC peripheral state */
1612 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1614 /* Check the parameters */
1615 assert_param(IS_LTDC_LAYER(LayerIdx
));
1617 /* Configures the default color values */
1618 LTDC_LAYER(hltdc
, LayerIdx
)->CKCR
&= ~(LTDC_LxCKCR_CKBLUE
| LTDC_LxCKCR_CKGREEN
| LTDC_LxCKCR_CKRED
);
1619 LTDC_LAYER(hltdc
, LayerIdx
)->CKCR
= RGBValue
;
1621 /* Do not Sets the Reload */
1623 /* Change the LTDC state*/
1624 hltdc
->State
= HAL_LTDC_STATE_READY
;
1626 /* Process unlocked */
1627 __HAL_UNLOCK(hltdc
);
1633 * @brief Enable the color keying without reloading.
1634 * Variant of the function HAL_LTDC_EnableColorKeying without immediate reload
1635 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1636 * the configuration information for the LTDC.
1637 * @param LayerIdx: LTDC Layer index.
1638 * This parameter can be one of the following values:
1640 * @retval HAL status
1642 HAL_StatusTypeDef
HAL_LTDC_EnableColorKeying_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
1644 /* Process locked */
1647 /* Change LTDC peripheral state */
1648 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1650 /* Check the parameters */
1651 assert_param(IS_LTDC_LAYER(LayerIdx
));
1653 /* Enable LTDC color keying by setting COLKEN bit */
1654 LTDC_LAYER(hltdc
, LayerIdx
)->CR
|= (uint32_t)LTDC_LxCR_COLKEN
;
1656 /* Do not Sets the Reload */
1658 /* Change the LTDC state*/
1659 hltdc
->State
= HAL_LTDC_STATE_READY
;
1661 /* Process unlocked */
1662 __HAL_UNLOCK(hltdc
);
1668 * @brief Disable the color keying without reloading.
1669 * Variant of the function HAL_LTDC_DisableColorKeying without immediate reload
1670 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1671 * the configuration information for the LTDC.
1672 * @param LayerIdx: LTDC Layer index.
1673 * This parameter can be one of the following values:
1675 * @retval HAL status
1677 HAL_StatusTypeDef
HAL_LTDC_DisableColorKeying_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
1679 /* Process locked */
1682 /* Change LTDC peripheral state */
1683 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1685 /* Check the parameters */
1686 assert_param(IS_LTDC_LAYER(LayerIdx
));
1688 /* Disable LTDC color keying by setting COLKEN bit */
1689 LTDC_LAYER(hltdc
, LayerIdx
)->CR
&= ~(uint32_t)LTDC_LxCR_COLKEN
;
1691 /* Do not Sets the Reload */
1693 /* Change the LTDC state*/
1694 hltdc
->State
= HAL_LTDC_STATE_READY
;
1696 /* Process unlocked */
1697 __HAL_UNLOCK(hltdc
);
1703 * @brief Enable the color lookup table without reloading.
1704 * Variant of the function HAL_LTDC_EnableCLUT without immediate reload
1705 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1706 * the configuration information for the LTDC.
1707 * @param LayerIdx: LTDC Layer index.
1708 * This parameter can be one of the following values:
1710 * @retval HAL status
1712 HAL_StatusTypeDef
HAL_LTDC_EnableCLUT_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
1715 /* Process locked */
1718 /* Change LTDC peripheral state */
1719 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1721 /* Check the parameters */
1722 assert_param(IS_LTDC_LAYER(LayerIdx
));
1724 /* Disable LTDC color lookup table by setting CLUTEN bit */
1725 LTDC_LAYER(hltdc
, LayerIdx
)->CR
|= (uint32_t)LTDC_LxCR_CLUTEN
;
1727 /* Do not Sets the Reload */
1729 /* Change the LTDC state*/
1730 hltdc
->State
= HAL_LTDC_STATE_READY
;
1732 /* Process unlocked */
1733 __HAL_UNLOCK(hltdc
);
1739 * @brief Disable the color lookup table without reloading.
1740 * Variant of the function HAL_LTDC_DisableCLUT without immediate reload
1741 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1742 * the configuration information for the LTDC.
1743 * @param LayerIdx: LTDC Layer index.
1744 * This parameter can be one of the following values:
1746 * @retval HAL status
1748 HAL_StatusTypeDef
HAL_LTDC_DisableCLUT_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
1751 /* Process locked */
1754 /* Change LTDC peripheral state */
1755 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1757 /* Check the parameters */
1758 assert_param(IS_LTDC_LAYER(LayerIdx
));
1760 /* Disable LTDC color lookup table by setting CLUTEN bit */
1761 LTDC_LAYER(hltdc
, LayerIdx
)->CR
&= ~(uint32_t)LTDC_LxCR_CLUTEN
;
1763 /* Do not Sets the Reload */
1765 /* Change the LTDC state*/
1766 hltdc
->State
= HAL_LTDC_STATE_READY
;
1768 /* Process unlocked */
1769 __HAL_UNLOCK(hltdc
);
1778 /** @defgroup LTDC_Exported_Functions_Group4 Peripheral State and Errors functions
1779 * @brief Peripheral State and Errors functions
1782 ===============================================================================
1783 ##### Peripheral State and Errors functions #####
1784 ===============================================================================
1786 This subsection provides functions allowing to
1787 (+) Check the LTDC state.
1795 * @brief Return the LTDC state
1796 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
1797 * the configuration information for the LTDC.
1800 HAL_LTDC_StateTypeDef
HAL_LTDC_GetState(LTDC_HandleTypeDef
*hltdc
)
1802 return hltdc
->State
;
1806 * @brief Return the LTDC error code
1807 * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains
1808 * the configuration information for the LTDC.
1809 * @retval LTDC Error Code
1811 uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef
*hltdc
)
1813 return hltdc
->ErrorCode
;
1821 * @brief Configures the LTDC peripheral
1822 * @param hltdc : Pointer to a LTDC_HandleTypeDef structure that contains
1823 * the configuration information for the LTDC.
1824 * @param pLayerCfg: Pointer LTDC Layer Configuration structure
1825 * @param LayerIdx: LTDC Layer index.
1826 * This parameter can be one of the following values: 0 or 1
1829 static void LTDC_SetConfig(LTDC_HandleTypeDef
*hltdc
, LTDC_LayerCfgTypeDef
*pLayerCfg
, uint32_t LayerIdx
)
1835 /* Configures the horizontal start and stop position */
1836 tmp
= ((pLayerCfg
->WindowX1
+ ((hltdc
->Instance
->BPCR
& LTDC_BPCR_AHBP
) >> 16)) << 16);
1837 LTDC_LAYER(hltdc
, LayerIdx
)->WHPCR
&= ~(LTDC_LxWHPCR_WHSTPOS
| LTDC_LxWHPCR_WHSPPOS
);
1838 LTDC_LAYER(hltdc
, LayerIdx
)->WHPCR
= ((pLayerCfg
->WindowX0
+ ((hltdc
->Instance
->BPCR
& LTDC_BPCR_AHBP
) >> 16) + 1) | tmp
);
1840 /* Configures the vertical start and stop position */
1841 tmp
= ((pLayerCfg
->WindowY1
+ (hltdc
->Instance
->BPCR
& LTDC_BPCR_AVBP
)) << 16);
1842 LTDC_LAYER(hltdc
, LayerIdx
)->WVPCR
&= ~(LTDC_LxWVPCR_WVSTPOS
| LTDC_LxWVPCR_WVSPPOS
);
1843 LTDC_LAYER(hltdc
, LayerIdx
)->WVPCR
= ((pLayerCfg
->WindowY0
+ (hltdc
->Instance
->BPCR
& LTDC_BPCR_AVBP
) + 1) | tmp
);
1845 /* Specifies the pixel format */
1846 LTDC_LAYER(hltdc
, LayerIdx
)->PFCR
&= ~(LTDC_LxPFCR_PF
);
1847 LTDC_LAYER(hltdc
, LayerIdx
)->PFCR
= (pLayerCfg
->PixelFormat
);
1849 /* Configures the default color values */
1850 tmp
= ((uint32_t)(pLayerCfg
->Backcolor
.Green
) << 8);
1851 tmp1
= ((uint32_t)(pLayerCfg
->Backcolor
.Red
) << 16);
1852 tmp2
= (pLayerCfg
->Alpha0
<< 24);
1853 LTDC_LAYER(hltdc
, LayerIdx
)->DCCR
&= ~(LTDC_LxDCCR_DCBLUE
| LTDC_LxDCCR_DCGREEN
| LTDC_LxDCCR_DCRED
| LTDC_LxDCCR_DCALPHA
);
1854 LTDC_LAYER(hltdc
, LayerIdx
)->DCCR
= (pLayerCfg
->Backcolor
.Blue
| tmp
| tmp1
| tmp2
);
1856 /* Specifies the constant alpha value */
1857 LTDC_LAYER(hltdc
, LayerIdx
)->CACR
&= ~(LTDC_LxCACR_CONSTA
);
1858 LTDC_LAYER(hltdc
, LayerIdx
)->CACR
= (pLayerCfg
->Alpha
);
1860 /* Specifies the blending factors */
1861 LTDC_LAYER(hltdc
, LayerIdx
)->BFCR
&= ~(LTDC_LxBFCR_BF2
| LTDC_LxBFCR_BF1
);
1862 LTDC_LAYER(hltdc
, LayerIdx
)->BFCR
= (pLayerCfg
->BlendingFactor1
| pLayerCfg
->BlendingFactor2
);
1864 /* Configures the color frame buffer start address */
1865 LTDC_LAYER(hltdc
, LayerIdx
)->CFBAR
&= ~(LTDC_LxCFBAR_CFBADD
);
1866 LTDC_LAYER(hltdc
, LayerIdx
)->CFBAR
= (pLayerCfg
->FBStartAdress
);
1868 if(pLayerCfg
->PixelFormat
== LTDC_PIXEL_FORMAT_ARGB8888
)
1872 else if (pLayerCfg
->PixelFormat
== LTDC_PIXEL_FORMAT_RGB888
)
1876 else if((pLayerCfg
->PixelFormat
== LTDC_PIXEL_FORMAT_ARGB4444
) || \
1877 (pLayerCfg
->PixelFormat
== LTDC_PIXEL_FORMAT_RGB565
) || \
1878 (pLayerCfg
->PixelFormat
== LTDC_PIXEL_FORMAT_ARGB1555
) || \
1879 (pLayerCfg
->PixelFormat
== LTDC_PIXEL_FORMAT_AL88
))
1888 /* Configures the color frame buffer pitch in byte */
1889 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLR
&= ~(LTDC_LxCFBLR_CFBLL
| LTDC_LxCFBLR_CFBP
);
1890 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLR
= (((pLayerCfg
->ImageWidth
* tmp
) << 16) | (((pLayerCfg
->WindowX1
- pLayerCfg
->WindowX0
) * tmp
) + 3));
1892 /* Configures the frame buffer line number */
1893 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLNR
&= ~(LTDC_LxCFBLNR_CFBLNBR
);
1894 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLNR
= (pLayerCfg
->ImageHeight
);
1896 /* Enable LTDC_Layer by setting LEN bit */
1897 LTDC_LAYER(hltdc
, LayerIdx
)->CR
|= (uint32_t)LTDC_LxCR_LEN
;
1904 #endif /* HAL_LTDC_MODULE_ENABLED */
1909 #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
1915 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/