mbed SDK library sources

Fork of mbed-src by mbed official

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Thu Jan 30 12:15:05 2014 +0000
Revision:
80:66393a7b209d
Parent:
76:aeb1df146756
Synchronized with git revision dba523f83fe09b7fce11fc1299dd1216e9776359

Full URL: https://github.com/mbedmicro/mbed/commit/dba523f83fe09b7fce11fc1299dd1216e9776359/

Update of I2C, SPI, SLEEP for NUCLEO_F103RB and L152RE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 76:aeb1df146756 1 /**
mbed_official 76:aeb1df146756 2 ******************************************************************************
mbed_official 76:aeb1df146756 3 * @file stm32l1xx_lcd.c
mbed_official 76:aeb1df146756 4 * @author MCD Application Team
mbed_official 80:66393a7b209d 5 * @version V1.3.0
mbed_official 80:66393a7b209d 6 * @date 31-January-2014
mbed_official 76:aeb1df146756 7 * @brief This file provides firmware functions to manage the following
mbed_official 76:aeb1df146756 8 * functionalities of the LCD controller (LCD) peripheral:
mbed_official 76:aeb1df146756 9 * + Initialization and configuration
mbed_official 76:aeb1df146756 10 * + LCD RAM memory write
mbed_official 76:aeb1df146756 11 * + Interrupts and flags management
mbed_official 76:aeb1df146756 12 *
mbed_official 76:aeb1df146756 13 * @verbatim
mbed_official 76:aeb1df146756 14
mbed_official 76:aeb1df146756 15 ===============================================================================
mbed_official 76:aeb1df146756 16 ##### LCD Clock #####
mbed_official 76:aeb1df146756 17 ===============================================================================
mbed_official 76:aeb1df146756 18 [..] LCDCLK is the same as RTCCLK.
mbed_official 76:aeb1df146756 19 [..] To configure the RTCCLK/LCDCLK, proceed as follows:
mbed_official 76:aeb1df146756 20 (+) Enable the Power Controller (PWR) APB1 interface clock using the
mbed_official 76:aeb1df146756 21 RCC_APB1PeriphClockCmd() function.
mbed_official 76:aeb1df146756 22 (+) Enable access to RTC domain using the PWR_RTCAccessCmd() function.
mbed_official 76:aeb1df146756 23 (+) Select the RTC clock source using the RCC_RTCCLKConfig() function.
mbed_official 76:aeb1df146756 24
mbed_official 76:aeb1df146756 25 [..] The frequency generator allows you to achieve various LCD frame rates
mbed_official 76:aeb1df146756 26 starting from an LCD input clock frequency (LCDCLK) which can vary
mbed_official 76:aeb1df146756 27 from 32 kHz up to 1 MHz.
mbed_official 76:aeb1df146756 28
mbed_official 76:aeb1df146756 29 ##### LCD and low power modes #####
mbed_official 76:aeb1df146756 30 ===============================================================================
mbed_official 76:aeb1df146756 31 [..] The LCD still active during STOP mode.
mbed_official 76:aeb1df146756 32
mbed_official 76:aeb1df146756 33 ##### How to use this driver #####
mbed_official 76:aeb1df146756 34 ===============================================================================
mbed_official 76:aeb1df146756 35 [..]
mbed_official 76:aeb1df146756 36 (#) Enable LCD clock using
mbed_official 76:aeb1df146756 37 RCC_APB1PeriphClockCmd(RCC_APB1Periph_LCD, ENABLE) function.
mbed_official 76:aeb1df146756 38 (#) Configure the LCD prescaler, divider, duty, bias and voltage source
mbed_official 76:aeb1df146756 39 using LCD_Init() function.
mbed_official 76:aeb1df146756 40 (#) Optionally you can enable/configure:
mbed_official 76:aeb1df146756 41 (++) LCD High Drive using the LCD_HighDriveCmd() function.
mbed_official 76:aeb1df146756 42 (++) LCD COM/SEG Mux using the LCD_MuxSegmentCmd() function.
mbed_official 76:aeb1df146756 43 (++) LCD Pulse ON Duration using the LCD_PulseOnDurationConfig() function.
mbed_official 76:aeb1df146756 44 (++) LCD Dead Time using the LCD_DeadTimeConfig() function
mbed_official 76:aeb1df146756 45 (++) The LCD Blink mode and frequency using the LCD_BlinkConfig() function.
mbed_official 76:aeb1df146756 46 (++) The LCD Contrast using the LCD_ContrastConfig() function.
mbed_official 76:aeb1df146756 47 (#) Call the LCD_WaitForSynchro() function to wait for LCD_FCR register
mbed_official 76:aeb1df146756 48 synchronization.
mbed_official 76:aeb1df146756 49 (#) Call the LCD_Cmd() to enable the LCD controller.
mbed_official 76:aeb1df146756 50 (#) Wait until the LCD Controller status is enabled and the step-up
mbed_official 76:aeb1df146756 51 converter is ready using the LCD_GetFlagStatus() and
mbed_official 76:aeb1df146756 52 LCD_FLAG_ENS and LCD_FLAG_RDY flags.
mbed_official 76:aeb1df146756 53 (#) Write to the LCD RAM memory using the LCD_Write() function.
mbed_official 76:aeb1df146756 54 (#) Request an update display using the LCD_UpdateDisplayRequest()
mbed_official 76:aeb1df146756 55 function.
mbed_official 76:aeb1df146756 56 (#) Wait until the update display is finished by checking the UDD
mbed_official 76:aeb1df146756 57 flag status using the LCD_GetFlagStatus(LCD_FLAG_UDD).
mbed_official 76:aeb1df146756 58
mbed_official 76:aeb1df146756 59 @endverbatim
mbed_official 76:aeb1df146756 60
mbed_official 76:aeb1df146756 61 ******************************************************************************
mbed_official 76:aeb1df146756 62 * @attention
mbed_official 76:aeb1df146756 63 *
mbed_official 80:66393a7b209d 64 * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
mbed_official 76:aeb1df146756 65 *
mbed_official 76:aeb1df146756 66 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
mbed_official 76:aeb1df146756 67 * You may not use this file except in compliance with the License.
mbed_official 76:aeb1df146756 68 * You may obtain a copy of the License at:
mbed_official 76:aeb1df146756 69 *
mbed_official 76:aeb1df146756 70 * http://www.st.com/software_license_agreement_liberty_v2
mbed_official 76:aeb1df146756 71 *
mbed_official 76:aeb1df146756 72 * Unless required by applicable law or agreed to in writing, software
mbed_official 76:aeb1df146756 73 * distributed under the License is distributed on an "AS IS" BASIS,
mbed_official 76:aeb1df146756 74 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbed_official 76:aeb1df146756 75 * See the License for the specific language governing permissions and
mbed_official 76:aeb1df146756 76 * limitations under the License.
mbed_official 76:aeb1df146756 77 *
mbed_official 76:aeb1df146756 78 ******************************************************************************
mbed_official 76:aeb1df146756 79 */
mbed_official 76:aeb1df146756 80
mbed_official 76:aeb1df146756 81 /* Includes ------------------------------------------------------------------*/
mbed_official 76:aeb1df146756 82 #include "stm32l1xx_lcd.h"
mbed_official 76:aeb1df146756 83 #include "stm32l1xx_rcc.h"
mbed_official 76:aeb1df146756 84
mbed_official 76:aeb1df146756 85 /** @addtogroup STM32L1xx_StdPeriph_Driver
mbed_official 76:aeb1df146756 86 * @{
mbed_official 76:aeb1df146756 87 */
mbed_official 76:aeb1df146756 88
mbed_official 76:aeb1df146756 89 /** @defgroup LCD
mbed_official 76:aeb1df146756 90 * @brief LCD driver modules
mbed_official 76:aeb1df146756 91 * @{
mbed_official 76:aeb1df146756 92 */
mbed_official 76:aeb1df146756 93
mbed_official 76:aeb1df146756 94 /* Private typedef -----------------------------------------------------------*/
mbed_official 76:aeb1df146756 95 /* Private define ------------------------------------------------------------*/
mbed_official 76:aeb1df146756 96 /* ------------ LCD registers bit address in the alias region --------------- */
mbed_official 76:aeb1df146756 97 #define LCD_OFFSET (LCD_BASE - PERIPH_BASE)
mbed_official 76:aeb1df146756 98
mbed_official 76:aeb1df146756 99 /* --- CR Register ---*/
mbed_official 76:aeb1df146756 100
mbed_official 76:aeb1df146756 101 /* Alias word address of LCDEN bit */
mbed_official 76:aeb1df146756 102 #define CR_OFFSET (LCD_OFFSET + 0x00)
mbed_official 76:aeb1df146756 103 #define LCDEN_BitNumber 0x00
mbed_official 76:aeb1df146756 104 #define CR_LCDEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (LCDEN_BitNumber * 4))
mbed_official 76:aeb1df146756 105
mbed_official 76:aeb1df146756 106 /* Alias word address of MUX_SEG bit */
mbed_official 76:aeb1df146756 107 #define MUX_SEG_BitNumber 0x07
mbed_official 76:aeb1df146756 108 #define CR_MUX_SEG_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (MUX_SEG_BitNumber * 4))
mbed_official 76:aeb1df146756 109
mbed_official 76:aeb1df146756 110
mbed_official 76:aeb1df146756 111 /* --- FCR Register ---*/
mbed_official 76:aeb1df146756 112
mbed_official 76:aeb1df146756 113 /* Alias word address of HD bit */
mbed_official 76:aeb1df146756 114 #define FCR_OFFSET (LCD_OFFSET + 0x04)
mbed_official 76:aeb1df146756 115 #define HD_BitNumber 0x00
mbed_official 76:aeb1df146756 116 #define FCR_HD_BB (PERIPH_BB_BASE + (FCR_OFFSET * 32) + (HD_BitNumber * 4))
mbed_official 76:aeb1df146756 117
mbed_official 76:aeb1df146756 118 /* --- SR Register ---*/
mbed_official 76:aeb1df146756 119
mbed_official 76:aeb1df146756 120 /* Alias word address of UDR bit */
mbed_official 76:aeb1df146756 121 #define SR_OFFSET (LCD_OFFSET + 0x08)
mbed_official 76:aeb1df146756 122 #define UDR_BitNumber 0x02
mbed_official 76:aeb1df146756 123 #define SR_UDR_BB (PERIPH_BB_BASE + (SR_OFFSET * 32) + (UDR_BitNumber * 4))
mbed_official 76:aeb1df146756 124
mbed_official 76:aeb1df146756 125 #define FCR_MASK ((uint32_t)0xFC03FFFF) /* LCD FCR Mask */
mbed_official 76:aeb1df146756 126 #define CR_MASK ((uint32_t)0xFFFFFF81) /* LCD CR Mask */
mbed_official 76:aeb1df146756 127 #define PON_MASK ((uint32_t)0xFFFFFF8F) /* LCD PON Mask */
mbed_official 76:aeb1df146756 128 #define DEAD_MASK ((uint32_t)0xFFFFFC7F) /* LCD DEAD Mask */
mbed_official 76:aeb1df146756 129 #define BLINK_MASK ((uint32_t)0xFFFC1FFF) /* LCD BLINK Mask */
mbed_official 76:aeb1df146756 130 #define CONTRAST_MASK ((uint32_t)0xFFFFE3FF) /* LCD CONTRAST Mask */
mbed_official 76:aeb1df146756 131
mbed_official 80:66393a7b209d 132 #define SYNCHRO_TIMEOUT ((uint32_t) 0x00008000)
mbed_official 80:66393a7b209d 133
mbed_official 76:aeb1df146756 134 /* Private macro -------------------------------------------------------------*/
mbed_official 76:aeb1df146756 135 /* Private variables ---------------------------------------------------------*/
mbed_official 76:aeb1df146756 136 /* Private function prototypes -----------------------------------------------*/
mbed_official 76:aeb1df146756 137 /* Private functions ---------------------------------------------------------*/
mbed_official 76:aeb1df146756 138
mbed_official 76:aeb1df146756 139 /** @defgroup LCD_Private_Functions
mbed_official 76:aeb1df146756 140 * @{
mbed_official 76:aeb1df146756 141 */
mbed_official 76:aeb1df146756 142
mbed_official 76:aeb1df146756 143 /** @defgroup LCD_Group1 Initialization and Configuration functions
mbed_official 76:aeb1df146756 144 * @brief Initialization and Configuration functions
mbed_official 76:aeb1df146756 145 *
mbed_official 76:aeb1df146756 146 @verbatim
mbed_official 76:aeb1df146756 147 ===============================================================================
mbed_official 76:aeb1df146756 148 ##### Initialization and Configuration functions #####
mbed_official 76:aeb1df146756 149 ===============================================================================
mbed_official 76:aeb1df146756 150
mbed_official 76:aeb1df146756 151 @endverbatim
mbed_official 76:aeb1df146756 152 * @{
mbed_official 76:aeb1df146756 153 */
mbed_official 76:aeb1df146756 154
mbed_official 76:aeb1df146756 155 /**
mbed_official 76:aeb1df146756 156 * @brief Deinitializes the LCD peripheral registers to their default reset
mbed_official 76:aeb1df146756 157 * values.
mbed_official 76:aeb1df146756 158 * @param None
mbed_official 76:aeb1df146756 159 * @retval None
mbed_official 76:aeb1df146756 160 */
mbed_official 76:aeb1df146756 161 void LCD_DeInit(void)
mbed_official 76:aeb1df146756 162 {
mbed_official 76:aeb1df146756 163 /* Enable LCD reset state */
mbed_official 76:aeb1df146756 164 RCC_APB1PeriphResetCmd(RCC_APB1Periph_LCD, ENABLE);
mbed_official 76:aeb1df146756 165 /* Release LCD from reset state */
mbed_official 76:aeb1df146756 166 RCC_APB1PeriphResetCmd(RCC_APB1Periph_LCD, DISABLE);
mbed_official 76:aeb1df146756 167 }
mbed_official 76:aeb1df146756 168
mbed_official 76:aeb1df146756 169 /**
mbed_official 76:aeb1df146756 170 * @brief Initializes the LCD peripheral according to the specified parameters
mbed_official 76:aeb1df146756 171 * in the LCD_InitStruct.
mbed_official 76:aeb1df146756 172 * @note This function can be used only when the LCD is disabled.
mbed_official 76:aeb1df146756 173 * @param LCD_InitStruct: pointer to a LCD_InitTypeDef structure that contains
mbed_official 76:aeb1df146756 174 * the configuration information for the specified LCD peripheral.
mbed_official 76:aeb1df146756 175 * @retval None
mbed_official 76:aeb1df146756 176 */
mbed_official 76:aeb1df146756 177 void LCD_Init(LCD_InitTypeDef* LCD_InitStruct)
mbed_official 76:aeb1df146756 178 {
mbed_official 76:aeb1df146756 179 /* Check function parameters */
mbed_official 76:aeb1df146756 180 assert_param(IS_LCD_PRESCALER(LCD_InitStruct->LCD_Prescaler));
mbed_official 76:aeb1df146756 181 assert_param(IS_LCD_DIVIDER(LCD_InitStruct->LCD_Divider));
mbed_official 76:aeb1df146756 182 assert_param(IS_LCD_DUTY(LCD_InitStruct->LCD_Duty));
mbed_official 76:aeb1df146756 183 assert_param(IS_LCD_BIAS(LCD_InitStruct->LCD_Bias));
mbed_official 76:aeb1df146756 184 assert_param(IS_LCD_VOLTAGE_SOURCE(LCD_InitStruct->LCD_VoltageSource));
mbed_official 76:aeb1df146756 185
mbed_official 76:aeb1df146756 186 LCD->FCR &= (uint32_t)FCR_MASK;
mbed_official 76:aeb1df146756 187 LCD->FCR |= (uint32_t)(LCD_InitStruct->LCD_Prescaler | LCD_InitStruct->LCD_Divider);
mbed_official 76:aeb1df146756 188
mbed_official 76:aeb1df146756 189 LCD_WaitForSynchro();
mbed_official 76:aeb1df146756 190
mbed_official 76:aeb1df146756 191 LCD->CR &= (uint32_t)CR_MASK;
mbed_official 76:aeb1df146756 192 LCD->CR |= (uint32_t)(LCD_InitStruct->LCD_Duty | LCD_InitStruct->LCD_Bias | \
mbed_official 76:aeb1df146756 193 LCD_InitStruct->LCD_VoltageSource);
mbed_official 76:aeb1df146756 194
mbed_official 76:aeb1df146756 195 }
mbed_official 76:aeb1df146756 196
mbed_official 76:aeb1df146756 197 /**
mbed_official 76:aeb1df146756 198 * @brief Fills each LCD_InitStruct member with its default value.
mbed_official 76:aeb1df146756 199 * @param LCD_InitStruct: pointer to a LCD_InitTypeDef structure which will
mbed_official 76:aeb1df146756 200 * be initialized.
mbed_official 76:aeb1df146756 201 * @retval None
mbed_official 76:aeb1df146756 202 */
mbed_official 76:aeb1df146756 203 void LCD_StructInit(LCD_InitTypeDef* LCD_InitStruct)
mbed_official 76:aeb1df146756 204 {
mbed_official 76:aeb1df146756 205 /*--------------- Reset LCD init structure parameters values -----------------*/
mbed_official 76:aeb1df146756 206 LCD_InitStruct->LCD_Prescaler = LCD_Prescaler_1; /*!< Initialize the LCD_Prescaler member */
mbed_official 76:aeb1df146756 207
mbed_official 76:aeb1df146756 208 LCD_InitStruct->LCD_Divider = LCD_Divider_16; /*!< Initialize the LCD_Divider member */
mbed_official 76:aeb1df146756 209
mbed_official 76:aeb1df146756 210 LCD_InitStruct->LCD_Duty = LCD_Duty_Static; /*!< Initialize the LCD_Duty member */
mbed_official 76:aeb1df146756 211
mbed_official 76:aeb1df146756 212 LCD_InitStruct->LCD_Bias = LCD_Bias_1_4; /*!< Initialize the LCD_Bias member */
mbed_official 76:aeb1df146756 213
mbed_official 76:aeb1df146756 214 LCD_InitStruct->LCD_VoltageSource = LCD_VoltageSource_Internal; /*!< Initialize the LCD_VoltageSource member */
mbed_official 76:aeb1df146756 215 }
mbed_official 76:aeb1df146756 216
mbed_official 76:aeb1df146756 217 /**
mbed_official 76:aeb1df146756 218 * @brief Enables or disables the LCD Controller.
mbed_official 76:aeb1df146756 219 * @param NewState: new state of the LCD peripheral.
mbed_official 76:aeb1df146756 220 * This parameter can be: ENABLE or DISABLE.
mbed_official 76:aeb1df146756 221 * @retval None
mbed_official 76:aeb1df146756 222 */
mbed_official 76:aeb1df146756 223 void LCD_Cmd(FunctionalState NewState)
mbed_official 76:aeb1df146756 224 {
mbed_official 76:aeb1df146756 225 assert_param(IS_FUNCTIONAL_STATE(NewState));
mbed_official 76:aeb1df146756 226
mbed_official 76:aeb1df146756 227 /* Check the parameters */
mbed_official 76:aeb1df146756 228 assert_param(IS_FUNCTIONAL_STATE(NewState));
mbed_official 76:aeb1df146756 229
mbed_official 76:aeb1df146756 230 *(__IO uint32_t *) CR_LCDEN_BB = (uint32_t)NewState;
mbed_official 76:aeb1df146756 231 }
mbed_official 76:aeb1df146756 232
mbed_official 76:aeb1df146756 233 /**
mbed_official 76:aeb1df146756 234 * @brief Waits until the LCD FCR register is synchronized in the LCDCLK domain.
mbed_official 76:aeb1df146756 235 * This function must be called after any write operation to LCD_FCR register.
mbed_official 76:aeb1df146756 236 * @param None
mbed_official 76:aeb1df146756 237 * @retval None
mbed_official 76:aeb1df146756 238 */
mbed_official 76:aeb1df146756 239 void LCD_WaitForSynchro(void)
mbed_official 76:aeb1df146756 240 {
mbed_official 80:66393a7b209d 241 uint32_t synchrocounter = 0;
mbed_official 80:66393a7b209d 242 uint32_t synchrostatus = 0x00;
mbed_official 80:66393a7b209d 243
mbed_official 76:aeb1df146756 244 /* Loop until FCRSF flag is set */
mbed_official 80:66393a7b209d 245 do
mbed_official 76:aeb1df146756 246 {
mbed_official 80:66393a7b209d 247 synchrostatus = LCD->SR & LCD_FLAG_FCRSF;
mbed_official 80:66393a7b209d 248 synchrocounter++;
mbed_official 80:66393a7b209d 249 } while((synchrocounter != SYNCHRO_TIMEOUT) && (synchrostatus == 0x00));
mbed_official 76:aeb1df146756 250 }
mbed_official 76:aeb1df146756 251
mbed_official 76:aeb1df146756 252 /**
mbed_official 76:aeb1df146756 253 * @brief Enables or disables the low resistance divider. Displays with high
mbed_official 76:aeb1df146756 254 * internal resistance may need a longer drive time to achieve
mbed_official 76:aeb1df146756 255 * satisfactory contrast. This function is useful in this case if some
mbed_official 76:aeb1df146756 256 * additional power consumption can be tolerated.
mbed_official 76:aeb1df146756 257 * @note When this mode is enabled, the PulseOn Duration (PON) have to be
mbed_official 76:aeb1df146756 258 * programmed to 1/CK_PS (LCD_PulseOnDuration_1).
mbed_official 76:aeb1df146756 259 * @param NewState: new state of the low resistance divider.
mbed_official 76:aeb1df146756 260 * This parameter can be: ENABLE or DISABLE.
mbed_official 76:aeb1df146756 261 * @retval None
mbed_official 76:aeb1df146756 262 */
mbed_official 76:aeb1df146756 263 void LCD_HighDriveCmd(FunctionalState NewState)
mbed_official 76:aeb1df146756 264 {
mbed_official 76:aeb1df146756 265 /* Check the parameters */
mbed_official 76:aeb1df146756 266 assert_param(IS_FUNCTIONAL_STATE(NewState));
mbed_official 76:aeb1df146756 267
mbed_official 76:aeb1df146756 268 *(__IO uint32_t *) FCR_HD_BB = (uint32_t)NewState;
mbed_official 76:aeb1df146756 269 }
mbed_official 76:aeb1df146756 270
mbed_official 76:aeb1df146756 271 /**
mbed_official 76:aeb1df146756 272 * @brief Enables or disables the Mux Segment.
mbed_official 76:aeb1df146756 273 * @note This function can be used only when the LCD is disabled.
mbed_official 76:aeb1df146756 274 * @param NewState: new state of the Mux Segment.
mbed_official 76:aeb1df146756 275 * This parameter can be: ENABLE or DISABLE.
mbed_official 76:aeb1df146756 276 * @retval None
mbed_official 76:aeb1df146756 277 */
mbed_official 76:aeb1df146756 278 void LCD_MuxSegmentCmd(FunctionalState NewState)
mbed_official 76:aeb1df146756 279 {
mbed_official 76:aeb1df146756 280 /* Check the parameters */
mbed_official 76:aeb1df146756 281 assert_param(IS_FUNCTIONAL_STATE(NewState));
mbed_official 76:aeb1df146756 282
mbed_official 76:aeb1df146756 283 *(__IO uint32_t *) CR_MUX_SEG_BB = (uint32_t)NewState;
mbed_official 76:aeb1df146756 284 }
mbed_official 76:aeb1df146756 285
mbed_official 76:aeb1df146756 286 /**
mbed_official 76:aeb1df146756 287 * @brief Configures the LCD pulses on duration.
mbed_official 76:aeb1df146756 288 * @param LCD_PulseOnDuration: specifies the LCD pulse on duration in terms of
mbed_official 76:aeb1df146756 289 * CK_PS (prescaled LCD clock period) pulses.
mbed_official 76:aeb1df146756 290 * This parameter can be one of the following values:
mbed_official 76:aeb1df146756 291 * @arg LCD_PulseOnDuration_0: 0 pulse
mbed_official 76:aeb1df146756 292 * @arg LCD_PulseOnDuration_1: Pulse ON duration = 1/CK_PS
mbed_official 76:aeb1df146756 293 * @arg LCD_PulseOnDuration_2: Pulse ON duration = 2/CK_PS
mbed_official 76:aeb1df146756 294 * @arg LCD_PulseOnDuration_3: Pulse ON duration = 3/CK_PS
mbed_official 76:aeb1df146756 295 * @arg LCD_PulseOnDuration_4: Pulse ON duration = 4/CK_PS
mbed_official 76:aeb1df146756 296 * @arg LCD_PulseOnDuration_5: Pulse ON duration = 5/CK_PS
mbed_official 76:aeb1df146756 297 * @arg LCD_PulseOnDuration_6: Pulse ON duration = 6/CK_PS
mbed_official 76:aeb1df146756 298 * @arg LCD_PulseOnDuration_7: Pulse ON duration = 7/CK_PS
mbed_official 76:aeb1df146756 299 * @retval None
mbed_official 76:aeb1df146756 300 */
mbed_official 76:aeb1df146756 301 void LCD_PulseOnDurationConfig(uint32_t LCD_PulseOnDuration)
mbed_official 76:aeb1df146756 302 {
mbed_official 76:aeb1df146756 303 /* Check the parameters */
mbed_official 76:aeb1df146756 304 assert_param(IS_LCD_PULSE_ON_DURATION(LCD_PulseOnDuration));
mbed_official 76:aeb1df146756 305
mbed_official 76:aeb1df146756 306 LCD->FCR &= (uint32_t)PON_MASK;
mbed_official 76:aeb1df146756 307 LCD->FCR |= (uint32_t)(LCD_PulseOnDuration);
mbed_official 76:aeb1df146756 308 }
mbed_official 76:aeb1df146756 309
mbed_official 76:aeb1df146756 310 /**
mbed_official 76:aeb1df146756 311 * @brief Configures the LCD dead time.
mbed_official 76:aeb1df146756 312 * @param LCD_DeadTime: specifies the LCD dead time.
mbed_official 76:aeb1df146756 313 * This parameter can be one of the following values:
mbed_official 76:aeb1df146756 314 * @arg LCD_DeadTime_0: No dead Time
mbed_official 76:aeb1df146756 315 * @arg LCD_DeadTime_1: One Phase between different couple of Frame
mbed_official 76:aeb1df146756 316 * @arg LCD_DeadTime_2: Two Phase between different couple of Frame
mbed_official 76:aeb1df146756 317 * @arg LCD_DeadTime_3: Three Phase between different couple of Frame
mbed_official 76:aeb1df146756 318 * @arg LCD_DeadTime_4: Four Phase between different couple of Frame
mbed_official 76:aeb1df146756 319 * @arg LCD_DeadTime_5: Five Phase between different couple of Frame
mbed_official 76:aeb1df146756 320 * @arg LCD_DeadTime_6: Six Phase between different couple of Frame
mbed_official 76:aeb1df146756 321 * @arg LCD_DeadTime_7: Seven Phase between different couple of Frame
mbed_official 76:aeb1df146756 322 * @retval None
mbed_official 76:aeb1df146756 323 */
mbed_official 76:aeb1df146756 324 void LCD_DeadTimeConfig(uint32_t LCD_DeadTime)
mbed_official 76:aeb1df146756 325 {
mbed_official 76:aeb1df146756 326 /* Check the parameters */
mbed_official 76:aeb1df146756 327 assert_param(IS_LCD_DEAD_TIME(LCD_DeadTime));
mbed_official 76:aeb1df146756 328
mbed_official 76:aeb1df146756 329 LCD->FCR &= (uint32_t)DEAD_MASK;
mbed_official 76:aeb1df146756 330 LCD->FCR |= (uint32_t)(LCD_DeadTime);
mbed_official 76:aeb1df146756 331 }
mbed_official 76:aeb1df146756 332
mbed_official 76:aeb1df146756 333 /**
mbed_official 76:aeb1df146756 334 * @brief Configures the LCD Blink mode and Blink frequency.
mbed_official 76:aeb1df146756 335 * @param LCD_BlinkMode: specifies the LCD blink mode.
mbed_official 76:aeb1df146756 336 * This parameter can be one of the following values:
mbed_official 76:aeb1df146756 337 * @arg LCD_BlinkMode_Off: Blink disabled
mbed_official 76:aeb1df146756 338 * @arg LCD_BlinkMode_SEG0_COM0: Blink enabled on SEG[0], COM[0] (1 pixel)
mbed_official 76:aeb1df146756 339 * @arg LCD_BlinkMode_SEG0_AllCOM: Blink enabled on SEG[0], all COM (up to 8
mbed_official 76:aeb1df146756 340 * pixels according to the programmed duty)
mbed_official 76:aeb1df146756 341 * @arg LCD_BlinkMode_AllSEG_AllCOM: Blink enabled on all SEG and all COM
mbed_official 76:aeb1df146756 342 * (all pixels)
mbed_official 76:aeb1df146756 343 * @param LCD_BlinkFrequency: specifies the LCD blink frequency.
mbed_official 76:aeb1df146756 344 * This parameter can be one of the following values:
mbed_official 76:aeb1df146756 345 * @arg LCD_BlinkFrequency_Div8: The Blink frequency = fLcd/8
mbed_official 76:aeb1df146756 346 * @arg LCD_BlinkFrequency_Div16: The Blink frequency = fLcd/16
mbed_official 76:aeb1df146756 347 * @arg LCD_BlinkFrequency_Div32: The Blink frequency = fLcd/32
mbed_official 76:aeb1df146756 348 * @arg LCD_BlinkFrequency_Div64: The Blink frequency = fLcd/64
mbed_official 76:aeb1df146756 349 * @arg LCD_BlinkFrequency_Div128: The Blink frequency = fLcd/128
mbed_official 76:aeb1df146756 350 * @arg LCD_BlinkFrequency_Div256: The Blink frequency = fLcd/256
mbed_official 76:aeb1df146756 351 * @arg LCD_BlinkFrequency_Div512: The Blink frequency = fLcd/512
mbed_official 76:aeb1df146756 352 * @arg LCD_BlinkFrequency_Div1024: The Blink frequency = fLcd/1024
mbed_official 76:aeb1df146756 353 * @retval None
mbed_official 76:aeb1df146756 354 */
mbed_official 76:aeb1df146756 355 void LCD_BlinkConfig(uint32_t LCD_BlinkMode, uint32_t LCD_BlinkFrequency)
mbed_official 76:aeb1df146756 356 {
mbed_official 76:aeb1df146756 357 /* Check the parameters */
mbed_official 76:aeb1df146756 358 assert_param(IS_LCD_BLINK_MODE(LCD_BlinkMode));
mbed_official 76:aeb1df146756 359 assert_param(IS_LCD_BLINK_FREQUENCY(LCD_BlinkFrequency));
mbed_official 76:aeb1df146756 360
mbed_official 76:aeb1df146756 361 LCD->FCR &= (uint32_t)BLINK_MASK;
mbed_official 76:aeb1df146756 362 LCD->FCR |= (uint32_t)(LCD_BlinkMode | LCD_BlinkFrequency);
mbed_official 76:aeb1df146756 363 }
mbed_official 76:aeb1df146756 364
mbed_official 76:aeb1df146756 365 /**
mbed_official 76:aeb1df146756 366 * @brief Configures the LCD Contrast.
mbed_official 76:aeb1df146756 367 * @param LCD_Contrast: specifies the LCD Contrast.
mbed_official 76:aeb1df146756 368 * This parameter can be one of the following values:
mbed_official 76:aeb1df146756 369 * @arg LCD_Contrast_Level_0: Maximum Voltage = 2.60V
mbed_official 76:aeb1df146756 370 * @arg LCD_Contrast_Level_1: Maximum Voltage = 2.73V
mbed_official 76:aeb1df146756 371 * @arg LCD_Contrast_Level_2: Maximum Voltage = 2.86V
mbed_official 76:aeb1df146756 372 * @arg LCD_Contrast_Level_3: Maximum Voltage = 2.99V
mbed_official 76:aeb1df146756 373 * @arg LCD_Contrast_Level_4: Maximum Voltage = 3.12V
mbed_official 76:aeb1df146756 374 * @arg LCD_Contrast_Level_5: Maximum Voltage = 3.25V
mbed_official 76:aeb1df146756 375 * @arg LCD_Contrast_Level_6: Maximum Voltage = 3.38V
mbed_official 76:aeb1df146756 376 * @arg LCD_Contrast_Level_7: Maximum Voltage = 3.51V
mbed_official 76:aeb1df146756 377 * @retval None
mbed_official 76:aeb1df146756 378 */
mbed_official 76:aeb1df146756 379 void LCD_ContrastConfig(uint32_t LCD_Contrast)
mbed_official 76:aeb1df146756 380 {
mbed_official 76:aeb1df146756 381 /* Check the parameters */
mbed_official 76:aeb1df146756 382 assert_param(IS_LCD_CONTRAST(LCD_Contrast));
mbed_official 76:aeb1df146756 383
mbed_official 76:aeb1df146756 384 LCD->FCR &= (uint32_t)CONTRAST_MASK;
mbed_official 76:aeb1df146756 385 LCD->FCR |= (uint32_t)(LCD_Contrast);
mbed_official 76:aeb1df146756 386 }
mbed_official 76:aeb1df146756 387
mbed_official 76:aeb1df146756 388 /**
mbed_official 76:aeb1df146756 389 * @}
mbed_official 76:aeb1df146756 390 */
mbed_official 76:aeb1df146756 391
mbed_official 76:aeb1df146756 392 /** @defgroup LCD_Group2 LCD RAM memory write functions
mbed_official 76:aeb1df146756 393 * @brief LCD RAM memory write functions
mbed_official 76:aeb1df146756 394 *
mbed_official 76:aeb1df146756 395 @verbatim
mbed_official 76:aeb1df146756 396 ===============================================================================
mbed_official 76:aeb1df146756 397 ##### LCD RAM memory write functions #####
mbed_official 76:aeb1df146756 398 ===============================================================================
mbed_official 76:aeb1df146756 399 [..] Using its double buffer memory the LCD controller ensures the coherency
mbed_official 76:aeb1df146756 400 of the displayed information without having to use interrupts to control
mbed_official 76:aeb1df146756 401 LCD_RAM modification.
mbed_official 76:aeb1df146756 402
mbed_official 76:aeb1df146756 403 [..] The application software can access the first buffer level (LCD_RAM) through
mbed_official 76:aeb1df146756 404 the APB interface. Once it has modified the LCD_RAM, it sets the UDR flag
mbed_official 76:aeb1df146756 405 in the LCD_SR register using the LCD_UpdateDisplayRequest() function.
mbed_official 76:aeb1df146756 406
mbed_official 76:aeb1df146756 407 [..] This UDR flag (update display request) requests the updated information
mbed_official 76:aeb1df146756 408 to be moved into the second buffer level (LCD_DISPLAY).
mbed_official 76:aeb1df146756 409
mbed_official 76:aeb1df146756 410 [..] This operation is done synchronously with the frame (at the beginning of
mbed_official 76:aeb1df146756 411 the next frame), until the update is completed, the LCD_RAM is write
mbed_official 76:aeb1df146756 412 protected and the UDR flag stays high.
mbed_official 76:aeb1df146756 413
mbed_official 76:aeb1df146756 414 [..] Once the update is completed another flag (UDD - Update Display Done) is
mbed_official 76:aeb1df146756 415 set and generates an interrupt if the UDDIE bit in the LCD_FCR register
mbed_official 76:aeb1df146756 416 is set.
mbed_official 76:aeb1df146756 417
mbed_official 76:aeb1df146756 418 [..] The time it takes to update LCD_DISPLAY is, in the worst case, one odd
mbed_official 76:aeb1df146756 419 and one even frame.
mbed_official 76:aeb1df146756 420
mbed_official 76:aeb1df146756 421 [..] The update will not occur (UDR = 1 and UDD = 0) until the display is
mbed_official 76:aeb1df146756 422 enabled (LCDEN = 1).
mbed_official 76:aeb1df146756 423
mbed_official 76:aeb1df146756 424 @endverbatim
mbed_official 76:aeb1df146756 425 * @{
mbed_official 76:aeb1df146756 426 */
mbed_official 76:aeb1df146756 427
mbed_official 76:aeb1df146756 428 /**
mbed_official 76:aeb1df146756 429 * @brief Writes a word in the specific LCD RAM.
mbed_official 76:aeb1df146756 430 * @param LCD_RAMRegister: specifies the LCD Contrast.
mbed_official 76:aeb1df146756 431 * This parameter can be one of the following values:
mbed_official 76:aeb1df146756 432 * @arg LCD_RAMRegister_0: LCD RAM Register 0
mbed_official 76:aeb1df146756 433 * @arg LCD_RAMRegister_1: LCD RAM Register 1
mbed_official 76:aeb1df146756 434 * @arg LCD_RAMRegister_2: LCD RAM Register 2
mbed_official 76:aeb1df146756 435 * @arg LCD_RAMRegister_3: LCD RAM Register 3
mbed_official 76:aeb1df146756 436 * @arg LCD_RAMRegister_4: LCD RAM Register 4
mbed_official 76:aeb1df146756 437 * @arg LCD_RAMRegister_5: LCD RAM Register 5
mbed_official 76:aeb1df146756 438 * @arg LCD_RAMRegister_6: LCD RAM Register 6
mbed_official 76:aeb1df146756 439 * @arg LCD_RAMRegister_7: LCD RAM Register 7
mbed_official 76:aeb1df146756 440 * @arg LCD_RAMRegister_8: LCD RAM Register 8
mbed_official 76:aeb1df146756 441 * @arg LCD_RAMRegister_9: LCD RAM Register 9
mbed_official 76:aeb1df146756 442 * @arg LCD_RAMRegister_10: LCD RAM Register 10
mbed_official 76:aeb1df146756 443 * @arg LCD_RAMRegister_11: LCD RAM Register 11
mbed_official 76:aeb1df146756 444 * @arg LCD_RAMRegister_12: LCD RAM Register 12
mbed_official 76:aeb1df146756 445 * @arg LCD_RAMRegister_13: LCD RAM Register 13
mbed_official 76:aeb1df146756 446 * @arg LCD_RAMRegister_14: LCD RAM Register 14
mbed_official 76:aeb1df146756 447 * @arg LCD_RAMRegister_15: LCD RAM Register 15
mbed_official 76:aeb1df146756 448 * @param LCD_Data: specifies LCD Data Value to be written.
mbed_official 76:aeb1df146756 449 * @retval None
mbed_official 76:aeb1df146756 450 */
mbed_official 76:aeb1df146756 451 void LCD_Write(uint32_t LCD_RAMRegister, uint32_t LCD_Data)
mbed_official 76:aeb1df146756 452 {
mbed_official 76:aeb1df146756 453 /* Check the parameters */
mbed_official 76:aeb1df146756 454 assert_param(IS_LCD_RAM_REGISTER(LCD_RAMRegister));
mbed_official 76:aeb1df146756 455
mbed_official 76:aeb1df146756 456 /* Copy data bytes to RAM register */
mbed_official 76:aeb1df146756 457 LCD->RAM[LCD_RAMRegister] = (uint32_t)LCD_Data;
mbed_official 76:aeb1df146756 458 }
mbed_official 76:aeb1df146756 459
mbed_official 76:aeb1df146756 460 /**
mbed_official 76:aeb1df146756 461 * @brief Enables the Update Display Request.
mbed_official 76:aeb1df146756 462 * @note Each time software modifies the LCD_RAM it must set the UDR bit to
mbed_official 76:aeb1df146756 463 * transfer the updated data to the second level buffer.
mbed_official 76:aeb1df146756 464 * The UDR bit stays set until the end of the update and during this
mbed_official 76:aeb1df146756 465 * time the LCD_RAM is write protected.
mbed_official 76:aeb1df146756 466 * @note When the display is disabled, the update is performed for all
mbed_official 76:aeb1df146756 467 * LCD_DISPLAY locations.
mbed_official 76:aeb1df146756 468 * When the display is enabled, the update is performed only for locations
mbed_official 76:aeb1df146756 469 * for which commons are active (depending on DUTY). For example if
mbed_official 76:aeb1df146756 470 * DUTY = 1/2, only the LCD_DISPLAY of COM0 and COM1 will be updated.
mbed_official 76:aeb1df146756 471 * @param None
mbed_official 76:aeb1df146756 472 * @retval None
mbed_official 76:aeb1df146756 473 */
mbed_official 76:aeb1df146756 474 void LCD_UpdateDisplayRequest(void)
mbed_official 76:aeb1df146756 475 {
mbed_official 76:aeb1df146756 476 *(__IO uint32_t *) SR_UDR_BB = (uint32_t)0x01;
mbed_official 76:aeb1df146756 477 }
mbed_official 76:aeb1df146756 478
mbed_official 76:aeb1df146756 479 /**
mbed_official 76:aeb1df146756 480 * @}
mbed_official 76:aeb1df146756 481 */
mbed_official 76:aeb1df146756 482
mbed_official 76:aeb1df146756 483 /** @defgroup LCD_Group3 Interrupts and flags management functions
mbed_official 76:aeb1df146756 484 * @brief Interrupts and flags management functions
mbed_official 76:aeb1df146756 485 *
mbed_official 76:aeb1df146756 486 @verbatim
mbed_official 76:aeb1df146756 487 ===============================================================================
mbed_official 76:aeb1df146756 488 ##### Interrupts and flags management functions #####
mbed_official 76:aeb1df146756 489 ===============================================================================
mbed_official 76:aeb1df146756 490
mbed_official 76:aeb1df146756 491 @endverbatim
mbed_official 76:aeb1df146756 492 * @{
mbed_official 76:aeb1df146756 493 */
mbed_official 76:aeb1df146756 494
mbed_official 76:aeb1df146756 495 /**
mbed_official 76:aeb1df146756 496 * @brief Enables or disables the specified LCD interrupts.
mbed_official 76:aeb1df146756 497 * @param LCD_IT: specifies the LCD interrupts sources to be enabled or disabled.
mbed_official 76:aeb1df146756 498 * This parameter can be any combination of the following values:
mbed_official 76:aeb1df146756 499 * @arg LCD_IT_SOF: Start of Frame Interrupt
mbed_official 76:aeb1df146756 500 * @arg LCD_IT_UDD: Update Display Done Interrupt
mbed_official 76:aeb1df146756 501 * @param NewState: new state of the specified LCD interrupts.
mbed_official 76:aeb1df146756 502 * This parameter can be: ENABLE or DISABLE.
mbed_official 76:aeb1df146756 503 * @retval None
mbed_official 76:aeb1df146756 504 */
mbed_official 76:aeb1df146756 505 void LCD_ITConfig(uint32_t LCD_IT, FunctionalState NewState)
mbed_official 76:aeb1df146756 506 {
mbed_official 76:aeb1df146756 507 /* Check the parameters */
mbed_official 76:aeb1df146756 508 assert_param(IS_LCD_IT(LCD_IT));
mbed_official 76:aeb1df146756 509 assert_param(IS_FUNCTIONAL_STATE(NewState));
mbed_official 76:aeb1df146756 510
mbed_official 76:aeb1df146756 511 if (NewState != DISABLE)
mbed_official 76:aeb1df146756 512 {
mbed_official 76:aeb1df146756 513 LCD->FCR |= LCD_IT;
mbed_official 76:aeb1df146756 514 }
mbed_official 76:aeb1df146756 515 else
mbed_official 76:aeb1df146756 516 {
mbed_official 76:aeb1df146756 517 LCD->FCR &= (uint32_t)~LCD_IT;
mbed_official 76:aeb1df146756 518 }
mbed_official 76:aeb1df146756 519 }
mbed_official 76:aeb1df146756 520
mbed_official 76:aeb1df146756 521 /**
mbed_official 76:aeb1df146756 522 * @brief Checks whether the specified LCD flag is set or not.
mbed_official 76:aeb1df146756 523 * @param LCD_FLAG: specifies the flag to check.
mbed_official 76:aeb1df146756 524 * This parameter can be one of the following values:
mbed_official 76:aeb1df146756 525 * @arg LCD_FLAG_ENS: LCD Enabled flag. It indicates the LCD controller status.
mbed_official 76:aeb1df146756 526 * @note The ENS bit is set immediately when the LCDEN bit in the LCD_CR
mbed_official 76:aeb1df146756 527 * goes from 0 to 1. On deactivation it reflects the real status of
mbed_official 76:aeb1df146756 528 * LCD so it becomes 0 at the end of the last displayed frame.
mbed_official 76:aeb1df146756 529 * @arg LCD_FLAG_SOF: Start of Frame flag. This flag is set by hardware at
mbed_official 76:aeb1df146756 530 * the beginning of a new frame, at the same time as the display data is
mbed_official 76:aeb1df146756 531 * updated.
mbed_official 76:aeb1df146756 532 * @arg LCD_FLAG_UDR: Update Display Request flag.
mbed_official 76:aeb1df146756 533 * @arg LCD_FLAG_UDD: Update Display Done flag.
mbed_official 76:aeb1df146756 534 * @arg LCD_FLAG_RDY: Step_up converter Ready flag. It indicates the status
mbed_official 76:aeb1df146756 535 * of the step-up converter.
mbed_official 76:aeb1df146756 536 * @arg LCD_FLAG_FCRSF: LCD Frame Control Register Synchronization Flag.
mbed_official 76:aeb1df146756 537 * This flag is set by hardware each time the LCD_FCR register is updated
mbed_official 76:aeb1df146756 538 * in the LCDCLK domain.
mbed_official 76:aeb1df146756 539 * @retval The new state of LCD_FLAG (SET or RESET).
mbed_official 76:aeb1df146756 540 */
mbed_official 76:aeb1df146756 541 FlagStatus LCD_GetFlagStatus(uint32_t LCD_FLAG)
mbed_official 76:aeb1df146756 542 {
mbed_official 76:aeb1df146756 543 FlagStatus bitstatus = RESET;
mbed_official 76:aeb1df146756 544
mbed_official 76:aeb1df146756 545 /* Check the parameters */
mbed_official 76:aeb1df146756 546 assert_param(IS_LCD_GET_FLAG(LCD_FLAG));
mbed_official 76:aeb1df146756 547
mbed_official 76:aeb1df146756 548 if ((LCD->SR & LCD_FLAG) != (uint32_t)RESET)
mbed_official 76:aeb1df146756 549 {
mbed_official 76:aeb1df146756 550 bitstatus = SET;
mbed_official 76:aeb1df146756 551 }
mbed_official 76:aeb1df146756 552 else
mbed_official 76:aeb1df146756 553 {
mbed_official 76:aeb1df146756 554 bitstatus = RESET;
mbed_official 76:aeb1df146756 555 }
mbed_official 76:aeb1df146756 556 return bitstatus;
mbed_official 76:aeb1df146756 557 }
mbed_official 76:aeb1df146756 558
mbed_official 76:aeb1df146756 559 /**
mbed_official 76:aeb1df146756 560 * @brief Clears the LCD's pending flags.
mbed_official 76:aeb1df146756 561 * @param LCD_FLAG: specifies the flag to clear.
mbed_official 76:aeb1df146756 562 * This parameter can be any combination of the following values:
mbed_official 76:aeb1df146756 563 * @arg LCD_FLAG_SOF: Start of Frame Interrupt
mbed_official 76:aeb1df146756 564 * @arg LCD_FLAG_UDD: Update Display Done Interrupt
mbed_official 76:aeb1df146756 565 * @retval None
mbed_official 76:aeb1df146756 566 */
mbed_official 76:aeb1df146756 567 void LCD_ClearFlag(uint32_t LCD_FLAG)
mbed_official 76:aeb1df146756 568 {
mbed_official 76:aeb1df146756 569 /* Check the parameters */
mbed_official 76:aeb1df146756 570 assert_param(IS_LCD_CLEAR_FLAG(LCD_FLAG));
mbed_official 76:aeb1df146756 571
mbed_official 76:aeb1df146756 572 /* Clear the corresponding LCD flag */
mbed_official 76:aeb1df146756 573 LCD->CLR = (uint32_t)LCD_FLAG;
mbed_official 76:aeb1df146756 574 }
mbed_official 76:aeb1df146756 575
mbed_official 76:aeb1df146756 576 /**
mbed_official 76:aeb1df146756 577 * @brief Checks whether the specified RTC interrupt has occurred or not.
mbed_official 76:aeb1df146756 578 * @param LCD_IT: specifies the LCD interrupts sources to check.
mbed_official 76:aeb1df146756 579 * This parameter can be one of the following values:
mbed_official 76:aeb1df146756 580 * @arg LCD_IT_SOF: Start of Frame Interrupt
mbed_official 76:aeb1df146756 581 * @arg LCD_IT_UDD: Update Display Done Interrupt.
mbed_official 76:aeb1df146756 582 * @note If the device is in STOP mode (PCLK not provided) UDD will not
mbed_official 76:aeb1df146756 583 * generate an interrupt even if UDDIE = 1.
mbed_official 76:aeb1df146756 584 * If the display is not enabled the UDD interrupt will never occur.
mbed_official 76:aeb1df146756 585 * @retval The new state of the LCD_IT (SET or RESET).
mbed_official 76:aeb1df146756 586 */
mbed_official 76:aeb1df146756 587 ITStatus LCD_GetITStatus(uint32_t LCD_IT)
mbed_official 76:aeb1df146756 588 {
mbed_official 76:aeb1df146756 589 ITStatus bitstatus = RESET;
mbed_official 76:aeb1df146756 590
mbed_official 76:aeb1df146756 591 /* Check the parameters */
mbed_official 76:aeb1df146756 592 assert_param(IS_LCD_GET_IT(LCD_IT));
mbed_official 76:aeb1df146756 593
mbed_official 76:aeb1df146756 594 if ((LCD->SR & LCD_IT) != (uint16_t)RESET)
mbed_official 76:aeb1df146756 595 {
mbed_official 76:aeb1df146756 596 bitstatus = SET;
mbed_official 76:aeb1df146756 597 }
mbed_official 76:aeb1df146756 598 else
mbed_official 76:aeb1df146756 599 {
mbed_official 76:aeb1df146756 600 bitstatus = RESET;
mbed_official 76:aeb1df146756 601 }
mbed_official 76:aeb1df146756 602
mbed_official 76:aeb1df146756 603 if (((LCD->FCR & LCD_IT) != (uint16_t)RESET) && (bitstatus != (uint32_t)RESET))
mbed_official 76:aeb1df146756 604 {
mbed_official 76:aeb1df146756 605 bitstatus = SET;
mbed_official 76:aeb1df146756 606 }
mbed_official 76:aeb1df146756 607 else
mbed_official 76:aeb1df146756 608 {
mbed_official 76:aeb1df146756 609 bitstatus = RESET;
mbed_official 76:aeb1df146756 610 }
mbed_official 76:aeb1df146756 611 return bitstatus;
mbed_official 76:aeb1df146756 612 }
mbed_official 76:aeb1df146756 613
mbed_official 76:aeb1df146756 614 /**
mbed_official 76:aeb1df146756 615 * @brief Clears the LCD's interrupt pending bits.
mbed_official 76:aeb1df146756 616 * @param LCD_IT: specifies the interrupt pending bit to clear.
mbed_official 76:aeb1df146756 617 * This parameter can be any combination of the following values:
mbed_official 76:aeb1df146756 618 * @arg LCD_IT_SOF: Start of Frame Interrupt
mbed_official 76:aeb1df146756 619 * @arg LCD_IT_UDD: Update Display Done Interrupt
mbed_official 76:aeb1df146756 620 * @retval None
mbed_official 76:aeb1df146756 621 */
mbed_official 76:aeb1df146756 622 void LCD_ClearITPendingBit(uint32_t LCD_IT)
mbed_official 76:aeb1df146756 623 {
mbed_official 76:aeb1df146756 624 /* Check the parameters */
mbed_official 76:aeb1df146756 625 assert_param(IS_LCD_IT(LCD_IT));
mbed_official 76:aeb1df146756 626
mbed_official 76:aeb1df146756 627 /* Clear the corresponding LCD pending bit */
mbed_official 76:aeb1df146756 628 LCD->CLR = (uint32_t)LCD_IT;
mbed_official 76:aeb1df146756 629 }
mbed_official 76:aeb1df146756 630
mbed_official 76:aeb1df146756 631 /**
mbed_official 76:aeb1df146756 632 * @}
mbed_official 76:aeb1df146756 633 */
mbed_official 76:aeb1df146756 634
mbed_official 76:aeb1df146756 635 /**
mbed_official 76:aeb1df146756 636 * @}
mbed_official 76:aeb1df146756 637 */
mbed_official 76:aeb1df146756 638
mbed_official 76:aeb1df146756 639 /**
mbed_official 76:aeb1df146756 640 * @}
mbed_official 76:aeb1df146756 641 */
mbed_official 76:aeb1df146756 642
mbed_official 76:aeb1df146756 643 /**
mbed_official 76:aeb1df146756 644 * @}
mbed_official 76:aeb1df146756 645 */
mbed_official 76:aeb1df146756 646
mbed_official 76:aeb1df146756 647 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/