stm32f1xx_hal.h 11 KB

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