stm32f0xx_hal_tim_ex.h 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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. * <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 STM32F0xx_HAL_TIM_EX_H
  21. #define STM32F0xx_HAL_TIM_EX_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32f0xx_hal_def.h"
  27. /** @addtogroup STM32F0xx_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. #define TIM_TIM14_GPIO (0x00000000U) /*!< TIM14 TI1 is connected to GPIO */
  63. #define TIM_TIM14_RTC (0x00000001U) /*!< TIM14 TI1 is connected to RTC_clock */
  64. #define TIM_TIM14_HSE (0x00000002U) /*!< TIM14 TI1 is connected to HSE/32U */
  65. #define TIM_TIM14_MCO (0x00000003U) /*!< TIM14 TI1 is connected to MCO */
  66. /**
  67. * @}
  68. */
  69. /**
  70. * @}
  71. */
  72. /* End of exported constants -------------------------------------------------*/
  73. /* Exported macro ------------------------------------------------------------*/
  74. /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros
  75. * @{
  76. */
  77. /**
  78. * @}
  79. */
  80. /* End of exported macro -----------------------------------------------------*/
  81. /* Private macro -------------------------------------------------------------*/
  82. /** @defgroup TIMEx_Private_Macros TIM Extended Private Macros
  83. * @{
  84. */
  85. #define IS_TIM_REMAP(__INSTANCE__, __REMAP__) \
  86. (((__INSTANCE__) == TIM14) && (((__REMAP__) & 0xFFFFFFFCU) == 0x00000000U))
  87. /**
  88. * @}
  89. */
  90. /* End of private macro ------------------------------------------------------*/
  91. /* Exported functions --------------------------------------------------------*/
  92. /** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions
  93. * @{
  94. */
  95. /** @addtogroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions
  96. * @brief Timer Hall Sensor functions
  97. * @{
  98. */
  99. /* Timer Hall Sensor functions **********************************************/
  100. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef *sConfig);
  101. HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim);
  102. void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim);
  103. void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim);
  104. /* Blocking mode: Polling */
  105. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim);
  106. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim);
  107. /* Non-Blocking mode: Interrupt */
  108. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim);
  109. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim);
  110. /* Non-Blocking mode: DMA */
  111. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length);
  112. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim);
  113. /**
  114. * @}
  115. */
  116. /** @addtogroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions
  117. * @brief Timer Complementary Output Compare functions
  118. * @{
  119. */
  120. /* Timer Complementary Output Compare functions *****************************/
  121. /* Blocking mode: Polling */
  122. HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
  123. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
  124. /* Non-Blocking mode: Interrupt */
  125. HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  126. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  127. /* Non-Blocking mode: DMA */
  128. HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, 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, uint32_t *pData, uint16_t Length);
  146. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
  147. /**
  148. * @}
  149. */
  150. /** @addtogroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions
  151. * @brief Timer Complementary One Pulse functions
  152. * @{
  153. */
  154. /* Timer Complementary One Pulse functions **********************************/
  155. /* Blocking mode: Polling */
  156. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  157. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  158. /* Non-Blocking mode: Interrupt */
  159. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  160. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  161. /**
  162. * @}
  163. */
  164. /** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions
  165. * @brief Peripheral Control functions
  166. * @{
  167. */
  168. /* Extended Control functions ************************************************/
  169. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  170. uint32_t CommutationSource);
  171. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  172. uint32_t CommutationSource);
  173. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  174. uint32_t CommutationSource);
  175. HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim,
  176. TIM_MasterConfigTypeDef *sMasterConfig);
  177. HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim,
  178. TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
  179. HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap);
  180. /**
  181. * @}
  182. */
  183. /** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions
  184. * @brief Extended Callbacks functions
  185. * @{
  186. */
  187. /* Extended Callback **********************************************************/
  188. void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim);
  189. void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim);
  190. void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim);
  191. /**
  192. * @}
  193. */
  194. /** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions
  195. * @brief Extended Peripheral State functions
  196. * @{
  197. */
  198. /* Extended Peripheral State functions ***************************************/
  199. HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim);
  200. HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(TIM_HandleTypeDef *htim, uint32_t ChannelN);
  201. /**
  202. * @}
  203. */
  204. /**
  205. * @}
  206. */
  207. /* End of exported functions -------------------------------------------------*/
  208. /* Private functions----------------------------------------------------------*/
  209. /** @addtogroup TIMEx_Private_Functions TIMEx Private Functions
  210. * @{
  211. */
  212. void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
  213. void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma);
  214. /**
  215. * @}
  216. */
  217. /* End of private functions --------------------------------------------------*/
  218. /**
  219. * @}
  220. */
  221. /**
  222. * @}
  223. */
  224. #ifdef __cplusplus
  225. }
  226. #endif
  227. #endif /* STM32F0xx_HAL_TIM_EX_H */
  228. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/