stm32f1xx_hal_tim_ex.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32F1xx_HAL_TIM_EX_H
  21. #define STM32F1xx_HAL_TIM_EX_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32f1xx_hal_def.h"
  27. /** @addtogroup STM32F1xx_HAL_Driver
  28. * @{
  29. */
  30. /** @addtogroup TIMEx
  31. * @{
  32. */
  33. /* Exported types ------------------------------------------------------------*/
  34. /** @defgroup TIMEx_Exported_Types TIM Extended Exported Types
  35. * @{
  36. */
  37. /**
  38. * @brief TIM Hall sensor Configuration Structure definition
  39. */
  40. typedef struct
  41. {
  42. uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal.
  43. This parameter can be a value of @ref TIM_Input_Capture_Polarity */
  44. uint32_t IC1Prescaler; /*!< Specifies the Input Capture Prescaler.
  45. This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
  46. uint32_t IC1Filter; /*!< Specifies the input capture filter.
  47. This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
  48. uint32_t Commutation_Delay; /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
  49. This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
  50. } TIM_HallSensor_InitTypeDef;
  51. /**
  52. * @}
  53. */
  54. /* End of exported types -----------------------------------------------------*/
  55. /* Exported constants --------------------------------------------------------*/
  56. /** @defgroup TIMEx_Exported_Constants TIM Extended Exported Constants
  57. * @{
  58. */
  59. /** @defgroup TIMEx_Remap TIM Extended Remapping
  60. * @{
  61. */
  62. /**
  63. * @}
  64. */
  65. /**
  66. * @}
  67. */
  68. /* End of exported constants -------------------------------------------------*/
  69. /* Exported macro ------------------------------------------------------------*/
  70. /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros
  71. * @{
  72. */
  73. /**
  74. * @}
  75. */
  76. /* End of exported macro -----------------------------------------------------*/
  77. /* Private macro -------------------------------------------------------------*/
  78. /** @defgroup TIMEx_Private_Macros TIM Extended Private Macros
  79. * @{
  80. */
  81. /**
  82. * @}
  83. */
  84. /* End of private macro ------------------------------------------------------*/
  85. /* Exported functions --------------------------------------------------------*/
  86. /** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions
  87. * @{
  88. */
  89. /** @addtogroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions
  90. * @brief Timer Hall Sensor functions
  91. * @{
  92. */
  93. /* Timer Hall Sensor functions **********************************************/
  94. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef *sConfig);
  95. HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim);
  96. void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim);
  97. void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim);
  98. /* Blocking mode: Polling */
  99. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim);
  100. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim);
  101. /* Non-Blocking mode: Interrupt */
  102. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim);
  103. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim);
  104. /* Non-Blocking mode: DMA */
  105. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length);
  106. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim);
  107. /**
  108. * @}
  109. */
  110. /** @addtogroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions
  111. * @brief Timer Complementary Output Compare functions
  112. * @{
  113. */
  114. /* Timer Complementary Output Compare functions *****************************/
  115. /* Blocking mode: Polling */
  116. HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
  117. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
  118. /* Non-Blocking mode: Interrupt */
  119. HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  120. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  121. /* Non-Blocking mode: DMA */
  122. HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, 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, uint32_t *pData, uint16_t Length);
  140. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
  141. /**
  142. * @}
  143. */
  144. /** @addtogroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions
  145. * @brief Timer Complementary One Pulse functions
  146. * @{
  147. */
  148. /* Timer Complementary One Pulse functions **********************************/
  149. /* Blocking mode: Polling */
  150. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  151. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  152. /* Non-Blocking mode: Interrupt */
  153. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  154. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  155. /**
  156. * @}
  157. */
  158. /** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions
  159. * @brief Peripheral Control functions
  160. * @{
  161. */
  162. /* Extended Control functions ************************************************/
  163. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  164. uint32_t CommutationSource);
  165. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  166. uint32_t CommutationSource);
  167. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  168. uint32_t CommutationSource);
  169. HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim,
  170. TIM_MasterConfigTypeDef *sMasterConfig);
  171. HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim,
  172. TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
  173. HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap);
  174. /**
  175. * @}
  176. */
  177. /** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions
  178. * @brief Extended Callbacks functions
  179. * @{
  180. */
  181. /* Extended Callback **********************************************************/
  182. void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim);
  183. void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim);
  184. void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim);
  185. /**
  186. * @}
  187. */
  188. /** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions
  189. * @brief Extended Peripheral State functions
  190. * @{
  191. */
  192. /* Extended Peripheral State functions ***************************************/
  193. HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim);
  194. HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(TIM_HandleTypeDef *htim, uint32_t ChannelN);
  195. /**
  196. * @}
  197. */
  198. /**
  199. * @}
  200. */
  201. /* End of exported functions -------------------------------------------------*/
  202. /* Private functions----------------------------------------------------------*/
  203. /** @addtogroup TIMEx_Private_Functions TIMEx Private Functions
  204. * @{
  205. */
  206. void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
  207. void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma);
  208. /**
  209. * @}
  210. */
  211. /* End of private functions --------------------------------------------------*/
  212. /**
  213. * @}
  214. */
  215. /**
  216. * @}
  217. */
  218. #ifdef __cplusplus
  219. }
  220. #endif
  221. #endif /* STM32F1xx_HAL_TIM_EX_H */
  222. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/