mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_L152RE/stm32l1xx_wwdg.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_wwdg.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 Window watchdog (WWDG) peripheral: |
mbed_official | 76:aeb1df146756 | 9 | * + Prescaler, Refresh window and Counter configuration |
mbed_official | 76:aeb1df146756 | 10 | * + WWDG activation |
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 | ##### WWDG features ##### |
mbed_official | 76:aeb1df146756 | 17 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 18 | [..] Once enabled the WWDG generates a system reset on expiry of a programmed |
mbed_official | 76:aeb1df146756 | 19 | time period, unless the program refreshes the counter (downcounter) |
mbed_official | 76:aeb1df146756 | 20 | before to reach 0x3F value (i.e. a reset is generated when the counter |
mbed_official | 76:aeb1df146756 | 21 | value rolls over from 0x40 to 0x3F). |
mbed_official | 76:aeb1df146756 | 22 | [..] An MCU reset is also generated if the counter value is refreshed |
mbed_official | 76:aeb1df146756 | 23 | before the counter has reached the refresh window value. This |
mbed_official | 76:aeb1df146756 | 24 | implies that the counter must be refreshed in a limited window. |
mbed_official | 76:aeb1df146756 | 25 | |
mbed_official | 76:aeb1df146756 | 26 | [..] Once enabled the WWDG cannot be disabled except by a system reset. |
mbed_official | 76:aeb1df146756 | 27 | |
mbed_official | 76:aeb1df146756 | 28 | [..] WWDGRST flag in RCC_CSR register can be used to inform when a WWDG |
mbed_official | 76:aeb1df146756 | 29 | reset occurs. |
mbed_official | 76:aeb1df146756 | 30 | |
mbed_official | 76:aeb1df146756 | 31 | [..] The WWDG counter input clock is derived from the APB clock divided |
mbed_official | 76:aeb1df146756 | 32 | by a programmable prescaler. |
mbed_official | 76:aeb1df146756 | 33 | |
mbed_official | 76:aeb1df146756 | 34 | [..] WWDG counter clock = PCLK1 / Prescaler. |
mbed_official | 76:aeb1df146756 | 35 | [..] WWDG timeout = (WWDG counter clock) * (counter value). |
mbed_official | 76:aeb1df146756 | 36 | |
mbed_official | 76:aeb1df146756 | 37 | [..] Min-max timeout value @32MHz (PCLK1): ~128us / ~65.6ms. |
mbed_official | 76:aeb1df146756 | 38 | |
mbed_official | 76:aeb1df146756 | 39 | ##### How to use this driver ##### |
mbed_official | 76:aeb1df146756 | 40 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 41 | [..] |
mbed_official | 76:aeb1df146756 | 42 | (#) Enable WWDG clock using RCC_APB1PeriphClockCmd(RCC_APB1Periph_WWDG, ENABLE) |
mbed_official | 76:aeb1df146756 | 43 | function. |
mbed_official | 76:aeb1df146756 | 44 | |
mbed_official | 76:aeb1df146756 | 45 | (#) Configure the WWDG prescaler using WWDG_SetPrescaler() function. |
mbed_official | 76:aeb1df146756 | 46 | |
mbed_official | 76:aeb1df146756 | 47 | (#) Configure the WWDG refresh window using WWDG_SetWindowValue() function. |
mbed_official | 76:aeb1df146756 | 48 | |
mbed_official | 76:aeb1df146756 | 49 | (#) Set the WWDG counter value and start it using WWDG_Enable() function. |
mbed_official | 76:aeb1df146756 | 50 | When the WWDG is enabled the counter value should be configured to |
mbed_official | 76:aeb1df146756 | 51 | a value greater than 0x40 to prevent generating an immediate reset. |
mbed_official | 76:aeb1df146756 | 52 | |
mbed_official | 76:aeb1df146756 | 53 | (#) Optionally you can enable the Early wakeup interrupt which is |
mbed_official | 76:aeb1df146756 | 54 | generated when the counter reach 0x40. |
mbed_official | 76:aeb1df146756 | 55 | Once enabled this interrupt cannot be disabled except by a system reset. |
mbed_official | 76:aeb1df146756 | 56 | |
mbed_official | 76:aeb1df146756 | 57 | (#) Then the application program must refresh the WWDG counter at regular |
mbed_official | 76:aeb1df146756 | 58 | intervals during normal operation to prevent an MCU reset, using |
mbed_official | 76:aeb1df146756 | 59 | WWDG_SetCounter() function. This operation must occur only when |
mbed_official | 76:aeb1df146756 | 60 | the counter value is lower than the refresh window value, |
mbed_official | 76:aeb1df146756 | 61 | programmed using WWDG_SetWindowValue(). |
mbed_official | 76:aeb1df146756 | 62 | |
mbed_official | 76:aeb1df146756 | 63 | * @endverbatim |
mbed_official | 76:aeb1df146756 | 64 | * |
mbed_official | 76:aeb1df146756 | 65 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 66 | * @attention |
mbed_official | 76:aeb1df146756 | 67 | * |
mbed_official | 106:ced8cbb51063 | 68 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 76:aeb1df146756 | 69 | * |
mbed_official | 106:ced8cbb51063 | 70 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 106:ced8cbb51063 | 71 | * are permitted provided that the following conditions are met: |
mbed_official | 106:ced8cbb51063 | 72 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 106:ced8cbb51063 | 73 | * this list of conditions and the following disclaimer. |
mbed_official | 106:ced8cbb51063 | 74 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 106:ced8cbb51063 | 75 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 106:ced8cbb51063 | 76 | * and/or other materials provided with the distribution. |
mbed_official | 106:ced8cbb51063 | 77 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 106:ced8cbb51063 | 78 | * may be used to endorse or promote products derived from this software |
mbed_official | 106:ced8cbb51063 | 79 | * without specific prior written permission. |
mbed_official | 76:aeb1df146756 | 80 | * |
mbed_official | 106:ced8cbb51063 | 81 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 106:ced8cbb51063 | 82 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 106:ced8cbb51063 | 83 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 106:ced8cbb51063 | 84 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 106:ced8cbb51063 | 85 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 106:ced8cbb51063 | 86 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 106:ced8cbb51063 | 87 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 106:ced8cbb51063 | 88 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 106:ced8cbb51063 | 89 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 106:ced8cbb51063 | 90 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 76:aeb1df146756 | 91 | * |
mbed_official | 76:aeb1df146756 | 92 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 93 | */ |
mbed_official | 76:aeb1df146756 | 94 | |
mbed_official | 76:aeb1df146756 | 95 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 96 | #include "stm32l1xx_wwdg.h" |
mbed_official | 76:aeb1df146756 | 97 | #include "stm32l1xx_rcc.h" |
mbed_official | 76:aeb1df146756 | 98 | |
mbed_official | 76:aeb1df146756 | 99 | /** @addtogroup STM32L1xx_StdPeriph_Driver |
mbed_official | 76:aeb1df146756 | 100 | * @{ |
mbed_official | 76:aeb1df146756 | 101 | */ |
mbed_official | 76:aeb1df146756 | 102 | |
mbed_official | 76:aeb1df146756 | 103 | /** @defgroup WWDG |
mbed_official | 76:aeb1df146756 | 104 | * @brief WWDG driver modules |
mbed_official | 76:aeb1df146756 | 105 | * @{ |
mbed_official | 76:aeb1df146756 | 106 | */ |
mbed_official | 76:aeb1df146756 | 107 | |
mbed_official | 76:aeb1df146756 | 108 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 109 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 110 | |
mbed_official | 76:aeb1df146756 | 111 | /* ----------- WWDG registers bit address in the alias region ----------- */ |
mbed_official | 76:aeb1df146756 | 112 | #define WWDG_OFFSET (WWDG_BASE - PERIPH_BASE) |
mbed_official | 76:aeb1df146756 | 113 | |
mbed_official | 76:aeb1df146756 | 114 | /* Alias word address of EWI bit */ |
mbed_official | 76:aeb1df146756 | 115 | #define CFR_OFFSET (WWDG_OFFSET + 0x04) |
mbed_official | 76:aeb1df146756 | 116 | #define EWI_BitNumber 0x09 |
mbed_official | 76:aeb1df146756 | 117 | #define CFR_EWI_BB (PERIPH_BB_BASE + (CFR_OFFSET * 32) + (EWI_BitNumber * 4)) |
mbed_official | 76:aeb1df146756 | 118 | |
mbed_official | 76:aeb1df146756 | 119 | /* --------------------- WWDG registers bit mask ------------------------ */ |
mbed_official | 76:aeb1df146756 | 120 | |
mbed_official | 76:aeb1df146756 | 121 | /* CFR register bit mask */ |
mbed_official | 76:aeb1df146756 | 122 | #define CFR_WDGTB_MASK ((uint32_t)0xFFFFFE7F) |
mbed_official | 76:aeb1df146756 | 123 | #define CFR_W_MASK ((uint32_t)0xFFFFFF80) |
mbed_official | 76:aeb1df146756 | 124 | #define BIT_MASK ((uint8_t)0x7F) |
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 WWDG_Private_Functions |
mbed_official | 76:aeb1df146756 | 132 | * @{ |
mbed_official | 76:aeb1df146756 | 133 | */ |
mbed_official | 76:aeb1df146756 | 134 | |
mbed_official | 76:aeb1df146756 | 135 | /** @defgroup WWDG_Group1 Prescaler, Refresh window and Counter configuration functions |
mbed_official | 76:aeb1df146756 | 136 | * @brief Prescaler, Refresh window 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, Refresh window 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 Deinitializes the WWDG peripheral registers to their default reset values. |
mbed_official | 76:aeb1df146756 | 149 | * @param None |
mbed_official | 76:aeb1df146756 | 150 | * @retval None |
mbed_official | 76:aeb1df146756 | 151 | */ |
mbed_official | 76:aeb1df146756 | 152 | void WWDG_DeInit(void) |
mbed_official | 76:aeb1df146756 | 153 | { |
mbed_official | 76:aeb1df146756 | 154 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, ENABLE); |
mbed_official | 76:aeb1df146756 | 155 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, DISABLE); |
mbed_official | 76:aeb1df146756 | 156 | } |
mbed_official | 76:aeb1df146756 | 157 | |
mbed_official | 76:aeb1df146756 | 158 | /** |
mbed_official | 76:aeb1df146756 | 159 | * @brief Sets the WWDG Prescaler. |
mbed_official | 76:aeb1df146756 | 160 | * @param WWDG_Prescaler: specifies the WWDG Prescaler. |
mbed_official | 76:aeb1df146756 | 161 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 162 | * @arg WWDG_Prescaler_1: WWDG counter clock = (PCLK1/4096)/1 |
mbed_official | 76:aeb1df146756 | 163 | * @arg WWDG_Prescaler_2: WWDG counter clock = (PCLK1/4096)/2 |
mbed_official | 76:aeb1df146756 | 164 | * @arg WWDG_Prescaler_4: WWDG counter clock = (PCLK1/4096)/4 |
mbed_official | 76:aeb1df146756 | 165 | * @arg WWDG_Prescaler_8: WWDG counter clock = (PCLK1/4096)/8 |
mbed_official | 76:aeb1df146756 | 166 | * @retval None |
mbed_official | 76:aeb1df146756 | 167 | */ |
mbed_official | 76:aeb1df146756 | 168 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler) |
mbed_official | 76:aeb1df146756 | 169 | { |
mbed_official | 76:aeb1df146756 | 170 | uint32_t tmpreg = 0; |
mbed_official | 76:aeb1df146756 | 171 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 172 | assert_param(IS_WWDG_PRESCALER(WWDG_Prescaler)); |
mbed_official | 76:aeb1df146756 | 173 | /* Clear WDGTB[1:0] bits */ |
mbed_official | 76:aeb1df146756 | 174 | tmpreg = WWDG->CFR & CFR_WDGTB_MASK; |
mbed_official | 76:aeb1df146756 | 175 | /* Set WDGTB[1:0] bits according to WWDG_Prescaler value */ |
mbed_official | 76:aeb1df146756 | 176 | tmpreg |= WWDG_Prescaler; |
mbed_official | 76:aeb1df146756 | 177 | /* Store the new value */ |
mbed_official | 76:aeb1df146756 | 178 | WWDG->CFR = tmpreg; |
mbed_official | 76:aeb1df146756 | 179 | } |
mbed_official | 76:aeb1df146756 | 180 | |
mbed_official | 76:aeb1df146756 | 181 | /** |
mbed_official | 76:aeb1df146756 | 182 | * @brief Sets the WWDG window value. |
mbed_official | 76:aeb1df146756 | 183 | * @param WindowValue: specifies the window value to be compared to the downcounter. |
mbed_official | 76:aeb1df146756 | 184 | * This parameter value must be lower than 0x80. |
mbed_official | 76:aeb1df146756 | 185 | * @retval None |
mbed_official | 76:aeb1df146756 | 186 | */ |
mbed_official | 76:aeb1df146756 | 187 | void WWDG_SetWindowValue(uint8_t WindowValue) |
mbed_official | 76:aeb1df146756 | 188 | { |
mbed_official | 76:aeb1df146756 | 189 | __IO uint32_t tmpreg = 0; |
mbed_official | 76:aeb1df146756 | 190 | |
mbed_official | 76:aeb1df146756 | 191 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 192 | assert_param(IS_WWDG_WINDOW_VALUE(WindowValue)); |
mbed_official | 76:aeb1df146756 | 193 | /* Clear W[6:0] bits */ |
mbed_official | 76:aeb1df146756 | 194 | |
mbed_official | 76:aeb1df146756 | 195 | tmpreg = WWDG->CFR & CFR_W_MASK; |
mbed_official | 76:aeb1df146756 | 196 | |
mbed_official | 76:aeb1df146756 | 197 | /* Set W[6:0] bits according to WindowValue value */ |
mbed_official | 76:aeb1df146756 | 198 | tmpreg |= WindowValue & (uint32_t) BIT_MASK; |
mbed_official | 76:aeb1df146756 | 199 | |
mbed_official | 76:aeb1df146756 | 200 | /* Store the new value */ |
mbed_official | 76:aeb1df146756 | 201 | WWDG->CFR = tmpreg; |
mbed_official | 76:aeb1df146756 | 202 | } |
mbed_official | 76:aeb1df146756 | 203 | |
mbed_official | 76:aeb1df146756 | 204 | /** |
mbed_official | 76:aeb1df146756 | 205 | * @brief Enables the WWDG Early Wakeup interrupt(EWI). |
mbed_official | 76:aeb1df146756 | 206 | * @note Once enabled this interrupt cannot be disabled except by a system reset. |
mbed_official | 76:aeb1df146756 | 207 | * @param None |
mbed_official | 76:aeb1df146756 | 208 | * @retval None |
mbed_official | 76:aeb1df146756 | 209 | */ |
mbed_official | 76:aeb1df146756 | 210 | void WWDG_EnableIT(void) |
mbed_official | 76:aeb1df146756 | 211 | { |
mbed_official | 76:aeb1df146756 | 212 | *(__IO uint32_t *) CFR_EWI_BB = (uint32_t)ENABLE; |
mbed_official | 76:aeb1df146756 | 213 | } |
mbed_official | 76:aeb1df146756 | 214 | |
mbed_official | 76:aeb1df146756 | 215 | /** |
mbed_official | 76:aeb1df146756 | 216 | * @brief Sets the WWDG counter value. |
mbed_official | 76:aeb1df146756 | 217 | * @param Counter: specifies the watchdog counter value. |
mbed_official | 76:aeb1df146756 | 218 | * This parameter must be a number between 0x40 and 0x7F (to prevent generating |
mbed_official | 76:aeb1df146756 | 219 | * an immediate reset). |
mbed_official | 76:aeb1df146756 | 220 | * @retval None |
mbed_official | 76:aeb1df146756 | 221 | */ |
mbed_official | 76:aeb1df146756 | 222 | void WWDG_SetCounter(uint8_t Counter) |
mbed_official | 76:aeb1df146756 | 223 | { |
mbed_official | 76:aeb1df146756 | 224 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 225 | assert_param(IS_WWDG_COUNTER(Counter)); |
mbed_official | 76:aeb1df146756 | 226 | /* Write to T[6:0] bits to configure the counter value, no need to do |
mbed_official | 76:aeb1df146756 | 227 | a read-modify-write; writing a 0 to WDGA bit does nothing */ |
mbed_official | 76:aeb1df146756 | 228 | WWDG->CR = Counter & BIT_MASK; |
mbed_official | 76:aeb1df146756 | 229 | } |
mbed_official | 76:aeb1df146756 | 230 | |
mbed_official | 76:aeb1df146756 | 231 | /** |
mbed_official | 76:aeb1df146756 | 232 | * @} |
mbed_official | 76:aeb1df146756 | 233 | */ |
mbed_official | 76:aeb1df146756 | 234 | |
mbed_official | 76:aeb1df146756 | 235 | /** @defgroup WWDG_Group2 WWDG activation functions |
mbed_official | 76:aeb1df146756 | 236 | * @brief WWDG activation functions |
mbed_official | 76:aeb1df146756 | 237 | * |
mbed_official | 76:aeb1df146756 | 238 | @verbatim |
mbed_official | 76:aeb1df146756 | 239 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 240 | ##### WWDG activation function ##### |
mbed_official | 76:aeb1df146756 | 241 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 242 | |
mbed_official | 76:aeb1df146756 | 243 | @endverbatim |
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 | * @brief Enables WWDG and load the counter value. |
mbed_official | 76:aeb1df146756 | 249 | * @param Counter: specifies the watchdog counter value. |
mbed_official | 76:aeb1df146756 | 250 | * This parameter must be a number between 0x40 and 0x7F (to prevent generating |
mbed_official | 76:aeb1df146756 | 251 | * an immediate reset). |
mbed_official | 76:aeb1df146756 | 252 | * @retval None |
mbed_official | 76:aeb1df146756 | 253 | */ |
mbed_official | 76:aeb1df146756 | 254 | void WWDG_Enable(uint8_t Counter) |
mbed_official | 76:aeb1df146756 | 255 | { |
mbed_official | 76:aeb1df146756 | 256 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 257 | assert_param(IS_WWDG_COUNTER(Counter)); |
mbed_official | 76:aeb1df146756 | 258 | WWDG->CR = WWDG_CR_WDGA | Counter; |
mbed_official | 76:aeb1df146756 | 259 | } |
mbed_official | 76:aeb1df146756 | 260 | |
mbed_official | 76:aeb1df146756 | 261 | /** |
mbed_official | 76:aeb1df146756 | 262 | * @} |
mbed_official | 76:aeb1df146756 | 263 | */ |
mbed_official | 76:aeb1df146756 | 264 | |
mbed_official | 76:aeb1df146756 | 265 | /** @defgroup WWDG_Group3 Interrupts and flags management functions |
mbed_official | 76:aeb1df146756 | 266 | * @brief Interrupts and flags management functions |
mbed_official | 76:aeb1df146756 | 267 | * |
mbed_official | 76:aeb1df146756 | 268 | @verbatim |
mbed_official | 76:aeb1df146756 | 269 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 270 | ##### Interrupts and flags management functions ##### |
mbed_official | 76:aeb1df146756 | 271 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 272 | |
mbed_official | 76:aeb1df146756 | 273 | @endverbatim |
mbed_official | 76:aeb1df146756 | 274 | * @{ |
mbed_official | 76:aeb1df146756 | 275 | */ |
mbed_official | 76:aeb1df146756 | 276 | |
mbed_official | 76:aeb1df146756 | 277 | /** |
mbed_official | 76:aeb1df146756 | 278 | * @brief Checks whether the Early Wakeup interrupt flag is set or not. |
mbed_official | 76:aeb1df146756 | 279 | * @param None |
mbed_official | 76:aeb1df146756 | 280 | * @retval The new state of the Early Wakeup interrupt flag (SET or RESET). |
mbed_official | 76:aeb1df146756 | 281 | */ |
mbed_official | 76:aeb1df146756 | 282 | FlagStatus WWDG_GetFlagStatus(void) |
mbed_official | 76:aeb1df146756 | 283 | { |
mbed_official | 76:aeb1df146756 | 284 | FlagStatus bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 285 | |
mbed_official | 76:aeb1df146756 | 286 | if ((WWDG->SR) != (uint32_t)RESET) |
mbed_official | 76:aeb1df146756 | 287 | { |
mbed_official | 76:aeb1df146756 | 288 | bitstatus = SET; |
mbed_official | 76:aeb1df146756 | 289 | } |
mbed_official | 76:aeb1df146756 | 290 | else |
mbed_official | 76:aeb1df146756 | 291 | { |
mbed_official | 76:aeb1df146756 | 292 | bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 293 | } |
mbed_official | 76:aeb1df146756 | 294 | return bitstatus; |
mbed_official | 76:aeb1df146756 | 295 | } |
mbed_official | 76:aeb1df146756 | 296 | |
mbed_official | 76:aeb1df146756 | 297 | /** |
mbed_official | 76:aeb1df146756 | 298 | * @brief Clears Early Wakeup interrupt flag. |
mbed_official | 76:aeb1df146756 | 299 | * @param None |
mbed_official | 76:aeb1df146756 | 300 | * @retval None |
mbed_official | 76:aeb1df146756 | 301 | */ |
mbed_official | 76:aeb1df146756 | 302 | void WWDG_ClearFlag(void) |
mbed_official | 76:aeb1df146756 | 303 | { |
mbed_official | 76:aeb1df146756 | 304 | WWDG->SR = (uint32_t)RESET; |
mbed_official | 76:aeb1df146756 | 305 | } |
mbed_official | 76:aeb1df146756 | 306 | |
mbed_official | 76:aeb1df146756 | 307 | /** |
mbed_official | 76:aeb1df146756 | 308 | * @} |
mbed_official | 76:aeb1df146756 | 309 | */ |
mbed_official | 76:aeb1df146756 | 310 | |
mbed_official | 76:aeb1df146756 | 311 | /** |
mbed_official | 76:aeb1df146756 | 312 | * @} |
mbed_official | 76:aeb1df146756 | 313 | */ |
mbed_official | 76:aeb1df146756 | 314 | |
mbed_official | 76:aeb1df146756 | 315 | /** |
mbed_official | 76:aeb1df146756 | 316 | * @} |
mbed_official | 76:aeb1df146756 | 317 | */ |
mbed_official | 76:aeb1df146756 | 318 | |
mbed_official | 76:aeb1df146756 | 319 | /** |
mbed_official | 76:aeb1df146756 | 320 | * @} |
mbed_official | 76:aeb1df146756 | 321 | */ |
mbed_official | 76:aeb1df146756 | 322 | |
mbed_official | 76:aeb1df146756 | 323 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |