stm32f1xx_hal.h 11 KB

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