mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F030R8/stm32f0xx_iwdg.c@106:ced8cbb51063, 2014-02-26 (annotated)
- Committer:
- mbed_official
- Date:
- Wed Feb 26 09:45:12 2014 +0000
- Revision:
- 106:ced8cbb51063
- Parent:
- 76:aeb1df146756
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 stm32f0xx_iwdg.c |
mbed_official | 76:aeb1df146756 | 4 | * @author MCD Application Team |
mbed_official | 76:aeb1df146756 | 5 | * @version V1.3.0 |
mbed_official | 76:aeb1df146756 | 6 | * @date 16-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 Independent watchdog (IWDG) peripheral: |
mbed_official | 76:aeb1df146756 | 9 | * + Prescaler and Counter configuration |
mbed_official | 76:aeb1df146756 | 10 | * + IWDG activation |
mbed_official | 76:aeb1df146756 | 11 | * + Flag 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 | ##### IWDG features ##### |
mbed_official | 76:aeb1df146756 | 17 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 18 | [..] The IWDG can be started by either software or hardware (configurable |
mbed_official | 76:aeb1df146756 | 19 | through option byte). |
mbed_official | 76:aeb1df146756 | 20 | |
mbed_official | 76:aeb1df146756 | 21 | [..] The IWDG is clocked by its own dedicated low-speed clock (LSI) and |
mbed_official | 76:aeb1df146756 | 22 | thus stays active even if the main clock fails. |
mbed_official | 76:aeb1df146756 | 23 | Once the IWDG is started, the LSI is forced ON and cannot be disabled |
mbed_official | 76:aeb1df146756 | 24 | (LSI cannot be disabled too), and the counter starts counting down from |
mbed_official | 76:aeb1df146756 | 25 | the reset value of 0xFFF. When it reaches the end of count value (0x000) |
mbed_official | 76:aeb1df146756 | 26 | a system reset is generated. |
mbed_official | 76:aeb1df146756 | 27 | The IWDG counter should be reloaded at regular intervals to prevent |
mbed_official | 76:aeb1df146756 | 28 | an MCU reset. |
mbed_official | 76:aeb1df146756 | 29 | |
mbed_official | 76:aeb1df146756 | 30 | [..] The IWDG is implemented in the VDD voltage domain that is still functional |
mbed_official | 76:aeb1df146756 | 31 | in STOP and STANDBY mode (IWDG reset can wake-up from STANDBY). |
mbed_official | 76:aeb1df146756 | 32 | |
mbed_official | 76:aeb1df146756 | 33 | [..] IWDGRST flag in RCC_CSR register can be used to inform when a IWDG |
mbed_official | 76:aeb1df146756 | 34 | reset occurs. |
mbed_official | 76:aeb1df146756 | 35 | |
mbed_official | 76:aeb1df146756 | 36 | [..] Min-max timeout value @40KHz (LSI): ~0.1ms / ~28.3s |
mbed_official | 76:aeb1df146756 | 37 | The IWDG timeout may vary due to LSI frequency dispersion. STM32F0xx |
mbed_official | 76:aeb1df146756 | 38 | devices provide the capability to measure the LSI frequency (LSI clock |
mbed_official | 76:aeb1df146756 | 39 | should be seleted as RTC clock which is internally connected to TIM10 CH1 |
mbed_official | 76:aeb1df146756 | 40 | input capture). The measured value can be used to have an IWDG timeout with |
mbed_official | 76:aeb1df146756 | 41 | an acceptable accuracy. |
mbed_official | 76:aeb1df146756 | 42 | For more information, please refer to the STM32F0xx Reference manual. |
mbed_official | 76:aeb1df146756 | 43 | |
mbed_official | 76:aeb1df146756 | 44 | ##### How to use this driver ##### |
mbed_official | 76:aeb1df146756 | 45 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 46 | [..] This driver allows to use IWDG peripheral with either window option enabled |
mbed_official | 76:aeb1df146756 | 47 | or disabled. To do so follow one of the two procedures below. |
mbed_official | 76:aeb1df146756 | 48 | (#) Window option is enabled: |
mbed_official | 76:aeb1df146756 | 49 | (++) Start the IWDG using IWDG_Enable() function, when the IWDG is used |
mbed_official | 76:aeb1df146756 | 50 | in software mode (no need to enable the LSI, it will be enabled |
mbed_official | 76:aeb1df146756 | 51 | by hardware). |
mbed_official | 76:aeb1df146756 | 52 | (++) Enable write access to IWDG_PR and IWDG_RLR registers using |
mbed_official | 76:aeb1df146756 | 53 | IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable) function. |
mbed_official | 76:aeb1df146756 | 54 | (++) Configure the IWDG prescaler using IWDG_SetPrescaler() function. |
mbed_official | 76:aeb1df146756 | 55 | (++) Configure the IWDG counter value using IWDG_SetReload() function. |
mbed_official | 76:aeb1df146756 | 56 | This value will be loaded in the IWDG counter each time the counter |
mbed_official | 76:aeb1df146756 | 57 | is reloaded, then the IWDG will start counting down from this value. |
mbed_official | 76:aeb1df146756 | 58 | (++) Wait for the IWDG registers to be updated using IWDG_GetFlagStatus() function. |
mbed_official | 76:aeb1df146756 | 59 | (++) Configure the IWDG refresh window using IWDG_SetWindowValue() function. |
mbed_official | 76:aeb1df146756 | 60 | |
mbed_official | 76:aeb1df146756 | 61 | (#) Window option is disabled: |
mbed_official | 76:aeb1df146756 | 62 | (++) Enable write access to IWDG_PR and IWDG_RLR registers using |
mbed_official | 76:aeb1df146756 | 63 | IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable) function. |
mbed_official | 76:aeb1df146756 | 64 | (++) Configure the IWDG prescaler using IWDG_SetPrescaler() function. |
mbed_official | 76:aeb1df146756 | 65 | (++) Configure the IWDG counter value using IWDG_SetReload() function. |
mbed_official | 76:aeb1df146756 | 66 | This value will be loaded in the IWDG counter each time the counter |
mbed_official | 76:aeb1df146756 | 67 | is reloaded, then the IWDG will start counting down from this value. |
mbed_official | 76:aeb1df146756 | 68 | (++) Wait for the IWDG registers to be updated using IWDG_GetFlagStatus() function. |
mbed_official | 76:aeb1df146756 | 69 | (++) reload the IWDG counter at regular intervals during normal operation |
mbed_official | 76:aeb1df146756 | 70 | to prevent an MCU reset, using IWDG_ReloadCounter() function. |
mbed_official | 76:aeb1df146756 | 71 | (++) Start the IWDG using IWDG_Enable() function, when the IWDG is used |
mbed_official | 76:aeb1df146756 | 72 | in software mode (no need to enable the LSI, it will be enabled |
mbed_official | 76:aeb1df146756 | 73 | by hardware). |
mbed_official | 76:aeb1df146756 | 74 | |
mbed_official | 76:aeb1df146756 | 75 | @endverbatim |
mbed_official | 76:aeb1df146756 | 76 | * |
mbed_official | 76:aeb1df146756 | 77 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 78 | * @attention |
mbed_official | 76:aeb1df146756 | 79 | * |
mbed_official | 106:ced8cbb51063 | 80 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 76:aeb1df146756 | 81 | * |
mbed_official | 106:ced8cbb51063 | 82 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 106:ced8cbb51063 | 83 | * are permitted provided that the following conditions are met: |
mbed_official | 106:ced8cbb51063 | 84 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 106:ced8cbb51063 | 85 | * this list of conditions and the following disclaimer. |
mbed_official | 106:ced8cbb51063 | 86 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 106:ced8cbb51063 | 87 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 106:ced8cbb51063 | 88 | * and/or other materials provided with the distribution. |
mbed_official | 106:ced8cbb51063 | 89 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 106:ced8cbb51063 | 90 | * may be used to endorse or promote products derived from this software |
mbed_official | 106:ced8cbb51063 | 91 | * without specific prior written permission. |
mbed_official | 76:aeb1df146756 | 92 | * |
mbed_official | 106:ced8cbb51063 | 93 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 106:ced8cbb51063 | 94 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 106:ced8cbb51063 | 95 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 106:ced8cbb51063 | 96 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 106:ced8cbb51063 | 97 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 106:ced8cbb51063 | 98 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 106:ced8cbb51063 | 99 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 106:ced8cbb51063 | 100 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 106:ced8cbb51063 | 101 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 106:ced8cbb51063 | 102 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 76:aeb1df146756 | 103 | * |
mbed_official | 76:aeb1df146756 | 104 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 105 | */ |
mbed_official | 76:aeb1df146756 | 106 | |
mbed_official | 76:aeb1df146756 | 107 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 108 | #include "stm32f0xx_iwdg.h" |
mbed_official | 76:aeb1df146756 | 109 | |
mbed_official | 76:aeb1df146756 | 110 | /** @addtogroup STM32F0xx_StdPeriph_Driver |
mbed_official | 76:aeb1df146756 | 111 | * @{ |
mbed_official | 76:aeb1df146756 | 112 | */ |
mbed_official | 76:aeb1df146756 | 113 | |
mbed_official | 76:aeb1df146756 | 114 | /** @defgroup IWDG |
mbed_official | 76:aeb1df146756 | 115 | * @brief IWDG driver modules |
mbed_official | 76:aeb1df146756 | 116 | * @{ |
mbed_official | 76:aeb1df146756 | 117 | */ |
mbed_official | 76:aeb1df146756 | 118 | |
mbed_official | 76:aeb1df146756 | 119 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 120 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 121 | /* ---------------------- IWDG registers bit mask ----------------------------*/ |
mbed_official | 76:aeb1df146756 | 122 | /* KR register bit mask */ |
mbed_official | 76:aeb1df146756 | 123 | #define KR_KEY_RELOAD ((uint16_t)0xAAAA) |
mbed_official | 76:aeb1df146756 | 124 | #define KR_KEY_ENABLE ((uint16_t)0xCCCC) |
mbed_official | 76:aeb1df146756 | 125 | |
mbed_official | 76:aeb1df146756 | 126 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 127 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 128 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 129 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 130 | |
mbed_official | 76:aeb1df146756 | 131 | /** @defgroup IWDG_Private_Functions |
mbed_official | 76:aeb1df146756 | 132 | * @{ |
mbed_official | 76:aeb1df146756 | 133 | */ |
mbed_official | 76:aeb1df146756 | 134 | |
mbed_official | 76:aeb1df146756 | 135 | /** @defgroup IWDG_Group1 Prescaler and Counter configuration functions |
mbed_official | 76:aeb1df146756 | 136 | * @brief Prescaler and Counter configuration functions |
mbed_official | 76:aeb1df146756 | 137 | * |
mbed_official | 76:aeb1df146756 | 138 | @verbatim |
mbed_official | 76:aeb1df146756 | 139 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 140 | ##### Prescaler and Counter configuration functions ##### |
mbed_official | 76:aeb1df146756 | 141 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 142 | |
mbed_official | 76:aeb1df146756 | 143 | @endverbatim |
mbed_official | 76:aeb1df146756 | 144 | * @{ |
mbed_official | 76:aeb1df146756 | 145 | */ |
mbed_official | 76:aeb1df146756 | 146 | |
mbed_official | 76:aeb1df146756 | 147 | /** |
mbed_official | 76:aeb1df146756 | 148 | * @brief Enables or disables write access to IWDG_PR and IWDG_RLR registers. |
mbed_official | 76:aeb1df146756 | 149 | * @param IWDG_WriteAccess: new state of write access to IWDG_PR and IWDG_RLR registers. |
mbed_official | 76:aeb1df146756 | 150 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 151 | * @arg IWDG_WriteAccess_Enable: Enable write access to IWDG_PR and IWDG_RLR registers |
mbed_official | 76:aeb1df146756 | 152 | * @arg IWDG_WriteAccess_Disable: Disable write access to IWDG_PR and IWDG_RLR registers |
mbed_official | 76:aeb1df146756 | 153 | * @retval None |
mbed_official | 76:aeb1df146756 | 154 | */ |
mbed_official | 76:aeb1df146756 | 155 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess) |
mbed_official | 76:aeb1df146756 | 156 | { |
mbed_official | 76:aeb1df146756 | 157 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 158 | assert_param(IS_IWDG_WRITE_ACCESS(IWDG_WriteAccess)); |
mbed_official | 76:aeb1df146756 | 159 | IWDG->KR = IWDG_WriteAccess; |
mbed_official | 76:aeb1df146756 | 160 | } |
mbed_official | 76:aeb1df146756 | 161 | |
mbed_official | 76:aeb1df146756 | 162 | /** |
mbed_official | 76:aeb1df146756 | 163 | * @brief Sets IWDG Prescaler value. |
mbed_official | 76:aeb1df146756 | 164 | * @param IWDG_Prescaler: specifies the IWDG Prescaler value. |
mbed_official | 76:aeb1df146756 | 165 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 166 | * @arg IWDG_Prescaler_4: IWDG prescaler set to 4 |
mbed_official | 76:aeb1df146756 | 167 | * @arg IWDG_Prescaler_8: IWDG prescaler set to 8 |
mbed_official | 76:aeb1df146756 | 168 | * @arg IWDG_Prescaler_16: IWDG prescaler set to 16 |
mbed_official | 76:aeb1df146756 | 169 | * @arg IWDG_Prescaler_32: IWDG prescaler set to 32 |
mbed_official | 76:aeb1df146756 | 170 | * @arg IWDG_Prescaler_64: IWDG prescaler set to 64 |
mbed_official | 76:aeb1df146756 | 171 | * @arg IWDG_Prescaler_128: IWDG prescaler set to 128 |
mbed_official | 76:aeb1df146756 | 172 | * @arg IWDG_Prescaler_256: IWDG prescaler set to 256 |
mbed_official | 76:aeb1df146756 | 173 | * @retval None |
mbed_official | 76:aeb1df146756 | 174 | */ |
mbed_official | 76:aeb1df146756 | 175 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler) |
mbed_official | 76:aeb1df146756 | 176 | { |
mbed_official | 76:aeb1df146756 | 177 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 178 | assert_param(IS_IWDG_PRESCALER(IWDG_Prescaler)); |
mbed_official | 76:aeb1df146756 | 179 | IWDG->PR = IWDG_Prescaler; |
mbed_official | 76:aeb1df146756 | 180 | } |
mbed_official | 76:aeb1df146756 | 181 | |
mbed_official | 76:aeb1df146756 | 182 | /** |
mbed_official | 76:aeb1df146756 | 183 | * @brief Sets IWDG Reload value. |
mbed_official | 76:aeb1df146756 | 184 | * @param Reload: specifies the IWDG Reload value. |
mbed_official | 76:aeb1df146756 | 185 | * This parameter must be a number between 0 and 0x0FFF. |
mbed_official | 76:aeb1df146756 | 186 | * @retval None |
mbed_official | 76:aeb1df146756 | 187 | */ |
mbed_official | 76:aeb1df146756 | 188 | void IWDG_SetReload(uint16_t Reload) |
mbed_official | 76:aeb1df146756 | 189 | { |
mbed_official | 76:aeb1df146756 | 190 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 191 | assert_param(IS_IWDG_RELOAD(Reload)); |
mbed_official | 76:aeb1df146756 | 192 | IWDG->RLR = Reload; |
mbed_official | 76:aeb1df146756 | 193 | } |
mbed_official | 76:aeb1df146756 | 194 | |
mbed_official | 76:aeb1df146756 | 195 | /** |
mbed_official | 76:aeb1df146756 | 196 | * @brief Reloads IWDG counter with value defined in the reload register |
mbed_official | 76:aeb1df146756 | 197 | * (write access to IWDG_PR and IWDG_RLR registers disabled). |
mbed_official | 76:aeb1df146756 | 198 | * @param None |
mbed_official | 76:aeb1df146756 | 199 | * @retval None |
mbed_official | 76:aeb1df146756 | 200 | */ |
mbed_official | 76:aeb1df146756 | 201 | void IWDG_ReloadCounter(void) |
mbed_official | 76:aeb1df146756 | 202 | { |
mbed_official | 76:aeb1df146756 | 203 | IWDG->KR = KR_KEY_RELOAD; |
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 Sets the IWDG window value. |
mbed_official | 76:aeb1df146756 | 209 | * @param WindowValue: specifies the window value to be compared to the downcounter. |
mbed_official | 76:aeb1df146756 | 210 | * @retval None |
mbed_official | 76:aeb1df146756 | 211 | */ |
mbed_official | 76:aeb1df146756 | 212 | void IWDG_SetWindowValue(uint16_t WindowValue) |
mbed_official | 76:aeb1df146756 | 213 | { |
mbed_official | 76:aeb1df146756 | 214 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 215 | assert_param(IS_IWDG_WINDOW_VALUE(WindowValue)); |
mbed_official | 76:aeb1df146756 | 216 | IWDG->WINR = WindowValue; |
mbed_official | 76:aeb1df146756 | 217 | } |
mbed_official | 76:aeb1df146756 | 218 | |
mbed_official | 76:aeb1df146756 | 219 | /** |
mbed_official | 76:aeb1df146756 | 220 | * @} |
mbed_official | 76:aeb1df146756 | 221 | */ |
mbed_official | 76:aeb1df146756 | 222 | |
mbed_official | 76:aeb1df146756 | 223 | /** @defgroup IWDG_Group2 IWDG activation function |
mbed_official | 76:aeb1df146756 | 224 | * @brief IWDG activation function |
mbed_official | 76:aeb1df146756 | 225 | * |
mbed_official | 76:aeb1df146756 | 226 | @verbatim |
mbed_official | 76:aeb1df146756 | 227 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 228 | ##### IWDG activation function ##### |
mbed_official | 76:aeb1df146756 | 229 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 230 | |
mbed_official | 76:aeb1df146756 | 231 | @endverbatim |
mbed_official | 76:aeb1df146756 | 232 | * @{ |
mbed_official | 76:aeb1df146756 | 233 | */ |
mbed_official | 76:aeb1df146756 | 234 | |
mbed_official | 76:aeb1df146756 | 235 | /** |
mbed_official | 76:aeb1df146756 | 236 | * @brief Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled). |
mbed_official | 76:aeb1df146756 | 237 | * @param None |
mbed_official | 76:aeb1df146756 | 238 | * @retval None |
mbed_official | 76:aeb1df146756 | 239 | */ |
mbed_official | 76:aeb1df146756 | 240 | void IWDG_Enable(void) |
mbed_official | 76:aeb1df146756 | 241 | { |
mbed_official | 76:aeb1df146756 | 242 | IWDG->KR = KR_KEY_ENABLE; |
mbed_official | 76:aeb1df146756 | 243 | } |
mbed_official | 76:aeb1df146756 | 244 | |
mbed_official | 76:aeb1df146756 | 245 | /** |
mbed_official | 76:aeb1df146756 | 246 | * @} |
mbed_official | 76:aeb1df146756 | 247 | */ |
mbed_official | 76:aeb1df146756 | 248 | |
mbed_official | 76:aeb1df146756 | 249 | /** @defgroup IWDG_Group3 Flag management function |
mbed_official | 76:aeb1df146756 | 250 | * @brief Flag management function |
mbed_official | 76:aeb1df146756 | 251 | * |
mbed_official | 76:aeb1df146756 | 252 | @verbatim |
mbed_official | 76:aeb1df146756 | 253 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 254 | ##### Flag management function ##### |
mbed_official | 76:aeb1df146756 | 255 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 256 | |
mbed_official | 76:aeb1df146756 | 257 | @endverbatim |
mbed_official | 76:aeb1df146756 | 258 | * @{ |
mbed_official | 76:aeb1df146756 | 259 | */ |
mbed_official | 76:aeb1df146756 | 260 | |
mbed_official | 76:aeb1df146756 | 261 | /** |
mbed_official | 76:aeb1df146756 | 262 | * @brief Checks whether the specified IWDG flag is set or not. |
mbed_official | 76:aeb1df146756 | 263 | * @param IWDG_FLAG: specifies the flag to check. |
mbed_official | 76:aeb1df146756 | 264 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 265 | * @arg IWDG_FLAG_PVU: Prescaler Value Update on going |
mbed_official | 76:aeb1df146756 | 266 | * @arg IWDG_FLAG_RVU: Reload Value Update on going |
mbed_official | 76:aeb1df146756 | 267 | * @arg IWDG_FLAG_WVU: Counter Window Value Update on going |
mbed_official | 76:aeb1df146756 | 268 | * @retval The new state of IWDG_FLAG (SET or RESET). |
mbed_official | 76:aeb1df146756 | 269 | */ |
mbed_official | 76:aeb1df146756 | 270 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG) |
mbed_official | 76:aeb1df146756 | 271 | { |
mbed_official | 76:aeb1df146756 | 272 | FlagStatus bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 273 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 274 | assert_param(IS_IWDG_FLAG(IWDG_FLAG)); |
mbed_official | 76:aeb1df146756 | 275 | if ((IWDG->SR & IWDG_FLAG) != (uint32_t)RESET) |
mbed_official | 76:aeb1df146756 | 276 | { |
mbed_official | 76:aeb1df146756 | 277 | bitstatus = SET; |
mbed_official | 76:aeb1df146756 | 278 | } |
mbed_official | 76:aeb1df146756 | 279 | else |
mbed_official | 76:aeb1df146756 | 280 | { |
mbed_official | 76:aeb1df146756 | 281 | bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 282 | } |
mbed_official | 76:aeb1df146756 | 283 | /* Return the flag status */ |
mbed_official | 76:aeb1df146756 | 284 | return bitstatus; |
mbed_official | 76:aeb1df146756 | 285 | } |
mbed_official | 76:aeb1df146756 | 286 | |
mbed_official | 76:aeb1df146756 | 287 | /** |
mbed_official | 76:aeb1df146756 | 288 | * @} |
mbed_official | 76:aeb1df146756 | 289 | */ |
mbed_official | 76:aeb1df146756 | 290 | |
mbed_official | 76:aeb1df146756 | 291 | /** |
mbed_official | 76:aeb1df146756 | 292 | * @} |
mbed_official | 76:aeb1df146756 | 293 | */ |
mbed_official | 76:aeb1df146756 | 294 | |
mbed_official | 76:aeb1df146756 | 295 | /** |
mbed_official | 76:aeb1df146756 | 296 | * @} |
mbed_official | 76:aeb1df146756 | 297 | */ |
mbed_official | 76:aeb1df146756 | 298 | |
mbed_official | 76:aeb1df146756 | 299 | /** |
mbed_official | 76:aeb1df146756 | 300 | * @} |
mbed_official | 76:aeb1df146756 | 301 | */ |
mbed_official | 76:aeb1df146756 | 302 | |
mbed_official | 76:aeb1df146756 | 303 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |