Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h (10978B)
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 * Copyright (c) 2017 STMicroelectronics. 11 * All rights reserved. 12 * 13 * This software is licensed under terms that can be found in the LICENSE file 14 * in the root directory of this software component. 15 * If no LICENSE file comes with this software, it is provided AS-IS. 16 * 17 ****************************************************************************** 18 */ 19 20 /* Define to prevent recursive inclusion -------------------------------------*/ 21 #ifndef __STM32F1xx_HAL_H 22 #define __STM32F1xx_HAL_H 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /* Includes ------------------------------------------------------------------*/ 29 #include "stm32f1xx_hal_conf.h" 30 31 /** @addtogroup STM32F1xx_HAL_Driver 32 * @{ 33 */ 34 35 /** @addtogroup HAL 36 * @{ 37 */ 38 39 /* Exported constants --------------------------------------------------------*/ 40 41 /** @defgroup HAL_Exported_Constants HAL Exported Constants 42 * @{ 43 */ 44 45 /** @defgroup HAL_TICK_FREQ Tick Frequency 46 * @{ 47 */ 48 typedef enum { 49 HAL_TICK_FREQ_10HZ = 100U, 50 HAL_TICK_FREQ_100HZ = 10U, 51 HAL_TICK_FREQ_1KHZ = 1U, 52 HAL_TICK_FREQ_DEFAULT = HAL_TICK_FREQ_1KHZ 53 } HAL_TickFreqTypeDef; 54 /** 55 * @} 56 */ 57 /* Exported types ------------------------------------------------------------*/ 58 extern __IO uint32_t uwTick; 59 extern uint32_t uwTickPrio; 60 extern HAL_TickFreqTypeDef uwTickFreq; 61 62 /** 63 * @} 64 */ 65 /* Exported macro ------------------------------------------------------------*/ 66 /** @defgroup HAL_Exported_Macros HAL Exported Macros 67 * @{ 68 */ 69 70 /** @defgroup DBGMCU_Freeze_Unfreeze Freeze Unfreeze Peripherals in Debug mode 71 * @brief Freeze/Unfreeze Peripherals in Debug mode 72 * Note: On devices STM32F10xx8 and STM32F10xxB, 73 * STM32F101xC/D/E and STM32F103xC/D/E, 74 * STM32F101xF/G and STM32F103xF/G 75 * STM32F10xx4 and STM32F10xx6 76 * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in 77 * debug mode (not accessible by the user software in normal mode). 78 * Refer to errata sheet of these devices for more details. 79 * @{ 80 */ 81 82 /* Peripherals on APB1 */ 83 /** 84 * @brief TIM2 Peripherals Debug mode 85 */ 86 #define __HAL_DBGMCU_FREEZE_TIM2() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM2_STOP) 87 #define __HAL_DBGMCU_UNFREEZE_TIM2() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM2_STOP) 88 89 /** 90 * @brief TIM3 Peripherals Debug mode 91 */ 92 #define __HAL_DBGMCU_FREEZE_TIM3() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM3_STOP) 93 #define __HAL_DBGMCU_UNFREEZE_TIM3() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM3_STOP) 94 95 #if defined (DBGMCU_CR_DBG_TIM4_STOP) 96 /** 97 * @brief TIM4 Peripherals Debug mode 98 */ 99 #define __HAL_DBGMCU_FREEZE_TIM4() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM4_STOP) 100 #define __HAL_DBGMCU_UNFREEZE_TIM4() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM4_STOP) 101 #endif 102 103 #if defined (DBGMCU_CR_DBG_TIM5_STOP) 104 /** 105 * @brief TIM5 Peripherals Debug mode 106 */ 107 #define __HAL_DBGMCU_FREEZE_TIM5() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM5_STOP) 108 #define __HAL_DBGMCU_UNFREEZE_TIM5() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM5_STOP) 109 #endif 110 111 #if defined (DBGMCU_CR_DBG_TIM6_STOP) 112 /** 113 * @brief TIM6 Peripherals Debug mode 114 */ 115 #define __HAL_DBGMCU_FREEZE_TIM6() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM6_STOP) 116 #define __HAL_DBGMCU_UNFREEZE_TIM6() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM6_STOP) 117 #endif 118 119 #if defined (DBGMCU_CR_DBG_TIM7_STOP) 120 /** 121 * @brief TIM7 Peripherals Debug mode 122 */ 123 #define __HAL_DBGMCU_FREEZE_TIM7() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM7_STOP) 124 #define __HAL_DBGMCU_UNFREEZE_TIM7() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM7_STOP) 125 #endif 126 127 #if defined (DBGMCU_CR_DBG_TIM12_STOP) 128 /** 129 * @brief TIM12 Peripherals Debug mode 130 */ 131 #define __HAL_DBGMCU_FREEZE_TIM12() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM12_STOP) 132 #define __HAL_DBGMCU_UNFREEZE_TIM12() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM12_STOP) 133 #endif 134 135 #if defined (DBGMCU_CR_DBG_TIM13_STOP) 136 /** 137 * @brief TIM13 Peripherals Debug mode 138 */ 139 #define __HAL_DBGMCU_FREEZE_TIM13() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM13_STOP) 140 #define __HAL_DBGMCU_UNFREEZE_TIM13() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM13_STOP) 141 #endif 142 143 #if defined (DBGMCU_CR_DBG_TIM14_STOP) 144 /** 145 * @brief TIM14 Peripherals Debug mode 146 */ 147 #define __HAL_DBGMCU_FREEZE_TIM14() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM14_STOP) 148 #define __HAL_DBGMCU_UNFREEZE_TIM14() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM14_STOP) 149 #endif 150 151 /** 152 * @brief WWDG Peripherals Debug mode 153 */ 154 #define __HAL_DBGMCU_FREEZE_WWDG() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP) 155 #define __HAL_DBGMCU_UNFREEZE_WWDG() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP) 156 157 /** 158 * @brief IWDG Peripherals Debug mode 159 */ 160 #define __HAL_DBGMCU_FREEZE_IWDG() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP) 161 #define __HAL_DBGMCU_UNFREEZE_IWDG() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP) 162 163 /** 164 * @brief I2C1 Peripherals Debug mode 165 */ 166 #define __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT) 167 #define __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT) 168 169 #if defined (DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT) 170 /** 171 * @brief I2C2 Peripherals Debug mode 172 */ 173 #define __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT) 174 #define __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT) 175 #endif 176 177 #if defined (DBGMCU_CR_DBG_CAN1_STOP) 178 /** 179 * @brief CAN1 Peripherals Debug mode 180 */ 181 #define __HAL_DBGMCU_FREEZE_CAN1() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN1_STOP) 182 #define __HAL_DBGMCU_UNFREEZE_CAN1() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN1_STOP) 183 #endif 184 185 #if defined (DBGMCU_CR_DBG_CAN2_STOP) 186 /** 187 * @brief CAN2 Peripherals Debug mode 188 */ 189 #define __HAL_DBGMCU_FREEZE_CAN2() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN2_STOP) 190 #define __HAL_DBGMCU_UNFREEZE_CAN2() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN2_STOP) 191 #endif 192 193 /* Peripherals on APB2 */ 194 #if defined (DBGMCU_CR_DBG_TIM1_STOP) 195 /** 196 * @brief TIM1 Peripherals Debug mode 197 */ 198 #define __HAL_DBGMCU_FREEZE_TIM1() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM1_STOP) 199 #define __HAL_DBGMCU_UNFREEZE_TIM1() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM1_STOP) 200 #endif 201 202 #if defined (DBGMCU_CR_DBG_TIM8_STOP) 203 /** 204 * @brief TIM8 Peripherals Debug mode 205 */ 206 #define __HAL_DBGMCU_FREEZE_TIM8() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM8_STOP) 207 #define __HAL_DBGMCU_UNFREEZE_TIM8() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM8_STOP) 208 #endif 209 210 #if defined (DBGMCU_CR_DBG_TIM9_STOP) 211 /** 212 * @brief TIM9 Peripherals Debug mode 213 */ 214 #define __HAL_DBGMCU_FREEZE_TIM9() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM9_STOP) 215 #define __HAL_DBGMCU_UNFREEZE_TIM9() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM9_STOP) 216 #endif 217 218 #if defined (DBGMCU_CR_DBG_TIM10_STOP) 219 /** 220 * @brief TIM10 Peripherals Debug mode 221 */ 222 #define __HAL_DBGMCU_FREEZE_TIM10() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM10_STOP) 223 #define __HAL_DBGMCU_UNFREEZE_TIM10() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM10_STOP) 224 #endif 225 226 #if defined (DBGMCU_CR_DBG_TIM11_STOP) 227 /** 228 * @brief TIM11 Peripherals Debug mode 229 */ 230 #define __HAL_DBGMCU_FREEZE_TIM11() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM11_STOP) 231 #define __HAL_DBGMCU_UNFREEZE_TIM11() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM11_STOP) 232 #endif 233 234 #if defined (DBGMCU_CR_DBG_TIM15_STOP) 235 /** 236 * @brief TIM15 Peripherals Debug mode 237 */ 238 #define __HAL_DBGMCU_FREEZE_TIM15() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM15_STOP) 239 #define __HAL_DBGMCU_UNFREEZE_TIM15() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM15_STOP) 240 #endif 241 242 #if defined (DBGMCU_CR_DBG_TIM16_STOP) 243 /** 244 * @brief TIM16 Peripherals Debug mode 245 */ 246 #define __HAL_DBGMCU_FREEZE_TIM16() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM16_STOP) 247 #define __HAL_DBGMCU_UNFREEZE_TIM16() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM16_STOP) 248 #endif 249 250 #if defined (DBGMCU_CR_DBG_TIM17_STOP) 251 /** 252 * @brief TIM17 Peripherals Debug mode 253 */ 254 #define __HAL_DBGMCU_FREEZE_TIM17() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM17_STOP) 255 #define __HAL_DBGMCU_UNFREEZE_TIM17() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM17_STOP) 256 #endif 257 258 /** 259 * @} 260 */ 261 262 /** @defgroup HAL_Private_Macros HAL Private Macros 263 * @{ 264 */ 265 #define IS_TICKFREQ(FREQ) (((FREQ) == HAL_TICK_FREQ_10HZ) || \ 266 ((FREQ) == HAL_TICK_FREQ_100HZ) || \ 267 ((FREQ) == HAL_TICK_FREQ_1KHZ)) 268 /** 269 * @} 270 */ 271 272 /* Exported functions --------------------------------------------------------*/ 273 /** @addtogroup HAL_Exported_Functions 274 * @{ 275 */ 276 /** @addtogroup HAL_Exported_Functions_Group1 277 * @{ 278 */ 279 /* Initialization and de-initialization functions ******************************/ 280 HAL_StatusTypeDef HAL_Init(void); 281 HAL_StatusTypeDef HAL_DeInit(void); 282 void HAL_MspInit(void); 283 void HAL_MspDeInit(void); 284 HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority); 285 /** 286 * @} 287 */ 288 289 /** @addtogroup HAL_Exported_Functions_Group2 290 * @{ 291 */ 292 /* Peripheral Control functions ************************************************/ 293 void HAL_IncTick(void); 294 void HAL_Delay(uint32_t Delay); 295 uint32_t HAL_GetTick(void); 296 uint32_t HAL_GetTickPrio(void); 297 HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq); 298 HAL_TickFreqTypeDef HAL_GetTickFreq(void); 299 void HAL_SuspendTick(void); 300 void HAL_ResumeTick(void); 301 uint32_t HAL_GetHalVersion(void); 302 uint32_t HAL_GetREVID(void); 303 uint32_t HAL_GetDEVID(void); 304 uint32_t HAL_GetUIDw0(void); 305 uint32_t HAL_GetUIDw1(void); 306 uint32_t HAL_GetUIDw2(void); 307 void HAL_DBGMCU_EnableDBGSleepMode(void); 308 void HAL_DBGMCU_DisableDBGSleepMode(void); 309 void HAL_DBGMCU_EnableDBGStopMode(void); 310 void HAL_DBGMCU_DisableDBGStopMode(void); 311 void HAL_DBGMCU_EnableDBGStandbyMode(void); 312 void HAL_DBGMCU_DisableDBGStandbyMode(void); 313 /** 314 * @} 315 */ 316 317 /** 318 * @} 319 */ 320 321 /** 322 * @} 323 */ 324 /* Private types -------------------------------------------------------------*/ 325 /* Private variables ---------------------------------------------------------*/ 326 /** @defgroup HAL_Private_Variables HAL Private Variables 327 * @{ 328 */ 329 /** 330 * @} 331 */ 332 /* Private constants ---------------------------------------------------------*/ 333 /** @defgroup HAL_Private_Constants HAL Private Constants 334 * @{ 335 */ 336 /** 337 * @} 338 */ 339 /* Private macros ------------------------------------------------------------*/ 340 /* Private functions ---------------------------------------------------------*/ 341 /** 342 * @} 343 */ 344 345 /** 346 * @} 347 */ 348 349 #ifdef __cplusplus 350 } 351 #endif 352 353 #endif /* __STM32F1xx_HAL_H */ 354
