STM32L443xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_hal_lcd.h 00004 * @author MCD Application Team 00005 * @brief Header file of LCD Controller HAL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved. 00011 * 00012 * This software is licensed under terms that can be found in the LICENSE file in 00013 * the root directory of this software component. 00014 * If no LICENSE file comes with this software, it is provided AS-IS. 00015 ****************************************************************************** 00016 */ 00017 00018 /* Define to prevent recursive inclusion -------------------------------------*/ 00019 #ifndef STM32L4xx_HAL_LCD_H 00020 #define STM32L4xx_HAL_LCD_H 00021 00022 #ifdef __cplusplus 00023 extern "C" { 00024 #endif 00025 00026 #if defined(STM32L433xx) || defined(STM32L443xx) || defined(STM32L476xx) || defined(STM32L486xx) || defined(STM32L496xx) || defined(STM32L4A6xx) 00027 00028 /* Includes ------------------------------------------------------------------*/ 00029 #include "stm32l4xx_hal_def.h" 00030 00031 /** @addtogroup STM32L4xx_HAL_Driver 00032 * @{ 00033 */ 00034 00035 /** @addtogroup LCD 00036 * @{ 00037 */ 00038 00039 /* Exported types ------------------------------------------------------------*/ 00040 /** @defgroup LCD_Exported_Types LCD Exported Types 00041 * @{ 00042 */ 00043 00044 /** 00045 * @brief LCD Init structure definition 00046 */ 00047 00048 typedef struct 00049 { 00050 uint32_t Prescaler; /*!< Configures the LCD Prescaler. 00051 This parameter can be one value of @ref LCD_Prescaler */ 00052 uint32_t Divider; /*!< Configures the LCD Divider. 00053 This parameter can be one value of @ref LCD_Divider */ 00054 uint32_t Duty; /*!< Configures the LCD Duty. 00055 This parameter can be one value of @ref LCD_Duty */ 00056 uint32_t Bias; /*!< Configures the LCD Bias. 00057 This parameter can be one value of @ref LCD_Bias */ 00058 uint32_t VoltageSource; /*!< Selects the LCD Voltage source. 00059 This parameter can be one value of @ref LCD_Voltage_Source */ 00060 uint32_t Contrast; /*!< Configures the LCD Contrast. 00061 This parameter can be one value of @ref LCD_Contrast */ 00062 uint32_t DeadTime; /*!< Configures the LCD Dead Time. 00063 This parameter can be one value of @ref LCD_DeadTime */ 00064 uint32_t PulseOnDuration; /*!< Configures the LCD Pulse On Duration. 00065 This parameter can be one value of @ref LCD_PulseOnDuration */ 00066 uint32_t HighDrive; /*!< Enable or disable the low resistance divider. 00067 This parameter can be one value of @ref LCD_HighDrive */ 00068 uint32_t BlinkMode; /*!< Configures the LCD Blink Mode. 00069 This parameter can be one value of @ref LCD_BlinkMode */ 00070 uint32_t BlinkFrequency; /*!< Configures the LCD Blink frequency. 00071 This parameter can be one value of @ref LCD_BlinkFrequency */ 00072 uint32_t MuxSegment; /*!< Enable or disable mux segment. 00073 This parameter can be one value of @ref LCD_MuxSegment */ 00074 } LCD_InitTypeDef; 00075 00076 /** 00077 * @brief HAL LCD State structures definition 00078 */ 00079 typedef enum 00080 { 00081 HAL_LCD_STATE_RESET = 0x00, /*!< Peripheral is not yet Initialized */ 00082 HAL_LCD_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */ 00083 HAL_LCD_STATE_BUSY = 0x02, /*!< an internal process is ongoing */ 00084 HAL_LCD_STATE_TIMEOUT = 0x03, /*!< Timeout state */ 00085 HAL_LCD_STATE_ERROR = 0x04 /*!< Error */ 00086 } HAL_LCD_StateTypeDef; 00087 00088 /** 00089 * @brief UART handle Structure definition 00090 */ 00091 typedef struct 00092 { 00093 LCD_TypeDef *Instance; /* LCD registers base address */ 00094 00095 LCD_InitTypeDef Init; /* LCD communication parameters */ 00096 00097 HAL_LockTypeDef Lock; /* Locking object */ 00098 00099 __IO HAL_LCD_StateTypeDef State; /* LCD communication state */ 00100 00101 __IO uint32_t ErrorCode; /* LCD Error code */ 00102 00103 } LCD_HandleTypeDef; 00104 /** 00105 * @} 00106 */ 00107 00108 /* Exported constants --------------------------------------------------------*/ 00109 /** @defgroup LCD_Exported_Constants LCD Exported Constants 00110 * @{ 00111 */ 00112 00113 /** @defgroup LCD_ErrorCode LCD Error Code 00114 * @{ 00115 */ 00116 #define HAL_LCD_ERROR_NONE (0x00000000U) /*!< No error */ 00117 #define HAL_LCD_ERROR_FCRSF (0x00000001U) /*!< Synchro flag timeout error */ 00118 #define HAL_LCD_ERROR_UDR (0x00000002U) /*!< Update display request flag timeout error */ 00119 #define HAL_LCD_ERROR_UDD (0x00000004U) /*!< Update display done flag timeout error */ 00120 #define HAL_LCD_ERROR_ENS (0x00000008U) /*!< LCD enabled status flag timeout error */ 00121 #define HAL_LCD_ERROR_RDY (0x00000010U) /*!< LCD Booster ready timeout error */ 00122 /** 00123 * @} 00124 */ 00125 00126 /** @defgroup LCD_Prescaler LCD Prescaler 00127 * @{ 00128 */ 00129 #define LCD_PRESCALER_1 (0x00000000U) /*!< CLKPS = LCDCLK */ 00130 #define LCD_PRESCALER_2 (0x00400000U) /*!< CLKPS = LCDCLK/2 */ 00131 #define LCD_PRESCALER_4 (0x00800000U) /*!< CLKPS = LCDCLK/4 */ 00132 #define LCD_PRESCALER_8 (0x00C00000U) /*!< CLKPS = LCDCLK/8 */ 00133 #define LCD_PRESCALER_16 (0x01000000U) /*!< CLKPS = LCDCLK/16 */ 00134 #define LCD_PRESCALER_32 (0x01400000U) /*!< CLKPS = LCDCLK/32 */ 00135 #define LCD_PRESCALER_64 (0x01800000U) /*!< CLKPS = LCDCLK/64 */ 00136 #define LCD_PRESCALER_128 (0x01C00000U) /*!< CLKPS = LCDCLK/128 */ 00137 #define LCD_PRESCALER_256 (0x02000000U) /*!< CLKPS = LCDCLK/256 */ 00138 #define LCD_PRESCALER_512 (0x02400000U) /*!< CLKPS = LCDCLK/512 */ 00139 #define LCD_PRESCALER_1024 (0x02800000U) /*!< CLKPS = LCDCLK/1024 */ 00140 #define LCD_PRESCALER_2048 (0x02C00000U) /*!< CLKPS = LCDCLK/2048 */ 00141 #define LCD_PRESCALER_4096 (0x03000000U) /*!< CLKPS = LCDCLK/4096 */ 00142 #define LCD_PRESCALER_8192 (0x03400000U) /*!< CLKPS = LCDCLK/8192 */ 00143 #define LCD_PRESCALER_16384 (0x03800000U) /*!< CLKPS = LCDCLK/16384 */ 00144 #define LCD_PRESCALER_32768 (0x03C00000U) /*!< CLKPS = LCDCLK/32768 */ 00145 /** 00146 * @} 00147 */ 00148 00149 /** @defgroup LCD_Divider LCD Divider 00150 * @{ 00151 */ 00152 #define LCD_DIVIDER_16 (0x00000000U) /*!< LCD frequency = CLKPS/16 */ 00153 #define LCD_DIVIDER_17 (0x00040000U) /*!< LCD frequency = CLKPS/17 */ 00154 #define LCD_DIVIDER_18 (0x00080000U) /*!< LCD frequency = CLKPS/18 */ 00155 #define LCD_DIVIDER_19 (0x000C0000U) /*!< LCD frequency = CLKPS/19 */ 00156 #define LCD_DIVIDER_20 (0x00100000U) /*!< LCD frequency = CLKPS/20 */ 00157 #define LCD_DIVIDER_21 (0x00140000U) /*!< LCD frequency = CLKPS/21 */ 00158 #define LCD_DIVIDER_22 (0x00180000U) /*!< LCD frequency = CLKPS/22 */ 00159 #define LCD_DIVIDER_23 (0x001C0000U) /*!< LCD frequency = CLKPS/23 */ 00160 #define LCD_DIVIDER_24 (0x00200000U) /*!< LCD frequency = CLKPS/24 */ 00161 #define LCD_DIVIDER_25 (0x00240000U) /*!< LCD frequency = CLKPS/25 */ 00162 #define LCD_DIVIDER_26 (0x00280000U) /*!< LCD frequency = CLKPS/26 */ 00163 #define LCD_DIVIDER_27 (0x002C0000U) /*!< LCD frequency = CLKPS/27 */ 00164 #define LCD_DIVIDER_28 (0x00300000U) /*!< LCD frequency = CLKPS/28 */ 00165 #define LCD_DIVIDER_29 (0x00340000U) /*!< LCD frequency = CLKPS/29 */ 00166 #define LCD_DIVIDER_30 (0x00380000U) /*!< LCD frequency = CLKPS/30 */ 00167 #define LCD_DIVIDER_31 (0x003C0000U) /*!< LCD frequency = CLKPS/31 */ 00168 /** 00169 * @} 00170 */ 00171 00172 00173 /** @defgroup LCD_Duty LCD Duty 00174 * @{ 00175 */ 00176 #define LCD_DUTY_STATIC (0x00000000U) /*!< Static duty */ 00177 #define LCD_DUTY_1_2 (LCD_CR_DUTY_0) /*!< 1/2 duty */ 00178 #define LCD_DUTY_1_3 (LCD_CR_DUTY_1) /*!< 1/3 duty */ 00179 #define LCD_DUTY_1_4 ((LCD_CR_DUTY_1 | LCD_CR_DUTY_0)) /*!< 1/4 duty */ 00180 #define LCD_DUTY_1_8 (LCD_CR_DUTY_2) /*!< 1/8 duty */ 00181 /** 00182 * @} 00183 */ 00184 00185 00186 /** @defgroup LCD_Bias LCD Bias 00187 * @{ 00188 */ 00189 #define LCD_BIAS_1_4 (0x00000000U) /*!< 1/4 Bias */ 00190 #define LCD_BIAS_1_2 LCD_CR_BIAS_0 /*!< 1/2 Bias */ 00191 #define LCD_BIAS_1_3 LCD_CR_BIAS_1 /*!< 1/3 Bias */ 00192 /** 00193 * @} 00194 */ 00195 00196 /** @defgroup LCD_Voltage_Source LCD Voltage Source 00197 * @{ 00198 */ 00199 #define LCD_VOLTAGESOURCE_INTERNAL (0x00000000U) /*!< Internal voltage source for the LCD */ 00200 #define LCD_VOLTAGESOURCE_EXTERNAL LCD_CR_VSEL /*!< External voltage source for the LCD */ 00201 /** 00202 * @} 00203 */ 00204 00205 /** @defgroup LCD_Interrupts LCD Interrupts 00206 * @{ 00207 */ 00208 #define LCD_IT_SOF LCD_FCR_SOFIE 00209 #define LCD_IT_UDD LCD_FCR_UDDIE 00210 /** 00211 * @} 00212 */ 00213 00214 /** @defgroup LCD_PulseOnDuration LCD Pulse On Duration 00215 * @{ 00216 */ 00217 #define LCD_PULSEONDURATION_0 (0x00000000U) /*!< Pulse ON duration = 0 pulse */ 00218 #define LCD_PULSEONDURATION_1 (LCD_FCR_PON_0) /*!< Pulse ON duration = 1/CK_PS */ 00219 #define LCD_PULSEONDURATION_2 (LCD_FCR_PON_1) /*!< Pulse ON duration = 2/CK_PS */ 00220 #define LCD_PULSEONDURATION_3 (LCD_FCR_PON_1 | LCD_FCR_PON_0) /*!< Pulse ON duration = 3/CK_PS */ 00221 #define LCD_PULSEONDURATION_4 (LCD_FCR_PON_2) /*!< Pulse ON duration = 4/CK_PS */ 00222 #define LCD_PULSEONDURATION_5 (LCD_FCR_PON_2 | LCD_FCR_PON_0) /*!< Pulse ON duration = 5/CK_PS */ 00223 #define LCD_PULSEONDURATION_6 (LCD_FCR_PON_2 | LCD_FCR_PON_1) /*!< Pulse ON duration = 6/CK_PS */ 00224 #define LCD_PULSEONDURATION_7 (LCD_FCR_PON) /*!< Pulse ON duration = 7/CK_PS */ 00225 /** 00226 * @} 00227 */ 00228 00229 00230 /** @defgroup LCD_DeadTime LCD Dead Time 00231 * @{ 00232 */ 00233 #define LCD_DEADTIME_0 (0x00000000U) /*!< No dead Time */ 00234 #define LCD_DEADTIME_1 (LCD_FCR_DEAD_0) /*!< One Phase between different couple of Frame */ 00235 #define LCD_DEADTIME_2 (LCD_FCR_DEAD_1) /*!< Two Phase between different couple of Frame */ 00236 #define LCD_DEADTIME_3 (LCD_FCR_DEAD_1 | LCD_FCR_DEAD_0) /*!< Three Phase between different couple of Frame */ 00237 #define LCD_DEADTIME_4 (LCD_FCR_DEAD_2) /*!< Four Phase between different couple of Frame */ 00238 #define LCD_DEADTIME_5 (LCD_FCR_DEAD_2 | LCD_FCR_DEAD_0) /*!< Five Phase between different couple of Frame */ 00239 #define LCD_DEADTIME_6 (LCD_FCR_DEAD_2 | LCD_FCR_DEAD_1) /*!< Six Phase between different couple of Frame */ 00240 #define LCD_DEADTIME_7 (LCD_FCR_DEAD) /*!< Seven Phase between different couple of Frame */ 00241 /** 00242 * @} 00243 */ 00244 00245 /** @defgroup LCD_BlinkMode LCD Blink Mode 00246 * @{ 00247 */ 00248 #define LCD_BLINKMODE_OFF (0x00000000U) /*!< Blink disabled */ 00249 #define LCD_BLINKMODE_SEG0_COM0 (LCD_FCR_BLINK_0) /*!< Blink enabled on SEG[0], COM[0] (1 pixel) */ 00250 #define LCD_BLINKMODE_SEG0_ALLCOM (LCD_FCR_BLINK_1) /*!< Blink enabled on SEG[0], all COM (up to 00251 8 pixels according to the programmed duty) */ 00252 #define LCD_BLINKMODE_ALLSEG_ALLCOM (LCD_FCR_BLINK) /*!< Blink enabled on all SEG and all COM (all pixels) */ 00253 /** 00254 * @} 00255 */ 00256 00257 /** @defgroup LCD_BlinkFrequency LCD Blink Frequency 00258 * @{ 00259 */ 00260 #define LCD_BLINKFREQUENCY_DIV8 (0x00000000U) /*!< The Blink frequency = fLCD/8 */ 00261 #define LCD_BLINKFREQUENCY_DIV16 (LCD_FCR_BLINKF_0) /*!< The Blink frequency = fLCD/16 */ 00262 #define LCD_BLINKFREQUENCY_DIV32 (LCD_FCR_BLINKF_1) /*!< The Blink frequency = fLCD/32 */ 00263 #define LCD_BLINKFREQUENCY_DIV64 (LCD_FCR_BLINKF_1 | LCD_FCR_BLINKF_0) /*!< The Blink frequency = fLCD/64 */ 00264 #define LCD_BLINKFREQUENCY_DIV128 (LCD_FCR_BLINKF_2) /*!< The Blink frequency = fLCD/128 */ 00265 #define LCD_BLINKFREQUENCY_DIV256 (LCD_FCR_BLINKF_2 |LCD_FCR_BLINKF_0) /*!< The Blink frequency = fLCD/256 */ 00266 #define LCD_BLINKFREQUENCY_DIV512 (LCD_FCR_BLINKF_2 |LCD_FCR_BLINKF_1) /*!< The Blink frequency = fLCD/512 */ 00267 #define LCD_BLINKFREQUENCY_DIV1024 (LCD_FCR_BLINKF) /*!< The Blink frequency = fLCD/1024 */ 00268 /** 00269 * @} 00270 */ 00271 00272 /** @defgroup LCD_Contrast LCD Contrast 00273 * @{ 00274 */ 00275 #define LCD_CONTRASTLEVEL_0 (0x00000000U) /*!< Maximum Voltage = 2.60V */ 00276 #define LCD_CONTRASTLEVEL_1 (LCD_FCR_CC_0) /*!< Maximum Voltage = 2.73V */ 00277 #define LCD_CONTRASTLEVEL_2 (LCD_FCR_CC_1) /*!< Maximum Voltage = 2.86V */ 00278 #define LCD_CONTRASTLEVEL_3 (LCD_FCR_CC_1 | LCD_FCR_CC_0) /*!< Maximum Voltage = 2.99V */ 00279 #define LCD_CONTRASTLEVEL_4 (LCD_FCR_CC_2) /*!< Maximum Voltage = 3.12V */ 00280 #define LCD_CONTRASTLEVEL_5 (LCD_FCR_CC_2 | LCD_FCR_CC_0) /*!< Maximum Voltage = 3.26V */ 00281 #define LCD_CONTRASTLEVEL_6 (LCD_FCR_CC_2 | LCD_FCR_CC_1) /*!< Maximum Voltage = 3.40V */ 00282 #define LCD_CONTRASTLEVEL_7 (LCD_FCR_CC) /*!< Maximum Voltage = 3.55V */ 00283 /** 00284 * @} 00285 */ 00286 00287 /** @defgroup LCD_RAMRegister LCD RAMRegister 00288 * @{ 00289 */ 00290 #define LCD_RAM_REGISTER0 (0x00000000U) /*!< LCD RAM Register 0 */ 00291 #define LCD_RAM_REGISTER1 (0x00000001U) /*!< LCD RAM Register 1 */ 00292 #define LCD_RAM_REGISTER2 (0x00000002U) /*!< LCD RAM Register 2 */ 00293 #define LCD_RAM_REGISTER3 (0x00000003U) /*!< LCD RAM Register 3 */ 00294 #define LCD_RAM_REGISTER4 (0x00000004U) /*!< LCD RAM Register 4 */ 00295 #define LCD_RAM_REGISTER5 (0x00000005U) /*!< LCD RAM Register 5 */ 00296 #define LCD_RAM_REGISTER6 (0x00000006U) /*!< LCD RAM Register 6 */ 00297 #define LCD_RAM_REGISTER7 (0x00000007U) /*!< LCD RAM Register 7 */ 00298 #define LCD_RAM_REGISTER8 (0x00000008U) /*!< LCD RAM Register 8 */ 00299 #define LCD_RAM_REGISTER9 (0x00000009U) /*!< LCD RAM Register 9 */ 00300 #define LCD_RAM_REGISTER10 (0x0000000AU) /*!< LCD RAM Register 10 */ 00301 #define LCD_RAM_REGISTER11 (0x0000000BU) /*!< LCD RAM Register 11 */ 00302 #define LCD_RAM_REGISTER12 (0x0000000CU) /*!< LCD RAM Register 12 */ 00303 #define LCD_RAM_REGISTER13 (0x0000000DU) /*!< LCD RAM Register 13 */ 00304 #define LCD_RAM_REGISTER14 (0x0000000EU) /*!< LCD RAM Register 14 */ 00305 #define LCD_RAM_REGISTER15 (0x0000000FU) /*!< LCD RAM Register 15 */ 00306 /** 00307 * @} 00308 */ 00309 00310 /** @defgroup LCD_HighDrive LCD High Drive 00311 * @{ 00312 */ 00313 00314 #define LCD_HIGHDRIVE_DISABLE ((uint32_t)0x00000000) /*!< High drive disabled */ 00315 #define LCD_HIGHDRIVE_ENABLE (LCD_FCR_HD) /*!< High drive enabled */ 00316 /** 00317 * @} 00318 */ 00319 00320 /** @defgroup LCD_MuxSegment LCD Mux Segment 00321 * @{ 00322 */ 00323 00324 #define LCD_MUXSEGMENT_DISABLE (0x00000000U) /*!< SEG pin multiplexing disabled */ 00325 #define LCD_MUXSEGMENT_ENABLE (LCD_CR_MUX_SEG) /*!< SEG[31:28] are multiplexed with SEG[43:40] */ 00326 /** 00327 * @} 00328 */ 00329 00330 /** @defgroup LCD_Flag_Definition LCD Flags Definition 00331 * @{ 00332 */ 00333 #define LCD_FLAG_ENS LCD_SR_ENS /*!< LCD enabled status */ 00334 #define LCD_FLAG_SOF LCD_SR_SOF /*!< Start of frame flag */ 00335 #define LCD_FLAG_UDR LCD_SR_UDR /*!< Update display request */ 00336 #define LCD_FLAG_UDD LCD_SR_UDD /*!< Update display done */ 00337 #define LCD_FLAG_RDY LCD_SR_RDY /*!< Ready flag */ 00338 #define LCD_FLAG_FCRSF LCD_SR_FCRSR /*!< LCD Frame Control Register Synchronization flag */ 00339 /** 00340 * @} 00341 */ 00342 00343 /** 00344 * @} 00345 */ 00346 00347 /* Exported macros -----------------------------------------------------------*/ 00348 /** @defgroup LCD_Exported_Macros LCD Exported Macros 00349 * @{ 00350 */ 00351 00352 /** @brief Reset LCD handle state. 00353 * @param __HANDLE__ specifies the LCD Handle. 00354 * @retval None 00355 */ 00356 #define __HAL_LCD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LCD_STATE_RESET) 00357 00358 /** @brief Enable the LCD peripheral. 00359 * @param __HANDLE__ specifies the LCD Handle. 00360 * @retval None 00361 */ 00362 #define __HAL_LCD_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, LCD_CR_LCDEN) 00363 00364 /** @brief Disable the LCD peripheral. 00365 * @param __HANDLE__ specifies the LCD Handle. 00366 * @retval None 00367 */ 00368 #define __HAL_LCD_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR, LCD_CR_LCDEN) 00369 00370 /** @brief Enable the low resistance divider. 00371 * @param __HANDLE__ specifies the LCD Handle. 00372 * @note Displays with high internal resistance may need a longer drive time to 00373 * achieve satisfactory contrast. This function is useful in this case if 00374 * some additional power consumption can be tolerated. 00375 * @note When this mode is enabled, the PulseOn Duration (PON) have to be 00376 * programmed to 1/CK_PS (LCD_PULSEONDURATION_1). 00377 * @retval None 00378 */ 00379 #define __HAL_LCD_HIGHDRIVER_ENABLE(__HANDLE__) \ 00380 do { \ 00381 SET_BIT((__HANDLE__)->Instance->FCR, LCD_FCR_HD); \ 00382 LCD_WaitForSynchro(__HANDLE__); \ 00383 } while(0) 00384 00385 /** @brief Disable the low resistance divider. 00386 * @param __HANDLE__ specifies the LCD Handle. 00387 * @retval None 00388 */ 00389 #define __HAL_LCD_HIGHDRIVER_DISABLE(__HANDLE__) \ 00390 do { \ 00391 CLEAR_BIT((__HANDLE__)->Instance->FCR, LCD_FCR_HD); \ 00392 LCD_WaitForSynchro(__HANDLE__); \ 00393 } while(0) 00394 00395 /** @brief Enable the voltage output buffer for higher driving capability. 00396 * @param __HANDLE__ specifies the LCD Handle. 00397 * @retval None 00398 */ 00399 #define __HAL_LCD_VOLTAGE_BUFFER_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, LCD_CR_BUFEN) 00400 00401 /** @brief Disable the voltage output buffer for higher driving capability. 00402 * @param __HANDLE__ specifies the LCD Handle. 00403 * @retval None 00404 */ 00405 #define __HAL_LCD_VOLTAGE_BUFFER_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR, LCD_CR_BUFEN) 00406 00407 /** 00408 * @brief Configure the LCD pulse on duration. 00409 * @param __HANDLE__ specifies the LCD Handle. 00410 * @param __DURATION__ specifies the LCD pulse on duration in terms of 00411 * CK_PS (prescaled LCD clock period) pulses. 00412 * This parameter can be one of the following values: 00413 * @arg LCD_PULSEONDURATION_0: 0 pulse 00414 * @arg LCD_PULSEONDURATION_1: Pulse ON duration = 1/CK_PS 00415 * @arg LCD_PULSEONDURATION_2: Pulse ON duration = 2/CK_PS 00416 * @arg LCD_PULSEONDURATION_3: Pulse ON duration = 3/CK_PS 00417 * @arg LCD_PULSEONDURATION_4: Pulse ON duration = 4/CK_PS 00418 * @arg LCD_PULSEONDURATION_5: Pulse ON duration = 5/CK_PS 00419 * @arg LCD_PULSEONDURATION_6: Pulse ON duration = 6/CK_PS 00420 * @arg LCD_PULSEONDURATION_7: Pulse ON duration = 7/CK_PS 00421 * @retval None 00422 */ 00423 #define __HAL_LCD_PULSEONDURATION_CONFIG(__HANDLE__, __DURATION__) \ 00424 do { \ 00425 MODIFY_REG((__HANDLE__)->Instance->FCR, LCD_FCR_PON, (__DURATION__)); \ 00426 LCD_WaitForSynchro(__HANDLE__); \ 00427 } while(0) 00428 00429 /** 00430 * @brief Configure the LCD dead time. 00431 * @param __HANDLE__ specifies the LCD Handle. 00432 * @param __DEADTIME__ specifies the LCD dead time. 00433 * This parameter can be one of the following values: 00434 * @arg LCD_DEADTIME_0: No dead Time 00435 * @arg LCD_DEADTIME_1: One Phase between different couple of Frame 00436 * @arg LCD_DEADTIME_2: Two Phase between different couple of Frame 00437 * @arg LCD_DEADTIME_3: Three Phase between different couple of Frame 00438 * @arg LCD_DEADTIME_4: Four Phase between different couple of Frame 00439 * @arg LCD_DEADTIME_5: Five Phase between different couple of Frame 00440 * @arg LCD_DEADTIME_6: Six Phase between different couple of Frame 00441 * @arg LCD_DEADTIME_7: Seven Phase between different couple of Frame 00442 * @retval None 00443 */ 00444 #define __HAL_LCD_DEADTIME_CONFIG(__HANDLE__, __DEADTIME__) \ 00445 do { \ 00446 MODIFY_REG((__HANDLE__)->Instance->FCR, LCD_FCR_DEAD, (__DEADTIME__)); \ 00447 LCD_WaitForSynchro(__HANDLE__); \ 00448 } while(0) 00449 00450 /** 00451 * @brief Configure the LCD contrast. 00452 * @param __HANDLE__ specifies the LCD Handle. 00453 * @param __CONTRAST__ specifies the LCD Contrast. 00454 * This parameter can be one of the following values: 00455 * @arg LCD_CONTRASTLEVEL_0: Maximum Voltage = 2.60V 00456 * @arg LCD_CONTRASTLEVEL_1: Maximum Voltage = 2.73V 00457 * @arg LCD_CONTRASTLEVEL_2: Maximum Voltage = 2.86V 00458 * @arg LCD_CONTRASTLEVEL_3: Maximum Voltage = 2.99V 00459 * @arg LCD_CONTRASTLEVEL_4: Maximum Voltage = 3.12V 00460 * @arg LCD_CONTRASTLEVEL_5: Maximum Voltage = 3.25V 00461 * @arg LCD_CONTRASTLEVEL_6: Maximum Voltage = 3.38V 00462 * @arg LCD_CONTRASTLEVEL_7: Maximum Voltage = 3.51V 00463 * @retval None 00464 */ 00465 #define __HAL_LCD_CONTRAST_CONFIG(__HANDLE__, __CONTRAST__) \ 00466 do { \ 00467 MODIFY_REG((__HANDLE__)->Instance->FCR, LCD_FCR_CC, (__CONTRAST__)); \ 00468 LCD_WaitForSynchro(__HANDLE__); \ 00469 } while(0) 00470 00471 /** 00472 * @brief Configure the LCD Blink mode and Blink frequency. 00473 * @param __HANDLE__ specifies the LCD Handle. 00474 * @param __BLINKMODE__ specifies the LCD blink mode. 00475 * This parameter can be one of the following values: 00476 * @arg LCD_BLINKMODE_OFF: Blink disabled 00477 * @arg LCD_BLINKMODE_SEG0_COM0: Blink enabled on SEG[0], COM[0] (1 pixel) 00478 * @arg LCD_BLINKMODE_SEG0_ALLCOM: Blink enabled on SEG[0], all COM (up to 8 00479 * pixels according to the programmed duty) 00480 * @arg LCD_BLINKMODE_ALLSEG_ALLCOM: Blink enabled on all SEG and all COM 00481 * (all pixels) 00482 * @param __BLINKFREQUENCY__ specifies the LCD blink frequency. 00483 * @arg LCD_BLINKFREQUENCY_DIV8: The Blink frequency = fLcd/8 00484 * @arg LCD_BLINKFREQUENCY_DIV16: The Blink frequency = fLcd/16 00485 * @arg LCD_BLINKFREQUENCY_DIV32: The Blink frequency = fLcd/32 00486 * @arg LCD_BLINKFREQUENCY_DIV64: The Blink frequency = fLcd/64 00487 * @arg LCD_BLINKFREQUENCY_DIV128: The Blink frequency = fLcd/128 00488 * @arg LCD_BLINKFREQUENCY_DIV256: The Blink frequency = fLcd/256 00489 * @arg LCD_BLINKFREQUENCY_DIV512: The Blink frequency = fLcd/512 00490 * @arg LCD_BLINKFREQUENCY_DIV1024: The Blink frequency = fLcd/1024 00491 * @retval None 00492 */ 00493 #define __HAL_LCD_BLINK_CONFIG(__HANDLE__, __BLINKMODE__, __BLINKFREQUENCY__) \ 00494 do { \ 00495 MODIFY_REG((__HANDLE__)->Instance->FCR, (LCD_FCR_BLINKF | LCD_FCR_BLINK), ((__BLINKMODE__) | (__BLINKFREQUENCY__))); \ 00496 LCD_WaitForSynchro(__HANDLE__); \ 00497 } while(0) 00498 00499 /** @brief Enable the specified LCD interrupt. 00500 * @param __HANDLE__ specifies the LCD Handle. 00501 * @param __INTERRUPT__ specifies the LCD interrupt source to be enabled. 00502 * This parameter can be one of the following values: 00503 * @arg LCD_IT_SOF: Start of Frame Interrupt 00504 * @arg LCD_IT_UDD: Update Display Done Interrupt 00505 * @retval None 00506 */ 00507 #define __HAL_LCD_ENABLE_IT(__HANDLE__, __INTERRUPT__) \ 00508 do { \ 00509 SET_BIT((__HANDLE__)->Instance->FCR, (__INTERRUPT__)); \ 00510 LCD_WaitForSynchro(__HANDLE__); \ 00511 } while(0) 00512 00513 /** @brief Disable the specified LCD interrupt. 00514 * @param __HANDLE__ specifies the LCD Handle. 00515 * @param __INTERRUPT__ specifies the LCD interrupt source to be disabled. 00516 * This parameter can be one of the following values: 00517 * @arg LCD_IT_SOF: Start of Frame Interrupt 00518 * @arg LCD_IT_UDD: Update Display Done Interrupt 00519 * @retval None 00520 */ 00521 #define __HAL_LCD_DISABLE_IT(__HANDLE__, __INTERRUPT__) \ 00522 do { \ 00523 CLEAR_BIT((__HANDLE__)->Instance->FCR, (__INTERRUPT__)); \ 00524 LCD_WaitForSynchro(__HANDLE__); \ 00525 } while(0) 00526 00527 /** @brief Check whether the specified LCD interrupt source is enabled or not. 00528 * @param __HANDLE__ specifies the LCD Handle. 00529 * @param __IT__ specifies the LCD interrupt source to check. 00530 * This parameter can be one of the following values: 00531 * @arg LCD_IT_SOF: Start of Frame Interrupt 00532 * @arg LCD_IT_UDD: Update Display Done Interrupt. 00533 * @note If the device is in STOP mode (PCLK not provided) UDD will not 00534 * generate an interrupt even if UDDIE = 1. 00535 * If the display is not enabled the UDD interrupt will never occur. 00536 * @retval The state of __IT__ (TRUE or FALSE). 00537 */ 00538 #define __HAL_LCD_GET_IT_SOURCE(__HANDLE__, __IT__) (((__HANDLE__)->Instance->FCR) & (__IT__)) 00539 00540 /** @brief Check whether the specified LCD flag is set or not. 00541 * @param __HANDLE__ specifies the LCD Handle. 00542 * @param __FLAG__ specifies the flag to check. 00543 * This parameter can be one of the following values: 00544 * @arg LCD_FLAG_ENS: LCD Enabled flag. It indicates the LCD controller status. 00545 * @note The ENS bit is set immediately when the LCDEN bit in the LCD_CR 00546 * goes from 0 to 1. On deactivation it reflects the real status of 00547 * LCD so it becomes 0 at the end of the last displayed frame. 00548 * @arg LCD_FLAG_SOF: Start of Frame flag. This flag is set by hardware at 00549 * the beginning of a new frame, at the same time as the display data is 00550 * updated. 00551 * @arg LCD_FLAG_UDR: Update Display Request flag. 00552 * @arg LCD_FLAG_UDD: Update Display Done flag. 00553 * @arg LCD_FLAG_RDY: Step_up converter Ready flag. It indicates the status 00554 * of the step-up converter. 00555 * @arg LCD_FLAG_FCRSF: LCD Frame Control Register Synchronization Flag. 00556 * This flag is set by hardware each time the LCD_FCR register is updated 00557 * in the LCDCLK domain. 00558 * @retval The new state of __FLAG__ (TRUE or FALSE). 00559 */ 00560 #define __HAL_LCD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) 00561 00562 /** @brief Clear the specified LCD pending flag. 00563 * @param __HANDLE__ specifies the LCD Handle. 00564 * @param __FLAG__ specifies the flag to clear. 00565 * This parameter can be any combination of the following values: 00566 * @arg LCD_FLAG_SOF: Start of Frame Interrupt 00567 * @arg LCD_FLAG_UDD: Update Display Done Interrupt 00568 * @retval None 00569 */ 00570 #define __HAL_LCD_CLEAR_FLAG(__HANDLE__, __FLAG__) WRITE_REG((__HANDLE__)->Instance->CLR, (__FLAG__)) 00571 00572 /** 00573 * @} 00574 */ 00575 00576 /* Exported functions ------------------------------------------------------- */ 00577 /** @addtogroup LCD_Exported_Functions 00578 * @{ 00579 */ 00580 00581 /* Initialization/de-initialization methods **********************************/ 00582 /** @addtogroup LCD_Exported_Functions_Group1 00583 * @{ 00584 */ 00585 HAL_StatusTypeDef HAL_LCD_DeInit(LCD_HandleTypeDef *hlcd); 00586 HAL_StatusTypeDef HAL_LCD_Init(LCD_HandleTypeDef *hlcd); 00587 void HAL_LCD_MspInit(LCD_HandleTypeDef *hlcd); 00588 void HAL_LCD_MspDeInit(LCD_HandleTypeDef *hlcd); 00589 /** 00590 * @} 00591 */ 00592 00593 /* IO operation methods *******************************************************/ 00594 /** @addtogroup LCD_Exported_Functions_Group2 00595 * @{ 00596 */ 00597 HAL_StatusTypeDef HAL_LCD_Write(LCD_HandleTypeDef *hlcd, uint32_t RAMRegisterIndex, uint32_t RAMRegisterMask, uint32_t Data); 00598 HAL_StatusTypeDef HAL_LCD_Clear(LCD_HandleTypeDef *hlcd); 00599 HAL_StatusTypeDef HAL_LCD_UpdateDisplayRequest(LCD_HandleTypeDef *hlcd); 00600 /** 00601 * @} 00602 */ 00603 00604 /* Peripheral State methods **************************************************/ 00605 /** @addtogroup LCD_Exported_Functions_Group3 00606 * @{ 00607 */ 00608 HAL_LCD_StateTypeDef HAL_LCD_GetState(LCD_HandleTypeDef *hlcd); 00609 uint32_t HAL_LCD_GetError(LCD_HandleTypeDef *hlcd); 00610 /** 00611 * @} 00612 */ 00613 00614 /** 00615 * @} 00616 */ 00617 00618 /* Private types -------------------------------------------------------------*/ 00619 /* Private variables ---------------------------------------------------------*/ 00620 /* Private constants ---------------------------------------------------------*/ 00621 /* Private macros ------------------------------------------------------------*/ 00622 /** @defgroup LCD_Private_Macros LCD Private Macros 00623 * @{ 00624 */ 00625 00626 #define IS_LCD_PRESCALER(__PRESCALER__) (((__PRESCALER__) == LCD_PRESCALER_1) || \ 00627 ((__PRESCALER__) == LCD_PRESCALER_2) || \ 00628 ((__PRESCALER__) == LCD_PRESCALER_4) || \ 00629 ((__PRESCALER__) == LCD_PRESCALER_8) || \ 00630 ((__PRESCALER__) == LCD_PRESCALER_16) || \ 00631 ((__PRESCALER__) == LCD_PRESCALER_32) || \ 00632 ((__PRESCALER__) == LCD_PRESCALER_64) || \ 00633 ((__PRESCALER__) == LCD_PRESCALER_128) || \ 00634 ((__PRESCALER__) == LCD_PRESCALER_256) || \ 00635 ((__PRESCALER__) == LCD_PRESCALER_512) || \ 00636 ((__PRESCALER__) == LCD_PRESCALER_1024) || \ 00637 ((__PRESCALER__) == LCD_PRESCALER_2048) || \ 00638 ((__PRESCALER__) == LCD_PRESCALER_4096) || \ 00639 ((__PRESCALER__) == LCD_PRESCALER_8192) || \ 00640 ((__PRESCALER__) == LCD_PRESCALER_16384) || \ 00641 ((__PRESCALER__) == LCD_PRESCALER_32768)) 00642 00643 #define IS_LCD_DIVIDER(__DIVIDER__) (((__DIVIDER__) == LCD_DIVIDER_16) || \ 00644 ((__DIVIDER__) == LCD_DIVIDER_17) || \ 00645 ((__DIVIDER__) == LCD_DIVIDER_18) || \ 00646 ((__DIVIDER__) == LCD_DIVIDER_19) || \ 00647 ((__DIVIDER__) == LCD_DIVIDER_20) || \ 00648 ((__DIVIDER__) == LCD_DIVIDER_21) || \ 00649 ((__DIVIDER__) == LCD_DIVIDER_22) || \ 00650 ((__DIVIDER__) == LCD_DIVIDER_23) || \ 00651 ((__DIVIDER__) == LCD_DIVIDER_24) || \ 00652 ((__DIVIDER__) == LCD_DIVIDER_25) || \ 00653 ((__DIVIDER__) == LCD_DIVIDER_26) || \ 00654 ((__DIVIDER__) == LCD_DIVIDER_27) || \ 00655 ((__DIVIDER__) == LCD_DIVIDER_28) || \ 00656 ((__DIVIDER__) == LCD_DIVIDER_29) || \ 00657 ((__DIVIDER__) == LCD_DIVIDER_30) || \ 00658 ((__DIVIDER__) == LCD_DIVIDER_31)) 00659 00660 #define IS_LCD_DUTY(__DUTY__) (((__DUTY__) == LCD_DUTY_STATIC) || \ 00661 ((__DUTY__) == LCD_DUTY_1_2) || \ 00662 ((__DUTY__) == LCD_DUTY_1_3) || \ 00663 ((__DUTY__) == LCD_DUTY_1_4) || \ 00664 ((__DUTY__) == LCD_DUTY_1_8)) 00665 00666 #define IS_LCD_BIAS(__BIAS__) (((__BIAS__) == LCD_BIAS_1_4) || \ 00667 ((__BIAS__) == LCD_BIAS_1_2) || \ 00668 ((__BIAS__) == LCD_BIAS_1_3)) 00669 00670 #define IS_LCD_VOLTAGE_SOURCE(SOURCE) (((SOURCE) == LCD_VOLTAGESOURCE_INTERNAL) || \ 00671 ((SOURCE) == LCD_VOLTAGESOURCE_EXTERNAL)) 00672 00673 00674 #define IS_LCD_PULSE_ON_DURATION(__DURATION__) (((__DURATION__) == LCD_PULSEONDURATION_0) || \ 00675 ((__DURATION__) == LCD_PULSEONDURATION_1) || \ 00676 ((__DURATION__) == LCD_PULSEONDURATION_2) || \ 00677 ((__DURATION__) == LCD_PULSEONDURATION_3) || \ 00678 ((__DURATION__) == LCD_PULSEONDURATION_4) || \ 00679 ((__DURATION__) == LCD_PULSEONDURATION_5) || \ 00680 ((__DURATION__) == LCD_PULSEONDURATION_6) || \ 00681 ((__DURATION__) == LCD_PULSEONDURATION_7)) 00682 00683 #define IS_LCD_DEAD_TIME(__TIME__) (((__TIME__) == LCD_DEADTIME_0) || \ 00684 ((__TIME__) == LCD_DEADTIME_1) || \ 00685 ((__TIME__) == LCD_DEADTIME_2) || \ 00686 ((__TIME__) == LCD_DEADTIME_3) || \ 00687 ((__TIME__) == LCD_DEADTIME_4) || \ 00688 ((__TIME__) == LCD_DEADTIME_5) || \ 00689 ((__TIME__) == LCD_DEADTIME_6) || \ 00690 ((__TIME__) == LCD_DEADTIME_7)) 00691 00692 #define IS_LCD_BLINK_MODE(__MODE__) (((__MODE__) == LCD_BLINKMODE_OFF) || \ 00693 ((__MODE__) == LCD_BLINKMODE_SEG0_COM0) || \ 00694 ((__MODE__) == LCD_BLINKMODE_SEG0_ALLCOM) || \ 00695 ((__MODE__) == LCD_BLINKMODE_ALLSEG_ALLCOM)) 00696 00697 #define IS_LCD_BLINK_FREQUENCY(__FREQUENCY__) (((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV8) || \ 00698 ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV16) || \ 00699 ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV32) || \ 00700 ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV64) || \ 00701 ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV128) || \ 00702 ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV256) || \ 00703 ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV512) || \ 00704 ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV1024)) 00705 00706 #define IS_LCD_CONTRAST(__CONTRAST__) (((__CONTRAST__) == LCD_CONTRASTLEVEL_0) || \ 00707 ((__CONTRAST__) == LCD_CONTRASTLEVEL_1) || \ 00708 ((__CONTRAST__) == LCD_CONTRASTLEVEL_2) || \ 00709 ((__CONTRAST__) == LCD_CONTRASTLEVEL_3) || \ 00710 ((__CONTRAST__) == LCD_CONTRASTLEVEL_4) || \ 00711 ((__CONTRAST__) == LCD_CONTRASTLEVEL_5) || \ 00712 ((__CONTRAST__) == LCD_CONTRASTLEVEL_6) || \ 00713 ((__CONTRAST__) == LCD_CONTRASTLEVEL_7)) 00714 00715 #define IS_LCD_RAM_REGISTER(__REGISTER__) (((__REGISTER__) == LCD_RAM_REGISTER0) || \ 00716 ((__REGISTER__) == LCD_RAM_REGISTER1) || \ 00717 ((__REGISTER__) == LCD_RAM_REGISTER2) || \ 00718 ((__REGISTER__) == LCD_RAM_REGISTER3) || \ 00719 ((__REGISTER__) == LCD_RAM_REGISTER4) || \ 00720 ((__REGISTER__) == LCD_RAM_REGISTER5) || \ 00721 ((__REGISTER__) == LCD_RAM_REGISTER6) || \ 00722 ((__REGISTER__) == LCD_RAM_REGISTER7) || \ 00723 ((__REGISTER__) == LCD_RAM_REGISTER8) || \ 00724 ((__REGISTER__) == LCD_RAM_REGISTER9) || \ 00725 ((__REGISTER__) == LCD_RAM_REGISTER10) || \ 00726 ((__REGISTER__) == LCD_RAM_REGISTER11) || \ 00727 ((__REGISTER__) == LCD_RAM_REGISTER12) || \ 00728 ((__REGISTER__) == LCD_RAM_REGISTER13) || \ 00729 ((__REGISTER__) == LCD_RAM_REGISTER14) || \ 00730 ((__REGISTER__) == LCD_RAM_REGISTER15)) 00731 00732 #define IS_LCD_HIGH_DRIVE(__VALUE__) (((__VALUE__) == LCD_HIGHDRIVE_DISABLE) || \ 00733 ((__VALUE__) == LCD_HIGHDRIVE_ENABLE)) 00734 00735 #define IS_LCD_MUX_SEGMENT(__VALUE__) (((__VALUE__) == LCD_MUXSEGMENT_ENABLE) || \ 00736 ((__VALUE__) == LCD_MUXSEGMENT_DISABLE)) 00737 00738 /** 00739 * @} 00740 */ 00741 00742 /* Private functions ---------------------------------------------------------*/ 00743 /** @addtogroup LCD_Private_Functions 00744 * @{ 00745 */ 00746 00747 HAL_StatusTypeDef LCD_WaitForSynchro(LCD_HandleTypeDef *hlcd); 00748 00749 /** 00750 * @} 00751 */ 00752 00753 /** 00754 * @} 00755 */ 00756 00757 /** 00758 * @} 00759 */ 00760 00761 #endif /* STM32L433xx || STM32L443xx || STM32L476xx || STM32L486xx || STM32L496xx || STM32L4A6xx */ 00762 00763 #ifdef __cplusplus 00764 } 00765 #endif 00766 00767 #endif /* STM32L4xx_HAL_LCD_H */