stm32g0xx_hal_tim_ex.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. /**
  2. ******************************************************************************
  3. * @file stm32g0xx_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) 2018 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 STM32G0xx_HAL_TIM_EX_H
  20. #define STM32G0xx_HAL_TIM_EX_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32g0xx_hal_def.h"
  26. /** @addtogroup STM32G0xx_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. * @brief TIM Break/Break2 input configuration
  52. */
  53. typedef struct
  54. {
  55. uint32_t Source; /*!< Specifies the source of the timer break input.
  56. This parameter can be a value of @ref TIMEx_Break_Input_Source */
  57. uint32_t Enable; /*!< Specifies whether or not the break input source is enabled.
  58. This parameter can be a value of @ref TIMEx_Break_Input_Source_Enable */
  59. uint32_t Polarity; /*!< Specifies the break input source polarity.
  60. This parameter can be a value of @ref TIMEx_Break_Input_Source_Polarity */
  61. } TIMEx_BreakInputConfigTypeDef;
  62. /**
  63. * @}
  64. */
  65. /* End of exported types -----------------------------------------------------*/
  66. /* Exported constants --------------------------------------------------------*/
  67. /** @defgroup TIMEx_Exported_Constants TIM Extended Exported Constants
  68. * @{
  69. */
  70. /** @defgroup TIMEx_Remap TIM Extended Remapping
  71. * @{
  72. */
  73. #define TIM_TIM1_ETR_GPIO 0x00000000U /*!< TIM1_ETR is connected to GPIO */
  74. #if defined(COMP1) && defined(COMP2)
  75. #define TIM_TIM1_ETR_COMP1 TIM1_AF1_ETRSEL_0 /*!< TIM1_ETR is connected to COMP1 output */
  76. #define TIM_TIM1_ETR_COMP2 TIM1_AF1_ETRSEL_1 /*!< TIM1_ETR is connected to COMP2 output */
  77. #endif /* COMP1 && COMP2 */
  78. #define TIM_TIM1_ETR_ADC1_AWD1 (TIM1_AF1_ETRSEL_1 | TIM1_AF1_ETRSEL_0) /*!< TIM1_ETR is connected to ADC1 AWD1 */
  79. #define TIM_TIM1_ETR_ADC1_AWD2 TIM1_AF1_ETRSEL_2 /*!< TIM1_ETR is connected to ADC1 AWD2 */
  80. #define TIM_TIM1_ETR_ADC1_AWD3 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_0) /*!< TIM1_ETR is connected to ADC1 AWD3 */
  81. #if defined(COMP3)
  82. #define TIM_TIM1_ETR_COMP3 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_1) /*!< TIM1_ETR is connected to COMP3 output */
  83. #endif /* COMP3 */
  84. #if defined(TIM2)
  85. #define TIM_TIM2_ETR_GPIO 0x00000000U /*!< TIM2_ETR is connected to GPIO */
  86. #define TIM_TIM2_ETR_COMP1 TIM2_AF1_ETRSEL_0 /*!< TIM2_ETR is connected to COMP1 output */
  87. #define TIM_TIM2_ETR_COMP2 TIM2_AF1_ETRSEL_1 /*!< TIM2_ETR is connected to COMP2 output */
  88. #define TIM_TIM2_ETR_LSE (TIM2_AF1_ETRSEL_1 | TIM2_AF1_ETRSEL_0) /*!< TIM2_ETR is connected to LSE */
  89. #if defined(COMP3)
  90. #define TIM_TIM2_ETR_MCO TIM2_AF1_ETRSEL_2 /*!< TIM2_ETR is connected to MCO */
  91. #define TIM_TIM2_ETR_MCO2 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_0) /*!< TIM2_ETR is connected to MCO2 */
  92. #define TIM_TIM2_ETR_COMP3 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_1) /*!< TIM2_ETR is connected to COMP3 output */
  93. #endif /* COMP3 */
  94. #endif /* TIM2 */
  95. #if defined(TIM3)
  96. #define TIM_TIM3_ETR_GPIO 0x00000000U /*!< TIM3_ETR is connected to GPIO */
  97. #if defined(COMP1) && defined(COMP2)
  98. #define TIM_TIM3_ETR_COMP1 TIM3_AF1_ETRSEL_0 /*!< TIM3_ETR is connected to COMP1 output */
  99. #define TIM_TIM3_ETR_COMP2 TIM3_AF1_ETRSEL_1 /*!< TIM3_ETR is connected to COMP2 output */
  100. #endif /* COMP1 && COMP2 */
  101. #if defined(COMP3)
  102. #define TIM_TIM3_ETR_COMP3 (TIM3_AF1_ETRSEL_1 | TIM3_AF1_ETRSEL_0) /*!< TIM3_ETR is connected to COMP3 output */
  103. #endif /* COMP3 */
  104. #endif /* TIM3 */
  105. #if defined(TIM4)
  106. #define TIM_TIM4_ETR_GPIO 0x00000000U /*!< TIM4_ETR is connected to GPIO */
  107. #if defined(COMP1) && defined(COMP2)
  108. #define TIM_TIM4_ETR_COMP1 TIM4_AF1_ETRSEL_0 /*!< TIM4_ETR is connected to COMP1 output */
  109. #define TIM_TIM4_ETR_COMP2 TIM4_AF1_ETRSEL_1 /*!< TIM4_ETR is connected to COMP2 output */
  110. #endif /* COMP1 && COMP2 */
  111. #if defined(COMP3)
  112. #define TIM_TIM4_ETR_COMP3 (TIM4_AF1_ETRSEL_1 | TIM4_AF1_ETRSEL_0) /*!< TIM4_ETR is connected to COMP3 output */
  113. #endif /* COMP3 */
  114. #endif /* TIM4 */
  115. /**
  116. * @}
  117. */
  118. /** @defgroup TIMEx_Break_Input TIM Extended Break input
  119. * @{
  120. */
  121. #define TIM_BREAKINPUT_BRK 0x00000001U /*!< Timer break input */
  122. #define TIM_BREAKINPUT_BRK2 0x00000002U /*!< Timer break2 input */
  123. /**
  124. * @}
  125. */
  126. /** @defgroup TIMEx_Break_Input_Source TIM Extended Break input source
  127. * @{
  128. */
  129. #define TIM_BREAKINPUTSOURCE_BKIN 0x00000001U /*!< An external source (GPIO) is connected to the BKIN pin */
  130. #if defined(COMP1) && defined(COMP2)
  131. #define TIM_BREAKINPUTSOURCE_COMP1 0x00000002U /*!< The COMP1 output is connected to the break input */
  132. #define TIM_BREAKINPUTSOURCE_COMP2 0x00000004U /*!< The COMP2 output is connected to the break input */
  133. #endif /* COMP1 && COMP2 */
  134. #if defined(COMP3)
  135. #define TIM_BREAKINPUTSOURCE_COMP3 0x00000008U /*!< The COMP3 output is connected to the break input */
  136. #endif /* COMP3 */
  137. /**
  138. * @}
  139. */
  140. /** @defgroup TIMEx_Break_Input_Source_Enable TIM Extended Break input source enabling
  141. * @{
  142. */
  143. #define TIM_BREAKINPUTSOURCE_DISABLE 0x00000000U /*!< Break input source is disabled */
  144. #define TIM_BREAKINPUTSOURCE_ENABLE 0x00000001U /*!< Break input source is enabled */
  145. /**
  146. * @}
  147. */
  148. /** @defgroup TIMEx_Break_Input_Source_Polarity TIM Extended Break input polarity
  149. * @{
  150. */
  151. #define TIM_BREAKINPUTSOURCE_POLARITY_LOW 0x00000001U /*!< Break input source is active low */
  152. #define TIM_BREAKINPUTSOURCE_POLARITY_HIGH 0x00000000U /*!< Break input source is active_high */
  153. /**
  154. * @}
  155. */
  156. /** @defgroup TIMEx_Timer_Input_Selection TIM Extended Timer input selection
  157. * @{
  158. */
  159. #define TIM_TIM1_TI1_GPIO 0x00000000U /*!< TIM1_TI1 is connected to GPIO */
  160. #if defined(COMP1)
  161. #define TIM_TIM1_TI1_COMP1 0x00000001U /*!< TIM1_TI1 is connected to COMP1 OUT */
  162. #endif /* COMP1 */
  163. #define TIM_TIM1_TI2_GPIO 0x00000000U /*!< TIM1_TI2 is connected to GPIO */
  164. #if defined(COMP2)
  165. #define TIM_TIM1_TI2_COMP2 0x00000100U /*!< TIM1_TI2 is connected to COMP2 OUT */
  166. #endif /* COMP2 */
  167. #define TIM_TIM1_TI3_GPIO 0x00000000U /*!< TIM1_TI3 is connected to GPIO */
  168. #if defined(COMP3)
  169. #define TIM_TIM1_TI3_COMP3 0x00010000U /*!< TIM1_TI3 is connected to COMP3 OUT */
  170. #endif /* COMP3 */
  171. #if defined(TIM2)
  172. #define TIM_TIM2_TI1_GPIO 0x00000000U /*!< TIM2_TI1 is connected to GPIO */
  173. #define TIM_TIM2_TI1_COMP1 0x00000001U /*!< TIM2_TI1 is connected to COMP1 OUT */
  174. #define TIM_TIM2_TI2_GPIO 0x00000000U /*!< TIM2_TI2 is connected to GPIO */
  175. #define TIM_TIM2_TI2_COMP2 0x00000100U /*!< TIM2_TI2 is connected to COMP2 OUT */
  176. #define TIM_TIM2_TI3_GPIO 0x00000000U /*!< TIM2_TI3 is connected to GPIO */
  177. #if defined(COMP3)
  178. #define TIM_TIM2_TI3_COMP3 0x00010000U /*!< TIM2_TI3 is connected to COMP3 OUT */
  179. #endif /* COMP3 */
  180. #endif /* TIM2 */
  181. #define TIM_TIM3_TI1_GPIO 0x00000000U /*!< TIM3_TI1 is connected to GPIO */
  182. #if defined(COMP1)
  183. #define TIM_TIM3_TI1_COMP1 0x00000001U /*!< TIM3_TI1 is connected to COMP1 OUT */
  184. #endif /* COMP1 */
  185. #define TIM_TIM3_TI2_GPIO 0x00000000U /*!< TIM3_TI2 is connected to GPIO */
  186. #if defined(COMP2)
  187. #define TIM_TIM3_TI2_COMP2 0x00000100U /*!< TIM3_TI2 is connected to COMP2 OUT */
  188. #endif /* COMP2 */
  189. #define TIM_TIM3_TI3_GPIO 0x00000000U /*!< TIM3_TI3 is connected to GPIO */
  190. #if defined(COMP3)
  191. #define TIM_TIM3_TI3_COMP3 0x00010000U /*!< TIM3_TI3 is connected to COMP3 OUT */
  192. #endif /* COMP3 */
  193. #if defined(TIM4)
  194. #define TIM_TIM4_TI1_GPIO 0x00000000U /*!< TIM4_TI1 is connected to GPIO */
  195. #if defined(COMP1)
  196. #define TIM_TIM4_TI1_COMP1 0x00000001U /*!< TIM4_TI1 is connected to COMP1 OUT */
  197. #endif /* COMP1 */
  198. #define TIM_TIM4_TI2_GPIO 0x00000000U /*!< TIM4_TI2 is connected to GPIO */
  199. #if defined(COMP2)
  200. #define TIM_TIM4_TI2_COMP2 0x00000100U /*!< TIM4_TI2 is connected to COMP2 OUT */
  201. #endif /* COMP2 */
  202. #define TIM_TIM4_TI3_GPIO 0x00000000U /*!< TIM4_TI3 is connected to GPIO */
  203. #if defined(COMP3)
  204. #define TIM_TIM4_TI3_COMP3 0x00010000U /*!< TIM4_TI3 is connected to COMP3 OUT */
  205. #endif /* COMP3 */
  206. #endif /* TIM4 */
  207. #define TIM_TIM14_TI1_GPIO 0x00000000U /*!< TIM14_TI1 is connected to GPIO */
  208. #define TIM_TIM14_TI1_RTC 0x00000001U /*!< TIM14_TI1 is connected to RTC clock */
  209. #define TIM_TIM14_TI1_HSE_32 0x00000002U /*!< TIM14_TI1 is connected to HSE div 32 */
  210. #define TIM_TIM14_TI1_MCO 0x00000003U /*!< TIM14_TI1 is connected to MCO */
  211. #if defined(RCC_MCO2_SUPPORT)
  212. #define TIM_TIM14_TI1_MCO2 0x00000004U /*!< TIM14_TI1 is connected to MCO2 */
  213. #endif /* RCC_MCO2_SUPPORT */
  214. #if defined(TIM15)
  215. #define TIM_TIM15_TI1_GPIO 0x00000000U /*!< TIM15_TI1 is connected to GPIO */
  216. #define TIM_TIM15_TI1_TIM2_CH1 0x00000001U /*!< TIM15_TI1 is connected to TIM2 CH1 */
  217. #define TIM_TIM15_TI1_TIM3_CH1 0x00000002U /*!< TIM15_TI1 is connected to TIM3 CH1 */
  218. #define TIM_TIM15_TI2_GPIO 0x00000000U /*!< TIM15_TI2 is connected to GPIO */
  219. #define TIM_TIM15_TI2_TIM2_CH2 0x00000100U /*!< TIM15_TI2 is connected to TIM2 CH2 */
  220. #define TIM_TIM15_TI2_TIM3_CH2 0x00000200U /*!< TIM15_TI2 is connected to TIM3 CH2 */
  221. #endif /* TIM15 */
  222. #define TIM_TIM16_TI1_GPIO 0x00000000U /*!< TIM16_TI1 is connected to GPIO */
  223. #define TIM_TIM16_TI1_LSI 0x00000001U /*!< TIM16_TI1 is connected to LSI */
  224. #define TIM_TIM16_TI1_LSE 0x00000002U /*!< TIM16_TI1 is connected to LSE */
  225. #define TIM_TIM16_TI1_RTC_WAKEUP 0x00000003U /*!< TIM16_TI1 is connected to TRC wakeup interrupt */
  226. #if defined(RCC_MCO2_SUPPORT)
  227. #define TIM_TIM16_TI1_MCO2 0x00000004U /*!< TIM16_TI1 is connected to MCO2 */
  228. #endif /* RCC_MCO2_SUPPORT */
  229. #define TIM_TIM17_TI1_GPIO 0x00000000U /*!< TIM17_TI1 is connected to GPIO */
  230. #if defined(RCC_HSI48_SUPPORT)
  231. #define TIM_TIM17_TI1_HSI48 0x00000001U /*!< TIM17_TI1 is connected to HSI48/256 */
  232. #endif /* RCC_HSI48_SUPPORT */
  233. #define TIM_TIM17_TI1_HSE_32 0x00000002U /*!< TIM17_TI1 is connected to HSE div 32 */
  234. #define TIM_TIM17_TI1_MCO 0x00000003U /*!< TIM17_TI1 is connected to MCO */
  235. #if defined(RCC_MCO2_SUPPORT)
  236. #define TIM_TIM17_TI1_MCO2 0x00000004U /*!< TIM17_TI1 is connected to MCO2 */
  237. #endif /* RCC_MCO2_SUPPORT */
  238. /**
  239. * @}
  240. */
  241. /**
  242. * @}
  243. */
  244. /* End of exported constants -------------------------------------------------*/
  245. /* Exported macro ------------------------------------------------------------*/
  246. /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros
  247. * @{
  248. */
  249. /**
  250. * @}
  251. */
  252. /* End of exported macro -----------------------------------------------------*/
  253. /* Private macro -------------------------------------------------------------*/
  254. /** @defgroup TIMEx_Private_Macros TIM Extended Private Macros
  255. * @{
  256. */
  257. #define IS_TIM_REMAP(__REMAP__) ((((__REMAP__) & 0xFFFC3FFFU) == 0x00000000U))
  258. #define IS_TIM_BREAKINPUT(__BREAKINPUT__) (((__BREAKINPUT__) == TIM_BREAKINPUT_BRK) || \
  259. ((__BREAKINPUT__) == TIM_BREAKINPUT_BRK2))
  260. #if defined(COMP1) && defined(COMP2) && defined(COMP3)
  261. #define IS_TIM_BREAKINPUTSOURCE(__SOURCE__) (((__SOURCE__) == TIM_BREAKINPUTSOURCE_BKIN) || \
  262. ((__SOURCE__) == TIM_BREAKINPUTSOURCE_COMP1) || \
  263. ((__SOURCE__) == TIM_BREAKINPUTSOURCE_COMP2) || \
  264. ((__SOURCE__) == TIM_BREAKINPUTSOURCE_COMP3))
  265. #elif defined(COMP1) && defined(COMP2)
  266. #define IS_TIM_BREAKINPUTSOURCE(__SOURCE__) (((__SOURCE__) == TIM_BREAKINPUTSOURCE_BKIN) || \
  267. ((__SOURCE__) == TIM_BREAKINPUTSOURCE_COMP1) || \
  268. ((__SOURCE__) == TIM_BREAKINPUTSOURCE_COMP2))
  269. #else
  270. #define IS_TIM_BREAKINPUTSOURCE(__SOURCE__) ((__SOURCE__) == TIM_BREAKINPUTSOURCE_BKIN)
  271. #endif /* COMP1 && COMP2 && COMP3 */
  272. #define IS_TIM_BREAKINPUTSOURCE_STATE(__STATE__) (((__STATE__) == TIM_BREAKINPUTSOURCE_DISABLE) || \
  273. ((__STATE__) == TIM_BREAKINPUTSOURCE_ENABLE))
  274. #define IS_TIM_BREAKINPUTSOURCE_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_BREAKINPUTSOURCE_POLARITY_LOW) || \
  275. ((__POLARITY__) == TIM_BREAKINPUTSOURCE_POLARITY_HIGH))
  276. #define IS_TIM_TISEL(__TISEL__) ((((__TISEL__) & 0xF0F0F0F0U) == 0x00000000U))
  277. /**
  278. * @}
  279. */
  280. /* End of private macro ------------------------------------------------------*/
  281. /* Exported functions --------------------------------------------------------*/
  282. /** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions
  283. * @{
  284. */
  285. /** @addtogroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions
  286. * @brief Timer Hall Sensor functions
  287. * @{
  288. */
  289. /* Timer Hall Sensor functions **********************************************/
  290. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, const TIM_HallSensor_InitTypeDef *sConfig);
  291. HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim);
  292. void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim);
  293. void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim);
  294. /* Blocking mode: Polling */
  295. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim);
  296. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim);
  297. /* Non-Blocking mode: Interrupt */
  298. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim);
  299. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim);
  300. /* Non-Blocking mode: DMA */
  301. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length);
  302. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim);
  303. /**
  304. * @}
  305. */
  306. /** @addtogroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions
  307. * @brief Timer Complementary Output Compare functions
  308. * @{
  309. */
  310. /* Timer Complementary Output Compare functions *****************************/
  311. /* Blocking mode: Polling */
  312. HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
  313. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
  314. /* Non-Blocking mode: Interrupt */
  315. HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  316. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  317. /* Non-Blocking mode: DMA */
  318. HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData,
  319. uint16_t Length);
  320. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
  321. /**
  322. * @}
  323. */
  324. /** @addtogroup TIMEx_Exported_Functions_Group3 Extended Timer Complementary PWM functions
  325. * @brief Timer Complementary PWM functions
  326. * @{
  327. */
  328. /* Timer Complementary PWM functions ****************************************/
  329. /* Blocking mode: Polling */
  330. HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
  331. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
  332. /* Non-Blocking mode: Interrupt */
  333. HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  334. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  335. /* Non-Blocking mode: DMA */
  336. HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData,
  337. uint16_t Length);
  338. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
  339. /**
  340. * @}
  341. */
  342. /** @addtogroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions
  343. * @brief Timer Complementary One Pulse functions
  344. * @{
  345. */
  346. /* Timer Complementary One Pulse functions **********************************/
  347. /* Blocking mode: Polling */
  348. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  349. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  350. /* Non-Blocking mode: Interrupt */
  351. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  352. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  353. /**
  354. * @}
  355. */
  356. /** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions
  357. * @brief Peripheral Control functions
  358. * @{
  359. */
  360. /* Extended Control functions ************************************************/
  361. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  362. uint32_t CommutationSource);
  363. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  364. uint32_t CommutationSource);
  365. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
  366. uint32_t CommutationSource);
  367. HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim,
  368. const TIM_MasterConfigTypeDef *sMasterConfig);
  369. HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim,
  370. const TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
  371. HAL_StatusTypeDef HAL_TIMEx_ConfigBreakInput(TIM_HandleTypeDef *htim, uint32_t BreakInput,
  372. const TIMEx_BreakInputConfigTypeDef *sBreakInputConfig);
  373. HAL_StatusTypeDef HAL_TIMEx_GroupChannel5(TIM_HandleTypeDef *htim, uint32_t Channels);
  374. HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap);
  375. HAL_StatusTypeDef HAL_TIMEx_TISelection(TIM_HandleTypeDef *htim, uint32_t TISelection, uint32_t Channel);
  376. HAL_StatusTypeDef HAL_TIMEx_DisarmBreakInput(TIM_HandleTypeDef *htim, uint32_t BreakInput);
  377. HAL_StatusTypeDef HAL_TIMEx_ReArmBreakInput(const TIM_HandleTypeDef *htim, uint32_t BreakInput);
  378. /**
  379. * @}
  380. */
  381. /** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions
  382. * @brief Extended Callbacks functions
  383. * @{
  384. */
  385. /* Extended Callback **********************************************************/
  386. void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim);
  387. void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim);
  388. void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim);
  389. void HAL_TIMEx_Break2Callback(TIM_HandleTypeDef *htim);
  390. /**
  391. * @}
  392. */
  393. /** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions
  394. * @brief Extended Peripheral State functions
  395. * @{
  396. */
  397. /* Extended Peripheral State functions ***************************************/
  398. HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(const TIM_HandleTypeDef *htim);
  399. HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(const TIM_HandleTypeDef *htim, uint32_t ChannelN);
  400. /**
  401. * @}
  402. */
  403. /**
  404. * @}
  405. */
  406. /* End of exported functions -------------------------------------------------*/
  407. /* Private functions----------------------------------------------------------*/
  408. /** @addtogroup TIMEx_Private_Functions TIM Extended Private Functions
  409. * @{
  410. */
  411. void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
  412. void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma);
  413. /**
  414. * @}
  415. */
  416. /* End of private functions --------------------------------------------------*/
  417. /**
  418. * @}
  419. */
  420. /**
  421. * @}
  422. */
  423. #ifdef __cplusplus
  424. }
  425. #endif
  426. #endif /* STM32G0xx_HAL_TIM_EX_H */