stm32f1xx_hal_tim_ex.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_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 STM32F1xx_HAL_TIM_EX_H
  20. #define STM32F1xx_HAL_TIM_EX_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32f1xx_hal_def.h"
  26. /** @addtogroup STM32F1xx_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. /**
  62. * @}
  63. */
  64. /**
  65. * @}
  66. */
  67. /* End of exported constants -------------------------------------------------*/
  68. /* Exported macro ------------------------------------------------------------*/
  69. /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros
  70. * @{
  71. */
  72. /**
  73. * @}
  74. */
  75. /* End of exported macro -----------------------------------------------------*/
  76. /* Private macro -------------------------------------------------------------*/
  77. /** @defgroup TIMEx_Private_Macros TIM Extended Private Macros
  78. * @{
  79. */
  80. /**
  81. * @}
  82. */
  83. /* End of private macro ------------------------------------------------------*/
  84. /* Exported functions --------------------------------------------------------*/
  85. /** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions
  86. * @{
  87. */
  88. /** @addtogroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions
  89. * @brief Timer Hall Sensor functions
  90. * @{
  91. */
  92. /* Timer Hall Sensor functions **********************************************/
  93. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, const TIM_HallSensor_InitTypeDef *sConfig);
  94. HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim);
  95. void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim);
  96. void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim);
  97. /* Blocking mode: Polling */
  98. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim);
  99. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim);
  100. /* Non-Blocking mode: Interrupt */
  101. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim);
  102. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim);
  103. /* Non-Blocking mode: DMA */
  104. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length);
  105. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim);
  106. /**
  107. * @}
  108. */
  109. /** @addtogroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions
  110. * @brief Timer Complementary Output Compare functions
  111. * @{
  112. */
  113. /* Timer Complementary Output Compare functions *****************************/
  114. /* Blocking mode: Polling */
  115. HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
  116. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
  117. /* Non-Blocking mode: Interrupt */
  118. HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  119. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  120. /* Non-Blocking mode: DMA */
  121. HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData,
  122. uint16_t Length);
  123. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
  124. /**
  125. * @}
  126. */
  127. /** @addtogroup TIMEx_Exported_Functions_Group3 Extended Timer Complementary PWM functions
  128. * @brief Timer Complementary PWM functions
  129. * @{
  130. */
  131. /* Timer Complementary PWM functions ****************************************/
  132. /* Blocking mode: Polling */
  133. HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
  134. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
  135. /* Non-Blocking mode: Interrupt */
  136. HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  137. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  138. /* Non-Blocking mode: DMA */
  139. HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData,
  140. uint16_t Length);
  141. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
  142. /**
  143. * @}
  144. */
  145. /** @addtogroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions
  146. * @brief Timer Complementary One Pulse functions
  147. * @{
  148. */
  149. /* Timer Complementary One Pulse functions **********************************/
  150. /* Blocking mode: Polling */
  151. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  152. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  153. /* Non-Blocking mode: Interrupt */
  154. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  155. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  156. /**
  157. * @}
  158. */
  159. /** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions
  160. * @brief Peripheral Control functions
  161. * @{
  162. */
  163. /* Extended Control functions ************************************************/
  164. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  165. uint32_t CommutationSource);
  166. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  167. uint32_t CommutationSource);
  168. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  169. uint32_t CommutationSource);
  170. HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim,
  171. const TIM_MasterConfigTypeDef *sMasterConfig);
  172. HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim,
  173. const TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
  174. HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap);
  175. /**
  176. * @}
  177. */
  178. /** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions
  179. * @brief Extended Callbacks functions
  180. * @{
  181. */
  182. /* Extended Callback **********************************************************/
  183. void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim);
  184. void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim);
  185. void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim);
  186. /**
  187. * @}
  188. */
  189. /** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions
  190. * @brief Extended Peripheral State functions
  191. * @{
  192. */
  193. /* Extended Peripheral State functions ***************************************/
  194. HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(const TIM_HandleTypeDef *htim);
  195. HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(const TIM_HandleTypeDef *htim, uint32_t ChannelN);
  196. /**
  197. * @}
  198. */
  199. /**
  200. * @}
  201. */
  202. /* End of exported functions -------------------------------------------------*/
  203. /* Private functions----------------------------------------------------------*/
  204. /** @addtogroup TIMEx_Private_Functions TIM Extended Private Functions
  205. * @{
  206. */
  207. void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
  208. void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma);
  209. /**
  210. * @}
  211. */
  212. /* End of private functions --------------------------------------------------*/
  213. /**
  214. * @}
  215. */
  216. /**
  217. * @}
  218. */
  219. #ifdef __cplusplus
  220. }
  221. #endif
  222. #endif /* STM32F1xx_HAL_TIM_EX_H */