stm32f0xx_hal_tim_ex.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /**
  2. ******************************************************************************
  3. * @file stm32f0xx_hal_tim_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of TIM HAL Extended module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2016 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32F0xx_HAL_TIM_EX_H
  20. #define STM32F0xx_HAL_TIM_EX_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32f0xx_hal_def.h"
  26. /** @addtogroup STM32F0xx_HAL_Driver
  27. * @{
  28. */
  29. /** @addtogroup TIMEx
  30. * @{
  31. */
  32. /* Exported types ------------------------------------------------------------*/
  33. /** @defgroup TIMEx_Exported_Types TIM Extended Exported Types
  34. * @{
  35. */
  36. /**
  37. * @brief TIM Hall sensor Configuration Structure definition
  38. */
  39. typedef struct
  40. {
  41. uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal.
  42. This parameter can be a value of @ref TIM_Input_Capture_Polarity */
  43. uint32_t IC1Prescaler; /*!< Specifies the Input Capture Prescaler.
  44. This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
  45. uint32_t IC1Filter; /*!< Specifies the input capture filter.
  46. This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
  47. uint32_t Commutation_Delay; /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
  48. This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
  49. } TIM_HallSensor_InitTypeDef;
  50. /**
  51. * @}
  52. */
  53. /* End of exported types -----------------------------------------------------*/
  54. /* Exported constants --------------------------------------------------------*/
  55. /** @defgroup TIMEx_Exported_Constants TIM Extended Exported Constants
  56. * @{
  57. */
  58. /** @defgroup TIMEx_Remap TIM Extended Remapping
  59. * @{
  60. */
  61. #define TIM_TIM14_GPIO (0x00000000U) /*!< TIM14 TI1 is connected to GPIO */
  62. #define TIM_TIM14_RTC (0x00000001U) /*!< TIM14 TI1 is connected to RTC_clock */
  63. #define TIM_TIM14_HSE (0x00000002U) /*!< TIM14 TI1 is connected to HSE/32U */
  64. #define TIM_TIM14_MCO (0x00000003U) /*!< TIM14 TI1 is connected to MCO */
  65. /**
  66. * @}
  67. */
  68. /**
  69. * @}
  70. */
  71. /* End of exported constants -------------------------------------------------*/
  72. /* Exported macro ------------------------------------------------------------*/
  73. /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros
  74. * @{
  75. */
  76. /**
  77. * @}
  78. */
  79. /* End of exported macro -----------------------------------------------------*/
  80. /* Private macro -------------------------------------------------------------*/
  81. /** @defgroup TIMEx_Private_Macros TIM Extended Private Macros
  82. * @{
  83. */
  84. #define IS_TIM_REMAP(__INSTANCE__, __REMAP__) \
  85. (((__INSTANCE__) == TIM14) && (((__REMAP__) & 0xFFFFFFFCU) == 0x00000000U))
  86. /**
  87. * @}
  88. */
  89. /* End of private macro ------------------------------------------------------*/
  90. /* Exported functions --------------------------------------------------------*/
  91. /** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions
  92. * @{
  93. */
  94. /** @addtogroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions
  95. * @brief Timer Hall Sensor functions
  96. * @{
  97. */
  98. /* Timer Hall Sensor functions **********************************************/
  99. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, const TIM_HallSensor_InitTypeDef *sConfig);
  100. HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim);
  101. void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim);
  102. void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim);
  103. /* Blocking mode: Polling */
  104. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim);
  105. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim);
  106. /* Non-Blocking mode: Interrupt */
  107. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim);
  108. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim);
  109. /* Non-Blocking mode: DMA */
  110. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length);
  111. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim);
  112. /**
  113. * @}
  114. */
  115. /** @addtogroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions
  116. * @brief Timer Complementary Output Compare functions
  117. * @{
  118. */
  119. /* Timer Complementary Output Compare functions *****************************/
  120. /* Blocking mode: Polling */
  121. HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
  122. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
  123. /* Non-Blocking mode: Interrupt */
  124. HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  125. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  126. /* Non-Blocking mode: DMA */
  127. HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData,
  128. uint16_t Length);
  129. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
  130. /**
  131. * @}
  132. */
  133. /** @addtogroup TIMEx_Exported_Functions_Group3 Extended Timer Complementary PWM functions
  134. * @brief Timer Complementary PWM functions
  135. * @{
  136. */
  137. /* Timer Complementary PWM functions ****************************************/
  138. /* Blocking mode: Polling */
  139. HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
  140. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
  141. /* Non-Blocking mode: Interrupt */
  142. HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  143. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  144. /* Non-Blocking mode: DMA */
  145. HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData,
  146. uint16_t Length);
  147. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
  148. /**
  149. * @}
  150. */
  151. /** @addtogroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions
  152. * @brief Timer Complementary One Pulse functions
  153. * @{
  154. */
  155. /* Timer Complementary One Pulse functions **********************************/
  156. /* Blocking mode: Polling */
  157. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  158. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  159. /* Non-Blocking mode: Interrupt */
  160. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  161. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  162. /**
  163. * @}
  164. */
  165. /** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions
  166. * @brief Peripheral Control functions
  167. * @{
  168. */
  169. /* Extended Control functions ************************************************/
  170. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  171. uint32_t CommutationSource);
  172. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  173. uint32_t CommutationSource);
  174. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  175. uint32_t CommutationSource);
  176. HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim,
  177. const TIM_MasterConfigTypeDef *sMasterConfig);
  178. HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim,
  179. const TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
  180. HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap);
  181. /**
  182. * @}
  183. */
  184. /** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions
  185. * @brief Extended Callbacks functions
  186. * @{
  187. */
  188. /* Extended Callback **********************************************************/
  189. void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim);
  190. void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim);
  191. void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim);
  192. /**
  193. * @}
  194. */
  195. /** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions
  196. * @brief Extended Peripheral State functions
  197. * @{
  198. */
  199. /* Extended Peripheral State functions ***************************************/
  200. HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(const TIM_HandleTypeDef *htim);
  201. HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(const TIM_HandleTypeDef *htim, uint32_t ChannelN);
  202. /**
  203. * @}
  204. */
  205. /**
  206. * @}
  207. */
  208. /* End of exported functions -------------------------------------------------*/
  209. /* Private functions----------------------------------------------------------*/
  210. /** @addtogroup TIMEx_Private_Functions TIM Extended Private Functions
  211. * @{
  212. */
  213. void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
  214. void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma);
  215. /**
  216. * @}
  217. */
  218. /* End of private functions --------------------------------------------------*/
  219. /**
  220. * @}
  221. */
  222. /**
  223. * @}
  224. */
  225. #ifdef __cplusplus
  226. }
  227. #endif
  228. #endif /* STM32F0xx_HAL_TIM_EX_H */