Hal Drivers for L4
Dependents: BSP OneHopeOnePrayer FINAL_AUDIO_RECORD AudioDemo
Fork of STM32L4xx_HAL_Driver by
Inc/stm32l4xx_ll_wwdg.h@2:7aef7655b0a8, 2015-11-25 (annotated)
- Committer:
- EricLew
- Date:
- Wed Nov 25 17:30:43 2015 +0000
- Revision:
- 2:7aef7655b0a8
- Parent:
- 0:80ee8f3b695e
commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EricLew | 0:80ee8f3b695e | 1 | /** |
EricLew | 0:80ee8f3b695e | 2 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 3 | * @file stm32l4xx_ll_wwdg.h |
EricLew | 0:80ee8f3b695e | 4 | * @author MCD Application Team |
EricLew | 0:80ee8f3b695e | 5 | * @version V1.1.0 |
EricLew | 0:80ee8f3b695e | 6 | * @date 16-September-2015 |
EricLew | 0:80ee8f3b695e | 7 | * @brief Header file of WWDG LL module. |
EricLew | 0:80ee8f3b695e | 8 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 9 | * @attention |
EricLew | 0:80ee8f3b695e | 10 | * |
EricLew | 0:80ee8f3b695e | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
EricLew | 0:80ee8f3b695e | 12 | * |
EricLew | 0:80ee8f3b695e | 13 | * Redistribution and use in source and binary forms, with or without modification, |
EricLew | 0:80ee8f3b695e | 14 | * are permitted provided that the following conditions are met: |
EricLew | 0:80ee8f3b695e | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
EricLew | 0:80ee8f3b695e | 16 | * this list of conditions and the following disclaimer. |
EricLew | 0:80ee8f3b695e | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
EricLew | 0:80ee8f3b695e | 18 | * this list of conditions and the following disclaimer in the documentation |
EricLew | 0:80ee8f3b695e | 19 | * and/or other materials provided with the distribution. |
EricLew | 0:80ee8f3b695e | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
EricLew | 0:80ee8f3b695e | 21 | * may be used to endorse or promote products derived from this software |
EricLew | 0:80ee8f3b695e | 22 | * without specific prior written permission. |
EricLew | 0:80ee8f3b695e | 23 | * |
EricLew | 0:80ee8f3b695e | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
EricLew | 0:80ee8f3b695e | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
EricLew | 0:80ee8f3b695e | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
EricLew | 0:80ee8f3b695e | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
EricLew | 0:80ee8f3b695e | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
EricLew | 0:80ee8f3b695e | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
EricLew | 0:80ee8f3b695e | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
EricLew | 0:80ee8f3b695e | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
EricLew | 0:80ee8f3b695e | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
EricLew | 0:80ee8f3b695e | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
EricLew | 0:80ee8f3b695e | 34 | * |
EricLew | 0:80ee8f3b695e | 35 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 36 | */ |
EricLew | 0:80ee8f3b695e | 37 | |
EricLew | 0:80ee8f3b695e | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 39 | #ifndef __STM32L4xx_LL_WWDG_H |
EricLew | 0:80ee8f3b695e | 40 | #define __STM32L4xx_LL_WWDG_H |
EricLew | 0:80ee8f3b695e | 41 | |
EricLew | 0:80ee8f3b695e | 42 | #ifdef __cplusplus |
EricLew | 0:80ee8f3b695e | 43 | extern "C" { |
EricLew | 0:80ee8f3b695e | 44 | #endif |
EricLew | 0:80ee8f3b695e | 45 | |
EricLew | 0:80ee8f3b695e | 46 | /* Includes ------------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 47 | #include "stm32l4xx.h" |
EricLew | 0:80ee8f3b695e | 48 | |
EricLew | 0:80ee8f3b695e | 49 | /** @addtogroup STM32L4xx_LL_Driver |
EricLew | 0:80ee8f3b695e | 50 | * @{ |
EricLew | 0:80ee8f3b695e | 51 | */ |
EricLew | 0:80ee8f3b695e | 52 | |
EricLew | 0:80ee8f3b695e | 53 | #if defined (WWDG) |
EricLew | 0:80ee8f3b695e | 54 | |
EricLew | 0:80ee8f3b695e | 55 | /** @defgroup WWDG_LL WWDG |
EricLew | 0:80ee8f3b695e | 56 | * @{ |
EricLew | 0:80ee8f3b695e | 57 | */ |
EricLew | 0:80ee8f3b695e | 58 | |
EricLew | 0:80ee8f3b695e | 59 | /* Private types -------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 60 | /* Private variables ---------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 61 | |
EricLew | 0:80ee8f3b695e | 62 | /* Private constants ---------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 63 | |
EricLew | 0:80ee8f3b695e | 64 | /* Private macros ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 65 | |
EricLew | 0:80ee8f3b695e | 66 | /* Exported types ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 67 | /* Exported constants --------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 68 | /** @defgroup WWDG_LL_Exported_Constants WWDG Exported Constants |
EricLew | 0:80ee8f3b695e | 69 | * @{ |
EricLew | 0:80ee8f3b695e | 70 | */ |
EricLew | 0:80ee8f3b695e | 71 | |
EricLew | 0:80ee8f3b695e | 72 | /** @defgroup WWDG_LL_EC_GET_FLAG Get Flags Defines |
EricLew | 0:80ee8f3b695e | 73 | * @brief Flags defines which can be used with LL_WWDG_ReadReg function |
EricLew | 0:80ee8f3b695e | 74 | * @{ |
EricLew | 0:80ee8f3b695e | 75 | */ |
EricLew | 0:80ee8f3b695e | 76 | #define LL_WWDG_SR_EWIF WWDG_SR_EWIF |
EricLew | 0:80ee8f3b695e | 77 | /** |
EricLew | 0:80ee8f3b695e | 78 | * @} |
EricLew | 0:80ee8f3b695e | 79 | */ |
EricLew | 0:80ee8f3b695e | 80 | |
EricLew | 0:80ee8f3b695e | 81 | /** @defgroup WWDG_LL_EC_IT IT Defines |
EricLew | 0:80ee8f3b695e | 82 | * @brief IT defines which can be used with LL_WWDG_ReadReg and LL_WWDG_WriteReg functions |
EricLew | 0:80ee8f3b695e | 83 | * @{ |
EricLew | 0:80ee8f3b695e | 84 | */ |
EricLew | 0:80ee8f3b695e | 85 | #define LL_WWDG_CFR_EWI WWDG_CFR_EWI |
EricLew | 0:80ee8f3b695e | 86 | /** |
EricLew | 0:80ee8f3b695e | 87 | * @} |
EricLew | 0:80ee8f3b695e | 88 | */ |
EricLew | 0:80ee8f3b695e | 89 | |
EricLew | 0:80ee8f3b695e | 90 | /** @defgroup WWDG_LL_EC_PRESCALER PRESCALER |
EricLew | 0:80ee8f3b695e | 91 | * @{ |
EricLew | 0:80ee8f3b695e | 92 | */ |
EricLew | 0:80ee8f3b695e | 93 | #define LL_WWDG_PRESCALER_1 (uint32_t)0x00000000 /*!< WWDG counter clock = (PCLK1/4096)/1 */ |
EricLew | 0:80ee8f3b695e | 94 | #define LL_WWDG_PRESCALER_2 WWDG_CFR_WDGTB_0 /*!< WWDG counter clock = (PCLK1/4096)/2 */ |
EricLew | 0:80ee8f3b695e | 95 | #define LL_WWDG_PRESCALER_4 WWDG_CFR_WDGTB_1 /*!< WWDG counter clock = (PCLK1/4096)/4 */ |
EricLew | 0:80ee8f3b695e | 96 | #define LL_WWDG_PRESCALER_8 (WWDG_CFR_WDGTB_0 | WWDG_CFR_WDGTB_1) /*!< WWDG counter clock = (PCLK1/4096)/8 */ |
EricLew | 0:80ee8f3b695e | 97 | /** |
EricLew | 0:80ee8f3b695e | 98 | * @} |
EricLew | 0:80ee8f3b695e | 99 | */ |
EricLew | 0:80ee8f3b695e | 100 | |
EricLew | 0:80ee8f3b695e | 101 | /** |
EricLew | 0:80ee8f3b695e | 102 | * @} |
EricLew | 0:80ee8f3b695e | 103 | */ |
EricLew | 0:80ee8f3b695e | 104 | |
EricLew | 0:80ee8f3b695e | 105 | /* Exported macro ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 106 | /** @defgroup WWDG_LL_Exported_Macros WWDG Exported Macros |
EricLew | 0:80ee8f3b695e | 107 | * @{ |
EricLew | 0:80ee8f3b695e | 108 | */ |
EricLew | 0:80ee8f3b695e | 109 | /** @defgroup WWDG_LL_EM_WRITE_READ Common Write and read registers macros |
EricLew | 0:80ee8f3b695e | 110 | * @{ |
EricLew | 0:80ee8f3b695e | 111 | */ |
EricLew | 0:80ee8f3b695e | 112 | /** |
EricLew | 0:80ee8f3b695e | 113 | * @brief Write a value in WWDG register |
EricLew | 0:80ee8f3b695e | 114 | * @param __INSTANCE__ WWDG Instance |
EricLew | 0:80ee8f3b695e | 115 | * @param __REG__ Register to be written |
EricLew | 0:80ee8f3b695e | 116 | * @param __VALUE__ Value to be written in the register |
EricLew | 0:80ee8f3b695e | 117 | * @retval None |
EricLew | 0:80ee8f3b695e | 118 | */ |
EricLew | 0:80ee8f3b695e | 119 | #define LL_WWDG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) |
EricLew | 0:80ee8f3b695e | 120 | |
EricLew | 0:80ee8f3b695e | 121 | /** |
EricLew | 0:80ee8f3b695e | 122 | * @brief Read a value in WWDG register |
EricLew | 0:80ee8f3b695e | 123 | * @param __INSTANCE__ WWDG Instance |
EricLew | 0:80ee8f3b695e | 124 | * @param __REG__ Register to be read |
EricLew | 0:80ee8f3b695e | 125 | * @retval Register value |
EricLew | 0:80ee8f3b695e | 126 | */ |
EricLew | 0:80ee8f3b695e | 127 | #define LL_WWDG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
EricLew | 0:80ee8f3b695e | 128 | /** |
EricLew | 0:80ee8f3b695e | 129 | * @} |
EricLew | 0:80ee8f3b695e | 130 | */ |
EricLew | 0:80ee8f3b695e | 131 | |
EricLew | 0:80ee8f3b695e | 132 | |
EricLew | 0:80ee8f3b695e | 133 | /** |
EricLew | 0:80ee8f3b695e | 134 | * @} |
EricLew | 0:80ee8f3b695e | 135 | */ |
EricLew | 0:80ee8f3b695e | 136 | |
EricLew | 0:80ee8f3b695e | 137 | /* Exported functions --------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 138 | /** @defgroup WWDG_LL_Exported_Functions WWDG Exported Functions |
EricLew | 0:80ee8f3b695e | 139 | * @{ |
EricLew | 0:80ee8f3b695e | 140 | */ |
EricLew | 0:80ee8f3b695e | 141 | |
EricLew | 0:80ee8f3b695e | 142 | /** @defgroup WWDG_LL_EF_Configuration Configuration |
EricLew | 0:80ee8f3b695e | 143 | * @{ |
EricLew | 0:80ee8f3b695e | 144 | */ |
EricLew | 0:80ee8f3b695e | 145 | /** |
EricLew | 0:80ee8f3b695e | 146 | * @brief Enable Window Watchdog. The watchdog is always disabled after a reset. |
EricLew | 0:80ee8f3b695e | 147 | * It is enabled by setting the WDGA bit in the WWDG_CR register, |
EricLew | 0:80ee8f3b695e | 148 | * then it cannot be disabled again except by a reset. |
EricLew | 0:80ee8f3b695e | 149 | * This bit is set by software and only cleared by hardware after a reset. |
EricLew | 0:80ee8f3b695e | 150 | * When WDGA = 1, the watchdog can generate a reset. |
EricLew | 0:80ee8f3b695e | 151 | * @rmtoll CR WDGA LL_WWDG_Enable |
EricLew | 0:80ee8f3b695e | 152 | * @param WWDGx WWDG Instance |
EricLew | 0:80ee8f3b695e | 153 | * @retval None |
EricLew | 0:80ee8f3b695e | 154 | */ |
EricLew | 0:80ee8f3b695e | 155 | __STATIC_INLINE void LL_WWDG_Enable(WWDG_TypeDef* WWDGx) |
EricLew | 0:80ee8f3b695e | 156 | { |
EricLew | 0:80ee8f3b695e | 157 | SET_BIT(WWDGx->CR, WWDG_CR_WDGA); |
EricLew | 0:80ee8f3b695e | 158 | } |
EricLew | 0:80ee8f3b695e | 159 | |
EricLew | 0:80ee8f3b695e | 160 | /** |
EricLew | 0:80ee8f3b695e | 161 | * @brief Checks if Window Watchdog is enabled |
EricLew | 0:80ee8f3b695e | 162 | * @rmtoll CR WDGA LL_WWDG_IsEnabled |
EricLew | 0:80ee8f3b695e | 163 | * @param WWDGx WWDG Instance |
EricLew | 0:80ee8f3b695e | 164 | * @retval State of bit (1 or 0). |
EricLew | 0:80ee8f3b695e | 165 | */ |
EricLew | 0:80ee8f3b695e | 166 | __STATIC_INLINE uint32_t LL_WWDG_IsEnabled(WWDG_TypeDef* WWDGx) |
EricLew | 0:80ee8f3b695e | 167 | { |
EricLew | 0:80ee8f3b695e | 168 | return (READ_BIT(WWDGx->CR, WWDG_CR_WDGA) == (WWDG_CR_WDGA)); |
EricLew | 0:80ee8f3b695e | 169 | } |
EricLew | 0:80ee8f3b695e | 170 | |
EricLew | 0:80ee8f3b695e | 171 | /** |
EricLew | 0:80ee8f3b695e | 172 | * @brief Set the Watchdog counter value to provided value (7-bits b6-b0 value). |
EricLew | 0:80ee8f3b695e | 173 | * When writing to the WWDG_CR register, always write 1 in the MSB b6 to avoid generating an immediate reset. |
EricLew | 0:80ee8f3b695e | 174 | * This counter is decremented every (4096 x 2expWDGTB) PCLK cycles. |
EricLew | 0:80ee8f3b695e | 175 | * A reset is produced when it rolls over from 0x40 to 0x3F (b6 becomes cleared) |
EricLew | 0:80ee8f3b695e | 176 | * @rmtoll CR T LL_WWDG_SetCounter |
EricLew | 0:80ee8f3b695e | 177 | * @param WWDGx WWDG Instance |
EricLew | 0:80ee8f3b695e | 178 | * @param Counter 0..0x7F (7 bit counter value) |
EricLew | 0:80ee8f3b695e | 179 | * @retval None |
EricLew | 0:80ee8f3b695e | 180 | */ |
EricLew | 0:80ee8f3b695e | 181 | __STATIC_INLINE void LL_WWDG_SetCounter(WWDG_TypeDef* WWDGx, uint32_t Counter) |
EricLew | 0:80ee8f3b695e | 182 | { |
EricLew | 0:80ee8f3b695e | 183 | MODIFY_REG(WWDGx->CR, WWDG_CR_T, Counter); |
EricLew | 0:80ee8f3b695e | 184 | } |
EricLew | 0:80ee8f3b695e | 185 | |
EricLew | 0:80ee8f3b695e | 186 | /** |
EricLew | 0:80ee8f3b695e | 187 | * @brief Return current Watchdog Counter Value (7 bits counter value) |
EricLew | 0:80ee8f3b695e | 188 | * @rmtoll CR T LL_WWDG_GetCounter |
EricLew | 0:80ee8f3b695e | 189 | * @param WWDGx WWDG Instance |
EricLew | 0:80ee8f3b695e | 190 | * @retval 7 bit Watchdog Counter value |
EricLew | 0:80ee8f3b695e | 191 | */ |
EricLew | 0:80ee8f3b695e | 192 | __STATIC_INLINE uint32_t LL_WWDG_GetCounter(WWDG_TypeDef* WWDGx) |
EricLew | 0:80ee8f3b695e | 193 | { |
EricLew | 0:80ee8f3b695e | 194 | return (uint32_t)(READ_BIT(WWDGx->CR, WWDG_CR_T)); |
EricLew | 0:80ee8f3b695e | 195 | } |
EricLew | 0:80ee8f3b695e | 196 | |
EricLew | 0:80ee8f3b695e | 197 | /** |
EricLew | 0:80ee8f3b695e | 198 | * @brief Set the time base of the prescaler (WDGTB). |
EricLew | 0:80ee8f3b695e | 199 | * Prescaler is used to apply ratio on PCLK clock, so that Watchdog counter |
EricLew | 0:80ee8f3b695e | 200 | * is decremented every (4096 x 2expWDGTB) PCLK cycles |
EricLew | 0:80ee8f3b695e | 201 | * @rmtoll CFR WDGTB LL_WWDG_SetPrescaler |
EricLew | 0:80ee8f3b695e | 202 | * @param WWDGx WWDG Instance |
EricLew | 0:80ee8f3b695e | 203 | * @param Prescaler This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 204 | * @arg @ref LL_WWDG_PRESCALER_1 |
EricLew | 0:80ee8f3b695e | 205 | * @arg @ref LL_WWDG_PRESCALER_2 |
EricLew | 0:80ee8f3b695e | 206 | * @arg @ref LL_WWDG_PRESCALER_4 |
EricLew | 0:80ee8f3b695e | 207 | * @arg @ref LL_WWDG_PRESCALER_8 |
EricLew | 0:80ee8f3b695e | 208 | * @retval None |
EricLew | 0:80ee8f3b695e | 209 | */ |
EricLew | 0:80ee8f3b695e | 210 | __STATIC_INLINE void LL_WWDG_SetPrescaler(WWDG_TypeDef* WWDGx, uint32_t Prescaler) |
EricLew | 0:80ee8f3b695e | 211 | { |
EricLew | 0:80ee8f3b695e | 212 | MODIFY_REG(WWDGx->CFR, WWDG_CFR_WDGTB, Prescaler); |
EricLew | 0:80ee8f3b695e | 213 | } |
EricLew | 0:80ee8f3b695e | 214 | |
EricLew | 0:80ee8f3b695e | 215 | /** |
EricLew | 0:80ee8f3b695e | 216 | * @brief Return current Watchdog Prescaler Value |
EricLew | 0:80ee8f3b695e | 217 | * @rmtoll CFR WDGTB LL_WWDG_GetPrescaler |
EricLew | 0:80ee8f3b695e | 218 | * @param WWDGx WWDG Instance |
EricLew | 0:80ee8f3b695e | 219 | * @retval Returned value can be one of the following values: |
EricLew | 0:80ee8f3b695e | 220 | * @arg @ref LL_WWDG_PRESCALER_1 |
EricLew | 0:80ee8f3b695e | 221 | * @arg @ref LL_WWDG_PRESCALER_2 |
EricLew | 0:80ee8f3b695e | 222 | * @arg @ref LL_WWDG_PRESCALER_4 |
EricLew | 0:80ee8f3b695e | 223 | * @arg @ref LL_WWDG_PRESCALER_8 |
EricLew | 0:80ee8f3b695e | 224 | */ |
EricLew | 0:80ee8f3b695e | 225 | __STATIC_INLINE uint32_t LL_WWDG_GetPrescaler(WWDG_TypeDef* WWDGx) |
EricLew | 0:80ee8f3b695e | 226 | { |
EricLew | 0:80ee8f3b695e | 227 | return (uint32_t)(READ_BIT(WWDGx->CFR, WWDG_CFR_WDGTB)); |
EricLew | 0:80ee8f3b695e | 228 | } |
EricLew | 0:80ee8f3b695e | 229 | |
EricLew | 0:80ee8f3b695e | 230 | /** |
EricLew | 0:80ee8f3b695e | 231 | * @brief Set the Watchdog Window value to be compared to the downcounter (7-bits b6-b0 value). |
EricLew | 0:80ee8f3b695e | 232 | * This window value defines when write in the WWDG_CR register |
EricLew | 0:80ee8f3b695e | 233 | * to program Watchdog counter is allowed. |
EricLew | 0:80ee8f3b695e | 234 | * Watchdog counter value update must occur only when the counter value |
EricLew | 0:80ee8f3b695e | 235 | * is lower than the Watchdog window register value. |
EricLew | 0:80ee8f3b695e | 236 | * Otherwise, a MCU reset is generated if the 7-bit Watchdog counter value |
EricLew | 0:80ee8f3b695e | 237 | * (in the control register) is refreshed before the downcounter has reached |
EricLew | 0:80ee8f3b695e | 238 | * the watchdog window register value. |
EricLew | 0:80ee8f3b695e | 239 | * @rmtoll CFR W LL_WWDG_SetWindow |
EricLew | 0:80ee8f3b695e | 240 | * @param WWDGx WWDG Instance |
EricLew | 0:80ee8f3b695e | 241 | * @param Window 0..0x7F (7 bit Window value) |
EricLew | 0:80ee8f3b695e | 242 | * @retval None |
EricLew | 0:80ee8f3b695e | 243 | */ |
EricLew | 0:80ee8f3b695e | 244 | __STATIC_INLINE void LL_WWDG_SetWindow(WWDG_TypeDef* WWDGx, uint32_t Window) |
EricLew | 0:80ee8f3b695e | 245 | { |
EricLew | 0:80ee8f3b695e | 246 | MODIFY_REG(WWDGx->CFR, WWDG_CFR_W, Window); |
EricLew | 0:80ee8f3b695e | 247 | } |
EricLew | 0:80ee8f3b695e | 248 | |
EricLew | 0:80ee8f3b695e | 249 | /** |
EricLew | 0:80ee8f3b695e | 250 | * @brief Return current Watchdog Window Value (7 bits value) |
EricLew | 0:80ee8f3b695e | 251 | * @rmtoll CFR W LL_WWDG_GetWindow |
EricLew | 0:80ee8f3b695e | 252 | * @param WWDGx WWDG Instance |
EricLew | 0:80ee8f3b695e | 253 | * @retval 7 bit Watchdog Window value |
EricLew | 0:80ee8f3b695e | 254 | */ |
EricLew | 0:80ee8f3b695e | 255 | __STATIC_INLINE uint32_t LL_WWDG_GetWindow(WWDG_TypeDef* WWDGx) |
EricLew | 0:80ee8f3b695e | 256 | { |
EricLew | 0:80ee8f3b695e | 257 | return (uint32_t)(READ_BIT(WWDGx->CFR, WWDG_CFR_W)); |
EricLew | 0:80ee8f3b695e | 258 | } |
EricLew | 0:80ee8f3b695e | 259 | |
EricLew | 0:80ee8f3b695e | 260 | /** |
EricLew | 0:80ee8f3b695e | 261 | * @} |
EricLew | 0:80ee8f3b695e | 262 | */ |
EricLew | 0:80ee8f3b695e | 263 | |
EricLew | 0:80ee8f3b695e | 264 | /** @defgroup WWDG_LL_EF_FLAG_Management FLAG_Management |
EricLew | 0:80ee8f3b695e | 265 | * @{ |
EricLew | 0:80ee8f3b695e | 266 | */ |
EricLew | 0:80ee8f3b695e | 267 | /** |
EricLew | 0:80ee8f3b695e | 268 | * @brief Indicates if the WWDG Early Wakeup Interrupt Flag is set or not. |
EricLew | 0:80ee8f3b695e | 269 | * This bit is set by hardware when the counter has reached the value 0x40. |
EricLew | 0:80ee8f3b695e | 270 | * It must be cleared by software by writing 0. |
EricLew | 0:80ee8f3b695e | 271 | * A write of 1 has no effect. This bit is also set if the interrupt is not enabled. |
EricLew | 0:80ee8f3b695e | 272 | * @rmtoll SR EWIF LL_WWDG_IsActiveFlag_EWKUP |
EricLew | 0:80ee8f3b695e | 273 | * @param WWDGx WWDG Instance |
EricLew | 0:80ee8f3b695e | 274 | * @retval State of bit (1 or 0). |
EricLew | 0:80ee8f3b695e | 275 | */ |
EricLew | 0:80ee8f3b695e | 276 | __STATIC_INLINE uint32_t LL_WWDG_IsActiveFlag_EWKUP(WWDG_TypeDef* WWDGx) |
EricLew | 0:80ee8f3b695e | 277 | { |
EricLew | 0:80ee8f3b695e | 278 | return (READ_BIT(WWDGx->SR, WWDG_SR_EWIF) == (WWDG_SR_EWIF)); |
EricLew | 0:80ee8f3b695e | 279 | } |
EricLew | 0:80ee8f3b695e | 280 | |
EricLew | 0:80ee8f3b695e | 281 | /** |
EricLew | 0:80ee8f3b695e | 282 | * @brief Clear WWDG Early Wakeup Interrupt Flag (EWIF) |
EricLew | 0:80ee8f3b695e | 283 | * @rmtoll SR EWIF LL_WWDG_ClearFlag_EWKUP |
EricLew | 0:80ee8f3b695e | 284 | * @param WWDGx WWDG Instance |
EricLew | 0:80ee8f3b695e | 285 | * @retval None |
EricLew | 0:80ee8f3b695e | 286 | */ |
EricLew | 0:80ee8f3b695e | 287 | __STATIC_INLINE void LL_WWDG_ClearFlag_EWKUP(WWDG_TypeDef* WWDGx) |
EricLew | 0:80ee8f3b695e | 288 | { |
EricLew | 0:80ee8f3b695e | 289 | WRITE_REG(WWDGx->SR, ~WWDG_SR_EWIF); |
EricLew | 0:80ee8f3b695e | 290 | } |
EricLew | 0:80ee8f3b695e | 291 | |
EricLew | 0:80ee8f3b695e | 292 | /** |
EricLew | 0:80ee8f3b695e | 293 | * @} |
EricLew | 0:80ee8f3b695e | 294 | */ |
EricLew | 0:80ee8f3b695e | 295 | |
EricLew | 0:80ee8f3b695e | 296 | /** @defgroup WWDG_LL_EF_IT_Management IT_Management |
EricLew | 0:80ee8f3b695e | 297 | * @{ |
EricLew | 0:80ee8f3b695e | 298 | */ |
EricLew | 0:80ee8f3b695e | 299 | /** |
EricLew | 0:80ee8f3b695e | 300 | * @brief Enable the Early Wakeup Interrupt. When set, an interrupt occurs |
EricLew | 0:80ee8f3b695e | 301 | * whenever the counter reaches the value 0x40. |
EricLew | 0:80ee8f3b695e | 302 | * This interrupt is only cleared by hardware after a reset |
EricLew | 0:80ee8f3b695e | 303 | * @rmtoll CFR EWI LL_WWDG_EnableIT_EWKUP |
EricLew | 0:80ee8f3b695e | 304 | * @param WWDGx WWDG Instance |
EricLew | 0:80ee8f3b695e | 305 | * @retval None |
EricLew | 0:80ee8f3b695e | 306 | */ |
EricLew | 0:80ee8f3b695e | 307 | __STATIC_INLINE void LL_WWDG_EnableIT_EWKUP(WWDG_TypeDef* WWDGx) |
EricLew | 0:80ee8f3b695e | 308 | { |
EricLew | 0:80ee8f3b695e | 309 | SET_BIT(WWDGx->CFR, WWDG_CFR_EWI); |
EricLew | 0:80ee8f3b695e | 310 | } |
EricLew | 0:80ee8f3b695e | 311 | |
EricLew | 0:80ee8f3b695e | 312 | /** |
EricLew | 0:80ee8f3b695e | 313 | * @brief Check if Early Wakeup Interrupt is enabled |
EricLew | 0:80ee8f3b695e | 314 | * @rmtoll CFR EWI LL_WWDG_IsEnabledIT_EWKUP |
EricLew | 0:80ee8f3b695e | 315 | * @param WWDGx WWDG Instance |
EricLew | 0:80ee8f3b695e | 316 | * @retval State of bit (1 or 0). |
EricLew | 0:80ee8f3b695e | 317 | */ |
EricLew | 0:80ee8f3b695e | 318 | __STATIC_INLINE uint32_t LL_WWDG_IsEnabledIT_EWKUP(WWDG_TypeDef* WWDGx) |
EricLew | 0:80ee8f3b695e | 319 | { |
EricLew | 0:80ee8f3b695e | 320 | return (READ_BIT(WWDGx->CFR, WWDG_CFR_EWI) == (WWDG_CFR_EWI)); |
EricLew | 0:80ee8f3b695e | 321 | } |
EricLew | 0:80ee8f3b695e | 322 | |
EricLew | 0:80ee8f3b695e | 323 | /** |
EricLew | 0:80ee8f3b695e | 324 | * @} |
EricLew | 0:80ee8f3b695e | 325 | */ |
EricLew | 0:80ee8f3b695e | 326 | |
EricLew | 0:80ee8f3b695e | 327 | |
EricLew | 0:80ee8f3b695e | 328 | /** |
EricLew | 0:80ee8f3b695e | 329 | * @} |
EricLew | 0:80ee8f3b695e | 330 | */ |
EricLew | 0:80ee8f3b695e | 331 | |
EricLew | 0:80ee8f3b695e | 332 | /** |
EricLew | 0:80ee8f3b695e | 333 | * @} |
EricLew | 0:80ee8f3b695e | 334 | */ |
EricLew | 0:80ee8f3b695e | 335 | |
EricLew | 0:80ee8f3b695e | 336 | #endif /* WWDG */ |
EricLew | 0:80ee8f3b695e | 337 | |
EricLew | 0:80ee8f3b695e | 338 | /** |
EricLew | 0:80ee8f3b695e | 339 | * @} |
EricLew | 0:80ee8f3b695e | 340 | */ |
EricLew | 0:80ee8f3b695e | 341 | |
EricLew | 0:80ee8f3b695e | 342 | #ifdef __cplusplus |
EricLew | 0:80ee8f3b695e | 343 | } |
EricLew | 0:80ee8f3b695e | 344 | #endif |
EricLew | 0:80ee8f3b695e | 345 | |
EricLew | 0:80ee8f3b695e | 346 | #endif /* __STM32L4xx_LL_WWDG_H */ |
EricLew | 0:80ee8f3b695e | 347 | |
EricLew | 0:80ee8f3b695e | 348 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
EricLew | 0:80ee8f3b695e | 349 |