mbed library with additional peripherals for ST F401 board
Fork of mbed-src by
This mbed LIB has additional peripherals for ST F401 board
- UART2 : PA_3 rx, PA_2 tx
- UART3 : PC_7 rx, PC_6 tx
- I2C2 : PB_3 SDA, PB_10 SCL
- I2C3 : PB_4 SDA, PA_8 SCL
targets/cmsis/TARGET_STM/TARGET_NUCLEO_L152RE/stm32l1xx_lcd.c@106:ced8cbb51063, 2014-02-26 (annotated)
- Committer:
- mbed_official
- Date:
- Wed Feb 26 09:45:12 2014 +0000
- Revision:
- 106:ced8cbb51063
- Parent:
- 80:66393a7b209d
Synchronized with git revision 4222735eff5868389433f0e9271976b39c8115cd
Full URL: https://github.com/mbedmicro/mbed/commit/4222735eff5868389433f0e9271976b39c8115cd/
[NUCLEO_xxx] Update STM32CubeF4 driver V1.0.0 + update license
Who changed what in which revision?
User | Revision | Line number | New 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 | 106:ced8cbb51063 | 64 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 76:aeb1df146756 | 65 | * |
mbed_official | 106:ced8cbb51063 | 66 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 106:ced8cbb51063 | 67 | * are permitted provided that the following conditions are met: |
mbed_official | 106:ced8cbb51063 | 68 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 106:ced8cbb51063 | 69 | * this list of conditions and the following disclaimer. |
mbed_official | 106:ced8cbb51063 | 70 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 106:ced8cbb51063 | 71 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 106:ced8cbb51063 | 72 | * and/or other materials provided with the distribution. |
mbed_official | 106:ced8cbb51063 | 73 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 106:ced8cbb51063 | 74 | * may be used to endorse or promote products derived from this software |
mbed_official | 106:ced8cbb51063 | 75 | * without specific prior written permission. |
mbed_official | 76:aeb1df146756 | 76 | * |
mbed_official | 106:ced8cbb51063 | 77 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 106:ced8cbb51063 | 78 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 106:ced8cbb51063 | 79 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 106:ced8cbb51063 | 80 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 106:ced8cbb51063 | 81 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 106:ced8cbb51063 | 82 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 106:ced8cbb51063 | 83 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 106:ced8cbb51063 | 84 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 106:ced8cbb51063 | 85 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 106:ced8cbb51063 | 86 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 76:aeb1df146756 | 87 | * |
mbed_official | 76:aeb1df146756 | 88 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 89 | */ |
mbed_official | 76:aeb1df146756 | 90 | |
mbed_official | 76:aeb1df146756 | 91 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 92 | #include "stm32l1xx_lcd.h" |
mbed_official | 76:aeb1df146756 | 93 | #include "stm32l1xx_rcc.h" |
mbed_official | 76:aeb1df146756 | 94 | |
mbed_official | 76:aeb1df146756 | 95 | /** @addtogroup STM32L1xx_StdPeriph_Driver |
mbed_official | 76:aeb1df146756 | 96 | * @{ |
mbed_official | 76:aeb1df146756 | 97 | */ |
mbed_official | 76:aeb1df146756 | 98 | |
mbed_official | 76:aeb1df146756 | 99 | /** @defgroup LCD |
mbed_official | 76:aeb1df146756 | 100 | * @brief LCD driver modules |
mbed_official | 76:aeb1df146756 | 101 | * @{ |
mbed_official | 76:aeb1df146756 | 102 | */ |
mbed_official | 76:aeb1df146756 | 103 | |
mbed_official | 76:aeb1df146756 | 104 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 105 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 106 | /* ------------ LCD registers bit address in the alias region --------------- */ |
mbed_official | 76:aeb1df146756 | 107 | #define LCD_OFFSET (LCD_BASE - PERIPH_BASE) |
mbed_official | 76:aeb1df146756 | 108 | |
mbed_official | 76:aeb1df146756 | 109 | /* --- CR Register ---*/ |
mbed_official | 76:aeb1df146756 | 110 | |
mbed_official | 76:aeb1df146756 | 111 | /* Alias word address of LCDEN bit */ |
mbed_official | 76:aeb1df146756 | 112 | #define CR_OFFSET (LCD_OFFSET + 0x00) |
mbed_official | 76:aeb1df146756 | 113 | #define LCDEN_BitNumber 0x00 |
mbed_official | 76:aeb1df146756 | 114 | #define CR_LCDEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (LCDEN_BitNumber * 4)) |
mbed_official | 76:aeb1df146756 | 115 | |
mbed_official | 76:aeb1df146756 | 116 | /* Alias word address of MUX_SEG bit */ |
mbed_official | 76:aeb1df146756 | 117 | #define MUX_SEG_BitNumber 0x07 |
mbed_official | 76:aeb1df146756 | 118 | #define CR_MUX_SEG_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (MUX_SEG_BitNumber * 4)) |
mbed_official | 76:aeb1df146756 | 119 | |
mbed_official | 76:aeb1df146756 | 120 | |
mbed_official | 76:aeb1df146756 | 121 | /* --- FCR Register ---*/ |
mbed_official | 76:aeb1df146756 | 122 | |
mbed_official | 76:aeb1df146756 | 123 | /* Alias word address of HD bit */ |
mbed_official | 76:aeb1df146756 | 124 | #define FCR_OFFSET (LCD_OFFSET + 0x04) |
mbed_official | 76:aeb1df146756 | 125 | #define HD_BitNumber 0x00 |
mbed_official | 76:aeb1df146756 | 126 | #define FCR_HD_BB (PERIPH_BB_BASE + (FCR_OFFSET * 32) + (HD_BitNumber * 4)) |
mbed_official | 76:aeb1df146756 | 127 | |
mbed_official | 76:aeb1df146756 | 128 | /* --- SR Register ---*/ |
mbed_official | 76:aeb1df146756 | 129 | |
mbed_official | 76:aeb1df146756 | 130 | /* Alias word address of UDR bit */ |
mbed_official | 76:aeb1df146756 | 131 | #define SR_OFFSET (LCD_OFFSET + 0x08) |
mbed_official | 76:aeb1df146756 | 132 | #define UDR_BitNumber 0x02 |
mbed_official | 76:aeb1df146756 | 133 | #define SR_UDR_BB (PERIPH_BB_BASE + (SR_OFFSET * 32) + (UDR_BitNumber * 4)) |
mbed_official | 76:aeb1df146756 | 134 | |
mbed_official | 76:aeb1df146756 | 135 | #define FCR_MASK ((uint32_t)0xFC03FFFF) /* LCD FCR Mask */ |
mbed_official | 76:aeb1df146756 | 136 | #define CR_MASK ((uint32_t)0xFFFFFF81) /* LCD CR Mask */ |
mbed_official | 76:aeb1df146756 | 137 | #define PON_MASK ((uint32_t)0xFFFFFF8F) /* LCD PON Mask */ |
mbed_official | 76:aeb1df146756 | 138 | #define DEAD_MASK ((uint32_t)0xFFFFFC7F) /* LCD DEAD Mask */ |
mbed_official | 76:aeb1df146756 | 139 | #define BLINK_MASK ((uint32_t)0xFFFC1FFF) /* LCD BLINK Mask */ |
mbed_official | 76:aeb1df146756 | 140 | #define CONTRAST_MASK ((uint32_t)0xFFFFE3FF) /* LCD CONTRAST Mask */ |
mbed_official | 76:aeb1df146756 | 141 | |
mbed_official | 80:66393a7b209d | 142 | #define SYNCHRO_TIMEOUT ((uint32_t) 0x00008000) |
mbed_official | 80:66393a7b209d | 143 | |
mbed_official | 76:aeb1df146756 | 144 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 145 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 146 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 147 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 148 | |
mbed_official | 76:aeb1df146756 | 149 | /** @defgroup LCD_Private_Functions |
mbed_official | 76:aeb1df146756 | 150 | * @{ |
mbed_official | 76:aeb1df146756 | 151 | */ |
mbed_official | 76:aeb1df146756 | 152 | |
mbed_official | 76:aeb1df146756 | 153 | /** @defgroup LCD_Group1 Initialization and Configuration functions |
mbed_official | 76:aeb1df146756 | 154 | * @brief Initialization and Configuration functions |
mbed_official | 76:aeb1df146756 | 155 | * |
mbed_official | 76:aeb1df146756 | 156 | @verbatim |
mbed_official | 76:aeb1df146756 | 157 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 158 | ##### Initialization and Configuration functions ##### |
mbed_official | 76:aeb1df146756 | 159 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 160 | |
mbed_official | 76:aeb1df146756 | 161 | @endverbatim |
mbed_official | 76:aeb1df146756 | 162 | * @{ |
mbed_official | 76:aeb1df146756 | 163 | */ |
mbed_official | 76:aeb1df146756 | 164 | |
mbed_official | 76:aeb1df146756 | 165 | /** |
mbed_official | 76:aeb1df146756 | 166 | * @brief Deinitializes the LCD peripheral registers to their default reset |
mbed_official | 76:aeb1df146756 | 167 | * values. |
mbed_official | 76:aeb1df146756 | 168 | * @param None |
mbed_official | 76:aeb1df146756 | 169 | * @retval None |
mbed_official | 76:aeb1df146756 | 170 | */ |
mbed_official | 76:aeb1df146756 | 171 | void LCD_DeInit(void) |
mbed_official | 76:aeb1df146756 | 172 | { |
mbed_official | 76:aeb1df146756 | 173 | /* Enable LCD reset state */ |
mbed_official | 76:aeb1df146756 | 174 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_LCD, ENABLE); |
mbed_official | 76:aeb1df146756 | 175 | /* Release LCD from reset state */ |
mbed_official | 76:aeb1df146756 | 176 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_LCD, DISABLE); |
mbed_official | 76:aeb1df146756 | 177 | } |
mbed_official | 76:aeb1df146756 | 178 | |
mbed_official | 76:aeb1df146756 | 179 | /** |
mbed_official | 76:aeb1df146756 | 180 | * @brief Initializes the LCD peripheral according to the specified parameters |
mbed_official | 76:aeb1df146756 | 181 | * in the LCD_InitStruct. |
mbed_official | 76:aeb1df146756 | 182 | * @note This function can be used only when the LCD is disabled. |
mbed_official | 76:aeb1df146756 | 183 | * @param LCD_InitStruct: pointer to a LCD_InitTypeDef structure that contains |
mbed_official | 76:aeb1df146756 | 184 | * the configuration information for the specified LCD peripheral. |
mbed_official | 76:aeb1df146756 | 185 | * @retval None |
mbed_official | 76:aeb1df146756 | 186 | */ |
mbed_official | 76:aeb1df146756 | 187 | void LCD_Init(LCD_InitTypeDef* LCD_InitStruct) |
mbed_official | 76:aeb1df146756 | 188 | { |
mbed_official | 76:aeb1df146756 | 189 | /* Check function parameters */ |
mbed_official | 76:aeb1df146756 | 190 | assert_param(IS_LCD_PRESCALER(LCD_InitStruct->LCD_Prescaler)); |
mbed_official | 76:aeb1df146756 | 191 | assert_param(IS_LCD_DIVIDER(LCD_InitStruct->LCD_Divider)); |
mbed_official | 76:aeb1df146756 | 192 | assert_param(IS_LCD_DUTY(LCD_InitStruct->LCD_Duty)); |
mbed_official | 76:aeb1df146756 | 193 | assert_param(IS_LCD_BIAS(LCD_InitStruct->LCD_Bias)); |
mbed_official | 76:aeb1df146756 | 194 | assert_param(IS_LCD_VOLTAGE_SOURCE(LCD_InitStruct->LCD_VoltageSource)); |
mbed_official | 76:aeb1df146756 | 195 | |
mbed_official | 76:aeb1df146756 | 196 | LCD->FCR &= (uint32_t)FCR_MASK; |
mbed_official | 76:aeb1df146756 | 197 | LCD->FCR |= (uint32_t)(LCD_InitStruct->LCD_Prescaler | LCD_InitStruct->LCD_Divider); |
mbed_official | 76:aeb1df146756 | 198 | |
mbed_official | 76:aeb1df146756 | 199 | LCD_WaitForSynchro(); |
mbed_official | 76:aeb1df146756 | 200 | |
mbed_official | 76:aeb1df146756 | 201 | LCD->CR &= (uint32_t)CR_MASK; |
mbed_official | 76:aeb1df146756 | 202 | LCD->CR |= (uint32_t)(LCD_InitStruct->LCD_Duty | LCD_InitStruct->LCD_Bias | \ |
mbed_official | 76:aeb1df146756 | 203 | LCD_InitStruct->LCD_VoltageSource); |
mbed_official | 76:aeb1df146756 | 204 | |
mbed_official | 76:aeb1df146756 | 205 | } |
mbed_official | 76:aeb1df146756 | 206 | |
mbed_official | 76:aeb1df146756 | 207 | /** |
mbed_official | 76:aeb1df146756 | 208 | * @brief Fills each LCD_InitStruct member with its default value. |
mbed_official | 76:aeb1df146756 | 209 | * @param LCD_InitStruct: pointer to a LCD_InitTypeDef structure which will |
mbed_official | 76:aeb1df146756 | 210 | * be initialized. |
mbed_official | 76:aeb1df146756 | 211 | * @retval None |
mbed_official | 76:aeb1df146756 | 212 | */ |
mbed_official | 76:aeb1df146756 | 213 | void LCD_StructInit(LCD_InitTypeDef* LCD_InitStruct) |
mbed_official | 76:aeb1df146756 | 214 | { |
mbed_official | 76:aeb1df146756 | 215 | /*--------------- Reset LCD init structure parameters values -----------------*/ |
mbed_official | 76:aeb1df146756 | 216 | LCD_InitStruct->LCD_Prescaler = LCD_Prescaler_1; /*!< Initialize the LCD_Prescaler member */ |
mbed_official | 76:aeb1df146756 | 217 | |
mbed_official | 76:aeb1df146756 | 218 | LCD_InitStruct->LCD_Divider = LCD_Divider_16; /*!< Initialize the LCD_Divider member */ |
mbed_official | 76:aeb1df146756 | 219 | |
mbed_official | 76:aeb1df146756 | 220 | LCD_InitStruct->LCD_Duty = LCD_Duty_Static; /*!< Initialize the LCD_Duty member */ |
mbed_official | 76:aeb1df146756 | 221 | |
mbed_official | 76:aeb1df146756 | 222 | LCD_InitStruct->LCD_Bias = LCD_Bias_1_4; /*!< Initialize the LCD_Bias member */ |
mbed_official | 76:aeb1df146756 | 223 | |
mbed_official | 76:aeb1df146756 | 224 | LCD_InitStruct->LCD_VoltageSource = LCD_VoltageSource_Internal; /*!< Initialize the LCD_VoltageSource member */ |
mbed_official | 76:aeb1df146756 | 225 | } |
mbed_official | 76:aeb1df146756 | 226 | |
mbed_official | 76:aeb1df146756 | 227 | /** |
mbed_official | 76:aeb1df146756 | 228 | * @brief Enables or disables the LCD Controller. |
mbed_official | 76:aeb1df146756 | 229 | * @param NewState: new state of the LCD peripheral. |
mbed_official | 76:aeb1df146756 | 230 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 76:aeb1df146756 | 231 | * @retval None |
mbed_official | 76:aeb1df146756 | 232 | */ |
mbed_official | 76:aeb1df146756 | 233 | void LCD_Cmd(FunctionalState NewState) |
mbed_official | 76:aeb1df146756 | 234 | { |
mbed_official | 76:aeb1df146756 | 235 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 76:aeb1df146756 | 236 | |
mbed_official | 76:aeb1df146756 | 237 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 238 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 76:aeb1df146756 | 239 | |
mbed_official | 76:aeb1df146756 | 240 | *(__IO uint32_t *) CR_LCDEN_BB = (uint32_t)NewState; |
mbed_official | 76:aeb1df146756 | 241 | } |
mbed_official | 76:aeb1df146756 | 242 | |
mbed_official | 76:aeb1df146756 | 243 | /** |
mbed_official | 76:aeb1df146756 | 244 | * @brief Waits until the LCD FCR register is synchronized in the LCDCLK domain. |
mbed_official | 76:aeb1df146756 | 245 | * This function must be called after any write operation to LCD_FCR register. |
mbed_official | 76:aeb1df146756 | 246 | * @param None |
mbed_official | 76:aeb1df146756 | 247 | * @retval None |
mbed_official | 76:aeb1df146756 | 248 | */ |
mbed_official | 76:aeb1df146756 | 249 | void LCD_WaitForSynchro(void) |
mbed_official | 76:aeb1df146756 | 250 | { |
mbed_official | 80:66393a7b209d | 251 | uint32_t synchrocounter = 0; |
mbed_official | 80:66393a7b209d | 252 | uint32_t synchrostatus = 0x00; |
mbed_official | 80:66393a7b209d | 253 | |
mbed_official | 76:aeb1df146756 | 254 | /* Loop until FCRSF flag is set */ |
mbed_official | 80:66393a7b209d | 255 | do |
mbed_official | 76:aeb1df146756 | 256 | { |
mbed_official | 80:66393a7b209d | 257 | synchrostatus = LCD->SR & LCD_FLAG_FCRSF; |
mbed_official | 80:66393a7b209d | 258 | synchrocounter++; |
mbed_official | 80:66393a7b209d | 259 | } while((synchrocounter != SYNCHRO_TIMEOUT) && (synchrostatus == 0x00)); |
mbed_official | 76:aeb1df146756 | 260 | } |
mbed_official | 76:aeb1df146756 | 261 | |
mbed_official | 76:aeb1df146756 | 262 | /** |
mbed_official | 76:aeb1df146756 | 263 | * @brief Enables or disables the low resistance divider. Displays with high |
mbed_official | 76:aeb1df146756 | 264 | * internal resistance may need a longer drive time to achieve |
mbed_official | 76:aeb1df146756 | 265 | * satisfactory contrast. This function is useful in this case if some |
mbed_official | 76:aeb1df146756 | 266 | * additional power consumption can be tolerated. |
mbed_official | 76:aeb1df146756 | 267 | * @note When this mode is enabled, the PulseOn Duration (PON) have to be |
mbed_official | 76:aeb1df146756 | 268 | * programmed to 1/CK_PS (LCD_PulseOnDuration_1). |
mbed_official | 76:aeb1df146756 | 269 | * @param NewState: new state of the low resistance divider. |
mbed_official | 76:aeb1df146756 | 270 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 76:aeb1df146756 | 271 | * @retval None |
mbed_official | 76:aeb1df146756 | 272 | */ |
mbed_official | 76:aeb1df146756 | 273 | void LCD_HighDriveCmd(FunctionalState NewState) |
mbed_official | 76:aeb1df146756 | 274 | { |
mbed_official | 76:aeb1df146756 | 275 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 276 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 76:aeb1df146756 | 277 | |
mbed_official | 76:aeb1df146756 | 278 | *(__IO uint32_t *) FCR_HD_BB = (uint32_t)NewState; |
mbed_official | 76:aeb1df146756 | 279 | } |
mbed_official | 76:aeb1df146756 | 280 | |
mbed_official | 76:aeb1df146756 | 281 | /** |
mbed_official | 76:aeb1df146756 | 282 | * @brief Enables or disables the Mux Segment. |
mbed_official | 76:aeb1df146756 | 283 | * @note This function can be used only when the LCD is disabled. |
mbed_official | 76:aeb1df146756 | 284 | * @param NewState: new state of the Mux Segment. |
mbed_official | 76:aeb1df146756 | 285 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 76:aeb1df146756 | 286 | * @retval None |
mbed_official | 76:aeb1df146756 | 287 | */ |
mbed_official | 76:aeb1df146756 | 288 | void LCD_MuxSegmentCmd(FunctionalState NewState) |
mbed_official | 76:aeb1df146756 | 289 | { |
mbed_official | 76:aeb1df146756 | 290 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 291 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 76:aeb1df146756 | 292 | |
mbed_official | 76:aeb1df146756 | 293 | *(__IO uint32_t *) CR_MUX_SEG_BB = (uint32_t)NewState; |
mbed_official | 76:aeb1df146756 | 294 | } |
mbed_official | 76:aeb1df146756 | 295 | |
mbed_official | 76:aeb1df146756 | 296 | /** |
mbed_official | 76:aeb1df146756 | 297 | * @brief Configures the LCD pulses on duration. |
mbed_official | 76:aeb1df146756 | 298 | * @param LCD_PulseOnDuration: specifies the LCD pulse on duration in terms of |
mbed_official | 76:aeb1df146756 | 299 | * CK_PS (prescaled LCD clock period) pulses. |
mbed_official | 76:aeb1df146756 | 300 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 301 | * @arg LCD_PulseOnDuration_0: 0 pulse |
mbed_official | 76:aeb1df146756 | 302 | * @arg LCD_PulseOnDuration_1: Pulse ON duration = 1/CK_PS |
mbed_official | 76:aeb1df146756 | 303 | * @arg LCD_PulseOnDuration_2: Pulse ON duration = 2/CK_PS |
mbed_official | 76:aeb1df146756 | 304 | * @arg LCD_PulseOnDuration_3: Pulse ON duration = 3/CK_PS |
mbed_official | 76:aeb1df146756 | 305 | * @arg LCD_PulseOnDuration_4: Pulse ON duration = 4/CK_PS |
mbed_official | 76:aeb1df146756 | 306 | * @arg LCD_PulseOnDuration_5: Pulse ON duration = 5/CK_PS |
mbed_official | 76:aeb1df146756 | 307 | * @arg LCD_PulseOnDuration_6: Pulse ON duration = 6/CK_PS |
mbed_official | 76:aeb1df146756 | 308 | * @arg LCD_PulseOnDuration_7: Pulse ON duration = 7/CK_PS |
mbed_official | 76:aeb1df146756 | 309 | * @retval None |
mbed_official | 76:aeb1df146756 | 310 | */ |
mbed_official | 76:aeb1df146756 | 311 | void LCD_PulseOnDurationConfig(uint32_t LCD_PulseOnDuration) |
mbed_official | 76:aeb1df146756 | 312 | { |
mbed_official | 76:aeb1df146756 | 313 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 314 | assert_param(IS_LCD_PULSE_ON_DURATION(LCD_PulseOnDuration)); |
mbed_official | 76:aeb1df146756 | 315 | |
mbed_official | 76:aeb1df146756 | 316 | LCD->FCR &= (uint32_t)PON_MASK; |
mbed_official | 76:aeb1df146756 | 317 | LCD->FCR |= (uint32_t)(LCD_PulseOnDuration); |
mbed_official | 76:aeb1df146756 | 318 | } |
mbed_official | 76:aeb1df146756 | 319 | |
mbed_official | 76:aeb1df146756 | 320 | /** |
mbed_official | 76:aeb1df146756 | 321 | * @brief Configures the LCD dead time. |
mbed_official | 76:aeb1df146756 | 322 | * @param LCD_DeadTime: specifies the LCD dead time. |
mbed_official | 76:aeb1df146756 | 323 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 324 | * @arg LCD_DeadTime_0: No dead Time |
mbed_official | 76:aeb1df146756 | 325 | * @arg LCD_DeadTime_1: One Phase between different couple of Frame |
mbed_official | 76:aeb1df146756 | 326 | * @arg LCD_DeadTime_2: Two Phase between different couple of Frame |
mbed_official | 76:aeb1df146756 | 327 | * @arg LCD_DeadTime_3: Three Phase between different couple of Frame |
mbed_official | 76:aeb1df146756 | 328 | * @arg LCD_DeadTime_4: Four Phase between different couple of Frame |
mbed_official | 76:aeb1df146756 | 329 | * @arg LCD_DeadTime_5: Five Phase between different couple of Frame |
mbed_official | 76:aeb1df146756 | 330 | * @arg LCD_DeadTime_6: Six Phase between different couple of Frame |
mbed_official | 76:aeb1df146756 | 331 | * @arg LCD_DeadTime_7: Seven Phase between different couple of Frame |
mbed_official | 76:aeb1df146756 | 332 | * @retval None |
mbed_official | 76:aeb1df146756 | 333 | */ |
mbed_official | 76:aeb1df146756 | 334 | void LCD_DeadTimeConfig(uint32_t LCD_DeadTime) |
mbed_official | 76:aeb1df146756 | 335 | { |
mbed_official | 76:aeb1df146756 | 336 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 337 | assert_param(IS_LCD_DEAD_TIME(LCD_DeadTime)); |
mbed_official | 76:aeb1df146756 | 338 | |
mbed_official | 76:aeb1df146756 | 339 | LCD->FCR &= (uint32_t)DEAD_MASK; |
mbed_official | 76:aeb1df146756 | 340 | LCD->FCR |= (uint32_t)(LCD_DeadTime); |
mbed_official | 76:aeb1df146756 | 341 | } |
mbed_official | 76:aeb1df146756 | 342 | |
mbed_official | 76:aeb1df146756 | 343 | /** |
mbed_official | 76:aeb1df146756 | 344 | * @brief Configures the LCD Blink mode and Blink frequency. |
mbed_official | 76:aeb1df146756 | 345 | * @param LCD_BlinkMode: specifies the LCD blink mode. |
mbed_official | 76:aeb1df146756 | 346 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 347 | * @arg LCD_BlinkMode_Off: Blink disabled |
mbed_official | 76:aeb1df146756 | 348 | * @arg LCD_BlinkMode_SEG0_COM0: Blink enabled on SEG[0], COM[0] (1 pixel) |
mbed_official | 76:aeb1df146756 | 349 | * @arg LCD_BlinkMode_SEG0_AllCOM: Blink enabled on SEG[0], all COM (up to 8 |
mbed_official | 76:aeb1df146756 | 350 | * pixels according to the programmed duty) |
mbed_official | 76:aeb1df146756 | 351 | * @arg LCD_BlinkMode_AllSEG_AllCOM: Blink enabled on all SEG and all COM |
mbed_official | 76:aeb1df146756 | 352 | * (all pixels) |
mbed_official | 76:aeb1df146756 | 353 | * @param LCD_BlinkFrequency: specifies the LCD blink frequency. |
mbed_official | 76:aeb1df146756 | 354 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 355 | * @arg LCD_BlinkFrequency_Div8: The Blink frequency = fLcd/8 |
mbed_official | 76:aeb1df146756 | 356 | * @arg LCD_BlinkFrequency_Div16: The Blink frequency = fLcd/16 |
mbed_official | 76:aeb1df146756 | 357 | * @arg LCD_BlinkFrequency_Div32: The Blink frequency = fLcd/32 |
mbed_official | 76:aeb1df146756 | 358 | * @arg LCD_BlinkFrequency_Div64: The Blink frequency = fLcd/64 |
mbed_official | 76:aeb1df146756 | 359 | * @arg LCD_BlinkFrequency_Div128: The Blink frequency = fLcd/128 |
mbed_official | 76:aeb1df146756 | 360 | * @arg LCD_BlinkFrequency_Div256: The Blink frequency = fLcd/256 |
mbed_official | 76:aeb1df146756 | 361 | * @arg LCD_BlinkFrequency_Div512: The Blink frequency = fLcd/512 |
mbed_official | 76:aeb1df146756 | 362 | * @arg LCD_BlinkFrequency_Div1024: The Blink frequency = fLcd/1024 |
mbed_official | 76:aeb1df146756 | 363 | * @retval None |
mbed_official | 76:aeb1df146756 | 364 | */ |
mbed_official | 76:aeb1df146756 | 365 | void LCD_BlinkConfig(uint32_t LCD_BlinkMode, uint32_t LCD_BlinkFrequency) |
mbed_official | 76:aeb1df146756 | 366 | { |
mbed_official | 76:aeb1df146756 | 367 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 368 | assert_param(IS_LCD_BLINK_MODE(LCD_BlinkMode)); |
mbed_official | 76:aeb1df146756 | 369 | assert_param(IS_LCD_BLINK_FREQUENCY(LCD_BlinkFrequency)); |
mbed_official | 76:aeb1df146756 | 370 | |
mbed_official | 76:aeb1df146756 | 371 | LCD->FCR &= (uint32_t)BLINK_MASK; |
mbed_official | 76:aeb1df146756 | 372 | LCD->FCR |= (uint32_t)(LCD_BlinkMode | LCD_BlinkFrequency); |
mbed_official | 76:aeb1df146756 | 373 | } |
mbed_official | 76:aeb1df146756 | 374 | |
mbed_official | 76:aeb1df146756 | 375 | /** |
mbed_official | 76:aeb1df146756 | 376 | * @brief Configures the LCD Contrast. |
mbed_official | 76:aeb1df146756 | 377 | * @param LCD_Contrast: specifies the LCD Contrast. |
mbed_official | 76:aeb1df146756 | 378 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 379 | * @arg LCD_Contrast_Level_0: Maximum Voltage = 2.60V |
mbed_official | 76:aeb1df146756 | 380 | * @arg LCD_Contrast_Level_1: Maximum Voltage = 2.73V |
mbed_official | 76:aeb1df146756 | 381 | * @arg LCD_Contrast_Level_2: Maximum Voltage = 2.86V |
mbed_official | 76:aeb1df146756 | 382 | * @arg LCD_Contrast_Level_3: Maximum Voltage = 2.99V |
mbed_official | 76:aeb1df146756 | 383 | * @arg LCD_Contrast_Level_4: Maximum Voltage = 3.12V |
mbed_official | 76:aeb1df146756 | 384 | * @arg LCD_Contrast_Level_5: Maximum Voltage = 3.25V |
mbed_official | 76:aeb1df146756 | 385 | * @arg LCD_Contrast_Level_6: Maximum Voltage = 3.38V |
mbed_official | 76:aeb1df146756 | 386 | * @arg LCD_Contrast_Level_7: Maximum Voltage = 3.51V |
mbed_official | 76:aeb1df146756 | 387 | * @retval None |
mbed_official | 76:aeb1df146756 | 388 | */ |
mbed_official | 76:aeb1df146756 | 389 | void LCD_ContrastConfig(uint32_t LCD_Contrast) |
mbed_official | 76:aeb1df146756 | 390 | { |
mbed_official | 76:aeb1df146756 | 391 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 392 | assert_param(IS_LCD_CONTRAST(LCD_Contrast)); |
mbed_official | 76:aeb1df146756 | 393 | |
mbed_official | 76:aeb1df146756 | 394 | LCD->FCR &= (uint32_t)CONTRAST_MASK; |
mbed_official | 76:aeb1df146756 | 395 | LCD->FCR |= (uint32_t)(LCD_Contrast); |
mbed_official | 76:aeb1df146756 | 396 | } |
mbed_official | 76:aeb1df146756 | 397 | |
mbed_official | 76:aeb1df146756 | 398 | /** |
mbed_official | 76:aeb1df146756 | 399 | * @} |
mbed_official | 76:aeb1df146756 | 400 | */ |
mbed_official | 76:aeb1df146756 | 401 | |
mbed_official | 76:aeb1df146756 | 402 | /** @defgroup LCD_Group2 LCD RAM memory write functions |
mbed_official | 76:aeb1df146756 | 403 | * @brief LCD RAM memory write functions |
mbed_official | 76:aeb1df146756 | 404 | * |
mbed_official | 76:aeb1df146756 | 405 | @verbatim |
mbed_official | 76:aeb1df146756 | 406 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 407 | ##### LCD RAM memory write functions ##### |
mbed_official | 76:aeb1df146756 | 408 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 409 | [..] Using its double buffer memory the LCD controller ensures the coherency |
mbed_official | 76:aeb1df146756 | 410 | of the displayed information without having to use interrupts to control |
mbed_official | 76:aeb1df146756 | 411 | LCD_RAM modification. |
mbed_official | 76:aeb1df146756 | 412 | |
mbed_official | 76:aeb1df146756 | 413 | [..] The application software can access the first buffer level (LCD_RAM) through |
mbed_official | 76:aeb1df146756 | 414 | the APB interface. Once it has modified the LCD_RAM, it sets the UDR flag |
mbed_official | 76:aeb1df146756 | 415 | in the LCD_SR register using the LCD_UpdateDisplayRequest() function. |
mbed_official | 76:aeb1df146756 | 416 | |
mbed_official | 76:aeb1df146756 | 417 | [..] This UDR flag (update display request) requests the updated information |
mbed_official | 76:aeb1df146756 | 418 | to be moved into the second buffer level (LCD_DISPLAY). |
mbed_official | 76:aeb1df146756 | 419 | |
mbed_official | 76:aeb1df146756 | 420 | [..] This operation is done synchronously with the frame (at the beginning of |
mbed_official | 76:aeb1df146756 | 421 | the next frame), until the update is completed, the LCD_RAM is write |
mbed_official | 76:aeb1df146756 | 422 | protected and the UDR flag stays high. |
mbed_official | 76:aeb1df146756 | 423 | |
mbed_official | 76:aeb1df146756 | 424 | [..] Once the update is completed another flag (UDD - Update Display Done) is |
mbed_official | 76:aeb1df146756 | 425 | set and generates an interrupt if the UDDIE bit in the LCD_FCR register |
mbed_official | 76:aeb1df146756 | 426 | is set. |
mbed_official | 76:aeb1df146756 | 427 | |
mbed_official | 76:aeb1df146756 | 428 | [..] The time it takes to update LCD_DISPLAY is, in the worst case, one odd |
mbed_official | 76:aeb1df146756 | 429 | and one even frame. |
mbed_official | 76:aeb1df146756 | 430 | |
mbed_official | 76:aeb1df146756 | 431 | [..] The update will not occur (UDR = 1 and UDD = 0) until the display is |
mbed_official | 76:aeb1df146756 | 432 | enabled (LCDEN = 1). |
mbed_official | 76:aeb1df146756 | 433 | |
mbed_official | 76:aeb1df146756 | 434 | @endverbatim |
mbed_official | 76:aeb1df146756 | 435 | * @{ |
mbed_official | 76:aeb1df146756 | 436 | */ |
mbed_official | 76:aeb1df146756 | 437 | |
mbed_official | 76:aeb1df146756 | 438 | /** |
mbed_official | 76:aeb1df146756 | 439 | * @brief Writes a word in the specific LCD RAM. |
mbed_official | 76:aeb1df146756 | 440 | * @param LCD_RAMRegister: specifies the LCD Contrast. |
mbed_official | 76:aeb1df146756 | 441 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 442 | * @arg LCD_RAMRegister_0: LCD RAM Register 0 |
mbed_official | 76:aeb1df146756 | 443 | * @arg LCD_RAMRegister_1: LCD RAM Register 1 |
mbed_official | 76:aeb1df146756 | 444 | * @arg LCD_RAMRegister_2: LCD RAM Register 2 |
mbed_official | 76:aeb1df146756 | 445 | * @arg LCD_RAMRegister_3: LCD RAM Register 3 |
mbed_official | 76:aeb1df146756 | 446 | * @arg LCD_RAMRegister_4: LCD RAM Register 4 |
mbed_official | 76:aeb1df146756 | 447 | * @arg LCD_RAMRegister_5: LCD RAM Register 5 |
mbed_official | 76:aeb1df146756 | 448 | * @arg LCD_RAMRegister_6: LCD RAM Register 6 |
mbed_official | 76:aeb1df146756 | 449 | * @arg LCD_RAMRegister_7: LCD RAM Register 7 |
mbed_official | 76:aeb1df146756 | 450 | * @arg LCD_RAMRegister_8: LCD RAM Register 8 |
mbed_official | 76:aeb1df146756 | 451 | * @arg LCD_RAMRegister_9: LCD RAM Register 9 |
mbed_official | 76:aeb1df146756 | 452 | * @arg LCD_RAMRegister_10: LCD RAM Register 10 |
mbed_official | 76:aeb1df146756 | 453 | * @arg LCD_RAMRegister_11: LCD RAM Register 11 |
mbed_official | 76:aeb1df146756 | 454 | * @arg LCD_RAMRegister_12: LCD RAM Register 12 |
mbed_official | 76:aeb1df146756 | 455 | * @arg LCD_RAMRegister_13: LCD RAM Register 13 |
mbed_official | 76:aeb1df146756 | 456 | * @arg LCD_RAMRegister_14: LCD RAM Register 14 |
mbed_official | 76:aeb1df146756 | 457 | * @arg LCD_RAMRegister_15: LCD RAM Register 15 |
mbed_official | 76:aeb1df146756 | 458 | * @param LCD_Data: specifies LCD Data Value to be written. |
mbed_official | 76:aeb1df146756 | 459 | * @retval None |
mbed_official | 76:aeb1df146756 | 460 | */ |
mbed_official | 76:aeb1df146756 | 461 | void LCD_Write(uint32_t LCD_RAMRegister, uint32_t LCD_Data) |
mbed_official | 76:aeb1df146756 | 462 | { |
mbed_official | 76:aeb1df146756 | 463 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 464 | assert_param(IS_LCD_RAM_REGISTER(LCD_RAMRegister)); |
mbed_official | 76:aeb1df146756 | 465 | |
mbed_official | 76:aeb1df146756 | 466 | /* Copy data bytes to RAM register */ |
mbed_official | 76:aeb1df146756 | 467 | LCD->RAM[LCD_RAMRegister] = (uint32_t)LCD_Data; |
mbed_official | 76:aeb1df146756 | 468 | } |
mbed_official | 76:aeb1df146756 | 469 | |
mbed_official | 76:aeb1df146756 | 470 | /** |
mbed_official | 76:aeb1df146756 | 471 | * @brief Enables the Update Display Request. |
mbed_official | 76:aeb1df146756 | 472 | * @note Each time software modifies the LCD_RAM it must set the UDR bit to |
mbed_official | 76:aeb1df146756 | 473 | * transfer the updated data to the second level buffer. |
mbed_official | 76:aeb1df146756 | 474 | * The UDR bit stays set until the end of the update and during this |
mbed_official | 76:aeb1df146756 | 475 | * time the LCD_RAM is write protected. |
mbed_official | 76:aeb1df146756 | 476 | * @note When the display is disabled, the update is performed for all |
mbed_official | 76:aeb1df146756 | 477 | * LCD_DISPLAY locations. |
mbed_official | 76:aeb1df146756 | 478 | * When the display is enabled, the update is performed only for locations |
mbed_official | 76:aeb1df146756 | 479 | * for which commons are active (depending on DUTY). For example if |
mbed_official | 76:aeb1df146756 | 480 | * DUTY = 1/2, only the LCD_DISPLAY of COM0 and COM1 will be updated. |
mbed_official | 76:aeb1df146756 | 481 | * @param None |
mbed_official | 76:aeb1df146756 | 482 | * @retval None |
mbed_official | 76:aeb1df146756 | 483 | */ |
mbed_official | 76:aeb1df146756 | 484 | void LCD_UpdateDisplayRequest(void) |
mbed_official | 76:aeb1df146756 | 485 | { |
mbed_official | 76:aeb1df146756 | 486 | *(__IO uint32_t *) SR_UDR_BB = (uint32_t)0x01; |
mbed_official | 76:aeb1df146756 | 487 | } |
mbed_official | 76:aeb1df146756 | 488 | |
mbed_official | 76:aeb1df146756 | 489 | /** |
mbed_official | 76:aeb1df146756 | 490 | * @} |
mbed_official | 76:aeb1df146756 | 491 | */ |
mbed_official | 76:aeb1df146756 | 492 | |
mbed_official | 76:aeb1df146756 | 493 | /** @defgroup LCD_Group3 Interrupts and flags management functions |
mbed_official | 76:aeb1df146756 | 494 | * @brief Interrupts and flags management functions |
mbed_official | 76:aeb1df146756 | 495 | * |
mbed_official | 76:aeb1df146756 | 496 | @verbatim |
mbed_official | 76:aeb1df146756 | 497 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 498 | ##### Interrupts and flags management functions ##### |
mbed_official | 76:aeb1df146756 | 499 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 500 | |
mbed_official | 76:aeb1df146756 | 501 | @endverbatim |
mbed_official | 76:aeb1df146756 | 502 | * @{ |
mbed_official | 76:aeb1df146756 | 503 | */ |
mbed_official | 76:aeb1df146756 | 504 | |
mbed_official | 76:aeb1df146756 | 505 | /** |
mbed_official | 76:aeb1df146756 | 506 | * @brief Enables or disables the specified LCD interrupts. |
mbed_official | 76:aeb1df146756 | 507 | * @param LCD_IT: specifies the LCD interrupts sources to be enabled or disabled. |
mbed_official | 76:aeb1df146756 | 508 | * This parameter can be any combination of the following values: |
mbed_official | 76:aeb1df146756 | 509 | * @arg LCD_IT_SOF: Start of Frame Interrupt |
mbed_official | 76:aeb1df146756 | 510 | * @arg LCD_IT_UDD: Update Display Done Interrupt |
mbed_official | 76:aeb1df146756 | 511 | * @param NewState: new state of the specified LCD interrupts. |
mbed_official | 76:aeb1df146756 | 512 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 76:aeb1df146756 | 513 | * @retval None |
mbed_official | 76:aeb1df146756 | 514 | */ |
mbed_official | 76:aeb1df146756 | 515 | void LCD_ITConfig(uint32_t LCD_IT, FunctionalState NewState) |
mbed_official | 76:aeb1df146756 | 516 | { |
mbed_official | 76:aeb1df146756 | 517 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 518 | assert_param(IS_LCD_IT(LCD_IT)); |
mbed_official | 76:aeb1df146756 | 519 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 76:aeb1df146756 | 520 | |
mbed_official | 76:aeb1df146756 | 521 | if (NewState != DISABLE) |
mbed_official | 76:aeb1df146756 | 522 | { |
mbed_official | 76:aeb1df146756 | 523 | LCD->FCR |= LCD_IT; |
mbed_official | 76:aeb1df146756 | 524 | } |
mbed_official | 76:aeb1df146756 | 525 | else |
mbed_official | 76:aeb1df146756 | 526 | { |
mbed_official | 76:aeb1df146756 | 527 | LCD->FCR &= (uint32_t)~LCD_IT; |
mbed_official | 76:aeb1df146756 | 528 | } |
mbed_official | 76:aeb1df146756 | 529 | } |
mbed_official | 76:aeb1df146756 | 530 | |
mbed_official | 76:aeb1df146756 | 531 | /** |
mbed_official | 76:aeb1df146756 | 532 | * @brief Checks whether the specified LCD flag is set or not. |
mbed_official | 76:aeb1df146756 | 533 | * @param LCD_FLAG: specifies the flag to check. |
mbed_official | 76:aeb1df146756 | 534 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 535 | * @arg LCD_FLAG_ENS: LCD Enabled flag. It indicates the LCD controller status. |
mbed_official | 76:aeb1df146756 | 536 | * @note The ENS bit is set immediately when the LCDEN bit in the LCD_CR |
mbed_official | 76:aeb1df146756 | 537 | * goes from 0 to 1. On deactivation it reflects the real status of |
mbed_official | 76:aeb1df146756 | 538 | * LCD so it becomes 0 at the end of the last displayed frame. |
mbed_official | 76:aeb1df146756 | 539 | * @arg LCD_FLAG_SOF: Start of Frame flag. This flag is set by hardware at |
mbed_official | 76:aeb1df146756 | 540 | * the beginning of a new frame, at the same time as the display data is |
mbed_official | 76:aeb1df146756 | 541 | * updated. |
mbed_official | 76:aeb1df146756 | 542 | * @arg LCD_FLAG_UDR: Update Display Request flag. |
mbed_official | 76:aeb1df146756 | 543 | * @arg LCD_FLAG_UDD: Update Display Done flag. |
mbed_official | 76:aeb1df146756 | 544 | * @arg LCD_FLAG_RDY: Step_up converter Ready flag. It indicates the status |
mbed_official | 76:aeb1df146756 | 545 | * of the step-up converter. |
mbed_official | 76:aeb1df146756 | 546 | * @arg LCD_FLAG_FCRSF: LCD Frame Control Register Synchronization Flag. |
mbed_official | 76:aeb1df146756 | 547 | * This flag is set by hardware each time the LCD_FCR register is updated |
mbed_official | 76:aeb1df146756 | 548 | * in the LCDCLK domain. |
mbed_official | 76:aeb1df146756 | 549 | * @retval The new state of LCD_FLAG (SET or RESET). |
mbed_official | 76:aeb1df146756 | 550 | */ |
mbed_official | 76:aeb1df146756 | 551 | FlagStatus LCD_GetFlagStatus(uint32_t LCD_FLAG) |
mbed_official | 76:aeb1df146756 | 552 | { |
mbed_official | 76:aeb1df146756 | 553 | FlagStatus bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 554 | |
mbed_official | 76:aeb1df146756 | 555 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 556 | assert_param(IS_LCD_GET_FLAG(LCD_FLAG)); |
mbed_official | 76:aeb1df146756 | 557 | |
mbed_official | 76:aeb1df146756 | 558 | if ((LCD->SR & LCD_FLAG) != (uint32_t)RESET) |
mbed_official | 76:aeb1df146756 | 559 | { |
mbed_official | 76:aeb1df146756 | 560 | bitstatus = SET; |
mbed_official | 76:aeb1df146756 | 561 | } |
mbed_official | 76:aeb1df146756 | 562 | else |
mbed_official | 76:aeb1df146756 | 563 | { |
mbed_official | 76:aeb1df146756 | 564 | bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 565 | } |
mbed_official | 76:aeb1df146756 | 566 | return bitstatus; |
mbed_official | 76:aeb1df146756 | 567 | } |
mbed_official | 76:aeb1df146756 | 568 | |
mbed_official | 76:aeb1df146756 | 569 | /** |
mbed_official | 76:aeb1df146756 | 570 | * @brief Clears the LCD's pending flags. |
mbed_official | 76:aeb1df146756 | 571 | * @param LCD_FLAG: specifies the flag to clear. |
mbed_official | 76:aeb1df146756 | 572 | * This parameter can be any combination of the following values: |
mbed_official | 76:aeb1df146756 | 573 | * @arg LCD_FLAG_SOF: Start of Frame Interrupt |
mbed_official | 76:aeb1df146756 | 574 | * @arg LCD_FLAG_UDD: Update Display Done Interrupt |
mbed_official | 76:aeb1df146756 | 575 | * @retval None |
mbed_official | 76:aeb1df146756 | 576 | */ |
mbed_official | 76:aeb1df146756 | 577 | void LCD_ClearFlag(uint32_t LCD_FLAG) |
mbed_official | 76:aeb1df146756 | 578 | { |
mbed_official | 76:aeb1df146756 | 579 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 580 | assert_param(IS_LCD_CLEAR_FLAG(LCD_FLAG)); |
mbed_official | 76:aeb1df146756 | 581 | |
mbed_official | 76:aeb1df146756 | 582 | /* Clear the corresponding LCD flag */ |
mbed_official | 76:aeb1df146756 | 583 | LCD->CLR = (uint32_t)LCD_FLAG; |
mbed_official | 76:aeb1df146756 | 584 | } |
mbed_official | 76:aeb1df146756 | 585 | |
mbed_official | 76:aeb1df146756 | 586 | /** |
mbed_official | 76:aeb1df146756 | 587 | * @brief Checks whether the specified RTC interrupt has occurred or not. |
mbed_official | 76:aeb1df146756 | 588 | * @param LCD_IT: specifies the LCD interrupts sources to check. |
mbed_official | 76:aeb1df146756 | 589 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 590 | * @arg LCD_IT_SOF: Start of Frame Interrupt |
mbed_official | 76:aeb1df146756 | 591 | * @arg LCD_IT_UDD: Update Display Done Interrupt. |
mbed_official | 76:aeb1df146756 | 592 | * @note If the device is in STOP mode (PCLK not provided) UDD will not |
mbed_official | 76:aeb1df146756 | 593 | * generate an interrupt even if UDDIE = 1. |
mbed_official | 76:aeb1df146756 | 594 | * If the display is not enabled the UDD interrupt will never occur. |
mbed_official | 76:aeb1df146756 | 595 | * @retval The new state of the LCD_IT (SET or RESET). |
mbed_official | 76:aeb1df146756 | 596 | */ |
mbed_official | 76:aeb1df146756 | 597 | ITStatus LCD_GetITStatus(uint32_t LCD_IT) |
mbed_official | 76:aeb1df146756 | 598 | { |
mbed_official | 76:aeb1df146756 | 599 | ITStatus bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 600 | |
mbed_official | 76:aeb1df146756 | 601 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 602 | assert_param(IS_LCD_GET_IT(LCD_IT)); |
mbed_official | 76:aeb1df146756 | 603 | |
mbed_official | 76:aeb1df146756 | 604 | if ((LCD->SR & LCD_IT) != (uint16_t)RESET) |
mbed_official | 76:aeb1df146756 | 605 | { |
mbed_official | 76:aeb1df146756 | 606 | bitstatus = SET; |
mbed_official | 76:aeb1df146756 | 607 | } |
mbed_official | 76:aeb1df146756 | 608 | else |
mbed_official | 76:aeb1df146756 | 609 | { |
mbed_official | 76:aeb1df146756 | 610 | bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 611 | } |
mbed_official | 76:aeb1df146756 | 612 | |
mbed_official | 76:aeb1df146756 | 613 | if (((LCD->FCR & LCD_IT) != (uint16_t)RESET) && (bitstatus != (uint32_t)RESET)) |
mbed_official | 76:aeb1df146756 | 614 | { |
mbed_official | 76:aeb1df146756 | 615 | bitstatus = SET; |
mbed_official | 76:aeb1df146756 | 616 | } |
mbed_official | 76:aeb1df146756 | 617 | else |
mbed_official | 76:aeb1df146756 | 618 | { |
mbed_official | 76:aeb1df146756 | 619 | bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 620 | } |
mbed_official | 76:aeb1df146756 | 621 | return bitstatus; |
mbed_official | 76:aeb1df146756 | 622 | } |
mbed_official | 76:aeb1df146756 | 623 | |
mbed_official | 76:aeb1df146756 | 624 | /** |
mbed_official | 76:aeb1df146756 | 625 | * @brief Clears the LCD's interrupt pending bits. |
mbed_official | 76:aeb1df146756 | 626 | * @param LCD_IT: specifies the interrupt pending bit to clear. |
mbed_official | 76:aeb1df146756 | 627 | * This parameter can be any combination of the following values: |
mbed_official | 76:aeb1df146756 | 628 | * @arg LCD_IT_SOF: Start of Frame Interrupt |
mbed_official | 76:aeb1df146756 | 629 | * @arg LCD_IT_UDD: Update Display Done Interrupt |
mbed_official | 76:aeb1df146756 | 630 | * @retval None |
mbed_official | 76:aeb1df146756 | 631 | */ |
mbed_official | 76:aeb1df146756 | 632 | void LCD_ClearITPendingBit(uint32_t LCD_IT) |
mbed_official | 76:aeb1df146756 | 633 | { |
mbed_official | 76:aeb1df146756 | 634 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 635 | assert_param(IS_LCD_IT(LCD_IT)); |
mbed_official | 76:aeb1df146756 | 636 | |
mbed_official | 76:aeb1df146756 | 637 | /* Clear the corresponding LCD pending bit */ |
mbed_official | 76:aeb1df146756 | 638 | LCD->CLR = (uint32_t)LCD_IT; |
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 | */ |
mbed_official | 76:aeb1df146756 | 648 | |
mbed_official | 76:aeb1df146756 | 649 | /** |
mbed_official | 76:aeb1df146756 | 650 | * @} |
mbed_official | 76:aeb1df146756 | 651 | */ |
mbed_official | 76:aeb1df146756 | 652 | |
mbed_official | 76:aeb1df146756 | 653 | /** |
mbed_official | 76:aeb1df146756 | 654 | * @} |
mbed_official | 76:aeb1df146756 | 655 | */ |
mbed_official | 76:aeb1df146756 | 656 | |
mbed_official | 76:aeb1df146756 | 657 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |