Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 9 | ||
|---|---|---|---|
| Line 4... | Line 4... | ||
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @brief Header file of WWDG LL module. |
5 | * @brief Header file of WWDG LL module. |
| 6 | ****************************************************************************** |
6 | ****************************************************************************** |
| 7 | * @attention |
7 | * @attention |
| 8 | * |
8 | * |
| 9 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
| - | 10 | * All rights reserved.</center></h2> |
|
| 10 | * |
11 | * |
| 11 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
| 12 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
| 13 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
| 14 | * this list of conditions and the following disclaimer. |
- | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
| 16 | * this list of conditions and the following disclaimer in the documentation |
- | |
| 17 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
| 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
| 19 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
| 20 | * without specific prior written permission. |
- | |
| 21 | * |
- | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
| 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
| 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
| 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
| 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
| 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
| 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
| 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
| 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
| 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
| 32 | * |
16 | * |
| 33 | ****************************************************************************** |
17 | ****************************************************************************** |
| 34 | */ |
18 | */ |
| 35 | 19 | ||
| 36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| 37 | #ifndef __STM32F1xx_LL_WWDG_H |
21 | #ifndef STM32F1xx_LL_WWDG_H |
| 38 | #define __STM32F1xx_LL_WWDG_H |
22 | #define STM32F1xx_LL_WWDG_H |
| 39 | 23 | ||
| 40 | #ifdef __cplusplus |
24 | #ifdef __cplusplus |
| 41 | extern "C" { |
25 | extern "C" { |
| 42 | #endif |
26 | #endif |
| 43 | 27 | ||
| Line 54... | Line 38... | ||
| 54 | * @{ |
38 | * @{ |
| 55 | */ |
39 | */ |
| 56 | 40 | ||
| 57 | /* Private types -------------------------------------------------------------*/ |
41 | /* Private types -------------------------------------------------------------*/ |
| 58 | /* Private variables ---------------------------------------------------------*/ |
42 | /* Private variables ---------------------------------------------------------*/ |
| 59 | - | ||
| 60 | /* Private constants ---------------------------------------------------------*/ |
43 | /* Private constants ---------------------------------------------------------*/ |
| 61 | - | ||
| 62 | /* Private macros ------------------------------------------------------------*/ |
44 | /* Private macros ------------------------------------------------------------*/ |
| 63 | - | ||
| 64 | /* Exported types ------------------------------------------------------------*/ |
45 | /* Exported types ------------------------------------------------------------*/ |
| 65 | /* Exported constants --------------------------------------------------------*/ |
46 | /* Exported constants --------------------------------------------------------*/ |
| 66 | /** @defgroup WWDG_LL_Exported_Constants WWDG Exported Constants |
47 | /** @defgroup WWDG_LL_Exported_Constants WWDG Exported Constants |
| 67 | * @{ |
48 | * @{ |
| 68 | */ |
49 | */ |
| 69 | 50 | ||
| 70 | - | ||
| 71 | /** @defgroup WWDG_LL_EC_IT IT Defines |
51 | /** @defgroup WWDG_LL_EC_IT IT Defines |
| 72 | * @brief IT defines which can be used with LL_WWDG_ReadReg and LL_WWDG_WriteReg functions |
52 | * @brief IT defines which can be used with LL_WWDG_ReadReg and LL_WWDG_WriteReg functions |
| 73 | * @{ |
53 | * @{ |
| 74 | */ |
54 | */ |
| 75 | #define LL_WWDG_CFR_EWI WWDG_CFR_EWI |
55 | #define LL_WWDG_CFR_EWI WWDG_CFR_EWI |
| 76 | /** |
56 | /** |
| 77 | * @} |
57 | * @} |
| 78 | */ |
58 | */ |
| 79 | 59 | ||
| 80 | /** @defgroup WWDG_LL_EC_PRESCALER PRESCALER |
60 | /** @defgroup WWDG_LL_EC_PRESCALER PRESCALER |
| 81 | * @{ |
61 | * @{ |
| 82 | */ |
62 | */ |
| 83 | #define LL_WWDG_PRESCALER_1 0x00000000U /*!< WWDG counter clock = (PCLK1/4096)/1 */ |
63 | #define LL_WWDG_PRESCALER_1 0x00000000u /*!< WWDG counter clock = (PCLK1/4096)/1 */ |
| 84 | #define LL_WWDG_PRESCALER_2 WWDG_CFR_WDGTB_0 /*!< WWDG counter clock = (PCLK1/4096)/2 */ |
64 | #define LL_WWDG_PRESCALER_2 WWDG_CFR_WDGTB_0 /*!< WWDG counter clock = (PCLK1/4096)/2 */ |
| 85 | #define LL_WWDG_PRESCALER_4 WWDG_CFR_WDGTB_1 /*!< WWDG counter clock = (PCLK1/4096)/4 */ |
65 | #define LL_WWDG_PRESCALER_4 WWDG_CFR_WDGTB_1 /*!< WWDG counter clock = (PCLK1/4096)/4 */ |
| 86 | #define LL_WWDG_PRESCALER_8 (WWDG_CFR_WDGTB_0 | WWDG_CFR_WDGTB_1) /*!< WWDG counter clock = (PCLK1/4096)/8 */ |
66 | #define LL_WWDG_PRESCALER_8 (WWDG_CFR_WDGTB_0 | WWDG_CFR_WDGTB_1) /*!< WWDG counter clock = (PCLK1/4096)/8 */ |
| 87 | /** |
67 | /** |
| 88 | * @} |
68 | * @} |
| 89 | */ |
69 | */ |
| 90 | 70 | ||
| 91 | /** |
71 | /** |
| Line 117... | Line 97... | ||
| 117 | #define LL_WWDG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
97 | #define LL_WWDG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
| 118 | /** |
98 | /** |
| 119 | * @} |
99 | * @} |
| 120 | */ |
100 | */ |
| 121 | 101 | ||
| 122 | - | ||
| 123 | /** |
102 | /** |
| 124 | * @} |
103 | * @} |
| 125 | */ |
104 | */ |
| 126 | 105 | ||
| 127 | /* Exported functions --------------------------------------------------------*/ |
106 | /* Exported functions --------------------------------------------------------*/ |
| Line 153... | Line 132... | ||
| 153 | * @param WWDGx WWDG Instance |
132 | * @param WWDGx WWDG Instance |
| 154 | * @retval State of bit (1 or 0). |
133 | * @retval State of bit (1 or 0). |
| 155 | */ |
134 | */ |
| 156 | __STATIC_INLINE uint32_t LL_WWDG_IsEnabled(WWDG_TypeDef *WWDGx) |
135 | __STATIC_INLINE uint32_t LL_WWDG_IsEnabled(WWDG_TypeDef *WWDGx) |
| 157 | { |
136 | { |
| 158 | return (READ_BIT(WWDGx->CR, WWDG_CR_WDGA) == (WWDG_CR_WDGA)); |
137 | return ((READ_BIT(WWDGx->CR, WWDG_CR_WDGA) == (WWDG_CR_WDGA)) ? 1UL : 0UL); |
| 159 | } |
138 | } |
| 160 | 139 | ||
| 161 | /** |
140 | /** |
| 162 | * @brief Set the Watchdog counter value to provided value (7-bits T[6:0]) |
141 | * @brief Set the Watchdog counter value to provided value (7-bits T[6:0]) |
| 163 | * @note When writing to the WWDG_CR register, always write 1 in the MSB b6 to avoid generating an immediate reset |
142 | * @note When writing to the WWDG_CR register, always write 1 in the MSB b6 to avoid generating an immediate reset |
| Line 180... | Line 159... | ||
| 180 | * @param WWDGx WWDG Instance |
159 | * @param WWDGx WWDG Instance |
| 181 | * @retval 7 bit Watchdog Counter value |
160 | * @retval 7 bit Watchdog Counter value |
| 182 | */ |
161 | */ |
| 183 | __STATIC_INLINE uint32_t LL_WWDG_GetCounter(WWDG_TypeDef *WWDGx) |
162 | __STATIC_INLINE uint32_t LL_WWDG_GetCounter(WWDG_TypeDef *WWDGx) |
| 184 | { |
163 | { |
| 185 | return (uint32_t)(READ_BIT(WWDGx->CR, WWDG_CR_T)); |
164 | return (READ_BIT(WWDGx->CR, WWDG_CR_T)); |
| 186 | } |
165 | } |
| 187 | 166 | ||
| 188 | /** |
167 | /** |
| 189 | * @brief Set the time base of the prescaler (WDGTB). |
168 | * @brief Set the time base of the prescaler (WDGTB). |
| 190 | * @note Prescaler is used to apply ratio on PCLK clock, so that Watchdog counter |
169 | * @note Prescaler is used to apply ratio on PCLK clock, so that Watchdog counter |
| Line 213... | Line 192... | ||
| 213 | * @arg @ref LL_WWDG_PRESCALER_4 |
192 | * @arg @ref LL_WWDG_PRESCALER_4 |
| 214 | * @arg @ref LL_WWDG_PRESCALER_8 |
193 | * @arg @ref LL_WWDG_PRESCALER_8 |
| 215 | */ |
194 | */ |
| 216 | __STATIC_INLINE uint32_t LL_WWDG_GetPrescaler(WWDG_TypeDef *WWDGx) |
195 | __STATIC_INLINE uint32_t LL_WWDG_GetPrescaler(WWDG_TypeDef *WWDGx) |
| 217 | { |
196 | { |
| 218 | return (uint32_t)(READ_BIT(WWDGx->CFR, WWDG_CFR_WDGTB)); |
197 | return (READ_BIT(WWDGx->CFR, WWDG_CFR_WDGTB)); |
| 219 | } |
198 | } |
| 220 | 199 | ||
| 221 | /** |
200 | /** |
| 222 | * @brief Set the Watchdog Window value to be compared to the downcounter (7-bits W[6:0]). |
201 | * @brief Set the Watchdog Window value to be compared to the downcounter (7-bits W[6:0]). |
| 223 | * @note This window value defines when write in the WWDG_CR register |
202 | * @note This window value defines when write in the WWDG_CR register |
| Line 245... | Line 224... | ||
| 245 | * @param WWDGx WWDG Instance |
224 | * @param WWDGx WWDG Instance |
| 246 | * @retval 7 bit Watchdog Window value |
225 | * @retval 7 bit Watchdog Window value |
| 247 | */ |
226 | */ |
| 248 | __STATIC_INLINE uint32_t LL_WWDG_GetWindow(WWDG_TypeDef *WWDGx) |
227 | __STATIC_INLINE uint32_t LL_WWDG_GetWindow(WWDG_TypeDef *WWDGx) |
| 249 | { |
228 | { |
| 250 | return (uint32_t)(READ_BIT(WWDGx->CFR, WWDG_CFR_W)); |
229 | return (READ_BIT(WWDGx->CFR, WWDG_CFR_W)); |
| 251 | } |
230 | } |
| 252 | 231 | ||
| 253 | /** |
232 | /** |
| 254 | * @} |
233 | * @} |
| 255 | */ |
234 | */ |
| Line 266... | Line 245... | ||
| 266 | * @param WWDGx WWDG Instance |
245 | * @param WWDGx WWDG Instance |
| 267 | * @retval State of bit (1 or 0). |
246 | * @retval State of bit (1 or 0). |
| 268 | */ |
247 | */ |
| 269 | __STATIC_INLINE uint32_t LL_WWDG_IsActiveFlag_EWKUP(WWDG_TypeDef *WWDGx) |
248 | __STATIC_INLINE uint32_t LL_WWDG_IsActiveFlag_EWKUP(WWDG_TypeDef *WWDGx) |
| 270 | { |
249 | { |
| 271 | return (READ_BIT(WWDGx->SR, WWDG_SR_EWIF) == (WWDG_SR_EWIF)); |
250 | return ((READ_BIT(WWDGx->SR, WWDG_SR_EWIF) == (WWDG_SR_EWIF)) ? 1UL : 0UL); |
| 272 | } |
251 | } |
| 273 | 252 | ||
| 274 | /** |
253 | /** |
| 275 | * @brief Clear WWDG Early Wakeup Interrupt Flag (EWIF) |
254 | * @brief Clear WWDG Early Wakeup Interrupt Flag (EWIF) |
| 276 | * @rmtoll SR EWIF LL_WWDG_ClearFlag_EWKUP |
255 | * @rmtoll SR EWIF LL_WWDG_ClearFlag_EWKUP |
| Line 308... | Line 287... | ||
| 308 | * @param WWDGx WWDG Instance |
287 | * @param WWDGx WWDG Instance |
| 309 | * @retval State of bit (1 or 0). |
288 | * @retval State of bit (1 or 0). |
| 310 | */ |
289 | */ |
| 311 | __STATIC_INLINE uint32_t LL_WWDG_IsEnabledIT_EWKUP(WWDG_TypeDef *WWDGx) |
290 | __STATIC_INLINE uint32_t LL_WWDG_IsEnabledIT_EWKUP(WWDG_TypeDef *WWDGx) |
| 312 | { |
291 | { |
| 313 | return (READ_BIT(WWDGx->CFR, WWDG_CFR_EWI) == (WWDG_CFR_EWI)); |
292 | return ((READ_BIT(WWDGx->CFR, WWDG_CFR_EWI) == (WWDG_CFR_EWI)) ? 1UL : 0UL); |
| 314 | } |
293 | } |
| 315 | 294 | ||
| 316 | /** |
295 | /** |
| 317 | * @} |
296 | * @} |
| 318 | */ |
297 | */ |
| Line 333... | Line 312... | ||
| 333 | 312 | ||
| 334 | #ifdef __cplusplus |
313 | #ifdef __cplusplus |
| 335 | } |
314 | } |
| 336 | #endif |
315 | #endif |
| 337 | 316 | ||
| 338 | #endif /* __STM32F1xx_LL_WWDG_H */ |
317 | #endif /* STM32F1xx_LL_WWDG_H */ |
| 339 | 318 | ||
| 340 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
319 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |