2 ******************************************************************************
3 * @file stm32f4xx_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 a LTDC Layer.
70 (+) __HAL_LTDC_LAYER_DISABLE: Disable a LTDC Layer.
71 (+) __HAL_LTDC_CLEAR_FLAG: Clear the LTDC pending flags.
72 (+) __HAL_LTDC_ENABLE_IT: Enable the specified LTDC interrupts.
73 (+) __HAL_LTDC_DISABLE_IT: Disable the specified LTDC interrupts.
76 (@) You can refer to the LTDC HAL driver header file for more useful macros
79 ******************************************************************************
82 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
84 * Redistribution and use in source and binary forms, with or without modification,
85 * are permitted provided that the following conditions are met:
86 * 1. Redistributions of source code must retain the above copyright notice,
87 * this list of conditions and the following disclaimer.
88 * 2. Redistributions in binary form must reproduce the above copyright notice,
89 * this list of conditions and the following disclaimer in the documentation
90 * and/or other materials provided with the distribution.
91 * 3. Neither the name of STMicroelectronics nor the names of its contributors
92 * may be used to endorse or promote products derived from this software
93 * without specific prior written permission.
95 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
96 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
97 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
98 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
99 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
100 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
101 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
102 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
103 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
104 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
106 ******************************************************************************
109 /* Includes ------------------------------------------------------------------*/
110 #include "stm32f4xx_hal.h"
112 /** @addtogroup STM32F4xx_HAL_Driver
115 /** @defgroup LTDC LTDC
116 * @brief LTDC HAL module driver
120 #ifdef HAL_LTDC_MODULE_ENABLED
122 #if defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
124 /* Private typedef -----------------------------------------------------------*/
125 /* Private define ------------------------------------------------------------*/
126 /* Private macro -------------------------------------------------------------*/
127 /* Private variables ---------------------------------------------------------*/
128 /* Private function prototypes -----------------------------------------------*/
129 static void LTDC_SetConfig(LTDC_HandleTypeDef
*hltdc
, LTDC_LayerCfgTypeDef
*pLayerCfg
, uint32_t LayerIdx
);
130 /* Private functions ---------------------------------------------------------*/
132 /** @defgroup LTDC_Exported_Functions LTDC Exported Functions
136 /** @defgroup LTDC_Exported_Functions_Group1 Initialization and Configuration functions
137 * @brief Initialization and Configuration functions
140 ===============================================================================
141 ##### Initialization and Configuration functions #####
142 ===============================================================================
143 [..] This section provides functions allowing to:
144 (+) Initialize and configure the LTDC
145 (+) De-initialize the LTDC
152 * @brief Initialize the LTDC according to the specified parameters in the LTDC_InitTypeDef.
153 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
154 * the configuration information for the LTDC.
157 HAL_StatusTypeDef
HAL_LTDC_Init(LTDC_HandleTypeDef
*hltdc
)
159 uint32_t tmp
= 0U, tmp1
= 0U;
161 /* Check the LTDC peripheral state */
167 /* Check function parameters */
168 assert_param(IS_LTDC_ALL_INSTANCE(hltdc
->Instance
));
169 assert_param(IS_LTDC_HSYNC(hltdc
->Init
.HorizontalSync
));
170 assert_param(IS_LTDC_VSYNC(hltdc
->Init
.VerticalSync
));
171 assert_param(IS_LTDC_AHBP(hltdc
->Init
.AccumulatedHBP
));
172 assert_param(IS_LTDC_AVBP(hltdc
->Init
.AccumulatedVBP
));
173 assert_param(IS_LTDC_AAH(hltdc
->Init
.AccumulatedActiveH
));
174 assert_param(IS_LTDC_AAW(hltdc
->Init
.AccumulatedActiveW
));
175 assert_param(IS_LTDC_TOTALH(hltdc
->Init
.TotalHeigh
));
176 assert_param(IS_LTDC_TOTALW(hltdc
->Init
.TotalWidth
));
177 assert_param(IS_LTDC_HSPOL(hltdc
->Init
.HSPolarity
));
178 assert_param(IS_LTDC_VSPOL(hltdc
->Init
.VSPolarity
));
179 assert_param(IS_LTDC_DEPOL(hltdc
->Init
.DEPolarity
));
180 assert_param(IS_LTDC_PCPOL(hltdc
->Init
.PCPolarity
));
182 if(hltdc
->State
== HAL_LTDC_STATE_RESET
)
184 /* Allocate lock resource and initialize it */
185 hltdc
->Lock
= HAL_UNLOCKED
;
186 /* Init the low level hardware */
187 HAL_LTDC_MspInit(hltdc
);
190 /* Change LTDC peripheral state */
191 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
193 /* Configure the HS, VS, DE and PC polarity */
194 hltdc
->Instance
->GCR
&= ~(LTDC_GCR_HSPOL
| LTDC_GCR_VSPOL
| LTDC_GCR_DEPOL
| LTDC_GCR_PCPOL
);
195 hltdc
->Instance
->GCR
|= (uint32_t)(hltdc
->Init
.HSPolarity
| hltdc
->Init
.VSPolarity
| \
196 hltdc
->Init
.DEPolarity
| hltdc
->Init
.PCPolarity
);
198 /* Set Synchronization size */
199 hltdc
->Instance
->SSCR
&= ~(LTDC_SSCR_VSH
| LTDC_SSCR_HSW
);
200 tmp
= (hltdc
->Init
.HorizontalSync
<< 16U);
201 hltdc
->Instance
->SSCR
|= (tmp
| hltdc
->Init
.VerticalSync
);
203 /* Set Accumulated Back porch */
204 hltdc
->Instance
->BPCR
&= ~(LTDC_BPCR_AVBP
| LTDC_BPCR_AHBP
);
205 tmp
= (hltdc
->Init
.AccumulatedHBP
<< 16U);
206 hltdc
->Instance
->BPCR
|= (tmp
| hltdc
->Init
.AccumulatedVBP
);
208 /* Set Accumulated Active Width */
209 hltdc
->Instance
->AWCR
&= ~(LTDC_AWCR_AAH
| LTDC_AWCR_AAW
);
210 tmp
= (hltdc
->Init
.AccumulatedActiveW
<< 16U);
211 hltdc
->Instance
->AWCR
|= (tmp
| hltdc
->Init
.AccumulatedActiveH
);
213 /* Set Total Width */
214 hltdc
->Instance
->TWCR
&= ~(LTDC_TWCR_TOTALH
| LTDC_TWCR_TOTALW
);
215 tmp
= (hltdc
->Init
.TotalWidth
<< 16U);
216 hltdc
->Instance
->TWCR
|= (tmp
| hltdc
->Init
.TotalHeigh
);
218 /* Set the background color value */
219 tmp
= ((uint32_t)(hltdc
->Init
.Backcolor
.Green
) << 8U);
220 tmp1
= ((uint32_t)(hltdc
->Init
.Backcolor
.Red
) << 16U);
221 hltdc
->Instance
->BCCR
&= ~(LTDC_BCCR_BCBLUE
| LTDC_BCCR_BCGREEN
| LTDC_BCCR_BCRED
);
222 hltdc
->Instance
->BCCR
|= (tmp1
| tmp
| hltdc
->Init
.Backcolor
.Blue
);
224 /* Enable the Transfer Error and FIFO underrun interrupts */
225 __HAL_LTDC_ENABLE_IT(hltdc
, LTDC_IT_TE
| LTDC_IT_FU
);
227 /* Enable LTDC by setting LTDCEN bit */
228 __HAL_LTDC_ENABLE(hltdc
);
230 /* Initialize the error code */
231 hltdc
->ErrorCode
= HAL_LTDC_ERROR_NONE
;
233 /* Initialize the LTDC state*/
234 hltdc
->State
= HAL_LTDC_STATE_READY
;
240 * @brief De-initialize the LTDC peripheral.
241 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
242 * the configuration information for the LTDC.
246 HAL_StatusTypeDef
HAL_LTDC_DeInit(LTDC_HandleTypeDef
*hltdc
)
248 /* DeInit the low level hardware */
249 HAL_LTDC_MspDeInit(hltdc
);
251 /* Initialize the error code */
252 hltdc
->ErrorCode
= HAL_LTDC_ERROR_NONE
;
254 /* Initialize the LTDC state*/
255 hltdc
->State
= HAL_LTDC_STATE_RESET
;
264 * @brief Initialize the LTDC MSP.
265 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
266 * the configuration information for the LTDC.
269 __weak
void HAL_LTDC_MspInit(LTDC_HandleTypeDef
* hltdc
)
271 /* Prevent unused argument(s) compilation warning */
274 /* NOTE : This function should not be modified, when the callback is needed,
275 the HAL_LTDC_MspInit could be implemented in the user file
280 * @brief De-initialize the LTDC MSP.
281 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
282 * the configuration information for the LTDC.
285 __weak
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef
* hltdc
)
287 /* Prevent unused argument(s) compilation warning */
290 /* NOTE : This function should not be modified, when the callback is needed,
291 the HAL_LTDC_MspDeInit could be implemented in the user file
299 /** @defgroup LTDC_Exported_Functions_Group2 IO operation functions
300 * @brief IO operation functions
303 ===============================================================================
304 ##### IO operation functions #####
305 ===============================================================================
306 [..] This section provides function allowing to:
307 (+) Handle LTDC interrupt request
313 * @brief Handle LTDC interrupt request.
314 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
315 * the configuration information for the LTDC.
318 void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef
*hltdc
)
320 uint32_t isrflags
= READ_REG(hltdc
->Instance
->ISR
);
321 uint32_t itsources
= READ_REG(hltdc
->Instance
->IER
);
323 /* Transfer Error Interrupt management ***************************************/
324 if(((isrflags
& LTDC_ISR_TERRIF
) != RESET
) && ((itsources
& LTDC_IER_TERRIE
) != RESET
))
326 /* Disable the transfer Error interrupt */
327 __HAL_LTDC_DISABLE_IT(hltdc
, LTDC_IT_TE
);
329 /* Clear the transfer error flag */
330 __HAL_LTDC_CLEAR_FLAG(hltdc
, LTDC_FLAG_TE
);
332 /* Update error code */
333 hltdc
->ErrorCode
|= HAL_LTDC_ERROR_TE
;
335 /* Change LTDC state */
336 hltdc
->State
= HAL_LTDC_STATE_ERROR
;
338 /* Process unlocked */
341 /* Transfer error Callback */
342 HAL_LTDC_ErrorCallback(hltdc
);
345 /* FIFO underrun Interrupt management ***************************************/
346 if(((isrflags
& LTDC_ISR_FUIF
) != RESET
) && ((itsources
& LTDC_IER_FUIE
) != RESET
))
348 /* Disable the FIFO underrun interrupt */
349 __HAL_LTDC_DISABLE_IT(hltdc
, LTDC_IT_FU
);
351 /* Clear the FIFO underrun flag */
352 __HAL_LTDC_CLEAR_FLAG(hltdc
, LTDC_FLAG_FU
);
354 /* Update error code */
355 hltdc
->ErrorCode
|= HAL_LTDC_ERROR_FU
;
357 /* Change LTDC state */
358 hltdc
->State
= HAL_LTDC_STATE_ERROR
;
360 /* Process unlocked */
363 /* Transfer error Callback */
364 HAL_LTDC_ErrorCallback(hltdc
);
367 /* Line Interrupt management ************************************************/
368 if(((isrflags
& LTDC_ISR_LIF
) != RESET
) && ((itsources
& LTDC_IER_LIE
) != RESET
))
370 /* Disable the Line interrupt */
371 __HAL_LTDC_DISABLE_IT(hltdc
, LTDC_IT_LI
);
373 /* Clear the Line interrupt flag */
374 __HAL_LTDC_CLEAR_FLAG(hltdc
, LTDC_FLAG_LI
);
376 /* Change LTDC state */
377 hltdc
->State
= HAL_LTDC_STATE_READY
;
379 /* Process unlocked */
382 /* Line interrupt Callback */
383 HAL_LTDC_LineEventCallback(hltdc
);
386 /* Register reload Interrupt management ***************************************/
387 if(((isrflags
& LTDC_ISR_RRIF
) != RESET
) && ((itsources
& LTDC_IER_RRIE
) != RESET
))
389 /* Disable the register reload interrupt */
390 __HAL_LTDC_DISABLE_IT(hltdc
, LTDC_IT_RR
);
392 /* Clear the register reload flag */
393 __HAL_LTDC_CLEAR_FLAG(hltdc
, LTDC_FLAG_RR
);
395 /* Change LTDC state */
396 hltdc
->State
= HAL_LTDC_STATE_READY
;
398 /* Process unlocked */
401 /* Register reload interrupt Callback */
402 HAL_LTDC_ReloadEventCallback(hltdc
);
407 * @brief Error LTDC callback.
408 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
409 * the configuration information for the LTDC.
412 __weak
void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef
*hltdc
)
414 /* Prevent unused argument(s) compilation warning */
417 /* NOTE : This function should not be modified, when the callback is needed,
418 the HAL_LTDC_ErrorCallback could be implemented in the user file
423 * @brief Line Event callback.
424 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
425 * the configuration information for the LTDC.
428 __weak
void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef
*hltdc
)
430 /* Prevent unused argument(s) compilation warning */
433 /* NOTE : This function should not be modified, when the callback is needed,
434 the HAL_LTDC_LineEventCallback could be implemented in the user file
439 * @brief Reload Event callback.
440 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
441 * the configuration information for the LTDC.
444 __weak
void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef
*hltdc
)
446 /* Prevent unused argument(s) compilation warning */
449 /* NOTE : This function should not be modified, when the callback is needed,
450 the HAL_LTDC_ReloadEvenCallback could be implemented in the user file
458 /** @defgroup LTDC_Exported_Functions_Group3 Peripheral Control functions
459 * @brief Peripheral Control functions
462 ===============================================================================
463 ##### Peripheral Control functions #####
464 ===============================================================================
465 [..] This section provides functions allowing to:
466 (+) Configure the LTDC foreground or/and background parameters.
467 (+) Set the active layer.
468 (+) Configure the color keying.
469 (+) Configure the C-LUT.
470 (+) Enable / Disable the color keying.
471 (+) Enable / Disable the C-LUT.
472 (+) Update the layer position.
473 (+) Update the layer size.
474 (+) Update pixel format on the fly.
475 (+) Update transparency on the fly.
476 (+) Update address on the fly.
483 * @brief Configure the LTDC Layer according to the specified
484 * parameters in the LTDC_InitTypeDef and create the associated handle.
485 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
486 * the configuration information for the LTDC.
487 * @param pLayerCfg pointer to a LTDC_LayerCfgTypeDef structure that contains
488 * the configuration information for the Layer.
489 * @param LayerIdx LTDC Layer index.
490 * This parameter can be one of the following values:
491 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
494 HAL_StatusTypeDef
HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef
*hltdc
, LTDC_LayerCfgTypeDef
*pLayerCfg
, uint32_t LayerIdx
)
496 /* Check the parameters */
497 assert_param(IS_LTDC_LAYER(LayerIdx
));
498 assert_param(IS_LTDC_HCONFIGST(pLayerCfg
->WindowX0
));
499 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg
->WindowX1
));
500 assert_param(IS_LTDC_VCONFIGST(pLayerCfg
->WindowY0
));
501 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg
->WindowY1
));
502 assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg
->PixelFormat
));
503 assert_param(IS_LTDC_ALPHA(pLayerCfg
->Alpha
));
504 assert_param(IS_LTDC_ALPHA(pLayerCfg
->Alpha0
));
505 assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg
->BlendingFactor1
));
506 assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg
->BlendingFactor2
));
507 assert_param(IS_LTDC_CFBLL(pLayerCfg
->ImageWidth
));
508 assert_param(IS_LTDC_CFBLNBR(pLayerCfg
->ImageHeight
));
513 /* Change LTDC peripheral state */
514 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
516 /* Copy new layer configuration into handle structure */
517 hltdc
->LayerCfg
[LayerIdx
] = *pLayerCfg
;
519 /* Configure the LTDC Layer */
520 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
522 /* Set the Immediate Reload type */
523 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
525 /* Initialize the LTDC state*/
526 hltdc
->State
= HAL_LTDC_STATE_READY
;
528 /* Process unlocked */
535 * @brief Configure the color keying.
536 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
537 * the configuration information for the LTDC.
538 * @param RGBValue the color key value
539 * @param LayerIdx LTDC Layer index.
540 * This parameter can be one of the following values:
541 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
544 HAL_StatusTypeDef
HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef
*hltdc
, uint32_t RGBValue
, uint32_t LayerIdx
)
546 /* Check the parameters */
547 assert_param(IS_LTDC_LAYER(LayerIdx
));
552 /* Change LTDC peripheral state */
553 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
555 /* Configure the default color values */
556 LTDC_LAYER(hltdc
, LayerIdx
)->CKCR
&= ~(LTDC_LxCKCR_CKBLUE
| LTDC_LxCKCR_CKGREEN
| LTDC_LxCKCR_CKRED
);
557 LTDC_LAYER(hltdc
, LayerIdx
)->CKCR
= RGBValue
;
559 /* Set the Immediate Reload type */
560 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
562 /* Change the LTDC state*/
563 hltdc
->State
= HAL_LTDC_STATE_READY
;
565 /* Process unlocked */
572 * @brief Load the color lookup table.
573 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
574 * the configuration information for the LTDC.
575 * @param pCLUT pointer to the color lookup table address.
576 * @param CLUTSize the color lookup table size.
577 * @param LayerIdx LTDC Layer index.
578 * This parameter can be one of the following values:
579 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
582 HAL_StatusTypeDef
HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef
*hltdc
, uint32_t *pCLUT
, uint32_t CLUTSize
, uint32_t LayerIdx
)
585 uint32_t counter
= 0U;
586 uint32_t pcounter
= 0U;
588 /* Check the parameters */
589 assert_param(IS_LTDC_LAYER(LayerIdx
));
594 /* Change LTDC peripheral state */
595 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
597 for(counter
= 0U; (counter
< CLUTSize
); counter
++)
599 if(hltdc
->LayerCfg
[LayerIdx
].PixelFormat
== LTDC_PIXEL_FORMAT_AL44
)
601 tmp
= (((counter
+ 16U*counter
) << 24U) | ((uint32_t)(*pCLUT
) & 0xFFU
) | ((uint32_t)(*pCLUT
) & 0xFF00U
) | ((uint32_t)(*pCLUT
) & 0xFF0000U
));
605 tmp
= ((counter
<< 24U) | ((uint32_t)(*pCLUT
) & 0xFFU
) | ((uint32_t)(*pCLUT
) & 0xFF00U
) | ((uint32_t)(*pCLUT
) & 0xFF0000U
));
607 pcounter
= (uint32_t)pCLUT
+ sizeof(*pCLUT
);
608 pCLUT
= (uint32_t *)pcounter
;
610 /* Specifies the C-LUT address and RGB value */
611 LTDC_LAYER(hltdc
, LayerIdx
)->CLUTWR
= tmp
;
614 /* Change the LTDC state*/
615 hltdc
->State
= HAL_LTDC_STATE_READY
;
617 /* Process unlocked */
624 * @brief Enable the color keying.
625 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
626 * the configuration information for the LTDC.
627 * @param LayerIdx LTDC Layer index.
628 * This parameter can be one of the following values:
629 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
632 HAL_StatusTypeDef
HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
634 /* Check the parameters */
635 assert_param(IS_LTDC_LAYER(LayerIdx
));
640 /* Change LTDC peripheral state */
641 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
643 /* Enable LTDC color keying by setting COLKEN bit */
644 LTDC_LAYER(hltdc
, LayerIdx
)->CR
|= (uint32_t)LTDC_LxCR_COLKEN
;
646 /* Set the Immediate Reload type */
647 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
649 /* Change the LTDC state*/
650 hltdc
->State
= HAL_LTDC_STATE_READY
;
652 /* Process unlocked */
659 * @brief Disable the color keying.
660 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
661 * the configuration information for the LTDC.
662 * @param LayerIdx LTDC Layer index.
663 * This parameter can be one of the following values:
664 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
667 HAL_StatusTypeDef
HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
669 /* Check the parameters */
670 assert_param(IS_LTDC_LAYER(LayerIdx
));
675 /* Change LTDC peripheral state */
676 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
678 /* Disable LTDC color keying by setting COLKEN bit */
679 LTDC_LAYER(hltdc
, LayerIdx
)->CR
&= ~(uint32_t)LTDC_LxCR_COLKEN
;
681 /* Set the Immediate Reload type */
682 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
684 /* Change the LTDC state*/
685 hltdc
->State
= HAL_LTDC_STATE_READY
;
687 /* Process unlocked */
694 * @brief Enable the color lookup table.
695 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
696 * the configuration information for the LTDC.
697 * @param LayerIdx LTDC Layer index.
698 * This parameter can be one of the following values:
699 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
702 HAL_StatusTypeDef
HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
704 /* Check the parameters */
705 assert_param(IS_LTDC_LAYER(LayerIdx
));
710 /* Change LTDC peripheral state */
711 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
713 /* Enable LTDC color lookup table by setting CLUTEN bit */
714 LTDC_LAYER(hltdc
, LayerIdx
)->CR
|= (uint32_t)LTDC_LxCR_CLUTEN
;
716 /* Set the Immediate Reload type */
717 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
719 /* Change the LTDC state*/
720 hltdc
->State
= HAL_LTDC_STATE_READY
;
722 /* Process unlocked */
729 * @brief Disable the color lookup table.
730 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
731 * the configuration information for the LTDC.
732 * @param LayerIdx LTDC Layer index.
733 * This parameter can be one of the following values:
734 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
737 HAL_StatusTypeDef
HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
739 /* Check the parameters */
740 assert_param(IS_LTDC_LAYER(LayerIdx
));
745 /* Change LTDC peripheral state */
746 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
748 /* Disable LTDC color lookup table by setting CLUTEN bit */
749 LTDC_LAYER(hltdc
, LayerIdx
)->CR
&= ~(uint32_t)LTDC_LxCR_CLUTEN
;
751 /* Set the Immediate Reload type */
752 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
754 /* Change the LTDC state*/
755 hltdc
->State
= HAL_LTDC_STATE_READY
;
757 /* Process unlocked */
764 * @brief Enable Dither.
765 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
766 * the configuration information for the LTDC.
770 HAL_StatusTypeDef
HAL_LTDC_EnableDither(LTDC_HandleTypeDef
*hltdc
)
775 /* Change LTDC peripheral state */
776 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
778 /* Enable Dither by setting DTEN bit */
779 LTDC
->GCR
|= (uint32_t)LTDC_GCR_DEN
;
781 /* Change the LTDC state*/
782 hltdc
->State
= HAL_LTDC_STATE_READY
;
784 /* Process unlocked */
791 * @brief Disable Dither.
792 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
793 * the configuration information for the LTDC.
797 HAL_StatusTypeDef
HAL_LTDC_DisableDither(LTDC_HandleTypeDef
*hltdc
)
802 /* Change LTDC peripheral state */
803 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
805 /* Disable Dither by setting DTEN bit */
806 LTDC
->GCR
&= ~(uint32_t)LTDC_GCR_DEN
;
808 /* Change the LTDC state*/
809 hltdc
->State
= HAL_LTDC_STATE_READY
;
811 /* Process unlocked */
818 * @brief Set the LTDC window size.
819 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
820 * the configuration information for the LTDC.
821 * @param XSize LTDC Pixel per line
822 * @param YSize LTDC Line number
823 * @param LayerIdx LTDC Layer index.
824 * This parameter can be one of the following values:
825 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
828 HAL_StatusTypeDef
HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef
*hltdc
, uint32_t XSize
, uint32_t YSize
, uint32_t LayerIdx
)
830 LTDC_LayerCfgTypeDef
*pLayerCfg
;
832 /* Check the parameters (Layers parameters)*/
833 assert_param(IS_LTDC_LAYER(LayerIdx
));
834 assert_param(IS_LTDC_CFBLL(XSize
));
835 assert_param(IS_LTDC_CFBLNBR(YSize
));
840 /* Change LTDC peripheral state */
841 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
843 /* Get layer configuration from handle structure */
844 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
846 /* update horizontal stop */
847 pLayerCfg
->WindowX1
= XSize
+ pLayerCfg
->WindowX0
;
849 /* update vertical stop */
850 pLayerCfg
->WindowY1
= YSize
+ pLayerCfg
->WindowY0
;
852 /* Reconfigures the color frame buffer pitch in byte */
853 pLayerCfg
->ImageWidth
= XSize
;
855 /* Reconfigures the frame buffer line number */
856 pLayerCfg
->ImageHeight
= YSize
;
858 /* Set LTDC parameters */
859 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
861 /* Set the Immediate Reload type */
862 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
864 /* Change the LTDC state*/
865 hltdc
->State
= HAL_LTDC_STATE_READY
;
867 /* Process unlocked */
874 * @brief Set the LTDC window position.
875 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
876 * the configuration information for the LTDC.
877 * @param X0 LTDC window X offset
878 * @param Y0 LTDC window Y offset
879 * @param LayerIdx LTDC Layer index.
880 * This parameter can be one of the following values:
881 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
884 HAL_StatusTypeDef
HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef
*hltdc
, uint32_t X0
, uint32_t Y0
, uint32_t LayerIdx
)
886 LTDC_LayerCfgTypeDef
*pLayerCfg
;
888 /* Check the parameters */
889 assert_param(IS_LTDC_LAYER(LayerIdx
));
890 assert_param(IS_LTDC_CFBLL(X0
));
891 assert_param(IS_LTDC_CFBLNBR(Y0
));
896 /* Change LTDC peripheral state */
897 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
899 /* Get layer configuration from handle structure */
900 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
902 /* update horizontal start/stop */
903 pLayerCfg
->WindowX0
= X0
;
904 pLayerCfg
->WindowX1
= X0
+ pLayerCfg
->ImageWidth
;
906 /* update vertical start/stop */
907 pLayerCfg
->WindowY0
= Y0
;
908 pLayerCfg
->WindowY1
= Y0
+ pLayerCfg
->ImageHeight
;
910 /* Set LTDC parameters */
911 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
913 /* Set the Immediate Reload type */
914 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
916 /* Change the LTDC state*/
917 hltdc
->State
= HAL_LTDC_STATE_READY
;
919 /* Process unlocked */
926 * @brief Reconfigure the pixel format.
927 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
928 * the configuration information for the LTDC.
929 * @param Pixelformat new pixel format value.
930 * @param LayerIdx LTDC Layer index.
931 * This parameter can be one of the following values:
932 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1).
935 HAL_StatusTypeDef
HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef
*hltdc
, uint32_t Pixelformat
, uint32_t LayerIdx
)
937 LTDC_LayerCfgTypeDef
*pLayerCfg
;
939 /* Check the parameters */
940 assert_param(IS_LTDC_PIXEL_FORMAT(Pixelformat
));
941 assert_param(IS_LTDC_LAYER(LayerIdx
));
946 /* Change LTDC peripheral state */
947 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
949 /* Get layer configuration from handle structure */
950 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
952 /* Reconfigure the pixel format */
953 pLayerCfg
->PixelFormat
= Pixelformat
;
955 /* Set LTDC parameters */
956 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
958 /* Set the Immediate Reload type */
959 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
961 /* Change the LTDC state*/
962 hltdc
->State
= HAL_LTDC_STATE_READY
;
964 /* Process unlocked */
971 * @brief Reconfigure the layer alpha value.
972 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
973 * the configuration information for the LTDC.
974 * @param Alpha new alpha value.
975 * @param LayerIdx LTDC Layer index.
976 * This parameter can be one of the following values:
977 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
980 HAL_StatusTypeDef
HAL_LTDC_SetAlpha(LTDC_HandleTypeDef
*hltdc
, uint32_t Alpha
, uint32_t LayerIdx
)
982 LTDC_LayerCfgTypeDef
*pLayerCfg
;
984 /* Check the parameters */
985 assert_param(IS_LTDC_ALPHA(Alpha
));
986 assert_param(IS_LTDC_LAYER(LayerIdx
));
991 /* Change LTDC peripheral state */
992 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
994 /* Get layer configuration from handle structure */
995 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
997 /* Reconfigure the Alpha value */
998 pLayerCfg
->Alpha
= Alpha
;
1000 /* Set LTDC parameters */
1001 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1003 /* Set the Immediate Reload type */
1004 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
1006 /* Change the LTDC state*/
1007 hltdc
->State
= HAL_LTDC_STATE_READY
;
1009 /* Process unlocked */
1010 __HAL_UNLOCK(hltdc
);
1015 * @brief Reconfigure the frame buffer Address.
1016 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1017 * the configuration information for the LTDC.
1018 * @param Address new address value.
1019 * @param LayerIdx LTDC Layer index.
1020 * This parameter can be one of the following values:
1021 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1).
1022 * @retval HAL status
1024 HAL_StatusTypeDef
HAL_LTDC_SetAddress(LTDC_HandleTypeDef
*hltdc
, uint32_t Address
, uint32_t LayerIdx
)
1026 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1028 /* Check the parameters */
1029 assert_param(IS_LTDC_LAYER(LayerIdx
));
1031 /* Process locked */
1034 /* Change LTDC peripheral state */
1035 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1037 /* Get layer configuration from handle structure */
1038 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1040 /* Reconfigure the Address */
1041 pLayerCfg
->FBStartAdress
= Address
;
1043 /* Set LTDC parameters */
1044 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1046 /* Set the Immediate Reload type */
1047 hltdc
->Instance
->SRCR
= LTDC_SRCR_IMR
;
1049 /* Change the LTDC state*/
1050 hltdc
->State
= HAL_LTDC_STATE_READY
;
1052 /* Process unlocked */
1053 __HAL_UNLOCK(hltdc
);
1059 * @brief Function used to reconfigure the pitch for specific cases where the attached LayerIdx buffer have a width that is
1060 * larger than the one intended to be displayed on screen. Example of a buffer 800x480 attached to layer for which we
1061 * want to read and display on screen only a portion 320x240 taken in the center of the buffer. The pitch in pixels
1062 * will be in that case 800 pixels and not 320 pixels as initially configured by previous call to HAL_LTDC_ConfigLayer().
1063 * @note This function should be called only after a previous call to HAL_LTDC_ConfigLayer() to modify the default pitch
1064 * configured by HAL_LTDC_ConfigLayer() when required (refer to example described just above).
1065 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1066 * the configuration information for the LTDC.
1067 * @param LinePitchInPixels New line pitch in pixels to configure for LTDC layer 'LayerIdx'.
1068 * @param LayerIdx LTDC layer index concerned by the modification of line pitch.
1069 * @retval HAL status
1071 HAL_StatusTypeDef
HAL_LTDC_SetPitch(LTDC_HandleTypeDef
*hltdc
, uint32_t LinePitchInPixels
, uint32_t LayerIdx
)
1074 uint32_t pitchUpdate
= 0U;
1075 uint32_t pixelFormat
= 0U;
1077 /* Check the parameters */
1078 assert_param(IS_LTDC_LAYER(LayerIdx
));
1080 /* Process locked */
1083 /* Change LTDC peripheral state */
1084 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1086 /* get LayerIdx used pixel format */
1087 pixelFormat
= hltdc
->LayerCfg
[LayerIdx
].PixelFormat
;
1089 if(pixelFormat
== LTDC_PIXEL_FORMAT_ARGB8888
)
1093 else if (pixelFormat
== LTDC_PIXEL_FORMAT_RGB888
)
1097 else if((pixelFormat
== LTDC_PIXEL_FORMAT_ARGB4444
) || \
1098 (pixelFormat
== LTDC_PIXEL_FORMAT_RGB565
) || \
1099 (pixelFormat
== LTDC_PIXEL_FORMAT_ARGB1555
) || \
1100 (pixelFormat
== LTDC_PIXEL_FORMAT_AL88
))
1109 pitchUpdate
= ((LinePitchInPixels
* tmp
) << 16U);
1111 /* Clear previously set standard pitch */
1112 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLR
&= ~LTDC_LxCFBLR_CFBP
;
1114 /* Set the Reload type as immediate update of LTDC pitch configured above */
1115 LTDC
->SRCR
|= LTDC_SRCR_IMR
;
1117 /* Set new line pitch value */
1118 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLR
|= pitchUpdate
;
1120 /* Set the Reload type as immediate update of LTDC pitch configured above */
1121 LTDC
->SRCR
|= LTDC_SRCR_IMR
;
1123 /* Change the LTDC state*/
1124 hltdc
->State
= HAL_LTDC_STATE_READY
;
1126 /* Process unlocked */
1127 __HAL_UNLOCK(hltdc
);
1133 * @brief Define the position of the line interrupt.
1134 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1135 * the configuration information for the LTDC.
1136 * @param Line Line Interrupt Position.
1137 * @note User application may resort to HAL_LTDC_LineEventCallback() at line interrupt generation.
1138 * @retval HAL status
1140 HAL_StatusTypeDef
HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef
*hltdc
, uint32_t Line
)
1142 /* Check the parameters */
1143 assert_param(IS_LTDC_LIPOS(Line
));
1145 /* Process locked */
1148 /* Change LTDC peripheral state */
1149 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1151 /* Disable the Line interrupt */
1152 __HAL_LTDC_DISABLE_IT(hltdc
, LTDC_IT_LI
);
1154 /* Set the Line Interrupt position */
1155 LTDC
->LIPCR
= (uint32_t)Line
;
1157 /* Enable the Line interrupt */
1158 __HAL_LTDC_ENABLE_IT(hltdc
, LTDC_IT_LI
);
1160 /* Change the LTDC state*/
1161 hltdc
->State
= HAL_LTDC_STATE_READY
;
1163 /* Process unlocked */
1164 __HAL_UNLOCK(hltdc
);
1170 * @brief Reload LTDC Layers configuration.
1171 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1172 * the configuration information for the LTDC.
1173 * @param ReloadType This parameter can be one of the following values :
1174 * LTDC_RELOAD_IMMEDIATE : Immediate Reload
1175 * LTDC_RELOAD_VERTICAL_BLANKING : Reload in the next Vertical Blanking
1176 * @note User application may resort to HAL_LTDC_ReloadEventCallback() at reload interrupt generation.
1177 * @retval HAL status
1179 HAL_StatusTypeDef
HAL_LTDC_Reload(LTDC_HandleTypeDef
*hltdc
, uint32_t ReloadType
)
1181 /* Check the parameters */
1182 assert_param(IS_LTDC_RELOAD(ReloadType
));
1184 /* Process locked */
1187 /* Change LTDC peripheral state */
1188 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1190 /* Enable the Reload interrupt */
1191 __HAL_LTDC_ENABLE_IT(hltdc
, LTDC_IT_RR
);
1193 /* Apply Reload type */
1194 hltdc
->Instance
->SRCR
= ReloadType
;
1196 /* Change the LTDC state*/
1197 hltdc
->State
= HAL_LTDC_STATE_READY
;
1199 /* Process unlocked */
1200 __HAL_UNLOCK(hltdc
);
1206 * @brief Configure the LTDC Layer according to the specified without reloading
1207 * parameters in the LTDC_InitTypeDef and create the associated handle.
1208 * Variant of the function HAL_LTDC_ConfigLayer without immediate reload.
1209 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1210 * the configuration information for the LTDC.
1211 * @param pLayerCfg pointer to a LTDC_LayerCfgTypeDef structure that contains
1212 * the configuration information for the Layer.
1213 * @param LayerIdx LTDC Layer index.
1214 * This parameter can be one of the following values:
1215 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
1216 * @retval HAL status
1218 HAL_StatusTypeDef
HAL_LTDC_ConfigLayer_NoReload(LTDC_HandleTypeDef
*hltdc
, LTDC_LayerCfgTypeDef
*pLayerCfg
, uint32_t LayerIdx
)
1220 /* Check the parameters */
1221 assert_param(IS_LTDC_LAYER(LayerIdx
));
1222 assert_param(IS_LTDC_HCONFIGST(pLayerCfg
->WindowX0
));
1223 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg
->WindowX1
));
1224 assert_param(IS_LTDC_VCONFIGST(pLayerCfg
->WindowY0
));
1225 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg
->WindowY1
));
1226 assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg
->PixelFormat
));
1227 assert_param(IS_LTDC_ALPHA(pLayerCfg
->Alpha
));
1228 assert_param(IS_LTDC_ALPHA(pLayerCfg
->Alpha0
));
1229 assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg
->BlendingFactor1
));
1230 assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg
->BlendingFactor2
));
1231 assert_param(IS_LTDC_CFBLL(pLayerCfg
->ImageWidth
));
1232 assert_param(IS_LTDC_CFBLNBR(pLayerCfg
->ImageHeight
));
1234 /* Process locked */
1237 /* Change LTDC peripheral state */
1238 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1240 /* Copy new layer configuration into handle structure */
1241 hltdc
->LayerCfg
[LayerIdx
] = *pLayerCfg
;
1243 /* Configure the LTDC Layer */
1244 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1246 /* Do not set the Immediate Reload */
1248 /* Initialize the LTDC state*/
1249 hltdc
->State
= HAL_LTDC_STATE_READY
;
1251 /* Process unlocked */
1252 __HAL_UNLOCK(hltdc
);
1258 * @brief Set the LTDC window size without reloading.
1259 * Variant of the function HAL_LTDC_SetWindowSize without immediate reload.
1260 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1261 * the configuration information for the LTDC.
1262 * @param XSize LTDC Pixel per line
1263 * @param YSize LTDC Line number
1264 * @param LayerIdx LTDC Layer index.
1265 * This parameter can be one of the following values:
1266 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
1267 * @retval HAL status
1269 HAL_StatusTypeDef
HAL_LTDC_SetWindowSize_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t XSize
, uint32_t YSize
, uint32_t LayerIdx
)
1271 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1273 /* Check the parameters (Layers parameters)*/
1274 assert_param(IS_LTDC_LAYER(LayerIdx
));
1275 assert_param(IS_LTDC_CFBLL(XSize
));
1276 assert_param(IS_LTDC_CFBLNBR(YSize
));
1278 /* Process locked */
1281 /* Change LTDC peripheral state */
1282 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1284 /* Get layer configuration from handle structure */
1285 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1287 /* update horizontal stop */
1288 pLayerCfg
->WindowX1
= XSize
+ pLayerCfg
->WindowX0
;
1290 /* update vertical stop */
1291 pLayerCfg
->WindowY1
= YSize
+ pLayerCfg
->WindowY0
;
1293 /* Reconfigures the color frame buffer pitch in byte */
1294 pLayerCfg
->ImageWidth
= XSize
;
1296 /* Reconfigures the frame buffer line number */
1297 pLayerCfg
->ImageHeight
= YSize
;
1299 /* Set LTDC parameters */
1300 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1302 /* Do not set the Immediate Reload */
1304 /* Change the LTDC state*/
1305 hltdc
->State
= HAL_LTDC_STATE_READY
;
1307 /* Process unlocked */
1308 __HAL_UNLOCK(hltdc
);
1314 * @brief Set the LTDC window position without reloading.
1315 * Variant of the function HAL_LTDC_SetWindowPosition without immediate reload.
1316 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1317 * the configuration information for the LTDC.
1318 * @param X0 LTDC window X offset
1319 * @param Y0 LTDC window Y offset
1320 * @param LayerIdx LTDC Layer index.
1321 * This parameter can be one of the following values:
1322 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
1323 * @retval HAL status
1325 HAL_StatusTypeDef
HAL_LTDC_SetWindowPosition_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t X0
, uint32_t Y0
, uint32_t LayerIdx
)
1327 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1329 /* Check the parameters */
1330 assert_param(IS_LTDC_LAYER(LayerIdx
));
1331 assert_param(IS_LTDC_CFBLL(X0
));
1332 assert_param(IS_LTDC_CFBLNBR(Y0
));
1334 /* Process locked */
1337 /* Change LTDC peripheral state */
1338 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1340 /* Get layer configuration from handle structure */
1341 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1343 /* update horizontal start/stop */
1344 pLayerCfg
->WindowX0
= X0
;
1345 pLayerCfg
->WindowX1
= X0
+ pLayerCfg
->ImageWidth
;
1347 /* update vertical start/stop */
1348 pLayerCfg
->WindowY0
= Y0
;
1349 pLayerCfg
->WindowY1
= Y0
+ pLayerCfg
->ImageHeight
;
1351 /* Set LTDC parameters */
1352 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1354 /* Do not set the Immediate Reload */
1356 /* Change the LTDC state*/
1357 hltdc
->State
= HAL_LTDC_STATE_READY
;
1359 /* Process unlocked */
1360 __HAL_UNLOCK(hltdc
);
1366 * @brief Reconfigure the pixel format without reloading.
1367 * Variant of the function HAL_LTDC_SetPixelFormat without immediate reload.
1368 * @param hltdc pointer to a LTDC_HandleTypeDfef structure that contains
1369 * the configuration information for the LTDC.
1370 * @param Pixelformat new pixel format value.
1371 * @param LayerIdx LTDC Layer index.
1372 * This parameter can be one of the following values:
1373 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1).
1374 * @retval HAL status
1376 HAL_StatusTypeDef
HAL_LTDC_SetPixelFormat_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t Pixelformat
, uint32_t LayerIdx
)
1378 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1380 /* Check the parameters */
1381 assert_param(IS_LTDC_PIXEL_FORMAT(Pixelformat
));
1382 assert_param(IS_LTDC_LAYER(LayerIdx
));
1384 /* Process locked */
1387 /* Change LTDC peripheral state */
1388 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1390 /* Get layer configuration from handle structure */
1391 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1393 /* Reconfigure the pixel format */
1394 pLayerCfg
->PixelFormat
= Pixelformat
;
1396 /* Set LTDC parameters */
1397 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1399 /* Do not set the Immediate Reload */
1401 /* Change the LTDC state*/
1402 hltdc
->State
= HAL_LTDC_STATE_READY
;
1404 /* Process unlocked */
1405 __HAL_UNLOCK(hltdc
);
1411 * @brief Reconfigure the layer alpha value without reloading.
1412 * Variant of the function HAL_LTDC_SetAlpha without immediate reload.
1413 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1414 * the configuration information for the LTDC.
1415 * @param Alpha new alpha value.
1416 * @param LayerIdx LTDC Layer index.
1417 * This parameter can be one of the following values:
1418 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
1419 * @retval HAL status
1421 HAL_StatusTypeDef
HAL_LTDC_SetAlpha_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t Alpha
, uint32_t LayerIdx
)
1423 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1425 /* Check the parameters */
1426 assert_param(IS_LTDC_ALPHA(Alpha
));
1427 assert_param(IS_LTDC_LAYER(LayerIdx
));
1429 /* Process locked */
1432 /* Change LTDC peripheral state */
1433 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1435 /* Get layer configuration from handle structure */
1436 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1438 /* Reconfigure the Alpha value */
1439 pLayerCfg
->Alpha
= Alpha
;
1441 /* Set LTDC parameters */
1442 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1444 /* Do not set the Immediate Reload */
1446 /* Change the LTDC state*/
1447 hltdc
->State
= HAL_LTDC_STATE_READY
;
1449 /* Process unlocked */
1450 __HAL_UNLOCK(hltdc
);
1456 * @brief Reconfigure the frame buffer Address without reloading.
1457 * Variant of the function HAL_LTDC_SetAddress without immediate reload.
1458 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1459 * the configuration information for the LTDC.
1460 * @param Address new address value.
1461 * @param LayerIdx LTDC Layer index.
1462 * This parameter can be one of the following values:
1463 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1).
1464 * @retval HAL status
1466 HAL_StatusTypeDef
HAL_LTDC_SetAddress_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t Address
, uint32_t LayerIdx
)
1468 LTDC_LayerCfgTypeDef
*pLayerCfg
;
1470 /* Check the parameters */
1471 assert_param(IS_LTDC_LAYER(LayerIdx
));
1473 /* Process locked */
1476 /* Change LTDC peripheral state */
1477 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1479 /* Get layer configuration from handle structure */
1480 pLayerCfg
= &hltdc
->LayerCfg
[LayerIdx
];
1482 /* Reconfigure the Address */
1483 pLayerCfg
->FBStartAdress
= Address
;
1485 /* Set LTDC parameters */
1486 LTDC_SetConfig(hltdc
, pLayerCfg
, LayerIdx
);
1488 /* Do not set the Immediate Reload */
1490 /* Change the LTDC state*/
1491 hltdc
->State
= HAL_LTDC_STATE_READY
;
1493 /* Process unlocked */
1494 __HAL_UNLOCK(hltdc
);
1500 * @brief Function used to reconfigure the pitch for specific cases where the attached LayerIdx buffer have a width that is
1501 * larger than the one intended to be displayed on screen. Example of a buffer 800x480 attached to layer for which we
1502 * want to read and display on screen only a portion 320x240 taken in the center of the buffer. The pitch in pixels
1503 * will be in that case 800 pixels and not 320 pixels as initially configured by previous call to HAL_LTDC_ConfigLayer().
1504 * @note This function should be called only after a previous call to HAL_LTDC_ConfigLayer() to modify the default pitch
1505 * configured by HAL_LTDC_ConfigLayer() when required (refer to example described just above).
1506 * Variant of the function HAL_LTDC_SetPitch without immediate reload.
1507 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1508 * the configuration information for the LTDC.
1509 * @param LinePitchInPixels New line pitch in pixels to configure for LTDC layer 'LayerIdx'.
1510 * @param LayerIdx LTDC layer index concerned by the modification of line pitch.
1511 * @retval HAL status
1513 HAL_StatusTypeDef
HAL_LTDC_SetPitch_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t LinePitchInPixels
, uint32_t LayerIdx
)
1516 uint32_t pitchUpdate
= 0U;
1517 uint32_t pixelFormat
= 0U;
1519 /* Check the parameters */
1520 assert_param(IS_LTDC_LAYER(LayerIdx
));
1522 /* Process locked */
1525 /* Change LTDC peripheral state */
1526 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1528 /* get LayerIdx used pixel format */
1529 pixelFormat
= hltdc
->LayerCfg
[LayerIdx
].PixelFormat
;
1531 if(pixelFormat
== LTDC_PIXEL_FORMAT_ARGB8888
)
1535 else if (pixelFormat
== LTDC_PIXEL_FORMAT_RGB888
)
1539 else if((pixelFormat
== LTDC_PIXEL_FORMAT_ARGB4444
) || \
1540 (pixelFormat
== LTDC_PIXEL_FORMAT_RGB565
) || \
1541 (pixelFormat
== LTDC_PIXEL_FORMAT_ARGB1555
) || \
1542 (pixelFormat
== LTDC_PIXEL_FORMAT_AL88
))
1551 pitchUpdate
= ((LinePitchInPixels
* tmp
) << 16U);
1553 /* Clear previously set standard pitch */
1554 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLR
&= ~LTDC_LxCFBLR_CFBP
;
1556 /* Set new line pitch value */
1557 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLR
|= pitchUpdate
;
1559 /* Do not set the Immediate Reload */
1561 /* Change the LTDC state*/
1562 hltdc
->State
= HAL_LTDC_STATE_READY
;
1564 /* Process unlocked */
1565 __HAL_UNLOCK(hltdc
);
1572 * @brief Configure the color keying without reloading.
1573 * Variant of the function HAL_LTDC_ConfigColorKeying without immediate reload.
1574 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1575 * the configuration information for the LTDC.
1576 * @param RGBValue the color key value
1577 * @param LayerIdx LTDC Layer index.
1578 * This parameter can be one of the following values:
1579 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
1580 * @retval HAL status
1582 HAL_StatusTypeDef
HAL_LTDC_ConfigColorKeying_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t RGBValue
, uint32_t LayerIdx
)
1584 /* Check the parameters */
1585 assert_param(IS_LTDC_LAYER(LayerIdx
));
1587 /* Process locked */
1590 /* Change LTDC peripheral state */
1591 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1593 /* Configure the default color values */
1594 LTDC_LAYER(hltdc
, LayerIdx
)->CKCR
&= ~(LTDC_LxCKCR_CKBLUE
| LTDC_LxCKCR_CKGREEN
| LTDC_LxCKCR_CKRED
);
1595 LTDC_LAYER(hltdc
, LayerIdx
)->CKCR
= RGBValue
;
1597 /* Do not set the Immediate Reload */
1599 /* Change the LTDC state*/
1600 hltdc
->State
= HAL_LTDC_STATE_READY
;
1602 /* Process unlocked */
1603 __HAL_UNLOCK(hltdc
);
1609 * @brief Enable the color keying without reloading.
1610 * Variant of the function HAL_LTDC_EnableColorKeying without immediate reload.
1611 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1612 * the configuration information for the LTDC.
1613 * @param LayerIdx LTDC Layer index.
1614 * This parameter can be one of the following values:
1615 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
1616 * @retval HAL status
1618 HAL_StatusTypeDef
HAL_LTDC_EnableColorKeying_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
1620 /* Check the parameters */
1621 assert_param(IS_LTDC_LAYER(LayerIdx
));
1623 /* Process locked */
1626 /* Change LTDC peripheral state */
1627 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1629 /* Enable LTDC color keying by setting COLKEN bit */
1630 LTDC_LAYER(hltdc
, LayerIdx
)->CR
|= (uint32_t)LTDC_LxCR_COLKEN
;
1632 /* Do not set the Immediate Reload */
1634 /* Change the LTDC state*/
1635 hltdc
->State
= HAL_LTDC_STATE_READY
;
1637 /* Process unlocked */
1638 __HAL_UNLOCK(hltdc
);
1644 * @brief Disable the color keying without reloading.
1645 * Variant of the function HAL_LTDC_DisableColorKeying without immediate reload.
1646 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1647 * the configuration information for the LTDC.
1648 * @param LayerIdx LTDC Layer index.
1649 * This parameter can be one of the following values:
1650 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
1651 * @retval HAL status
1653 HAL_StatusTypeDef
HAL_LTDC_DisableColorKeying_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
1655 /* Check the parameters */
1656 assert_param(IS_LTDC_LAYER(LayerIdx
));
1658 /* Process locked */
1661 /* Change LTDC peripheral state */
1662 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1664 /* Disable LTDC color keying by setting COLKEN bit */
1665 LTDC_LAYER(hltdc
, LayerIdx
)->CR
&= ~(uint32_t)LTDC_LxCR_COLKEN
;
1667 /* Do not set the Immediate Reload */
1669 /* Change the LTDC state*/
1670 hltdc
->State
= HAL_LTDC_STATE_READY
;
1672 /* Process unlocked */
1673 __HAL_UNLOCK(hltdc
);
1679 * @brief Enable the color lookup table without reloading.
1680 * Variant of the function HAL_LTDC_EnableCLUT without immediate reload.
1681 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1682 * the configuration information for the LTDC.
1683 * @param LayerIdx LTDC Layer index.
1684 * This parameter can be one of the following values:
1685 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
1686 * @retval HAL status
1688 HAL_StatusTypeDef
HAL_LTDC_EnableCLUT_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
1690 /* Check the parameters */
1691 assert_param(IS_LTDC_LAYER(LayerIdx
));
1693 /* Process locked */
1696 /* Change LTDC peripheral state */
1697 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1699 /* Disable LTDC color lookup table by setting CLUTEN bit */
1700 LTDC_LAYER(hltdc
, LayerIdx
)->CR
|= (uint32_t)LTDC_LxCR_CLUTEN
;
1702 /* Do not set the Immediate Reload */
1704 /* Change the LTDC state*/
1705 hltdc
->State
= HAL_LTDC_STATE_READY
;
1707 /* Process unlocked */
1708 __HAL_UNLOCK(hltdc
);
1714 * @brief Disable the color lookup table without reloading.
1715 * Variant of the function HAL_LTDC_DisableCLUT without immediate reload.
1716 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1717 * the configuration information for the LTDC.
1718 * @param LayerIdx LTDC Layer index.
1719 * This parameter can be one of the following values:
1720 * LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
1721 * @retval HAL status
1723 HAL_StatusTypeDef
HAL_LTDC_DisableCLUT_NoReload(LTDC_HandleTypeDef
*hltdc
, uint32_t LayerIdx
)
1725 /* Check the parameters */
1726 assert_param(IS_LTDC_LAYER(LayerIdx
));
1728 /* Process locked */
1731 /* Change LTDC peripheral state */
1732 hltdc
->State
= HAL_LTDC_STATE_BUSY
;
1734 /* Disable LTDC color lookup table by setting CLUTEN bit */
1735 LTDC_LAYER(hltdc
, LayerIdx
)->CR
&= ~(uint32_t)LTDC_LxCR_CLUTEN
;
1737 /* Do not set the Immediate Reload */
1739 /* Change the LTDC state*/
1740 hltdc
->State
= HAL_LTDC_STATE_READY
;
1742 /* Process unlocked */
1743 __HAL_UNLOCK(hltdc
);
1752 /** @defgroup LTDC_Exported_Functions_Group4 Peripheral State and Errors functions
1753 * @brief Peripheral State and Errors functions
1756 ===============================================================================
1757 ##### Peripheral State and Errors functions #####
1758 ===============================================================================
1760 This subsection provides functions allowing to
1761 (+) Check the LTDC handle state.
1762 (+) Get the LTDC handle error code.
1769 * @brief Return the LTDC handle state.
1770 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1771 * the configuration information for the LTDC.
1774 HAL_LTDC_StateTypeDef
HAL_LTDC_GetState(LTDC_HandleTypeDef
*hltdc
)
1776 return hltdc
->State
;
1780 * @brief Return the LTDC handle error code.
1781 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
1782 * the configuration information for the LTDC.
1783 * @retval LTDC Error Code
1785 uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef
*hltdc
)
1787 return hltdc
->ErrorCode
;
1798 /** @defgroup LTDC_Private_Functions LTDC Private Functions
1803 * @brief Configure the LTDC peripheral
1804 * @param hltdc Pointer to a LTDC_HandleTypeDef structure that contains
1805 * the configuration information for the LTDC.
1806 * @param pLayerCfg Pointer LTDC Layer Configuration structure
1807 * @param LayerIdx LTDC Layer index.
1808 * This parameter can be one of the following values: LTDC_LAYER_1 (0) or LTDC_LAYER_2 (1)
1811 static void LTDC_SetConfig(LTDC_HandleTypeDef
*hltdc
, LTDC_LayerCfgTypeDef
*pLayerCfg
, uint32_t LayerIdx
)
1817 /* Configure the horizontal start and stop position */
1818 tmp
= ((pLayerCfg
->WindowX1
+ ((hltdc
->Instance
->BPCR
& LTDC_BPCR_AHBP
) >> 16U)) << 16U);
1819 LTDC_LAYER(hltdc
, LayerIdx
)->WHPCR
&= ~(LTDC_LxWHPCR_WHSTPOS
| LTDC_LxWHPCR_WHSPPOS
);
1820 LTDC_LAYER(hltdc
, LayerIdx
)->WHPCR
= ((pLayerCfg
->WindowX0
+ ((hltdc
->Instance
->BPCR
& LTDC_BPCR_AHBP
) >> 16U) + 1U) | tmp
);
1822 /* Configure the vertical start and stop position */
1823 tmp
= ((pLayerCfg
->WindowY1
+ (hltdc
->Instance
->BPCR
& LTDC_BPCR_AVBP
)) << 16U);
1824 LTDC_LAYER(hltdc
, LayerIdx
)->WVPCR
&= ~(LTDC_LxWVPCR_WVSTPOS
| LTDC_LxWVPCR_WVSPPOS
);
1825 LTDC_LAYER(hltdc
, LayerIdx
)->WVPCR
= ((pLayerCfg
->WindowY0
+ (hltdc
->Instance
->BPCR
& LTDC_BPCR_AVBP
) + 1U) | tmp
);
1827 /* Specifies the pixel format */
1828 LTDC_LAYER(hltdc
, LayerIdx
)->PFCR
&= ~(LTDC_LxPFCR_PF
);
1829 LTDC_LAYER(hltdc
, LayerIdx
)->PFCR
= (pLayerCfg
->PixelFormat
);
1831 /* Configure the default color values */
1832 tmp
= ((uint32_t)(pLayerCfg
->Backcolor
.Green
) << 8U);
1833 tmp1
= ((uint32_t)(pLayerCfg
->Backcolor
.Red
) << 16U);
1834 tmp2
= (pLayerCfg
->Alpha0
<< 24U);
1835 LTDC_LAYER(hltdc
, LayerIdx
)->DCCR
&= ~(LTDC_LxDCCR_DCBLUE
| LTDC_LxDCCR_DCGREEN
| LTDC_LxDCCR_DCRED
| LTDC_LxDCCR_DCALPHA
);
1836 LTDC_LAYER(hltdc
, LayerIdx
)->DCCR
= (pLayerCfg
->Backcolor
.Blue
| tmp
| tmp1
| tmp2
);
1838 /* Specifies the constant alpha value */
1839 LTDC_LAYER(hltdc
, LayerIdx
)->CACR
&= ~(LTDC_LxCACR_CONSTA
);
1840 LTDC_LAYER(hltdc
, LayerIdx
)->CACR
= (pLayerCfg
->Alpha
);
1842 /* Specifies the blending factors */
1843 LTDC_LAYER(hltdc
, LayerIdx
)->BFCR
&= ~(LTDC_LxBFCR_BF2
| LTDC_LxBFCR_BF1
);
1844 LTDC_LAYER(hltdc
, LayerIdx
)->BFCR
= (pLayerCfg
->BlendingFactor1
| pLayerCfg
->BlendingFactor2
);
1846 /* Configure the color frame buffer start address */
1847 LTDC_LAYER(hltdc
, LayerIdx
)->CFBAR
&= ~(LTDC_LxCFBAR_CFBADD
);
1848 LTDC_LAYER(hltdc
, LayerIdx
)->CFBAR
= (pLayerCfg
->FBStartAdress
);
1850 if(pLayerCfg
->PixelFormat
== LTDC_PIXEL_FORMAT_ARGB8888
)
1854 else if (pLayerCfg
->PixelFormat
== LTDC_PIXEL_FORMAT_RGB888
)
1858 else if((pLayerCfg
->PixelFormat
== LTDC_PIXEL_FORMAT_ARGB4444
) || \
1859 (pLayerCfg
->PixelFormat
== LTDC_PIXEL_FORMAT_RGB565
) || \
1860 (pLayerCfg
->PixelFormat
== LTDC_PIXEL_FORMAT_ARGB1555
) || \
1861 (pLayerCfg
->PixelFormat
== LTDC_PIXEL_FORMAT_AL88
))
1870 /* Configure the color frame buffer pitch in byte */
1871 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLR
&= ~(LTDC_LxCFBLR_CFBLL
| LTDC_LxCFBLR_CFBP
);
1872 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLR
= (((pLayerCfg
->ImageWidth
* tmp
) << 16U) | (((pLayerCfg
->WindowX1
- pLayerCfg
->WindowX0
) * tmp
) + 3U));
1874 /* Configure the frame buffer line number */
1875 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLNR
&= ~(LTDC_LxCFBLNR_CFBLNBR
);
1876 LTDC_LAYER(hltdc
, LayerIdx
)->CFBLNR
= (pLayerCfg
->ImageHeight
);
1878 /* Enable LTDC_Layer by setting LEN bit */
1879 LTDC_LAYER(hltdc
, LayerIdx
)->CR
|= (uint32_t)LTDC_LxCR_LEN
;
1885 #endif /* STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
1886 #endif /* HAL_LTDC_MODULE_ENABLED */
1896 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/