1 /**
2   ******************************************************************************
3   * @file    stm32l4xx_hal_lcd.c
4   * @author  MCD Application Team
5   * @brief   LCD Controller HAL module driver.
6   *          This file provides firmware functions to manage the following
7   *          functionalities of the LCD Controller (LCD) peripheral:
8   *           + Initialization/de-initialization methods
9   *           + I/O operation methods
10   *           + Peripheral State methods
11   *
12   ******************************************************************************
13   * @attention
14   *
15   * Copyright (c) 2017 STMicroelectronics.
16   * All rights reserved.
17   *
18   * This software is licensed under terms that can be found in the LICENSE file in
19   * the root directory of this software component.
20   * If no LICENSE file comes with this software, it is provided AS-IS.
21   ******************************************************************************
22   @verbatim
23   ==============================================================================
24                         ##### How to use this driver #####
25   ==============================================================================
26       [..] The LCD HAL driver can be used as follows:
27 
28       (#) Declare a LCD_HandleTypeDef handle structure.
29 
30       -@- The frequency generator allows you to achieve various LCD frame rates
31           starting from an LCD input clock frequency (LCDCLK) which can vary
32           from 32 kHz up to 1 MHz.
33 
34       (#) Initialize the LCD low level resources by implementing the HAL_LCD_MspInit() API:
35 
36           (++) Enable the LCDCLK (same as RTCCLK): to configure the RTCCLK/LCDCLK, proceed as follows:
37                (+++) Use RCC function HAL_RCCEx_PeriphCLKConfig in indicating RCC_PERIPHCLK_LCD and
38                   selected clock source (HSE, LSI or LSE)
39 
40           (++) LCD pins configuration:
41               (+++) Enable the clock for the LCD GPIOs.
42               (+++) Configure these LCD pins as alternate function no-pull.
43           (++) Enable the LCD interface clock.
44 
45 
46       (#) Program the Prescaler, Divider, Blink mode, Blink Frequency Duty, Bias,
47           Voltage Source, Dead Time, Pulse On Duration, Contrast, High drive and Multiplexer
48           Segment in the Init structure of the LCD handle.
49 
50       (#) Initialize the LCD registers by calling the HAL_LCD_Init() API.
51 
52       -@- The HAL_LCD_Init() API configures also the low level Hardware GPIO, CLOCK, ...etc)
53           by calling the customized HAL_LCD_MspInit() API.
54       -@- After calling the HAL_LCD_Init() the LCD RAM memory is cleared
55 
56       (#) Optionally you can update the LCD configuration using these macros:
57               (++) LCD High Drive using the __HAL_LCD_HIGHDRIVER_ENABLE() and __HAL_LCD_HIGHDRIVER_DISABLE() macros
58               (++) Voltage output buffer using __HAL_LCD_VOLTAGE_BUFFER_ENABLE() and __HAL_LCD_VOLTAGE_BUFFER_DISABLE() macros
59               (++) LCD Pulse ON Duration using the __HAL_LCD_PULSEONDURATION_CONFIG() macro
60               (++) LCD Dead Time using the __HAL_LCD_DEADTIME_CONFIG() macro
61               (++) The LCD Blink mode and frequency using the __HAL_LCD_BLINK_CONFIG() macro
62               (++) The LCD Contrast using the __HAL_LCD_CONTRAST_CONFIG() macro
63 
64       (#) Write to the LCD RAM memory using the HAL_LCD_Write() API, this API can be called
65           more time to update the different LCD RAM registers before calling
66           HAL_LCD_UpdateDisplayRequest() API.
67 
68       (#) The HAL_LCD_Clear() API can be used to clear the LCD RAM memory.
69 
70       (#) When LCD RAM memory is updated enable the update display request using
71           the HAL_LCD_UpdateDisplayRequest() API.
72 
73       [..] LCD and low power modes:
74            (#) The LCD remain active during Sleep, Low Power run, Low Power Sleep and
75                STOP modes.
76 
77   @endverbatim
78   ******************************************************************************
79   */
80 
81 /* Includes ------------------------------------------------------------------*/
82 #include "stm32l4xx_hal.h"
83 
84 #if defined(STM32L433xx) || defined(STM32L443xx) || defined(STM32L476xx) || defined(STM32L486xx) || defined(STM32L496xx) || defined(STM32L4A6xx)
85 
86 /** @addtogroup STM32L4xx_HAL_Driver
87   * @{
88   */
89 
90 #ifdef HAL_LCD_MODULE_ENABLED
91 
92 /** @defgroup LCD LCD
93   * @brief LCD HAL module driver
94   * @{
95   */
96 
97 /* Private typedef -----------------------------------------------------------*/
98 /* Private define ------------------------------------------------------------*/
99 /** @defgroup LCD_Private_Defines LCD Private Defines
100   * @{
101   */
102 
103 #define LCD_TIMEOUT_VALUE             1000U
104 
105 /**
106   * @}
107   */
108 
109 /* Private macro -------------------------------------------------------------*/
110 /* Private variables ---------------------------------------------------------*/
111 /* Private function prototypes -----------------------------------------------*/
112 /* Exported functions --------------------------------------------------------*/
113 
114 /** @defgroup LCD_Exported_Functions LCD Exported Functions
115   * @{
116   */
117 
118 /** @defgroup LCD_Exported_Functions_Group1 Initialization/de-initialization methods
119   *  @brief    Initialization and Configuration functions
120   *
121 @verbatim
122 ===============================================================================
123             ##### Initialization and Configuration functions #####
124  ===============================================================================
125     [..]
126 
127 @endverbatim
128   * @{
129   */
130 
131 /**
132   * @brief  Initialize the LCD peripheral according to the specified parameters
133   *         in the LCD_InitStruct and initialize the associated handle.
134   * @note   This function can be used only when the LCD is disabled.
135   * @param hlcd LCD handle
136   * @retval None
137   */
HAL_LCD_Init(LCD_HandleTypeDef * hlcd)138 HAL_StatusTypeDef HAL_LCD_Init(LCD_HandleTypeDef *hlcd)
139 {
140   uint32_t tickstart;
141   uint32_t counter;
142   HAL_StatusTypeDef status;
143 
144   /* Check the LCD handle allocation */
145   if (hlcd == NULL)
146   {
147     return HAL_ERROR;
148   }
149 
150   /* Check function parameters */
151   assert_param(IS_LCD_ALL_INSTANCE(hlcd->Instance));
152   assert_param(IS_LCD_PRESCALER(hlcd->Init.Prescaler));
153   assert_param(IS_LCD_DIVIDER(hlcd->Init.Divider));
154   assert_param(IS_LCD_DUTY(hlcd->Init.Duty));
155   assert_param(IS_LCD_BIAS(hlcd->Init.Bias));
156   assert_param(IS_LCD_VOLTAGE_SOURCE(hlcd->Init.VoltageSource));
157   assert_param(IS_LCD_PULSE_ON_DURATION(hlcd->Init.PulseOnDuration));
158   assert_param(IS_LCD_HIGH_DRIVE(hlcd->Init.HighDrive));
159   assert_param(IS_LCD_DEAD_TIME(hlcd->Init.DeadTime));
160   assert_param(IS_LCD_CONTRAST(hlcd->Init.Contrast));
161   assert_param(IS_LCD_BLINK_FREQUENCY(hlcd->Init.BlinkFrequency));
162   assert_param(IS_LCD_BLINK_MODE(hlcd->Init.BlinkMode));
163   assert_param(IS_LCD_MUX_SEGMENT(hlcd->Init.MuxSegment));
164 
165   if (hlcd->State == HAL_LCD_STATE_RESET)
166   {
167     /* Allocate lock resource and initialize it */
168     hlcd->Lock = HAL_UNLOCKED;
169 
170     /* Initialize the low level hardware (MSP) */
171     HAL_LCD_MspInit(hlcd);
172   }
173 
174   hlcd->State = HAL_LCD_STATE_BUSY;
175 
176   /* Disable the peripheral */
177   __HAL_LCD_DISABLE(hlcd);
178 
179   /* Clear the LCD_RAM registers and enable the display request by setting the UDR bit
180      in the LCD_SR register */
181   for (counter = LCD_RAM_REGISTER0; counter <= LCD_RAM_REGISTER15; counter++)
182   {
183     hlcd->Instance->RAM[counter] = 0;
184   }
185   /* Enable the display request */
186   hlcd->Instance->SR |= LCD_SR_UDR;
187   /* Configure the LCD Prescaler, Divider, Blink mode and Blink Frequency:
188      Set PS[3:0] bits according to hlcd->Init.Prescaler value
189      Set DIV[3:0] bits according to hlcd->Init.Divider value
190      Set BLINK[1:0] bits according to hlcd->Init.BlinkMode value
191      Set BLINKF[2:0] bits according to hlcd->Init.BlinkFrequency value
192      Set DEAD[2:0] bits according to hlcd->Init.DeadTime value
193      Set PON[2:0] bits according to hlcd->Init.PulseOnDuration value
194      Set CC[2:0] bits according to hlcd->Init.Contrast value
195      Set HD bit according to hlcd->Init.HighDrive value */
196   MODIFY_REG(hlcd->Instance->FCR, \
197              (LCD_FCR_PS | LCD_FCR_DIV | LCD_FCR_BLINK | LCD_FCR_BLINKF | \
198               LCD_FCR_DEAD | LCD_FCR_PON | LCD_FCR_CC | LCD_FCR_HD), \
199              (hlcd->Init.Prescaler | hlcd->Init.Divider | hlcd->Init.BlinkMode | hlcd->Init.BlinkFrequency | \
200               hlcd->Init.DeadTime | hlcd->Init.PulseOnDuration | hlcd->Init.Contrast | hlcd->Init.HighDrive));
201 
202   /* Wait until LCD Frame Control Register Synchronization flag (FCRSF) is set in the LCD_SR register
203      This bit is set by hardware each time the LCD_FCR register is updated in the LCDCLK
204      domain. It is cleared by hardware when writing to the LCD_FCR register.*/
205   status = LCD_WaitForSynchro(hlcd);
206   if (status != HAL_OK)
207   {
208     return status;
209   }
210 
211   /* Configure the LCD Duty, Bias, Voltage Source, Dead Time, Pulse On Duration and Contrast:
212      Set DUTY[2:0] bits according to hlcd->Init.Duty value
213      Set BIAS[1:0] bits according to hlcd->Init.Bias value
214      Set VSEL bit according to hlcd->Init.VoltageSource value
215      Set MUX_SEG bit according to hlcd->Init.MuxSegment value */
216   MODIFY_REG(hlcd->Instance->CR, \
217              (LCD_CR_DUTY | LCD_CR_BIAS | LCD_CR_VSEL | LCD_CR_MUX_SEG), \
218              (hlcd->Init.Duty | hlcd->Init.Bias | hlcd->Init.VoltageSource | hlcd->Init.MuxSegment));
219 
220   /* Enable the peripheral */
221   __HAL_LCD_ENABLE(hlcd);
222 
223   /* Get timeout */
224   tickstart = HAL_GetTick();
225 
226   /* Wait Until the LCD is enabled */
227   while (__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_ENS) == RESET)
228   {
229     if ((HAL_GetTick() - tickstart) > LCD_TIMEOUT_VALUE)
230     {
231       hlcd->ErrorCode = HAL_LCD_ERROR_ENS;
232       return HAL_TIMEOUT;
233     }
234   }
235 
236   /* Get timeout */
237   tickstart = HAL_GetTick();
238 
239   /*!< Wait Until the LCD Booster is ready */
240   while (__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_RDY) == RESET)
241   {
242     if ((HAL_GetTick() - tickstart) > LCD_TIMEOUT_VALUE)
243     {
244       hlcd->ErrorCode = HAL_LCD_ERROR_RDY;
245       return HAL_TIMEOUT;
246     }
247   }
248 
249   /* Initialize the LCD state */
250   hlcd->ErrorCode = HAL_LCD_ERROR_NONE;
251   hlcd->State = HAL_LCD_STATE_READY;
252 
253   return status;
254 }
255 
256 /**
257   * @brief  DeInitialize the LCD peripheral.
258   * @param hlcd LCD handle
259   * @retval HAL status
260   */
HAL_LCD_DeInit(LCD_HandleTypeDef * hlcd)261 HAL_StatusTypeDef HAL_LCD_DeInit(LCD_HandleTypeDef *hlcd)
262 {
263   /* Check the LCD handle allocation */
264   if (hlcd == NULL)
265   {
266     return HAL_ERROR;
267   }
268 
269   /* Check the parameters */
270   assert_param(IS_LCD_ALL_INSTANCE(hlcd->Instance));
271 
272   hlcd->State = HAL_LCD_STATE_BUSY;
273 
274   /* DeInit the low level hardware */
275   HAL_LCD_MspDeInit(hlcd);
276 
277   hlcd->ErrorCode = HAL_LCD_ERROR_NONE;
278   hlcd->State = HAL_LCD_STATE_RESET;
279 
280   /* Release Lock */
281   __HAL_UNLOCK(hlcd);
282 
283   return HAL_OK;
284 }
285 
286 /**
287   * @brief  DeInitialize the LCD MSP.
288   * @param hlcd LCD handle
289   * @retval None
290   */
HAL_LCD_MspDeInit(LCD_HandleTypeDef * hlcd)291 __weak void HAL_LCD_MspDeInit(LCD_HandleTypeDef *hlcd)
292 {
293   /* Prevent unused argument(s) compilation warning */
294   UNUSED(hlcd);
295 
296   /* NOTE: This function should not be modified, when the callback is needed,
297            the HAL_LCD_MspDeInit it to be implemented in the user file
298    */
299 }
300 
301 /**
302   * @brief  Initialize the LCD MSP.
303   * @param hlcd LCD handle
304   * @retval None
305   */
HAL_LCD_MspInit(LCD_HandleTypeDef * hlcd)306 __weak void HAL_LCD_MspInit(LCD_HandleTypeDef *hlcd)
307 {
308   /* Prevent unused argument(s) compilation warning */
309   UNUSED(hlcd);
310 
311   /* NOTE: This function should not be modified, when the callback is needed,
312            the HAL_LCD_MspInit is to be implemented in the user file
313    */
314 }
315 
316 /**
317   * @}
318   */
319 
320 /** @defgroup LCD_Exported_Functions_Group2 IO operation methods
321   *  @brief LCD RAM functions
322   *
323 @verbatim
324  ===============================================================================
325                       ##### IO operation functions #####
326  ===============================================================================
327  [..] Using its double buffer memory the LCD controller ensures the coherency of the
328  displayed information without having to use interrupts to control LCD_RAM
329  modification.
330  The application software can access the first buffer level (LCD_RAM) through
331  the APB interface. Once it has modified the LCD_RAM using the HAL_LCD_Write() API,
332  it sets the UDR flag in the LCD_SR register using the HAL_LCD_UpdateDisplayRequest() API.
333  This UDR flag (update display request) requests the updated information to be
334  moved into the second buffer level (LCD_DISPLAY).
335  This operation is done synchronously with the frame (at the beginning of the
336  next frame), until the update is completed, the LCD_RAM is write protected and
337  the UDR flag stays high.
338  Once the update is completed another flag (UDD - Update Display Done) is set and
339  generates an interrupt if the UDDIE bit in the LCD_FCR register is set.
340  The time it takes to update LCD_DISPLAY is, in the worst case, one odd and one
341  even frame.
342  The update will not occur (UDR = 1 and UDD = 0) until the display is
343  enabled (LCDEN = 1).
344 
345 @endverbatim
346   * @{
347   */
348 
349 /**
350   * @brief  Write a word in the specific LCD RAM.
351   * @param hlcd LCD handle
352   * @param RAMRegisterIndex specifies the LCD RAM Register.
353   *   This parameter can be one of the following values:
354   *     @arg LCD_RAM_REGISTER0: LCD RAM Register 0
355   *     @arg LCD_RAM_REGISTER1: LCD RAM Register 1
356   *     @arg LCD_RAM_REGISTER2: LCD RAM Register 2
357   *     @arg LCD_RAM_REGISTER3: LCD RAM Register 3
358   *     @arg LCD_RAM_REGISTER4: LCD RAM Register 4
359   *     @arg LCD_RAM_REGISTER5: LCD RAM Register 5
360   *     @arg LCD_RAM_REGISTER6: LCD RAM Register 6
361   *     @arg LCD_RAM_REGISTER7: LCD RAM Register 7
362   *     @arg LCD_RAM_REGISTER8: LCD RAM Register 8
363   *     @arg LCD_RAM_REGISTER9: LCD RAM Register 9
364   *     @arg LCD_RAM_REGISTER10: LCD RAM Register 10
365   *     @arg LCD_RAM_REGISTER11: LCD RAM Register 11
366   *     @arg LCD_RAM_REGISTER12: LCD RAM Register 12
367   *     @arg LCD_RAM_REGISTER13: LCD RAM Register 13
368   *     @arg LCD_RAM_REGISTER14: LCD RAM Register 14
369   *     @arg LCD_RAM_REGISTER15: LCD RAM Register 15
370   * @param RAMRegisterMask specifies the LCD RAM Register Data Mask.
371   * @param Data specifies LCD Data Value to be written.
372   * @retval None
373   */
HAL_LCD_Write(LCD_HandleTypeDef * hlcd,uint32_t RAMRegisterIndex,uint32_t RAMRegisterMask,uint32_t Data)374 HAL_StatusTypeDef HAL_LCD_Write(LCD_HandleTypeDef *hlcd, uint32_t RAMRegisterIndex, uint32_t RAMRegisterMask, uint32_t Data)
375 {
376   uint32_t tickstart;
377   HAL_LCD_StateTypeDef state = hlcd->State;
378 
379   if ((state == HAL_LCD_STATE_READY) || (state == HAL_LCD_STATE_BUSY))
380   {
381     /* Check the parameters */
382     assert_param(IS_LCD_RAM_REGISTER(RAMRegisterIndex));
383 
384     if (hlcd->State == HAL_LCD_STATE_READY)
385     {
386       /* Process Locked */
387       __HAL_LOCK(hlcd);
388       hlcd->State = HAL_LCD_STATE_BUSY;
389 
390       /* Get timeout */
391       tickstart = HAL_GetTick();
392 
393       /*!< Wait Until the LCD is ready */
394       while (__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_UDR) != RESET)
395       {
396         if ((HAL_GetTick() - tickstart) > LCD_TIMEOUT_VALUE)
397         {
398           hlcd->ErrorCode = HAL_LCD_ERROR_UDR;
399 
400           /* Process Unlocked */
401           __HAL_UNLOCK(hlcd);
402 
403           return HAL_TIMEOUT;
404         }
405       }
406     }
407 
408     /* Copy the new Data bytes to LCD RAM register */
409     MODIFY_REG(hlcd->Instance->RAM[RAMRegisterIndex], ~(RAMRegisterMask), Data);
410 
411     return HAL_OK;
412   }
413   else
414   {
415     return HAL_ERROR;
416   }
417 }
418 
419 /**
420   * @brief Clear the LCD RAM registers.
421   * @param hlcd LCD handle
422   * @retval None
423   */
HAL_LCD_Clear(LCD_HandleTypeDef * hlcd)424 HAL_StatusTypeDef HAL_LCD_Clear(LCD_HandleTypeDef *hlcd)
425 {
426   uint32_t tickstart;
427   uint32_t counter;
428   HAL_StatusTypeDef status = HAL_ERROR;
429   HAL_LCD_StateTypeDef state = hlcd->State;
430 
431   if ((state == HAL_LCD_STATE_READY) || (state == HAL_LCD_STATE_BUSY))
432   {
433     /* Process Locked */
434     __HAL_LOCK(hlcd);
435 
436     hlcd->State = HAL_LCD_STATE_BUSY;
437 
438     /* Get timeout */
439     tickstart = HAL_GetTick();
440 
441     /*!< Wait Until the LCD is ready */
442     while (__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_UDR) != RESET)
443     {
444       if ((HAL_GetTick() - tickstart) > LCD_TIMEOUT_VALUE)
445       {
446         hlcd->ErrorCode = HAL_LCD_ERROR_UDR;
447 
448         /* Process Unlocked */
449         __HAL_UNLOCK(hlcd);
450 
451         return HAL_TIMEOUT;
452       }
453     }
454     /* Clear the LCD_RAM registers */
455     for (counter = LCD_RAM_REGISTER0; counter <= LCD_RAM_REGISTER15; counter++)
456     {
457       hlcd->Instance->RAM[counter] = 0;
458     }
459 
460     /* Update the LCD display */
461     status = HAL_LCD_UpdateDisplayRequest(hlcd);
462   }
463   return status;
464 }
465 
466 /**
467   * @brief  Enable the Update Display Request.
468   * @param hlcd LCD handle
469   * @note   Each time software modifies the LCD_RAM it must set the UDR bit to
470   *         transfer the updated data to the second level buffer.
471   *         The UDR bit stays set until the end of the update and during this
472   *         time the LCD_RAM is write protected.
473   * @note   When the display is disabled, the update is performed for all
474   *         LCD_DISPLAY locations.
475   *         When the display is enabled, the update is performed only for locations
476   *         for which commons are active (depending on DUTY). For example if
477   *         DUTY = 1/2, only the LCD_DISPLAY of COM0 and COM1 will be updated.
478   * @retval None
479   */
HAL_LCD_UpdateDisplayRequest(LCD_HandleTypeDef * hlcd)480 HAL_StatusTypeDef HAL_LCD_UpdateDisplayRequest(LCD_HandleTypeDef *hlcd)
481 {
482   uint32_t tickstart;
483 
484   /* Clear the Update Display Done flag before starting the update display request */
485   __HAL_LCD_CLEAR_FLAG(hlcd, LCD_FLAG_UDD);
486 
487   /* Enable the display request */
488   hlcd->Instance->SR |= LCD_SR_UDR;
489 
490   /* Get timeout */
491   tickstart = HAL_GetTick();
492 
493   /*!< Wait Until the LCD display is done */
494   while (__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_UDD) == RESET)
495   {
496     if ((HAL_GetTick() - tickstart) > LCD_TIMEOUT_VALUE)
497     {
498       hlcd->ErrorCode = HAL_LCD_ERROR_UDD;
499 
500       /* Process Unlocked */
501       __HAL_UNLOCK(hlcd);
502 
503       return HAL_TIMEOUT;
504     }
505   }
506 
507   hlcd->State = HAL_LCD_STATE_READY;
508 
509   /* Process Unlocked */
510   __HAL_UNLOCK(hlcd);
511 
512   return HAL_OK;
513 }
514 
515 /**
516   * @}
517   */
518 
519 /** @defgroup LCD_Exported_Functions_Group3 Peripheral State methods
520   *  @brief   LCD State functions
521   *
522 @verbatim
523  ===============================================================================
524                       ##### Peripheral State functions #####
525  ===============================================================================
526     [..]
527      This subsection provides a set of functions allowing to control the LCD:
528       (+) HAL_LCD_GetState() API can be helpful to check in run-time the state of the LCD peripheral State.
529       (+) HAL_LCD_GetError() API to return the LCD error code.
530 @endverbatim
531   * @{
532   */
533 
534 /**
535   * @brief Return the LCD handle state.
536   * @param hlcd LCD handle
537   * @retval HAL state
538   */
HAL_LCD_GetState(LCD_HandleTypeDef * hlcd)539 HAL_LCD_StateTypeDef HAL_LCD_GetState(LCD_HandleTypeDef *hlcd)
540 {
541   /* Return LCD handle state */
542   return hlcd->State;
543 }
544 
545 /**
546   * @brief Return the LCD error code.
547   * @param hlcd LCD handle
548   * @retval LCD Error Code
549   */
HAL_LCD_GetError(LCD_HandleTypeDef * hlcd)550 uint32_t HAL_LCD_GetError(LCD_HandleTypeDef *hlcd)
551 {
552   return hlcd->ErrorCode;
553 }
554 
555 /**
556   * @}
557   */
558 
559 /**
560   * @}
561   */
562 
563 /** @defgroup LCD_Private_Functions LCD Private Functions
564   * @{
565   */
566 
567 /**
568   * @brief  Wait until the LCD FCR register is synchronized in the LCDCLK domain.
569   *   This function must be called after any write operation to LCD_FCR register.
570   * @retval None
571   */
LCD_WaitForSynchro(LCD_HandleTypeDef * hlcd)572 HAL_StatusTypeDef LCD_WaitForSynchro(LCD_HandleTypeDef *hlcd)
573 {
574   uint32_t tickstart;
575 
576   /* Get timeout */
577   tickstart = HAL_GetTick();
578 
579   /* Loop until FCRSF flag is set */
580   while (__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_FCRSF) == RESET)
581   {
582     if ((HAL_GetTick() - tickstart) > LCD_TIMEOUT_VALUE)
583     {
584       hlcd->ErrorCode = HAL_LCD_ERROR_FCRSF;
585       return HAL_TIMEOUT;
586     }
587   }
588 
589   return HAL_OK;
590 }
591 
592 /**
593   * @}
594   */
595 
596 /**
597   * @}
598   */
599 
600 #endif /* HAL_LCD_MODULE_ENABLED */
601 
602 /**
603   * @}
604   */
605 
606 #endif /* STM32L433xx || STM32L443xx || STM32L476xx || STM32L486xx || STM32L496xx || STM32L4A6xx */
607