]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L1/stm32l1xx_hal_lcd.c
Merge commit '4d116a04e94cf0d19317d5b44e4fa9f34a3e5594'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32L1 / stm32l1xx_hal_lcd.c
1 /**
2 ******************************************************************************
3 * @file stm32l1xx_hal_lcd.c
4 * @author MCD Application Team
5 * @version V1.0.0
6 * @date 5-September-2014
7 * @brief LCD Controller HAL module driver.
8 * This file provides firmware functions to manage the following
9 * functionalities of the LCD Controller (LCD) peripheral:
10 * + Initialization/de-initialization methods
11 * + I/O operation methods
12 * + Peripheral State methods
13 *
14 @verbatim
15 ==============================================================================
16 ##### How to use this driver #####
17 ==============================================================================
18 [..] The LCD HAL driver can be used as follows:
19
20 (#) Declare a LCD_HandleTypeDef handle structure.
21
22 (#) Initialize the LCD low level resources by implement the HAL_LCD_MspInit() API:
23 (##) Enable the LCDCLK (same as RTCCLK): to configure the RTCCLK/LCDCLK, proceed as follows:
24 (+) Use RCC function HAL_RCCEx_PeriphCLKConfig in indicating RCC_PERIPHCLK_LCD and
25 selected clock source (HSE, LSI or LSE)
26
27 -@- The frequency generator allows you to achieve various LCD frame rates
28 starting from an LCD input clock frequency (LCDCLK) which can vary
29 from 32 kHz up to 1 MHz.
30 (##) LCD pins configuration:
31 (+) Enable the clock for the LCD GPIOs.
32 (+) Configure these LCD pins as alternate function no-pull.
33 (##) Enable the LCD interface clock.
34
35 (#) Program the Prescaler, Divider, Blink mode, Blink Frequency Duty, Bias,
36 Voltage Source, Dead Time, Pulse On Duration and Contrast in the hlcd Init structure.
37
38 (#) Initialize the LCD registers by calling the HAL_LCD_Init() API.
39
40 -@- The HAL_LCD_Init() API configures also the low level Hardware GPIO, CLOCK, ...etc)
41 by calling the custumed HAL_LCD_MspInit() API.
42 -@- After calling the HAL_LCD_Init() the LCD RAM memory is cleared
43
44 (#) Optionally you can update the LCD configuration using these macros:
45 (+) LCD High Drive using the __HAL_LCD_HIGHDRIVER_ENABLE() and __HAL_LCD_HIGHDRIVER_DISABLE() macros
46 (+) LCD Pulse ON Duration using the __HAL_LCD_PULSEONDURATION_CONFIG() macro
47 (+) LCD Dead Time using the __HAL_LCD_DEADTIME_CONFIG() macro
48 (+) The LCD Blink mode and frequency using the __HAL_LCD_BLINK_CONFIG() macro
49 (+) The LCD Contrast using the __HAL_LCD_CONTRAST_CONFIG() macro
50
51 (#) Write to the LCD RAM memory using the HAL_LCD_Write() API, this API can be called
52 more time to update the different LCD RAM registers before calling
53 HAL_LCD_UpdateDisplayRequest() API.
54
55 (#) The HAL_LCD_Clear() API can be used to clear the LCD RAM memory.
56
57 (#) When LCD RAM memory is updated enable the update display request using
58 the HAL_LCD_UpdateDisplayRequest() API.
59
60 [..] LCD and low power modes:
61 (#) The LCD remain active during STOP mode.
62
63 @endverbatim
64 ******************************************************************************
65 * @attention
66 *
67 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
68 *
69 * Redistribution and use in source and binary forms, with or without modification,
70 * are permitted provided that the following conditions are met:
71 * 1. Redistributions of source code must retain the above copyright notice,
72 * this list of conditions and the following disclaimer.
73 * 2. Redistributions in binary form must reproduce the above copyright notice,
74 * this list of conditions and the following disclaimer in the documentation
75 * and/or other materials provided with the distribution.
76 * 3. Neither the name of STMicroelectronics nor the names of its contributors
77 * may be used to endorse or promote products derived from this software
78 * without specific prior written permission.
79 *
80 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
81 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
82 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
83 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
84 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
85 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
86 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
87 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
88 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
89 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
90 *
91 ******************************************************************************
92 */
93
94 /* Includes ------------------------------------------------------------------*/
95 #include "stm32l1xx_hal.h"
96
97 /** @addtogroup STM32L1xx_HAL_Driver
98 * @{
99 */
100
101 #ifdef HAL_LCD_MODULE_ENABLED
102
103 #if defined (STM32L100xB) || defined (STM32L100xBA) || defined (STM32L100xC) ||\
104 defined (STM32L152xB) || defined (STM32L152xBA) || defined (STM32L152xC) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L152xE) ||\
105 defined (STM32L162xC) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L162xE)
106
107 /** @defgroup LCD LCD
108 * @brief LCD HAL module driver
109 * @{
110 */
111
112 /* Private typedef -----------------------------------------------------------*/
113 /* Private define ------------------------------------------------------------*/
114 /** @defgroup LCD_Private_Defines LCD Private Defines
115 * @{
116 */
117
118 #define LCD_TIMEOUT_VALUE 1000
119
120 /**
121 * @}
122 */
123
124 /* Private macro -------------------------------------------------------------*/
125 /* Private variables ---------------------------------------------------------*/
126 /* Private function prototypes -----------------------------------------------*/
127 /* Private functions ---------------------------------------------------------*/
128
129 /** @defgroup LCD_Exported_Functions LCD Exported Functions
130 * @{
131 */
132
133 /** @defgroup LCD_Exported_Functions_Group1 Initialization/de-initialization methods
134 * @brief Initialization and Configuration functions
135 *
136 @verbatim
137 ===============================================================================
138 ##### Initialization and Configuration functions #####
139 ===============================================================================
140 [..]
141
142 @endverbatim
143 * @{
144 */
145
146 /**
147 * @brief DeInitializes the LCD peripheral.
148 * @param hlcd: LCD handle
149 * @retval HAL status
150 */
151 HAL_StatusTypeDef HAL_LCD_DeInit(LCD_HandleTypeDef *hlcd)
152 {
153 /* Check the LCD handle allocation */
154 if(hlcd == HAL_NULL)
155 {
156 return HAL_ERROR;
157 }
158
159 /* Check the parameters */
160 assert_param(IS_LCD_ALL_INSTANCE(hlcd->Instance));
161
162 hlcd->State = HAL_LCD_STATE_BUSY;
163
164 /* DeInit the low level hardware */
165 HAL_LCD_MspDeInit(hlcd);
166
167 hlcd->ErrorCode = HAL_LCD_ERROR_NONE;
168 hlcd->State = HAL_LCD_STATE_RESET;
169
170 /* Release Lock */
171 __HAL_UNLOCK(hlcd);
172
173 return HAL_OK;
174 }
175
176 /**
177 * @brief Initializes the LCD peripheral according to the specified parameters
178 * in the LCD_InitStruct.
179 * @note This function can be used only when the LCD is disabled.
180 * @param hlcd: LCD handle
181 * @retval None
182 */
183 HAL_StatusTypeDef HAL_LCD_Init(LCD_HandleTypeDef *hlcd)
184 {
185 uint32_t tickstart = 0x00;
186 uint8_t counter = 0;
187
188 /* Check the LCD handle allocation */
189 if(hlcd == HAL_NULL)
190 {
191 return HAL_ERROR;
192 }
193
194 /* Check function parameters */
195 assert_param(IS_LCD_ALL_INSTANCE(hlcd->Instance));
196 assert_param(IS_LCD_PRESCALER(hlcd->Init.Prescaler));
197 assert_param(IS_LCD_DIVIDER(hlcd->Init.Divider));
198 assert_param(IS_LCD_DUTY(hlcd->Init.Duty));
199 assert_param(IS_LCD_BIAS(hlcd->Init.Bias));
200 assert_param(IS_LCD_VOLTAGE_SOURCE(hlcd->Init.VoltageSource));
201 assert_param(IS_LCD_PULSE_ON_DURATION(hlcd->Init.PulseOnDuration));
202 assert_param(IS_LCD_DEAD_TIME(hlcd->Init.DeadTime));
203 assert_param(IS_LCD_CONTRAST(hlcd->Init.Contrast));
204 assert_param(IS_LCD_BLINK_FREQUENCY(hlcd->Init.BlinkFrequency));
205 assert_param(IS_LCD_BLINK_MODE(hlcd->Init.BlinkMode));
206 assert_param(IS_LCD_MUXSEGMENT(hlcd->Init.MuxSegment));
207
208 if(hlcd->State == HAL_LCD_STATE_RESET)
209 {
210 /* Initialize the low level hardware (MSP) */
211 HAL_LCD_MspInit(hlcd);
212 }
213
214 hlcd->State = HAL_LCD_STATE_BUSY;
215
216 /* Disable the peripheral */
217 __HAL_LCD_DISABLE(hlcd);
218
219 /* Clear the LCD_RAM registers and enable the display request by setting the UDR bit
220 in the LCD_SR register */
221 for(counter = LCD_RAM_REGISTER0; counter <= LCD_RAM_REGISTER15; counter++)
222 {
223 hlcd->Instance->RAM[counter] = 0;
224 }
225 /* Enable the display request */
226 hlcd->Instance->SR |= LCD_SR_UDR;
227
228 /* Configure the LCD Prescaler, Divider, Blink mode and Blink Frequency:
229 Set PS[3:0] bits according to hlcd->Init.Prescaler value
230 Set DIV[3:0] bits according to hlcd->Init.Divider value
231 Set BLINK[1:0] bits according to hlcd->Init.BlinkMode value
232 Set BLINKF[2:0] bits according to hlcd->Init.BlinkFrequency value
233 Set DEAD[2:0] bits according to hlcd->Init.DeadTime value
234 Set PON[2:0] bits according to hlcd->Init.PulseOnDuration value
235 Set CC[2:0] bits according to hlcd->Init.Contrast value */
236 MODIFY_REG(hlcd->Instance->FCR, \
237 (LCD_FCR_PS | LCD_FCR_DIV | LCD_FCR_BLINK| LCD_FCR_BLINKF | \
238 LCD_FCR_DEAD | LCD_FCR_PON | LCD_FCR_CC), \
239 (hlcd->Init.Prescaler | hlcd->Init.Divider | hlcd->Init.BlinkMode | hlcd->Init.BlinkFrequency | \
240 hlcd->Init.DeadTime | hlcd->Init.PulseOnDuration | hlcd->Init.Contrast));
241
242 /* Wait until LCD Frame Control Register Synchronization flag (FCRSF) is set in the LCD_SR register
243 This bit is set by hardware each time the LCD_FCR register is updated in the LCDCLK
244 domain. It is cleared by hardware when writing to the LCD_FCR register.*/
245 LCD_WaitForSynchro(hlcd);
246
247 /* Configure the LCD Duty, Bias, Voltage Source, Dead Time, Pulse On Duration and Contrast:
248 Set DUTY[2:0] bits according to hlcd->Init.Duty value
249 Set BIAS[1:0] bits according to hlcd->Init.Bias value
250 Set VSEL bit according to hlcd->Init.VoltageSource value
251 Set MUX_SEG bit according to hlcd->Init.MuxSegment value */
252 MODIFY_REG(hlcd->Instance->CR, \
253 (LCD_CR_DUTY | LCD_CR_BIAS | LCD_CR_VSEL | LCD_CR_MUX_SEG), \
254 (hlcd->Init.Duty | hlcd->Init.Bias | hlcd->Init.VoltageSource | hlcd->Init.MuxSegment));
255
256 /* Enable the peripheral */
257 __HAL_LCD_ENABLE(hlcd);
258
259 /* Get timeout */
260 tickstart = HAL_GetTick();
261
262 /* Wait Until the LCD is enabled */
263 while(__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_ENS) == RESET)
264 {
265 if((HAL_GetTick() - tickstart ) > LCD_TIMEOUT_VALUE)
266 {
267 hlcd->ErrorCode = HAL_LCD_ERROR_ENS;
268 return HAL_TIMEOUT;
269 }
270 }
271
272 /* Get timeout */
273 tickstart = HAL_GetTick();
274
275 /*!< Wait Until the LCD Booster is ready */
276 while(__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_RDY) == RESET)
277 {
278 if((HAL_GetTick() - tickstart ) > LCD_TIMEOUT_VALUE)
279 {
280 hlcd->ErrorCode = HAL_LCD_ERROR_RDY;
281 return HAL_TIMEOUT;
282 }
283 }
284
285 /* Initialize the LCD state */
286 hlcd->ErrorCode = HAL_LCD_ERROR_NONE;
287 hlcd->State= HAL_LCD_STATE_READY;
288
289 return HAL_OK;
290 }
291
292 /**
293 * @brief LCD MSP DeInit.
294 * @param hlcd: LCD handle
295 * @retval None
296 */
297 __weak void HAL_LCD_MspDeInit(LCD_HandleTypeDef *hlcd)
298 {
299 /* NOTE: This function Should not be modified, when the callback is needed,
300 the HAL_LCD_MspDeInit could be implemented in the user file
301 */
302 }
303
304 /**
305 * @brief LCD MSP Init.
306 * @param hlcd: LCD handle
307 * @retval None
308 */
309 __weak void HAL_LCD_MspInit(LCD_HandleTypeDef *hlcd)
310 {
311 /* NOTE: This function Should not be modified, when the callback is needed,
312 the HAL_LCD_MspInit could 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 Writes 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 */
374 HAL_StatusTypeDef HAL_LCD_Write(LCD_HandleTypeDef *hlcd, uint32_t RAMRegisterIndex, uint32_t RAMRegisterMask, uint32_t Data)
375 {
376 uint32_t tickstart = 0x00;
377
378 if((hlcd->State == HAL_LCD_STATE_READY) || (hlcd->State == HAL_LCD_STATE_BUSY))
379 {
380 /* Check the parameters */
381 assert_param(IS_LCD_RAM_REGISTER(RAMRegisterIndex));
382
383 if(hlcd->State == HAL_LCD_STATE_READY)
384 {
385 /* Process Locked */
386 __HAL_LOCK(hlcd);
387 hlcd->State = HAL_LCD_STATE_BUSY;
388
389 /* Get timeout */
390 tickstart = HAL_GetTick();
391
392 /*!< Wait Until the LCD is ready */
393 while(__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_UDR) != RESET)
394 {
395 if((HAL_GetTick() - tickstart ) > LCD_TIMEOUT_VALUE)
396 {
397 hlcd->ErrorCode = HAL_LCD_ERROR_UDR;
398
399 /* Process Unlocked */
400 __HAL_UNLOCK(hlcd);
401
402 return HAL_TIMEOUT;
403 }
404 }
405 }
406
407 /* Copy the new Data bytes to LCD RAM register */
408 MODIFY_REG(hlcd->Instance->RAM[RAMRegisterIndex], ~(RAMRegisterMask), Data);
409
410 return HAL_OK;
411 }
412 else
413 {
414 return HAL_ERROR;
415 }
416 }
417
418 /**
419 * @brief Clears the LCD RAM registers.
420 * @param hlcd: LCD handle
421 * @retval None
422 */
423 HAL_StatusTypeDef HAL_LCD_Clear(LCD_HandleTypeDef *hlcd)
424 {
425 uint32_t tickstart = 0x00;
426 uint32_t counter = 0;
427
428 if((hlcd->State == HAL_LCD_STATE_READY) || (hlcd->State == HAL_LCD_STATE_BUSY))
429 {
430 /* Process Locked */
431 __HAL_LOCK(hlcd);
432
433 hlcd->State = HAL_LCD_STATE_BUSY;
434
435 /* Get timeout */
436 tickstart = HAL_GetTick();
437
438 /*!< Wait Until the LCD is ready */
439 while(__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_UDR) != RESET)
440 {
441 if((HAL_GetTick() - tickstart ) > LCD_TIMEOUT_VALUE)
442 {
443 hlcd->ErrorCode = HAL_LCD_ERROR_UDR;
444
445 /* Process Unlocked */
446 __HAL_UNLOCK(hlcd);
447
448 return HAL_TIMEOUT;
449 }
450 }
451 /* Clear the LCD_RAM registers */
452 for(counter = LCD_RAM_REGISTER0; counter <= LCD_RAM_REGISTER15; counter++)
453 {
454 hlcd->Instance->RAM[counter] = 0;
455 }
456
457 /* Update the LCD display */
458 HAL_LCD_UpdateDisplayRequest(hlcd);
459
460 return HAL_OK;
461 }
462 else
463 {
464 return HAL_ERROR;
465 }
466 }
467
468 /**
469 * @brief Enables the Update Display Request.
470 * @param hlcd: LCD handle
471 * @note Each time software modifies the LCD_RAM it must set the UDR bit to
472 * transfer the updated data to the second level buffer.
473 * The UDR bit stays set until the end of the update and during this
474 * time the LCD_RAM is write protected.
475 * @note When the display is disabled, the update is performed for all
476 * LCD_DISPLAY locations.
477 * When the display is enabled, the update is performed only for locations
478 * for which commons are active (depending on DUTY). For example if
479 * DUTY = 1/2, only the LCD_DISPLAY of COM0 and COM1 will be updated.
480 * @retval None
481 */
482 HAL_StatusTypeDef HAL_LCD_UpdateDisplayRequest(LCD_HandleTypeDef *hlcd)
483 {
484 uint32_t tickstart = 0x00;
485
486 /* Clear the Update Display Done flag before starting the update display request */
487 __HAL_LCD_CLEAR_FLAG(hlcd, LCD_FLAG_UDD);
488
489 /* Enable the display request */
490 hlcd->Instance->SR |= LCD_SR_UDR;
491
492 /* Get timeout */
493 tickstart = HAL_GetTick();
494
495 /*!< Wait Until the LCD display is done */
496 while(__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_UDD) == RESET)
497 {
498 if((HAL_GetTick() - tickstart ) > LCD_TIMEOUT_VALUE)
499 {
500 hlcd->ErrorCode = HAL_LCD_ERROR_UDD;
501
502 /* Process Unlocked */
503 __HAL_UNLOCK(hlcd);
504
505 return HAL_TIMEOUT;
506 }
507 }
508
509 hlcd->State = HAL_LCD_STATE_READY;
510
511 /* Process Unlocked */
512 __HAL_UNLOCK(hlcd);
513
514 return HAL_OK;
515 }
516
517 /**
518 * @}
519 */
520
521 /** @defgroup LCD_Exported_Functions_Group3 Peripheral State methods
522 * @brief LCD State functions
523 *
524 @verbatim
525 ===============================================================================
526 ##### Peripheral State functions #####
527 ===============================================================================
528 [..]
529 This subsection provides a set of functions allowing to control the LCD:
530 (+) HAL_LCD_GetState() API can be helpful to check in run-time the state of the LCD peripheral State.
531 (+) HAL_LCD_GetError() API to return the LCD error code.
532 @endverbatim
533 * @{
534 */
535
536 /**
537 * @brief Returns the LCD state.
538 * @param hlcd: LCD handle
539 * @retval HAL state
540 */
541 HAL_LCD_StateTypeDef HAL_LCD_GetState(LCD_HandleTypeDef *hlcd)
542 {
543 return hlcd->State;
544 }
545
546 /**
547 * @brief Return the LCD error code
548 * @param hlcd: LCD handle
549 * @retval LCD Error Code
550 */
551 uint32_t HAL_LCD_GetError(LCD_HandleTypeDef *hlcd)
552 {
553 return hlcd->ErrorCode;
554 }
555
556 /**
557 * @}
558 */
559
560 /**
561 * @}
562 */
563
564 /** @defgroup LCD_Private_Functions LCD Private Functions
565 * @{
566 */
567
568 /**
569 * @brief Waits until the LCD FCR register is synchronized in the LCDCLK domain.
570 * This function must be called after any write operation to LCD_FCR register.
571 * @retval None
572 */
573 HAL_StatusTypeDef LCD_WaitForSynchro(LCD_HandleTypeDef *hlcd)
574 {
575 uint32_t tickstart = 0x00;
576
577 /* Get timeout */
578 tickstart = HAL_GetTick();
579
580 /* Loop until FCRSF flag is set */
581 while(__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_FCRSF) == RESET)
582 {
583 if((HAL_GetTick() - tickstart ) > LCD_TIMEOUT_VALUE)
584 {
585 hlcd->ErrorCode = HAL_LCD_ERROR_FCRSF;
586 return HAL_TIMEOUT;
587 }
588 }
589
590 return HAL_OK;
591 }
592
593 /**
594 * @}
595 */
596
597 /**
598 * @}
599 */
600
601 #endif /* STM32L100xB || STM32L100xBA || STM32L100xC ||... || STM32L162xD || STM32L162xE */
602
603 #endif /* HAL_LCD_MODULE_ENABLED */
604
605 /**
606 * @}
607 */
608
609 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
610
Imprint / Impressum