L4 HAL Drivers

Committer:
EricLew
Date:
Mon Nov 02 19:37:23 2015 +0000
Revision:
0:80ee8f3b695e
Errors are with definitions of LCD and QSPI functions. I believe all .h and .c files are  uploaded, but there may need to be certain functions called.

Who changed what in which revision?

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