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