2 ******************************************************************************
3 * @file stm32f1xx_hal.h
4 * @author MCD Application Team
7 * @brief This file contains all the functions prototypes for the HAL
9 ******************************************************************************
12 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
14 * Redistribution and use in source and binary forms, with or without modification,
15 * are permitted provided that the following conditions are met:
16 * 1. Redistributions of source code must retain the above copyright notice,
17 * this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright notice,
19 * this list of conditions and the following disclaimer in the documentation
20 * and/or other materials provided with the distribution.
21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 ******************************************************************************
39 /* Define to prevent recursive inclusion -------------------------------------*/
40 #ifndef __STM32F1xx_HAL_H
41 #define __STM32F1xx_HAL_H
47 /* Includes ------------------------------------------------------------------*/
48 #include "stm32f1xx_hal_conf.h"
50 /** @addtogroup STM32F1xx_HAL_Driver
58 /* Exported types ------------------------------------------------------------*/
59 /* Exported constants --------------------------------------------------------*/
61 /* Exported macro ------------------------------------------------------------*/
62 /** @defgroup HAL_Exported_Macros HAL Exported Macros
66 /** @defgroup DBGMCU_Freeze_Unfreeze Freeze Unfreeze Peripherals in Debug mode
67 * @brief Freeze/Unfreeze Peripherals in Debug mode
68 * Note: On devices STM32F10xx8 and STM32F10xxB,
69 * STM32F101xC/D/E and STM32F103xC/D/E,
70 * STM32F101xF/G and STM32F103xF/G
71 * STM32F10xx4 and STM32F10xx6
72 * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in
73 * debug mode (not accessible by the user software in normal mode).
74 * Refer to errata sheet of these devices for more details.
78 /* Peripherals on APB1 */
80 * @brief TIM2 Peripherals Debug mode
82 #define __HAL_DBGMCU_FREEZE_TIM2() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM2_STOP)
83 #define __HAL_DBGMCU_UNFREEZE_TIM2() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM2_STOP)
86 * @brief TIM3 Peripherals Debug mode
88 #define __HAL_DBGMCU_FREEZE_TIM3() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM3_STOP)
89 #define __HAL_DBGMCU_UNFREEZE_TIM3() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM3_STOP)
91 #if defined (DBGMCU_CR_DBG_TIM4_STOP)
93 * @brief TIM4 Peripherals Debug mode
95 #define __HAL_DBGMCU_FREEZE_TIM4() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM4_STOP)
96 #define __HAL_DBGMCU_UNFREEZE_TIM4() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM4_STOP)
99 #if defined (DBGMCU_CR_DBG_TIM5_STOP)
101 * @brief TIM5 Peripherals Debug mode
103 #define __HAL_DBGMCU_FREEZE_TIM5() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM5_STOP)
104 #define __HAL_DBGMCU_UNFREEZE_TIM5() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM5_STOP)
107 #if defined (DBGMCU_CR_DBG_TIM6_STOP)
109 * @brief TIM6 Peripherals Debug mode
111 #define __HAL_DBGMCU_FREEZE_TIM6() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM6_STOP)
112 #define __HAL_DBGMCU_UNFREEZE_TIM6() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM6_STOP)
115 #if defined (DBGMCU_CR_DBG_TIM7_STOP)
117 * @brief TIM7 Peripherals Debug mode
119 #define __HAL_DBGMCU_FREEZE_TIM7() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM7_STOP)
120 #define __HAL_DBGMCU_UNFREEZE_TIM7() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM7_STOP)
123 #if defined (DBGMCU_CR_DBG_TIM12_STOP)
125 * @brief TIM12 Peripherals Debug mode
127 #define __HAL_DBGMCU_FREEZE_TIM12() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM12_STOP)
128 #define __HAL_DBGMCU_UNFREEZE_TIM12() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM12_STOP)
131 #if defined (DBGMCU_CR_DBG_TIM13_STOP)
133 * @brief TIM13 Peripherals Debug mode
135 #define __HAL_DBGMCU_FREEZE_TIM13() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM13_STOP)
136 #define __HAL_DBGMCU_UNFREEZE_TIM13() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM13_STOP)
139 #if defined (DBGMCU_CR_DBG_TIM14_STOP)
141 * @brief TIM14 Peripherals Debug mode
143 #define __HAL_DBGMCU_FREEZE_TIM14() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM14_STOP)
144 #define __HAL_DBGMCU_UNFREEZE_TIM14() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM14_STOP)
148 * @brief WWDG Peripherals Debug mode
150 #define __HAL_DBGMCU_FREEZE_WWDG() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP)
151 #define __HAL_DBGMCU_UNFREEZE_WWDG() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP)
154 * @brief IWDG Peripherals Debug mode
156 #define __HAL_DBGMCU_FREEZE_IWDG() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP)
157 #define __HAL_DBGMCU_UNFREEZE_IWDG() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP)
160 * @brief I2C1 Peripherals Debug mode
162 #define __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT)
163 #define __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT)
165 #if defined (DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT)
167 * @brief I2C2 Peripherals Debug mode
169 #define __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT)
170 #define __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT)
173 #if defined (DBGMCU_CR_DBG_CAN1_STOP)
175 * @brief CAN1 Peripherals Debug mode
177 #define __HAL_DBGMCU_FREEZE_CAN1() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN1_STOP)
178 #define __HAL_DBGMCU_UNFREEZE_CAN1() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN1_STOP)
181 #if defined (DBGMCU_CR_DBG_CAN2_STOP)
183 * @brief CAN2 Peripherals Debug mode
185 #define __HAL_DBGMCU_FREEZE_CAN2() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN2_STOP)
186 #define __HAL_DBGMCU_UNFREEZE_CAN2() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN2_STOP)
189 /* Peripherals on APB2 */
190 #if defined (DBGMCU_CR_DBG_TIM1_STOP)
192 * @brief TIM1 Peripherals Debug mode
194 #define __HAL_DBGMCU_FREEZE_TIM1() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM1_STOP)
195 #define __HAL_DBGMCU_UNFREEZE_TIM1() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM1_STOP)
198 #if defined (DBGMCU_CR_DBG_TIM8_STOP)
200 * @brief TIM8 Peripherals Debug mode
202 #define __HAL_DBGMCU_FREEZE_TIM8() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM8_STOP)
203 #define __HAL_DBGMCU_UNFREEZE_TIM8() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM8_STOP)
206 #if defined (DBGMCU_CR_DBG_TIM9_STOP)
208 * @brief TIM9 Peripherals Debug mode
210 #define __HAL_DBGMCU_FREEZE_TIM9() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM9_STOP)
211 #define __HAL_DBGMCU_UNFREEZE_TIM9() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM9_STOP)
214 #if defined (DBGMCU_CR_DBG_TIM10_STOP)
216 * @brief TIM10 Peripherals Debug mode
218 #define __HAL_DBGMCU_FREEZE_TIM10() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM10_STOP)
219 #define __HAL_DBGMCU_UNFREEZE_TIM10() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM10_STOP)
222 #if defined (DBGMCU_CR_DBG_TIM11_STOP)
224 * @brief TIM11 Peripherals Debug mode
226 #define __HAL_DBGMCU_FREEZE_TIM11() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM11_STOP)
227 #define __HAL_DBGMCU_UNFREEZE_TIM11() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM11_STOP)
231 #if defined (DBGMCU_CR_DBG_TIM15_STOP)
233 * @brief TIM15 Peripherals Debug mode
235 #define __HAL_DBGMCU_FREEZE_TIM15() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM15_STOP)
236 #define __HAL_DBGMCU_UNFREEZE_TIM15() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM15_STOP)
239 #if defined (DBGMCU_CR_DBG_TIM16_STOP)
241 * @brief TIM16 Peripherals Debug mode
243 #define __HAL_DBGMCU_FREEZE_TIM16() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM16_STOP)
244 #define __HAL_DBGMCU_UNFREEZE_TIM16() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM16_STOP)
247 #if defined (DBGMCU_CR_DBG_TIM17_STOP)
249 * @brief TIM17 Peripherals Debug mode
251 #define __HAL_DBGMCU_FREEZE_TIM17() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM17_STOP)
252 #define __HAL_DBGMCU_UNFREEZE_TIM17() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM17_STOP)
263 /* Exported functions --------------------------------------------------------*/
264 /** @addtogroup HAL_Exported_Functions
267 /** @addtogroup HAL_Exported_Functions_Group1
270 /* Initialization and de-initialization functions ******************************/
271 HAL_StatusTypeDef
HAL_Init(void);
272 HAL_StatusTypeDef
HAL_DeInit(void);
273 void HAL_MspInit(void);
274 void HAL_MspDeInit(void);
275 HAL_StatusTypeDef
HAL_InitTick (uint32_t TickPriority
);
280 /** @addtogroup HAL_Exported_Functions_Group2
283 /* Peripheral Control functions ************************************************/
284 void HAL_IncTick(void);
285 void HAL_Delay(__IO
uint32_t Delay
);
286 uint32_t HAL_GetTick(void);
287 void HAL_SuspendTick(void);
288 void HAL_ResumeTick(void);
289 uint32_t HAL_GetHalVersion(void);
290 uint32_t HAL_GetREVID(void);
291 uint32_t HAL_GetDEVID(void);
292 void HAL_DBGMCU_EnableDBGSleepMode(void);
293 void HAL_DBGMCU_DisableDBGSleepMode(void);
294 void HAL_DBGMCU_EnableDBGStopMode(void);
295 void HAL_DBGMCU_DisableDBGStopMode(void);
296 void HAL_DBGMCU_EnableDBGStandbyMode(void);
297 void HAL_DBGMCU_DisableDBGStandbyMode(void);
298 void HAL_GetUID(uint32_t *UID
);
306 /* Private types -------------------------------------------------------------*/
307 /* Private variables ---------------------------------------------------------*/
308 /** @defgroup HAL_Private_Variables HAL Private Variables
314 /* Private constants ---------------------------------------------------------*/
315 /** @defgroup HAL_Private_Constants HAL Private Constants
321 /* Private macros ------------------------------------------------------------*/
322 /* Private functions ---------------------------------------------------------*/
335 #endif /* __STM32F1xx_HAL_H */
337 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/