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