Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | /** |
2 | ****************************************************************************** |
||
3 | * @file stm32f1xx_hal.h |
||
4 | * @author MCD Application Team |
||
5 | * @brief This file contains all the functions prototypes for the HAL |
||
6 | * module driver. |
||
7 | ****************************************************************************** |
||
8 | * @attention |
||
9 | * |
||
10 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
||
11 | * |
||
12 | * Redistribution and use in source and binary forms, with or without modification, |
||
13 | * are permitted provided that the following conditions are met: |
||
14 | * 1. Redistributions of source code must retain the above copyright notice, |
||
15 | * this list of conditions and the following disclaimer. |
||
16 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
||
17 | * this list of conditions and the following disclaimer in the documentation |
||
18 | * and/or other materials provided with the distribution. |
||
19 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
||
20 | * may be used to endorse or promote products derived from this software |
||
21 | * without specific prior written permission. |
||
22 | * |
||
23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
24 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
26 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
||
27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||
28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||
29 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||
30 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||
31 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||
32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
33 | * |
||
34 | ****************************************************************************** |
||
35 | */ |
||
36 | |||
37 | /* Define to prevent recursive inclusion -------------------------------------*/ |
||
38 | #ifndef __STM32F1xx_HAL_H |
||
39 | #define __STM32F1xx_HAL_H |
||
40 | |||
41 | #ifdef __cplusplus |
||
42 | extern "C" { |
||
43 | #endif |
||
44 | |||
45 | /* Includes ------------------------------------------------------------------*/ |
||
46 | #include "stm32f1xx_hal_conf.h" |
||
47 | |||
48 | /** @addtogroup STM32F1xx_HAL_Driver |
||
49 | * @{ |
||
50 | */ |
||
51 | |||
52 | /** @addtogroup HAL |
||
53 | * @{ |
||
54 | */ |
||
55 | |||
56 | /* Exported constants --------------------------------------------------------*/ |
||
57 | |||
58 | /** @defgroup HAL_Exported_Constants HAL Exported Constants |
||
59 | * @{ |
||
60 | */ |
||
61 | |||
62 | /** @defgroup HAL_TICK_FREQ Tick Frequency |
||
63 | * @{ |
||
64 | */ |
||
65 | typedef enum |
||
66 | { |
||
67 | HAL_TICK_FREQ_10HZ = 100U, |
||
68 | HAL_TICK_FREQ_100HZ = 10U, |
||
69 | HAL_TICK_FREQ_1KHZ = 1U, |
||
70 | HAL_TICK_FREQ_DEFAULT = HAL_TICK_FREQ_1KHZ |
||
71 | } HAL_TickFreqTypeDef; |
||
72 | /** |
||
73 | * @} |
||
74 | */ |
||
75 | /* Exported types ------------------------------------------------------------*/ |
||
76 | extern uint32_t uwTickPrio; |
||
77 | extern HAL_TickFreqTypeDef uwTickFreq; |
||
78 | |||
79 | /** |
||
80 | * @} |
||
81 | */ |
||
82 | /* Exported macro ------------------------------------------------------------*/ |
||
83 | /** @defgroup HAL_Exported_Macros HAL Exported Macros |
||
84 | * @{ |
||
85 | */ |
||
86 | |||
87 | /** @defgroup DBGMCU_Freeze_Unfreeze Freeze Unfreeze Peripherals in Debug mode |
||
88 | * @brief Freeze/Unfreeze Peripherals in Debug mode |
||
89 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
||
90 | * STM32F101xC/D/E and STM32F103xC/D/E, |
||
91 | * STM32F101xF/G and STM32F103xF/G |
||
92 | * STM32F10xx4 and STM32F10xx6 |
||
93 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
||
94 | * debug mode (not accessible by the user software in normal mode). |
||
95 | * Refer to errata sheet of these devices for more details. |
||
96 | * @{ |
||
97 | */ |
||
98 | |||
99 | /* Peripherals on APB1 */ |
||
100 | /** |
||
101 | * @brief TIM2 Peripherals Debug mode |
||
102 | */ |
||
103 | #define __HAL_DBGMCU_FREEZE_TIM2() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM2_STOP) |
||
104 | #define __HAL_DBGMCU_UNFREEZE_TIM2() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM2_STOP) |
||
105 | |||
106 | /** |
||
107 | * @brief TIM3 Peripherals Debug mode |
||
108 | */ |
||
109 | #define __HAL_DBGMCU_FREEZE_TIM3() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM3_STOP) |
||
110 | #define __HAL_DBGMCU_UNFREEZE_TIM3() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM3_STOP) |
||
111 | |||
112 | #if defined (DBGMCU_CR_DBG_TIM4_STOP) |
||
113 | /** |
||
114 | * @brief TIM4 Peripherals Debug mode |
||
115 | */ |
||
116 | #define __HAL_DBGMCU_FREEZE_TIM4() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM4_STOP) |
||
117 | #define __HAL_DBGMCU_UNFREEZE_TIM4() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM4_STOP) |
||
118 | #endif |
||
119 | |||
120 | #if defined (DBGMCU_CR_DBG_TIM5_STOP) |
||
121 | /** |
||
122 | * @brief TIM5 Peripherals Debug mode |
||
123 | */ |
||
124 | #define __HAL_DBGMCU_FREEZE_TIM5() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM5_STOP) |
||
125 | #define __HAL_DBGMCU_UNFREEZE_TIM5() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM5_STOP) |
||
126 | #endif |
||
127 | |||
128 | #if defined (DBGMCU_CR_DBG_TIM6_STOP) |
||
129 | /** |
||
130 | * @brief TIM6 Peripherals Debug mode |
||
131 | */ |
||
132 | #define __HAL_DBGMCU_FREEZE_TIM6() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM6_STOP) |
||
133 | #define __HAL_DBGMCU_UNFREEZE_TIM6() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM6_STOP) |
||
134 | #endif |
||
135 | |||
136 | #if defined (DBGMCU_CR_DBG_TIM7_STOP) |
||
137 | /** |
||
138 | * @brief TIM7 Peripherals Debug mode |
||
139 | */ |
||
140 | #define __HAL_DBGMCU_FREEZE_TIM7() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM7_STOP) |
||
141 | #define __HAL_DBGMCU_UNFREEZE_TIM7() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM7_STOP) |
||
142 | #endif |
||
143 | |||
144 | #if defined (DBGMCU_CR_DBG_TIM12_STOP) |
||
145 | /** |
||
146 | * @brief TIM12 Peripherals Debug mode |
||
147 | */ |
||
148 | #define __HAL_DBGMCU_FREEZE_TIM12() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM12_STOP) |
||
149 | #define __HAL_DBGMCU_UNFREEZE_TIM12() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM12_STOP) |
||
150 | #endif |
||
151 | |||
152 | #if defined (DBGMCU_CR_DBG_TIM13_STOP) |
||
153 | /** |
||
154 | * @brief TIM13 Peripherals Debug mode |
||
155 | */ |
||
156 | #define __HAL_DBGMCU_FREEZE_TIM13() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM13_STOP) |
||
157 | #define __HAL_DBGMCU_UNFREEZE_TIM13() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM13_STOP) |
||
158 | #endif |
||
159 | |||
160 | #if defined (DBGMCU_CR_DBG_TIM14_STOP) |
||
161 | /** |
||
162 | * @brief TIM14 Peripherals Debug mode |
||
163 | */ |
||
164 | #define __HAL_DBGMCU_FREEZE_TIM14() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM14_STOP) |
||
165 | #define __HAL_DBGMCU_UNFREEZE_TIM14() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM14_STOP) |
||
166 | #endif |
||
167 | |||
168 | /** |
||
169 | * @brief WWDG Peripherals Debug mode |
||
170 | */ |
||
171 | #define __HAL_DBGMCU_FREEZE_WWDG() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP) |
||
172 | #define __HAL_DBGMCU_UNFREEZE_WWDG() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP) |
||
173 | |||
174 | /** |
||
175 | * @brief IWDG Peripherals Debug mode |
||
176 | */ |
||
177 | #define __HAL_DBGMCU_FREEZE_IWDG() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP) |
||
178 | #define __HAL_DBGMCU_UNFREEZE_IWDG() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP) |
||
179 | |||
180 | /** |
||
181 | * @brief I2C1 Peripherals Debug mode |
||
182 | */ |
||
183 | #define __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT) |
||
184 | #define __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT) |
||
185 | |||
186 | #if defined (DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT) |
||
187 | /** |
||
188 | * @brief I2C2 Peripherals Debug mode |
||
189 | */ |
||
190 | #define __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT) |
||
191 | #define __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT) |
||
192 | #endif |
||
193 | |||
194 | #if defined (DBGMCU_CR_DBG_CAN1_STOP) |
||
195 | /** |
||
196 | * @brief CAN1 Peripherals Debug mode |
||
197 | */ |
||
198 | #define __HAL_DBGMCU_FREEZE_CAN1() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN1_STOP) |
||
199 | #define __HAL_DBGMCU_UNFREEZE_CAN1() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN1_STOP) |
||
200 | #endif |
||
201 | |||
202 | #if defined (DBGMCU_CR_DBG_CAN2_STOP) |
||
203 | /** |
||
204 | * @brief CAN2 Peripherals Debug mode |
||
205 | */ |
||
206 | #define __HAL_DBGMCU_FREEZE_CAN2() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN2_STOP) |
||
207 | #define __HAL_DBGMCU_UNFREEZE_CAN2() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN2_STOP) |
||
208 | #endif |
||
209 | |||
210 | /* Peripherals on APB2 */ |
||
211 | #if defined (DBGMCU_CR_DBG_TIM1_STOP) |
||
212 | /** |
||
213 | * @brief TIM1 Peripherals Debug mode |
||
214 | */ |
||
215 | #define __HAL_DBGMCU_FREEZE_TIM1() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM1_STOP) |
||
216 | #define __HAL_DBGMCU_UNFREEZE_TIM1() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM1_STOP) |
||
217 | #endif |
||
218 | |||
219 | #if defined (DBGMCU_CR_DBG_TIM8_STOP) |
||
220 | /** |
||
221 | * @brief TIM8 Peripherals Debug mode |
||
222 | */ |
||
223 | #define __HAL_DBGMCU_FREEZE_TIM8() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM8_STOP) |
||
224 | #define __HAL_DBGMCU_UNFREEZE_TIM8() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM8_STOP) |
||
225 | #endif |
||
226 | |||
227 | #if defined (DBGMCU_CR_DBG_TIM9_STOP) |
||
228 | /** |
||
229 | * @brief TIM9 Peripherals Debug mode |
||
230 | */ |
||
231 | #define __HAL_DBGMCU_FREEZE_TIM9() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM9_STOP) |
||
232 | #define __HAL_DBGMCU_UNFREEZE_TIM9() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM9_STOP) |
||
233 | #endif |
||
234 | |||
235 | #if defined (DBGMCU_CR_DBG_TIM10_STOP) |
||
236 | /** |
||
237 | * @brief TIM10 Peripherals Debug mode |
||
238 | */ |
||
239 | #define __HAL_DBGMCU_FREEZE_TIM10() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM10_STOP) |
||
240 | #define __HAL_DBGMCU_UNFREEZE_TIM10() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM10_STOP) |
||
241 | #endif |
||
242 | |||
243 | #if defined (DBGMCU_CR_DBG_TIM11_STOP) |
||
244 | /** |
||
245 | * @brief TIM11 Peripherals Debug mode |
||
246 | */ |
||
247 | #define __HAL_DBGMCU_FREEZE_TIM11() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM11_STOP) |
||
248 | #define __HAL_DBGMCU_UNFREEZE_TIM11() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM11_STOP) |
||
249 | #endif |
||
250 | |||
251 | |||
252 | #if defined (DBGMCU_CR_DBG_TIM15_STOP) |
||
253 | /** |
||
254 | * @brief TIM15 Peripherals Debug mode |
||
255 | */ |
||
256 | #define __HAL_DBGMCU_FREEZE_TIM15() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM15_STOP) |
||
257 | #define __HAL_DBGMCU_UNFREEZE_TIM15() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM15_STOP) |
||
258 | #endif |
||
259 | |||
260 | #if defined (DBGMCU_CR_DBG_TIM16_STOP) |
||
261 | /** |
||
262 | * @brief TIM16 Peripherals Debug mode |
||
263 | */ |
||
264 | #define __HAL_DBGMCU_FREEZE_TIM16() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM16_STOP) |
||
265 | #define __HAL_DBGMCU_UNFREEZE_TIM16() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM16_STOP) |
||
266 | #endif |
||
267 | |||
268 | #if defined (DBGMCU_CR_DBG_TIM17_STOP) |
||
269 | /** |
||
270 | * @brief TIM17 Peripherals Debug mode |
||
271 | */ |
||
272 | #define __HAL_DBGMCU_FREEZE_TIM17() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM17_STOP) |
||
273 | #define __HAL_DBGMCU_UNFREEZE_TIM17() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM17_STOP) |
||
274 | #endif |
||
275 | |||
276 | /** |
||
277 | * @} |
||
278 | */ |
||
279 | |||
280 | /** @defgroup HAL_Private_Macros HAL Private Macros |
||
281 | * @{ |
||
282 | */ |
||
283 | #define IS_TICKFREQ(FREQ) (((FREQ) == HAL_TICK_FREQ_10HZ) || \ |
||
284 | ((FREQ) == HAL_TICK_FREQ_100HZ) || \ |
||
285 | ((FREQ) == HAL_TICK_FREQ_1KHZ)) |
||
286 | /** |
||
287 | * @} |
||
288 | */ |
||
289 | |||
290 | /* Exported functions --------------------------------------------------------*/ |
||
291 | /** @addtogroup HAL_Exported_Functions |
||
292 | * @{ |
||
293 | */ |
||
294 | /** @addtogroup HAL_Exported_Functions_Group1 |
||
295 | * @{ |
||
296 | */ |
||
297 | /* Initialization and de-initialization functions ******************************/ |
||
298 | HAL_StatusTypeDef HAL_Init(void); |
||
299 | HAL_StatusTypeDef HAL_DeInit(void); |
||
300 | void HAL_MspInit(void); |
||
301 | void HAL_MspDeInit(void); |
||
302 | HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority); |
||
303 | /** |
||
304 | * @} |
||
305 | */ |
||
306 | |||
307 | /** @addtogroup HAL_Exported_Functions_Group2 |
||
308 | * @{ |
||
309 | */ |
||
310 | /* Peripheral Control functions ************************************************/ |
||
311 | void HAL_IncTick(void); |
||
312 | void HAL_Delay(uint32_t Delay); |
||
313 | uint32_t HAL_GetTick(void); |
||
314 | uint32_t HAL_GetTickPrio(void); |
||
315 | HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq); |
||
316 | HAL_TickFreqTypeDef HAL_GetTickFreq(void); |
||
317 | void HAL_SuspendTick(void); |
||
318 | void HAL_ResumeTick(void); |
||
319 | uint32_t HAL_GetHalVersion(void); |
||
320 | uint32_t HAL_GetREVID(void); |
||
321 | uint32_t HAL_GetDEVID(void); |
||
322 | void HAL_DBGMCU_EnableDBGSleepMode(void); |
||
323 | void HAL_DBGMCU_DisableDBGSleepMode(void); |
||
324 | void HAL_DBGMCU_EnableDBGStopMode(void); |
||
325 | void HAL_DBGMCU_DisableDBGStopMode(void); |
||
326 | void HAL_DBGMCU_EnableDBGStandbyMode(void); |
||
327 | void HAL_DBGMCU_DisableDBGStandbyMode(void); |
||
328 | void HAL_GetUID(uint32_t *UID); |
||
329 | /** |
||
330 | * @} |
||
331 | */ |
||
332 | |||
333 | /** |
||
334 | * @} |
||
335 | */ |
||
336 | /* Private types -------------------------------------------------------------*/ |
||
337 | /* Private variables ---------------------------------------------------------*/ |
||
338 | /** @defgroup HAL_Private_Variables HAL Private Variables |
||
339 | * @{ |
||
340 | */ |
||
341 | /** |
||
342 | * @} |
||
343 | */ |
||
344 | /* Private constants ---------------------------------------------------------*/ |
||
345 | /** @defgroup HAL_Private_Constants HAL Private Constants |
||
346 | * @{ |
||
347 | */ |
||
348 | /** |
||
349 | * @} |
||
350 | */ |
||
351 | /* Private macros ------------------------------------------------------------*/ |
||
352 | /* Private functions ---------------------------------------------------------*/ |
||
353 | /** |
||
354 | * @} |
||
355 | */ |
||
356 | |||
357 | /** |
||
358 | * @} |
||
359 | */ |
||
360 | |||
361 | #ifdef __cplusplus |
||
362 | } |
||
363 | #endif |
||
364 | |||
365 | #endif /* __STM32F1xx_HAL_H */ |
||
366 | |||
367 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |