1 /*********************************************************************************************************//**
2  * @file    ht32f5xxxx_lcd.c
3  * @version $Rev:: 1704         $
4  * @date    $Date:: 2017-08-17 #$
5  * @brief   This file provides all the LCD firmware functions.
6  *************************************************************************************************************
7  * @attention
8  *
9  * Firmware Disclaimer Information
10  *
11  * 1. The customer hereby acknowledges and agrees that the program technical documentation, including the
12  *    code, which is supplied by Holtek Semiconductor Inc., (hereinafter referred to as "HOLTEK") is the
13  *    proprietary and confidential intellectual property of HOLTEK, and is protected by copyright law and
14  *    other intellectual property laws.
15  *
16  * 2. The customer hereby acknowledges and agrees that the program technical documentation, including the
17  *    code, is confidential information belonging to HOLTEK, and must not be disclosed to any third parties
18  *    other than HOLTEK and the customer.
19  *
20  * 3. The program technical documentation, including the code, is provided "as is" and for customer reference
21  *    only. After delivery by HOLTEK, the customer shall use the program technical documentation, including
22  *    the code, at their own risk. HOLTEK disclaims any expressed, implied or statutory warranties, including
23  *    the warranties of merchantability, satisfactory quality and fitness for a particular purpose.
24  *
25  * <h2><center>Copyright (C) Holtek Semiconductor Inc. All rights reserved</center></h2>
26  ************************************************************************************************************/
27 
28 /* Includes ------------------------------------------------------------------------------------------------*/
29 #include "ht32f5xxxx_lcd.h"
30 
31 /** @addtogroup HT32F5xxxx_Peripheral_Driver HT32F5xxxx Peripheral Driver
32   * @{
33   */
34 
35 /** @defgroup LCD LCD
36   * @brief LCD driver modules
37   * @{
38   */
39 
40 /* Global functions ----------------------------------------------------------------------------------------*/
41 /** @defgroup LCD_Exported_Functions LCD exported functions
42   * @{
43   */
44 /*********************************************************************************************************//**
45  * @brief Deinitialize the LCD peripheral registers to their default reset values.
46  * @retval None
47  ************************************************************************************************************/
LCD_DriverDeInit(void)48 void LCD_DriverDeInit(void)
49 {
50   RSTCU_PeripReset_TypeDef RSTCUReset = {{0}};
51   RSTCUReset.Bit.LCD = 1;
52   RSTCU_PeripReset(RSTCUReset, ENABLE);
53 }
54 
55 /*********************************************************************************************************//**
56  * @brief Initializes the LCD peripheral according to the specified parameters in the LCD_InitStruct.
57  * @param LCD_InitStruct: pointer to a LCD_InitTypeDef structure.
58  * @retval None
59  ************************************************************************************************************/
LCD_DriverInit(LCD_InitTypeDef * LCD_InitStruct)60 void LCD_DriverInit(LCD_InitTypeDef* LCD_InitStruct)
61 {
62   /* !!! NOTICE !!!
63      Must wait until the LCDENS = 0 before change the LCD control register.
64   */
65   #if 0
66   while (LCD_GetFlagStatus(LCD_FLAG_ENS) == 1);
67   #endif
68 
69   HT_LCD->FCR = (u32)(LCD_InitStruct->LCD_Prescaler) |
70                 (u32)(LCD_InitStruct->LCD_Divider);
71 
72   HT_LCD->CR = (u32)(LCD_InitStruct->LCD_Waveform) |
73                (u32)(LCD_InitStruct->LCD_Bias) |
74                (u32)(LCD_InitStruct->LCD_Duty) |
75                (u32)(LCD_InitStruct->LCD_VoltageSource);
76 }
77 
78 /*********************************************************************************************************//**
79  * @brief Configure the MCONT mask time.
80  * @param Sel: specify the mask time.
81  *   This parameter can be:
82  *     @arg LCD_MaskTime_25ns : MCONT mask time is 25 ns
83  *     @arg LCD_MaskTime_40ns : MCONT mask time is 40 ns
84  * @retval None
85  ************************************************************************************************************/
LCD_MaskTimeConfig(LCD_MaskTime_Enum Sel)86 void LCD_MaskTimeConfig(LCD_MaskTime_Enum Sel)
87 {
88   /* !!! NOTICE !!!
89      Must wait until the LCDENS = 0 before change the LCD control register.
90   */
91   #if 0
92   while (LCD_GetFlagStatus(LCD_FLAG_ENS) == 1);
93   #endif
94 
95   HT_LCD->CR = (HT_LCD->CR & ~(1ul << 24)) | Sel;
96 }
97 
98 /*********************************************************************************************************//**
99  * @brief Enable or Disable half of the low value resistor (HRLEN).
100  * @param NewState: This parameter can be ENABLE or DISABLE.
101  * @retval None
102  ************************************************************************************************************/
LCD_HalfRLCmd(ControlStatus NewState)103 void LCD_HalfRLCmd(ControlStatus NewState)
104 {
105   /* Check the parameters                                                                                   */
106   Assert_Param(IS_CONTROL_STATUS(NewState));
107 
108   if (NewState != DISABLE)
109   {
110     HT_LCD->CR |= (1ul << 15);
111   }
112   else
113   {
114     HT_LCD->CR &= ~(1ul << 15);
115   }
116 }
117 
118 /*********************************************************************************************************//**
119  * @brief Configure the STATIC switch.
120  * @param Sel: specify the STATIC switch status.
121  *   This parameter can be:
122  *     @arg LCD_Static_Switch_Open  : STATIC switch is open during dead time.
123  *     @arg LCD_Static_Switch_close : STATIC switch is closed during dead time.
124  * @retval None
125  ************************************************************************************************************/
LCD_StaticSwitchConfig(LCD_StaticSwitch_Enum Sel)126 void LCD_StaticSwitchConfig(LCD_StaticSwitch_Enum Sel)
127 {
128   /* !!! NOTICE !!!
129      Must wait until the LCDENS = 0 before change the LCD control register.
130   */
131   #if 0
132   while (LCD_GetFlagStatus(LCD_FLAG_ENS) == 1);
133   #endif
134 
135   HT_LCD->CR = (HT_LCD->CR & ~(1ul << 14)) | Sel;
136 }
137 
138 /*********************************************************************************************************//**
139  * @brief Configure MuxCOM7 to be COM7 or SEGx.
140  * @param Sel: Specify the MuxSEG.
141  *   This parameter can be one of the following values:
142  *     @arg LCD_MUXCOM7_IS_COM7  :
143  *     @arg LCD_MUXCOM7_IS_SEGx  :(52341: SEG28, 57352: SEG36)
144  * @retval None
145  ************************************************************************************************************/
LCD_MuxCOM7Config(LCD_MUXCOM7_Enum Sel)146 void LCD_MuxCOM7Config(LCD_MUXCOM7_Enum Sel)
147 {
148   /* !!! NOTICE !!!
149      Must wait until the LCDENS = 0 before change the LCD control register.
150   */
151   #if 0
152   while (LCD_GetFlagStatus(LCD_FLAG_ENS) == 1);
153   #endif
154 
155   HT_LCD->CR = (HT_LCD->CR & ~(1ul << 11)) | Sel;
156 }
157 
158 /*********************************************************************************************************//**
159  * @brief Configure MuxCOM6 to be COM6 or SEGx.
160  * @param Sel: Specify the MuxSEG.
161  *   This parameter can be one of the following values:
162  *     @arg LCD_MUXCOM7_IS_COM6  :
163  *     @arg LCD_MUXCOM7_IS_SEGx  :(52341: SEG27, 57352: SEG35)
164  * @retval None
165  ************************************************************************************************************/
LCD_MuxCOM6Config(LCD_MUXCOM6_Enum Sel)166 void LCD_MuxCOM6Config(LCD_MUXCOM6_Enum Sel)
167 {
168   /* !!! NOTICE !!!
169      Must wait until the LCDENS = 0 before change the LCD settings.
170   */
171   #if 0
172   while (LCD_GetFlagStatus(LCD_FLAG_ENS) == 1);
173   #endif
174 
175   HT_LCD->CR = (HT_LCD->CR & ~(1ul << 10)) | Sel;
176 }
177 
178 /*********************************************************************************************************//**
179  * @brief Configure MuxCOM5 to be COM5 or SEGx.
180  * @param Sel: Specify the MuxSEG.
181  *   This parameter can be one of the following values:
182  *     @arg LCD_MUXCOM7_IS_COM5  :
183  *     @arg LCD_MUXCOM7_IS_SEGx  :(52341: SEG26, 57352: SEG34)
184  * @retval None
185  ************************************************************************************************************/
LCD_MuxCOM5Config(LCD_MUXCOM5_Enum Sel)186 void LCD_MuxCOM5Config(LCD_MUXCOM5_Enum Sel)
187 {
188   /* !!! NOTICE !!!
189      Must wait until the LCDENS = 0 before change the LCD settings.
190   */
191   #if 0
192   while (LCD_GetFlagStatus(LCD_FLAG_ENS) == 1);
193   #endif
194 
195   HT_LCD->CR = (HT_LCD->CR & ~(1ul << 9)) | Sel;
196 }
197 
198 /*********************************************************************************************************//**
199  * @brief Configure MuxCOM4 to be COM4 or SEGx.
200  * @param Sel: Specify the MuxSEG.
201  *   This parameter can be one of the following values:
202  *     @arg LCD_MUXCOM7_IS_COM4  :
203  *     @arg LCD_MUXCOM7_IS_SEGx  :(52341: SEG25, 57352: SEG33)
204  * @retval None
205  ************************************************************************************************************/
LCD_MuxCOM4Config(LCD_MUXCOM4_Enum Sel)206 void LCD_MuxCOM4Config(LCD_MUXCOM4_Enum Sel)
207 {
208   /* !!! NOTICE !!!
209      Must wait until the LCDENS = 0 before change the LCD settings.
210   */
211   #if 0
212   while (LCD_GetFlagStatus(LCD_FLAG_ENS) == 1);
213   #endif
214 
215   HT_LCD->CR = (HT_LCD->CR & ~(1ul << 8)) | Sel;
216 }
217 
218 /*********************************************************************************************************//**
219  * @brief Configure the LCD waveform type.
220  * @param Sel: specify the LCD waveform type.
221  *   This parameter can be one of the following values:
222  *     @arg LCD_Type_A_Waveform : Type A waveform
223  *     @arg LCD_Type_B_Waveform : Type B waveform
224  * @retval None
225  ************************************************************************************************************/
LCD_WaveformConfig(LCD_Waveform_Enum Sel)226 void LCD_WaveformConfig(LCD_Waveform_Enum Sel)
227 {
228   /* !!! NOTICE !!!
229      Must wait until the LCDENS = 0 before change the LCD settings.
230   */
231   #if 0
232   while (LCD_GetFlagStatus(LCD_FLAG_ENS) == 1);
233   #endif
234 
235   HT_LCD->CR = (HT_LCD->CR & ~(1ul << 7)) | Sel;
236 }
237 
238 /*********************************************************************************************************//**
239  * @brief Configure LCD Bias Selector.
240  * @param Sel: Specify LCD Bias Selector.
241  *   This parameter can be one of the following values:
242  *     @arg LCD_Bias_1_4    : Bias 1/4
243  *     @arg LCD_Bias_1_2    : Bias 1/2
244  *     @arg LCD_Bias_1_3    : Bias 1/3
245  *     @arg LCD_Bias_Static : STATIC
246  * @retval None
247  ************************************************************************************************************/
LCD_BiasConfig(LCD_Bias_Enum Sel)248 void LCD_BiasConfig(LCD_Bias_Enum Sel)
249 {
250   /* !!! NOTICE !!!
251      Must wait until the LCDENS = 0 before change the LCD settings.
252   */
253   #if 0
254   while (LCD_GetFlagStatus(LCD_FLAG_ENS) == 1);
255   #endif
256 
257   HT_LCD->CR = (HT_LCD->CR & ~(3ul << 5)) | Sel;
258 }
259 
260 /*********************************************************************************************************//**
261  * @brief Configure the LCD Duty Selection.
262  * @param Sel: Specify LCD Duty select.
263  *   This parameter can be one of the following values:
264  *     @arg LCD_Duty_Static : Static duty
265  *     @arg LCD_Duty_1_2    : 1/2 duty
266  *     @arg LCD_Duty_1_3    : 1/3 duty
267  *     @arg LCD_Duty_1_4    : 1/4 duty
268  *     @arg LCD_Duty_1_6    : 1/6 duty
269  *     @arg LCD_Duty_1_8    : 1/8 duty
270  ************************************************************************************************************/
LCD_DutyConfig(LCD_Duty_Enum Sel)271 void LCD_DutyConfig(LCD_Duty_Enum Sel)
272 {
273   /* !!! NOTICE !!!
274      Must wait until the LCDENS = 0 before change the LCD settings.
275   */
276   #if 0
277   while (LCD_GetFlagStatus(LCD_FLAG_ENS) == 1);
278   #endif
279 
280   HT_LCD->CR = (HT_LCD->CR & ~(7ul << 2)) | Sel;
281 }
282 
283 /*********************************************************************************************************//**
284  * @brief Configure the LCD Power Selection.
285  * @param Sel: Specify LCD Power select.
286  *   This parameter can be one of the following values:
287  *     @arg LCD_VoltageSource_External : External VLCD
288  *     @arg LCD_VoltageSource_Internal : Internal charge pump
289  * @retval None
290  ************************************************************************************************************/
LCD_VoltageSourceConfig(LCD_VoltageSource_Enum Sel)291 void LCD_VoltageSourceConfig(LCD_VoltageSource_Enum Sel)
292 {
293   /* !!! NOTICE !!!
294      Must wait until the LCDENS = 0 before change the LCD settings.
295   */
296   #if 0
297   while (LCD_GetFlagStatus(LCD_FLAG_ENS) == 1);
298   #endif
299 
300   HT_LCD->CR = (HT_LCD->CR & ~(1ul << 1)) | Sel;
301 }
302 
303 /*********************************************************************************************************//**
304  * @brief Enable or Disable the LCD peripheral.
305  * @param NewState: This parameter can be ENABLE or DISABLE.
306  * @retval None
307  ************************************************************************************************************/
LCD_Cmd(ControlStatus NewState)308 void LCD_Cmd(ControlStatus NewState)
309 {
310   /* Check the parameters                                                                                   */
311   Assert_Param(IS_CONTROL_STATUS(NewState));
312 
313   if (NewState != DISABLE)
314   {
315     HT_LCD->CR |= (1ul << 0);
316   }
317   else
318   {
319     HT_LCD->CR &= ~(1ul << 0);
320   }
321 }
322 
323 /*********************************************************************************************************//**
324  * @brief Configure the LCD 16-bit prescaler.
325  * @param Sel: specify the LCD 16-bit prescaler setting.
326  *   This parameter can be one of the following values:
327  *     @arg LCD_Prescaler_1     : CK_PS = CK_LCD / 1
328  *     @arg LCD_Prescaler_2     : CK_PS = CK_LCD / 2
329  *     @arg LCD_Prescaler_4     : CK_PS = CK_LCD / 4
330  *     @arg LCD_Prescaler_8     : CK_PS = CK_LCD / 8
331  *     @arg LCD_Prescaler_16    : CK_PS = CK_LCD / 16
332  *     @arg LCD_Prescaler_32    : CK_PS = CK_LCD / 32
333  *     @arg LCD_Prescaler_64    : CK_PS = CK_LCD / 64
334  *     @arg LCD_Prescaler_128   : CK_PS = CK_LCD / 128
335  *     @arg LCD_Prescaler_256   : CK_PS = CK_LCD / 256
336  *     @arg LCD_Prescaler_512   : CK_PS = CK_LCD / 512
337  *     @arg LCD_Prescaler_1024  : CK_PS = CK_LCD / 1024
338  *     @arg LCD_Prescaler_2048  : CK_PS = CK_LCD / 2048
339  *     @arg LCD_Prescaler_4096  : CK_PS = CK_LCD / 4096
340  *     @arg LCD_Prescaler_8192  : CK_PS = CK_LCD / 8192
341  *     @arg LCD_Prescaler_16384 : CK_PS = CK_LCD / 16384
342  *     @arg LCD_Prescaler_32768 : CK_PS = CK_LCD / 32768
343  * @retval None
344  ************************************************************************************************************/
LCD_PrescalerConfig(LCD_Prescaler_Enum Sel)345 void LCD_PrescalerConfig(LCD_Prescaler_Enum Sel)
346 {
347   while (LCD_GetFlagStatus(LCD_FLAG_FCRSF) == SET);
348   HT_LCD->FCR = (HT_LCD->FCR & ~(15ul << 22)) | Sel;
349 }
350 
351 /*********************************************************************************************************//**
352  * @brief Configure the LCD clock divider.
353  * @param Sel: specify the LCD clock divider setting.
354  *   This parameter can be one of the following values:
355  *     @arg LCD_Divider_16 : CK_DIV = CK_PS / 16
356  *     @arg LCD_Divider_17 : CK_DIV = CK_PS / 17
357  *     @arg LCD_Divider_18 : CK_DIV = CK_PS / 18
358  *     @arg LCD_Divider_19 : CK_DIV = CK_PS / 19
359  *     @arg LCD_Divider_20 : CK_DIV = CK_PS / 20
360  *     @arg LCD_Divider_21 : CK_DIV = CK_PS / 21
361  *     @arg LCD_Divider_22 : CK_DIV = CK_PS / 22
362  *     @arg LCD_Divider_23 : CK_DIV = CK_PS / 23
363  *     @arg LCD_Divider_24 : CK_DIV = CK_PS / 24
364  *     @arg LCD_Divider_25 : CK_DIV = CK_PS / 25
365  *     @arg LCD_Divider_26 : CK_DIV = CK_PS / 26
366  *     @arg LCD_Divider_27 : CK_DIV = CK_PS / 27
367  *     @arg LCD_Divider_28 : CK_DIV = CK_PS / 28
368  *     @arg LCD_Divider_29 : CK_DIV = CK_PS / 29
369  *     @arg LCD_Divider_30 : CK_DIV = CK_PS / 30
370  *     @arg LCD_Divider_31 : CK_DIV = CK_PS / 31
371  * @retval None
372  ************************************************************************************************************/
LCD_DividerConfig(LCD_Divider_Enum Sel)373 void LCD_DividerConfig(LCD_Divider_Enum Sel)
374 {
375   while (LCD_GetFlagStatus(LCD_FLAG_FCRSF) == SET);
376   HT_LCD->FCR = (HT_LCD->FCR & ~(15ul << 18)) | Sel;
377 }
378 
379 /*********************************************************************************************************//**
380  * @brief Configure the LCD Blink Mode Selection.
381  * @param Sel: Specify LCD Blink Mode Selection.
382  *   This parameter can be one of the following values:
383  *     @arg LCD_BlinkMode_Off           : Blink inactive
384  *     @arg LCD_BlinkMode_SEG0_COM0     : SEG0 on COM0 blink
385  *     @arg LCD_BlinkMode_SEG0_AllCOM   : SEG0 on All COM blink
386  *     @arg LCD_BlinkMode_AllSEG_AllCOM : All SEG on All COM blink
387  ************************************************************************************************************/
LCD_BlinkModeConfig(LCD_BlinkMode_Enum Sel)388 void LCD_BlinkModeConfig(LCD_BlinkMode_Enum Sel)
389 {
390   while (LCD_GetFlagStatus(LCD_FLAG_FCRSF) == SET);
391   HT_LCD->FCR = (HT_LCD->FCR & ~(3ul << 16)) | Sel;
392 }
393 
394 /*********************************************************************************************************//**
395  * @brief Configure the LCD Blink Frequency  Selection.
396  * @param Sel: Specify LCD Blink Frequency  Selection.
397  *   This parameter can be one of the following values:
398  *     @arg LCD_BlinkFrequency_Div8    : Blink frequency = frame rate / 8
399  *     @arg LCD_BlinkFrequency_Div16   : Blink frequency = frame rate / 16
400  *     @arg LCD_BlinkFrequency_Div32   : Blink frequency = frame rate / 32
401  *     @arg LCD_BlinkFrequency_Div64   : Blink frequency = frame rate / 64
402  *     @arg LCD_BlinkFrequency_Div128  : Blink frequency = frame rate / 128
403  *     @arg LCD_BlinkFrequency_Div256  : Blink frequency = frame rate / 256
404  *     @arg LCD_BlinkFrequency_Div512  : Blink frequency = frame rate / 512
405  *     @arg LCD_BlinkFrequency_Div1024 : Blink frequency = frame rate / 1024
406  ************************************************************************************************************/
LCD_BlinkFrequencyConfig(LCD_BlinkFrequency_Enum Sel)407 void LCD_BlinkFrequencyConfig(LCD_BlinkFrequency_Enum Sel)
408 {
409   while (LCD_GetFlagStatus(LCD_FLAG_FCRSF) == SET);
410   HT_LCD->FCR = (HT_LCD->FCR & ~(7ul << 13)) | Sel;
411 }
412 
413 /*********************************************************************************************************//**
414  * @brief Configure the LCD Charge Pump Voltage Selection.
415  * @param Sel: Specify LCD Charge Pump Voltage Selection.
416  *   This parameter can be one of the following values:
417  *     @arg LCD_ChargePump_2V65 : Charge pump voltage = 2.65 V
418  *     @arg LCD_ChargePump_2V75 : Charge pump voltage = 2.75 V
419  *     @arg LCD_ChargePump_2V85 : Charge pump voltage = 2.85 V
420  *     @arg LCD_ChargePump_2V95 : Charge pump voltage = 2.95 V
421  *     @arg LCD_ChargePump_3V10 : Charge pump voltage = 3.10 V
422  *     @arg LCD_ChargePump_3V25 : Charge pump voltage = 3.25 V
423  *     @arg LCD_ChargePump_3V40 : Charge pump voltage = 3.40 V
424  *     @arg LCD_ChargePump_3V55 : Charge pump voltage = 3.55 V
425  ************************************************************************************************************/
LCD_ChargePumpConfig(LCD_ChargePump_Enum Sel)426 void LCD_ChargePumpConfig(LCD_ChargePump_Enum Sel)
427 {
428   /* !!! NOTICE !!!
429      Must wait until the LCDENS = 0 before change the LCD settings.
430   */
431   #if 0
432   while (LCD_GetFlagStatus(LCD_FLAG_ENS) == 1);
433   #endif
434 
435   while (LCD_GetFlagStatus(LCD_FLAG_FCRSF));
436   HT_LCD->FCR = (HT_LCD->FCR & ~(7ul << 10)) | Sel;
437 }
438 
439 /*********************************************************************************************************//**
440  * @brief Configure the LCD Dead Time Duration Selection.
441  * @param Sel: Specify LCD Dead Time Duration Selection.
442      This parameter can be one of the following values:
443  *     @arg LCD_Deadtime_0 : No dead time
444  *     @arg LCD_Deadtime_1 : Type A: 1/2 phase period; Type B: 1 phase period
445  *     @arg LCD_Deadtime_2 : Type A: 2/2 phase period; Type B: 2 phase period
446  *     @arg LCD_Deadtime_3 : Type A: 3/2 phase period; Type B: 3 phase period
447  *     @arg LCD_Deadtime_4 : Type A: 4/2 phase period; Type B: 4 phase period
448  *     @arg LCD_Deadtime_5 : Type A: 5/2 phase period; Type B: 5 phase period
449  *     @arg LCD_Deadtime_6 : Type A: 6/2 phase period; Type B: 6 phase period
450  *     @arg LCD_Deadtime_7 : Type A: 7/2 phase period; Type B: 7 phase period
451  ************************************************************************************************************/
LCD_DeadTimeConfig(LCD_DeadTime_Enum Sel)452 void LCD_DeadTimeConfig(LCD_DeadTime_Enum Sel)
453 {
454   while (LCD_GetFlagStatus(LCD_FLAG_FCRSF) == SET);
455   HT_LCD->FCR = (HT_LCD->FCR & ~(7ul << 7)) | Sel;
456 }
457 
458 /*********************************************************************************************************//**
459  * @brief Configure the LCD High Drive Duration Selection.
460  * @param Sel: Specify LCD High Drive Duration Selection.
461  *   This parameter LCD_DEAD_Enum can be one of the following values:
462  *     @arg LCD_HighDrive_0      : No high drive
463  *     @arg LCD_HighDrive_1      : High drive duration = 1 CK_PS pulses
464  *     @arg LCD_HighDrive_2      : High drive duration = 2 CK_PS pulses
465  *     @arg LCD_HighDrive_3      : High drive duration = 3 CK_PS pulses
466  *     @arg LCD_HighDrive_4      : High drive duration = 4 CK_PS pulses
467  *     @arg LCD_HighDrive_5      : High drive duration = 5 CK_PS pulses
468  *     @arg LCD_HighDrive_6      : High drive duration = 6 CK_PS pulses
469  *     @arg LCD_HighDrive_7      : High drive duration = 7 CK_PS pulses
470  *     @arg LCD_HighDrive_Static : Static high drive
471  ************************************************************************************************************/
LCD_HighDriveConfig(LCD_HighDrive_Enum Sel)472 void LCD_HighDriveConfig(LCD_HighDrive_Enum Sel)
473 {
474   u32 FCR = HT_LCD->FCR;
475 
476   if (Sel == LCD_HighDrive_Static)
477   {
478     FCR |= (1ul << 0);
479   }
480   else
481   {
482     FCR &= ~(1ul << 0);
483     FCR = (FCR & ~(7ul << 4)) | Sel;
484   }
485 
486   while (LCD_GetFlagStatus(LCD_FLAG_FCRSF));
487   HT_LCD->FCR = FCR;
488 }
489 
490 /*********************************************************************************************************//**
491  * @brief Enable or Disable the specified LCD interrupts.
492  * @param LCD_INT: Specify the LCD interrupt sources that is to be enabled or disabled.
493  *   This parameter can be any combination of the following values:
494  *     @arg LCD_INT_UDDIE : Update Display Done Interrupt Enable
495  *     @arg LCD_INT_SOFIE : Start of Frame Interrupt Enable
496  * @param NewState: This parameter can be ENABLE or DISABLE.
497  * @retval None
498  ************************************************************************************************************/
LCD_IntConfig(u32 LCD_INT,ControlStatus NewState)499 void LCD_IntConfig(u32 LCD_INT, ControlStatus NewState)
500 {
501   /* Check the parameters                                                                                   */
502   Assert_Param(IS_LCD_INT(LCD_INT));
503   Assert_Param(IS_CONTROL_STATUS(NewState));
504 
505   if (NewState != DISABLE)
506   {
507     HT_LCD->IER |= LCD_INT;
508   }
509   else
510   {
511     HT_LCD->IER &= ~LCD_INT;
512   }
513 }
514 
515 /*********************************************************************************************************//**
516  * @brief Check whether the specified LCD flag has been set.
517  * @param LCD_FLAG: Specify the interrupt status to check.
518  *   This parameter can be any combination of the following values:
519  *     @arg LCD_FLAG_FCRSF : LCD Frame Control Register Synchronization Flag
520  *     @arg LCD_FLAG_RDY   : Ready Flag
521  *     @arg LCD_FLAG_UDD   : Update Display Done
522  *     @arg LCD_FLAG_UDR   : Update Display Request
523  *     @arg LCD_FLAG_SOF   : Start of Frame Flag
524  *     @arg LCD_FLAG_ENS   : LCD Enabled Status
525  * @retval SET or RESET
526  ************************************************************************************************************/
LCD_GetFlagStatus(u32 LCD_FLAG)527 FlagStatus LCD_GetFlagStatus(u32 LCD_FLAG)
528 {
529   /* Check the parameters                                                                                   */
530   Assert_Param(IS_LCD_FLAG(LCD_FLAG));
531 
532   if ((HT_LCD->SR & LCD_FLAG) != RESET)
533   {
534     return SET;
535   }
536   else
537   {
538     return RESET;
539   }
540 }
541 
542 /*********************************************************************************************************//**
543  * @brief SET LCD Update Display Request.
544  * @retval None
545  ************************************************************************************************************/
LCD_SetUpdateDisplayRequest(void)546 void LCD_SetUpdateDisplayRequest(void)
547 {
548   HT_LCD->SR |= LCD_FLAG_UDR;
549 }
550 
551 /*********************************************************************************************************//**
552  * @brief Clear the specified LCD flag.
553  * @param LCD_Flag: specify the flag that is to be cleared.
554  *   This parameter can be one of the following values:
555  *     @arg LCD_CLR_UDDC : Update display done clear
556  *     @arg LCD_CLR_SOFC : Start of frame flag clear
557  * @retval None
558  ************************************************************************************************************/
LCD_ClearFlag(u32 LCD_Flag)559 void LCD_ClearFlag(u32 LCD_Flag)
560 {
561   /* Check the parameters                                                                                   */
562   Assert_Param(IS_LCD_CLEAR(LCD_Flag));
563 
564   HT_LCD->CLR = LCD_Flag;
565 }
566 /**
567   * @}
568   */
569 
570 
571 /**
572   * @}
573   */
574 
575 /**
576   * @}
577   */
578