Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | /** |
2 | ****************************************************************************** |
||
3 | * @file stm32f0xx_hal_iwdg.h |
||
4 | * @author MCD Application Team |
||
5 | * @brief Header file of IWDG HAL module. |
||
6 | ****************************************************************************** |
||
7 | * @attention |
||
8 | * |
||
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
||
10 | * All rights reserved.</center></h2> |
||
11 | * |
||
12 | * This software component is licensed by ST under BSD 3-Clause license, |
||
13 | * the "License"; You may not use this file except in compliance with the |
||
14 | * License. You may obtain a copy of the License at: |
||
15 | * opensource.org/licenses/BSD-3-Clause |
||
16 | * |
||
17 | ****************************************************************************** |
||
18 | */ |
||
19 | |||
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
||
21 | #ifndef STM32F0xx_HAL_IWDG_H |
||
22 | #define STM32F0xx_HAL_IWDG_H |
||
23 | |||
24 | #ifdef __cplusplus |
||
25 | extern "C" { |
||
26 | #endif |
||
27 | |||
28 | /* Includes ------------------------------------------------------------------*/ |
||
29 | #include "stm32f0xx_hal_def.h" |
||
30 | |||
31 | /** @addtogroup STM32F0xx_HAL_Driver |
||
32 | * @{ |
||
33 | */ |
||
34 | |||
35 | /** @defgroup IWDG IWDG |
||
36 | * @{ |
||
37 | */ |
||
38 | |||
39 | /* Exported types ------------------------------------------------------------*/ |
||
40 | /** @defgroup IWDG_Exported_Types IWDG Exported Types |
||
41 | * @{ |
||
42 | */ |
||
43 | |||
44 | /** |
||
45 | * @brief IWDG Init structure definition |
||
46 | */ |
||
47 | typedef struct |
||
48 | { |
||
49 | uint32_t Prescaler; /*!< Select the prescaler of the IWDG. |
||
50 | This parameter can be a value of @ref IWDG_Prescaler */ |
||
51 | |||
52 | uint32_t Reload; /*!< Specifies the IWDG down-counter reload value. |
||
53 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */ |
||
54 | |||
55 | uint32_t Window; /*!< Specifies the window value to be compared to the down-counter. |
||
56 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */ |
||
57 | |||
58 | } IWDG_InitTypeDef; |
||
59 | |||
60 | /** |
||
61 | * @brief IWDG Handle Structure definition |
||
62 | */ |
||
63 | typedef struct |
||
64 | { |
||
65 | IWDG_TypeDef *Instance; /*!< Register base address */ |
||
66 | |||
67 | IWDG_InitTypeDef Init; /*!< IWDG required parameters */ |
||
68 | } IWDG_HandleTypeDef; |
||
69 | |||
70 | |||
71 | /** |
||
72 | * @} |
||
73 | */ |
||
74 | |||
75 | /* Exported constants --------------------------------------------------------*/ |
||
76 | /** @defgroup IWDG_Exported_Constants IWDG Exported Constants |
||
77 | * @{ |
||
78 | */ |
||
79 | |||
80 | /** @defgroup IWDG_Prescaler IWDG Prescaler |
||
81 | * @{ |
||
82 | */ |
||
83 | #define IWDG_PRESCALER_4 0x00000000u /*!< IWDG prescaler set to 4 */ |
||
84 | #define IWDG_PRESCALER_8 IWDG_PR_PR_0 /*!< IWDG prescaler set to 8 */ |
||
85 | #define IWDG_PRESCALER_16 IWDG_PR_PR_1 /*!< IWDG prescaler set to 16 */ |
||
86 | #define IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 32 */ |
||
87 | #define IWDG_PRESCALER_64 IWDG_PR_PR_2 /*!< IWDG prescaler set to 64 */ |
||
88 | #define IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 128 */ |
||
89 | #define IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< IWDG prescaler set to 256 */ |
||
90 | /** |
||
91 | * @} |
||
92 | */ |
||
93 | |||
94 | /** @defgroup IWDG_Window_option IWDG Window option |
||
95 | * @{ |
||
96 | */ |
||
97 | #define IWDG_WINDOW_DISABLE IWDG_WINR_WIN |
||
98 | /** |
||
99 | * @} |
||
100 | */ |
||
101 | |||
102 | /** |
||
103 | * @} |
||
104 | */ |
||
105 | |||
106 | /* Exported macros -----------------------------------------------------------*/ |
||
107 | /** @defgroup IWDG_Exported_Macros IWDG Exported Macros |
||
108 | * @{ |
||
109 | */ |
||
110 | |||
111 | /** |
||
112 | * @brief Enable the IWDG peripheral. |
||
113 | * @param __HANDLE__ IWDG handle |
||
114 | * @retval None |
||
115 | */ |
||
116 | #define __HAL_IWDG_START(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_ENABLE) |
||
117 | |||
118 | /** |
||
119 | * @brief Reload IWDG counter with value defined in the reload register |
||
120 | * (write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers disabled). |
||
121 | * @param __HANDLE__ IWDG handle |
||
122 | * @retval None |
||
123 | */ |
||
124 | #define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_RELOAD) |
||
125 | |||
126 | /** |
||
127 | * @} |
||
128 | */ |
||
129 | |||
130 | /* Exported functions --------------------------------------------------------*/ |
||
131 | /** @defgroup IWDG_Exported_Functions IWDG Exported Functions |
||
132 | * @{ |
||
133 | */ |
||
134 | |||
135 | /** @defgroup IWDG_Exported_Functions_Group1 Initialization and Start functions |
||
136 | * @{ |
||
137 | */ |
||
138 | /* Initialization/Start functions ********************************************/ |
||
6 | mjames | 139 | HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg); |
2 | mjames | 140 | /** |
141 | * @} |
||
142 | */ |
||
143 | |||
144 | /** @defgroup IWDG_Exported_Functions_Group2 IO operation functions |
||
145 | * @{ |
||
146 | */ |
||
147 | /* I/O operation functions ****************************************************/ |
||
6 | mjames | 148 | HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg); |
2 | mjames | 149 | /** |
150 | * @} |
||
151 | */ |
||
152 | |||
153 | /** |
||
154 | * @} |
||
155 | */ |
||
156 | |||
157 | /* Private constants ---------------------------------------------------------*/ |
||
158 | /** @defgroup IWDG_Private_Constants IWDG Private Constants |
||
159 | * @{ |
||
160 | */ |
||
161 | |||
162 | /** |
||
163 | * @brief IWDG Key Register BitMask |
||
164 | */ |
||
165 | #define IWDG_KEY_RELOAD 0x0000AAAAu /*!< IWDG Reload Counter Enable */ |
||
166 | #define IWDG_KEY_ENABLE 0x0000CCCCu /*!< IWDG Peripheral Enable */ |
||
167 | #define IWDG_KEY_WRITE_ACCESS_ENABLE 0x00005555u /*!< IWDG KR Write Access Enable */ |
||
168 | #define IWDG_KEY_WRITE_ACCESS_DISABLE 0x00000000u /*!< IWDG KR Write Access Disable */ |
||
169 | |||
170 | /** |
||
171 | * @} |
||
172 | */ |
||
173 | |||
174 | /* Private macros ------------------------------------------------------------*/ |
||
175 | /** @defgroup IWDG_Private_Macros IWDG Private Macros |
||
176 | * @{ |
||
177 | */ |
||
178 | |||
179 | /** |
||
180 | * @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. |
||
181 | * @param __HANDLE__ IWDG handle |
||
182 | * @retval None |
||
183 | */ |
||
184 | #define IWDG_ENABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_ENABLE) |
||
185 | |||
186 | /** |
||
187 | * @brief Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. |
||
188 | * @param __HANDLE__ IWDG handle |
||
189 | * @retval None |
||
190 | */ |
||
191 | #define IWDG_DISABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_DISABLE) |
||
192 | |||
193 | /** |
||
194 | * @brief Check IWDG prescaler value. |
||
195 | * @param __PRESCALER__ IWDG prescaler value |
||
196 | * @retval None |
||
197 | */ |
||
198 | #define IS_IWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == IWDG_PRESCALER_4) || \ |
||
199 | ((__PRESCALER__) == IWDG_PRESCALER_8) || \ |
||
200 | ((__PRESCALER__) == IWDG_PRESCALER_16) || \ |
||
201 | ((__PRESCALER__) == IWDG_PRESCALER_32) || \ |
||
202 | ((__PRESCALER__) == IWDG_PRESCALER_64) || \ |
||
203 | ((__PRESCALER__) == IWDG_PRESCALER_128)|| \ |
||
204 | ((__PRESCALER__) == IWDG_PRESCALER_256)) |
||
205 | |||
206 | /** |
||
207 | * @brief Check IWDG reload value. |
||
208 | * @param __RELOAD__ IWDG reload value |
||
209 | * @retval None |
||
210 | */ |
||
211 | #define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= IWDG_RLR_RL) |
||
212 | |||
213 | /** |
||
214 | * @brief Check IWDG window value. |
||
215 | * @param __WINDOW__ IWDG window value |
||
216 | * @retval None |
||
217 | */ |
||
218 | #define IS_IWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= IWDG_WINR_WIN) |
||
219 | |||
220 | |||
221 | /** |
||
222 | * @} |
||
223 | */ |
||
224 | |||
225 | /** |
||
226 | * @} |
||
227 | */ |
||
228 | |||
229 | /** |
||
230 | * @} |
||
231 | */ |
||
232 | |||
233 | |||
234 | #ifdef __cplusplus |
||
235 | } |
||
236 | #endif |
||
237 | |||
238 | #endif /* STM32F0xx_HAL_IWDG_H */ |
||
239 | |||
240 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |