stm32f2xx_hal.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /**
  2. ******************************************************************************
  3. * @file stm32f2xx_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) 2016 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 __STM32F2xx_HAL_H
  22. #define __STM32F2xx_HAL_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* Includes ------------------------------------------------------------------*/
  27. #include "stm32f2xx_hal_conf.h"
  28. /** @addtogroup STM32F2xx_HAL_Driver
  29. * @{
  30. */
  31. /** @addtogroup HAL
  32. * @{
  33. */
  34. /* Exported types ------------------------------------------------------------*/
  35. /* Exported constants --------------------------------------------------------*/
  36. /** @defgroup HAL_Exported_Constants HAL Exported Constants
  37. * @{
  38. */
  39. /** @defgroup HAL_TICK_FREQ Tick Frequency
  40. * @{
  41. */
  42. typedef enum
  43. {
  44. HAL_TICK_FREQ_10HZ = 100U,
  45. HAL_TICK_FREQ_100HZ = 10U,
  46. HAL_TICK_FREQ_1KHZ = 1U,
  47. HAL_TICK_FREQ_DEFAULT = HAL_TICK_FREQ_1KHZ
  48. } HAL_TickFreqTypeDef;
  49. /**
  50. * @}
  51. */
  52. /**
  53. * @}
  54. */
  55. /* Exported macro ------------------------------------------------------------*/
  56. /** @defgroup HAL_Exported_Macros HAL Exported Macros
  57. * @{
  58. */
  59. /** @brief Freeze/Unfreeze Peripherals in Debug mode
  60. */
  61. #define __HAL_DBGMCU_FREEZE_TIM2() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM2_STOP))
  62. #define __HAL_DBGMCU_FREEZE_TIM3() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM3_STOP))
  63. #define __HAL_DBGMCU_FREEZE_TIM4() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM4_STOP))
  64. #define __HAL_DBGMCU_FREEZE_TIM5() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM5_STOP))
  65. #define __HAL_DBGMCU_FREEZE_TIM6() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM6_STOP))
  66. #define __HAL_DBGMCU_FREEZE_TIM7() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM7_STOP))
  67. #define __HAL_DBGMCU_FREEZE_TIM12() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM12_STOP))
  68. #define __HAL_DBGMCU_FREEZE_TIM13() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM13_STOP))
  69. #define __HAL_DBGMCU_FREEZE_TIM14() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_TIM14_STOP))
  70. #define __HAL_DBGMCU_FREEZE_RTC() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_RTC_STOP))
  71. #define __HAL_DBGMCU_FREEZE_WWDG() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_WWDG_STOP))
  72. #define __HAL_DBGMCU_FREEZE_IWDG() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_IWDG_STOP))
  73. #define __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT))
  74. #define __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT))
  75. #define __HAL_DBGMCU_FREEZE_I2C3_TIMEOUT() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT))
  76. #define __HAL_DBGMCU_FREEZE_CAN1() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_CAN1_STOP))
  77. #define __HAL_DBGMCU_FREEZE_CAN2() (DBGMCU->APB1FZ |= (DBGMCU_APB1_FZ_DBG_CAN2_STOP))
  78. #define __HAL_DBGMCU_FREEZE_TIM1() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM1_STOP))
  79. #define __HAL_DBGMCU_FREEZE_TIM8() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM8_STOP))
  80. #define __HAL_DBGMCU_FREEZE_TIM9() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM9_STOP))
  81. #define __HAL_DBGMCU_FREEZE_TIM10() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM10_STOP))
  82. #define __HAL_DBGMCU_FREEZE_TIM11() (DBGMCU->APB2FZ |= (DBGMCU_APB2_FZ_DBG_TIM11_STOP))
  83. #define __HAL_DBGMCU_UNFREEZE_TIM2() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM2_STOP))
  84. #define __HAL_DBGMCU_UNFREEZE_TIM3() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM3_STOP))
  85. #define __HAL_DBGMCU_UNFREEZE_TIM4() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM4_STOP))
  86. #define __HAL_DBGMCU_UNFREEZE_TIM5() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM5_STOP))
  87. #define __HAL_DBGMCU_UNFREEZE_TIM6() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM6_STOP))
  88. #define __HAL_DBGMCU_UNFREEZE_TIM7() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM7_STOP))
  89. #define __HAL_DBGMCU_UNFREEZE_TIM12() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM12_STOP))
  90. #define __HAL_DBGMCU_UNFREEZE_TIM13() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM13_STOP))
  91. #define __HAL_DBGMCU_UNFREEZE_TIM14() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_TIM14_STOP))
  92. #define __HAL_DBGMCU_UNFREEZE_RTC() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_RTC_STOP))
  93. #define __HAL_DBGMCU_UNFREEZE_WWDG() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_WWDG_STOP))
  94. #define __HAL_DBGMCU_UNFREEZE_IWDG() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_IWDG_STOP))
  95. #define __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT))
  96. #define __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT))
  97. #define __HAL_DBGMCU_UNFREEZE_I2C3_TIMEOUT() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT))
  98. #define __HAL_DBGMCU_UNFREEZE_CAN1() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_CAN1_STOP))
  99. #define __HAL_DBGMCU_UNFREEZE_CAN2() (DBGMCU->APB1FZ &= ~(DBGMCU_APB1_FZ_DBG_CAN2_STOP))
  100. #define __HAL_DBGMCU_UNFREEZE_TIM1() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM1_STOP))
  101. #define __HAL_DBGMCU_UNFREEZE_TIM8() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM8_STOP))
  102. #define __HAL_DBGMCU_UNFREEZE_TIM9() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM9_STOP))
  103. #define __HAL_DBGMCU_UNFREEZE_TIM10() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM10_STOP))
  104. #define __HAL_DBGMCU_UNFREEZE_TIM11() (DBGMCU->APB2FZ &= ~(DBGMCU_APB2_FZ_DBG_TIM11_STOP))
  105. /** @brief Main Flash memory mapped at 0x00000000
  106. */
  107. #define __HAL_SYSCFG_REMAPMEMORY_FLASH() (SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE))
  108. /** @brief System Flash memory mapped at 0x00000000
  109. */
  110. #define __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\
  111. SYSCFG->MEMRMP |= SYSCFG_MEMRMP_MEM_MODE_0;\
  112. }while(0);
  113. /** @brief Embedded SRAM mapped at 0x00000000
  114. */
  115. #define __HAL_SYSCFG_REMAPMEMORY_SRAM() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\
  116. SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_MEM_MODE_0 | SYSCFG_MEMRMP_MEM_MODE_1);\
  117. }while(0);
  118. /** @brief FSMC Bank1 (NOR/PSRAM 1 and 2) mapped at 0x00000000
  119. */
  120. #define __HAL_SYSCFG_REMAPMEMORY_FSMC() do {SYSCFG->MEMRMP &= ~(SYSCFG_MEMRMP_MEM_MODE);\
  121. SYSCFG->MEMRMP |= (SYSCFG_MEMRMP_MEM_MODE_1);\
  122. }while(0);
  123. /**
  124. * @}
  125. */
  126. /** @defgroup HAL_Private_Macros HAL Private Macros
  127. * @{
  128. */
  129. #define IS_TICKFREQ(FREQ) (((FREQ) == HAL_TICK_FREQ_10HZ) || \
  130. ((FREQ) == HAL_TICK_FREQ_100HZ) || \
  131. ((FREQ) == HAL_TICK_FREQ_1KHZ))
  132. /**
  133. * @}
  134. */
  135. /* Exported functions --------------------------------------------------------*/
  136. /** @addtogroup HAL_Exported_Functions
  137. * @{
  138. */
  139. /** @addtogroup HAL_Exported_Functions_Group1
  140. * @{
  141. */
  142. /* Initialization and de-initialization functions ******************************/
  143. HAL_StatusTypeDef HAL_Init(void);
  144. HAL_StatusTypeDef HAL_DeInit(void);
  145. void HAL_MspInit(void);
  146. void HAL_MspDeInit(void);
  147. HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority);
  148. /**
  149. * @}
  150. */
  151. /* Exported variables ---------------------------------------------------------*/
  152. /** @addtogroup HAL_Exported_Variables
  153. * @{
  154. */
  155. extern __IO uint32_t uwTick;
  156. extern uint32_t uwTickPrio;
  157. extern HAL_TickFreqTypeDef uwTickFreq;
  158. /**
  159. * @}
  160. */
  161. /** @addtogroup HAL_Exported_Functions_Group2
  162. * @{
  163. */
  164. /* Peripheral Control functions ************************************************/
  165. void HAL_IncTick(void);
  166. void HAL_Delay(__IO uint32_t Delay);
  167. uint32_t HAL_GetTick(void);
  168. uint32_t HAL_GetTickPrio(void);
  169. HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq);
  170. HAL_TickFreqTypeDef HAL_GetTickFreq(void);
  171. void HAL_SuspendTick(void);
  172. void HAL_ResumeTick(void);
  173. uint32_t HAL_GetHalVersion(void);
  174. uint32_t HAL_GetREVID(void);
  175. uint32_t HAL_GetDEVID(void);
  176. void HAL_DBGMCU_EnableDBGSleepMode(void);
  177. void HAL_DBGMCU_DisableDBGSleepMode(void);
  178. void HAL_DBGMCU_EnableDBGStopMode(void);
  179. void HAL_DBGMCU_DisableDBGStopMode(void);
  180. void HAL_DBGMCU_EnableDBGStandbyMode(void);
  181. void HAL_DBGMCU_DisableDBGStandbyMode(void);
  182. void HAL_EnableCompensationCell(void);
  183. void HAL_DisableCompensationCell(void);
  184. uint32_t HAL_GetUIDw0(void);
  185. uint32_t HAL_GetUIDw1(void);
  186. uint32_t HAL_GetUIDw2(void);
  187. /**
  188. * @}
  189. */
  190. /**
  191. * @}
  192. */
  193. /* Private types -------------------------------------------------------------*/
  194. /* Private variables ---------------------------------------------------------*/
  195. /** @defgroup HAL_Private_Variables HAL Private Variables
  196. * @{
  197. */
  198. /**
  199. * @}
  200. */
  201. /* Private constants ---------------------------------------------------------*/
  202. /** @defgroup HAL_Private_Constants HAL Private Constants
  203. * @{
  204. */
  205. /**
  206. * @}
  207. */
  208. /* Private macros ------------------------------------------------------------*/
  209. /* Private functions ---------------------------------------------------------*/
  210. /**
  211. * @}
  212. */
  213. /**
  214. * @}
  215. */
  216. #ifdef __cplusplus
  217. }
  218. #endif
  219. #endif /* __STM32F2xx_HAL_H */
  220. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/