2 ******************************************************************************
\r
3 * @file stm32f7xx_hal_tim_ex.h
\r
4 * @author MCD Application Team
\r
5 * @brief Header file of TIM HAL Extended module.
\r
6 ******************************************************************************
\r
9 * <h2><center>© Copyright (c) 2017 STMicroelectronics.
\r
10 * All rights reserved.</center></h2>
\r
12 * This software component is licensed by ST under BSD 3-Clause license,
\r
13 * the "License"; You may not use this file except in compliance with the
\r
14 * License. You may obtain a copy of the License at:
\r
15 * opensource.org/licenses/BSD-3-Clause
\r
17 ******************************************************************************
\r
20 /* Define to prevent recursive inclusion -------------------------------------*/
\r
21 #ifndef STM32F7xx_HAL_TIM_EX_H
\r
22 #define STM32F7xx_HAL_TIM_EX_H
\r
28 /* Includes ------------------------------------------------------------------*/
\r
29 #include "stm32f7xx_hal_def.h"
\r
31 /** @addtogroup STM32F7xx_HAL_Driver
\r
35 /** @addtogroup TIMEx
\r
39 /* Exported types ------------------------------------------------------------*/
\r
40 /** @defgroup TIMEx_Exported_Types TIM Extended Exported Types
\r
45 * @brief TIM Hall sensor Configuration Structure definition
\r
50 uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal.
\r
51 This parameter can be a value of @ref TIM_Input_Capture_Polarity */
\r
53 uint32_t IC1Prescaler; /*!< Specifies the Input Capture Prescaler.
\r
54 This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
\r
56 uint32_t IC1Filter; /*!< Specifies the input capture filter.
\r
57 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
\r
59 uint32_t Commutation_Delay; /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
\r
60 This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
\r
61 } TIM_HallSensor_InitTypeDef;
\r
62 #if defined(TIM_BREAK_INPUT_SUPPORT)
\r
65 * @brief TIM Break/Break2 input configuration
\r
69 uint32_t Source; /*!< Specifies the source of the timer break input.
\r
70 This parameter can be a value of @ref TIMEx_Break_Input_Source */
\r
71 uint32_t Enable; /*!< Specifies whether or not the break input source is enabled.
\r
72 This parameter can be a value of @ref TIMEx_Break_Input_Source_Enable */
\r
73 uint32_t Polarity; /*!< Specifies the break input source polarity.
\r
74 This parameter can be a value of @ref TIMEx_Break_Input_Source_Polarity
\r
75 Not relevant when analog watchdog output of the DFSDM1 used as break input source */
\r
77 TIMEx_BreakInputConfigTypeDef;
\r
79 #endif /* TIM_BREAK_INPUT_SUPPORT */
\r
83 /* End of exported types -----------------------------------------------------*/
\r
85 /* Exported constants --------------------------------------------------------*/
\r
86 /** @defgroup TIMEx_Exported_Constants TIM Extended Exported Constants
\r
90 /** @defgroup TIMEx_Remap TIM Extended Remapping
\r
93 #define TIM_TIM2_TIM8_TRGO (0x00000000U)
\r
94 #define TIM_TIM2_ETH_PTP (0x00000400U)
\r
95 #define TIM_TIM2_USBFS_SOF (0x00000800U)
\r
96 #define TIM_TIM2_USBHS_SOF (0x00000C00U)
\r
97 #define TIM_TIM5_GPIO (0x00000000U)
\r
98 #define TIM_TIM5_LSI (0x00000040U)
\r
99 #define TIM_TIM5_LSE (0x00000080U)
\r
100 #define TIM_TIM5_RTC (0x000000C0U)
\r
101 #define TIM_TIM11_GPIO (0x00000000U)
\r
102 #define TIM_TIM11_SPDIFRX (0x00000001U)
\r
103 #define TIM_TIM11_HSE (0x00000002U)
\r
104 #define TIM_TIM11_MCO1 (0x00000003U)
\r
108 #if defined(TIM_BREAK_INPUT_SUPPORT)
\r
110 /** @defgroup TIMEx_Break_Input TIM Extended Break input
\r
113 #define TIM_BREAKINPUT_BRK 0x00000001U /* !< Timer break input */
\r
114 #define TIM_BREAKINPUT_BRK2 0x00000002U /* !< Timer break2 input */
\r
119 /** @defgroup TIMEx_Break_Input_Source TIM Extended Break input source
\r
122 #define TIM_BREAKINPUTSOURCE_BKIN ((uint32_t)0x00000001U) /* !< An external source (GPIO) is connected to the BKIN pin */
\r
123 #define TIM_BREAKINPUTSOURCE_DFSDM1 ((uint32_t)0x00000008U) /* !< The analog watchdog output of the DFSDM1 peripheral is connected to the break input */
\r
128 /** @defgroup TIMEx_Break_Input_Source_Enable TIM Extended Break input source enabling
\r
131 #define TIM_BREAKINPUTSOURCE_DISABLE 0x00000000U /* !< Break input source is disabled */
\r
132 #define TIM_BREAKINPUTSOURCE_ENABLE 0x00000001U /* !< Break input source is enabled */
\r
137 /** @defgroup TIMEx_Break_Input_Source_Polarity TIM Extended Break input polarity
\r
140 #define TIM_BREAKINPUTSOURCE_POLARITY_LOW 0x00000001U /* !< Break input source is active low */
\r
141 #define TIM_BREAKINPUTSOURCE_POLARITY_HIGH 0x00000000U /* !< Break input source is active_high */
\r
145 #endif /* TIM_BREAK_INPUT_SUPPORT */
\r
150 /* End of exported constants -------------------------------------------------*/
\r
152 /* Exported macro ------------------------------------------------------------*/
\r
153 /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros
\r
160 /* End of exported macro -----------------------------------------------------*/
\r
162 /* Private macro -------------------------------------------------------------*/
\r
163 /** @defgroup TIMEx_Private_Macros TIM Extended Private Macros
\r
166 #define IS_TIM_REMAP(__TIM_REMAP__) (((__TIM_REMAP__) == TIM_TIM2_TIM8_TRGO)||\
\r
167 ((__TIM_REMAP__) == TIM_TIM2_ETH_PTP) ||\
\r
168 ((__TIM_REMAP__) == TIM_TIM2_USBFS_SOF)||\
\r
169 ((__TIM_REMAP__) == TIM_TIM2_USBHS_SOF)||\
\r
170 ((__TIM_REMAP__) == TIM_TIM5_GPIO) ||\
\r
171 ((__TIM_REMAP__) == TIM_TIM5_LSI) ||\
\r
172 ((__TIM_REMAP__) == TIM_TIM5_LSE) ||\
\r
173 ((__TIM_REMAP__) == TIM_TIM5_RTC) ||\
\r
174 ((__TIM_REMAP__) == TIM_TIM11_GPIO) ||\
\r
175 ((__TIM_REMAP__) == TIM_TIM11_SPDIFRX) ||\
\r
176 ((__TIM_REMAP__) == TIM_TIM11_HSE) ||\
\r
177 ((__TIM_REMAP__) == TIM_TIM11_MCO1))
\r
178 #if defined(TIM_BREAK_INPUT_SUPPORT)
\r
180 #define IS_TIM_BREAKINPUT(__BREAKINPUT__) (((__BREAKINPUT__) == TIM_BREAKINPUT_BRK) || \
\r
181 ((__BREAKINPUT__) == TIM_BREAKINPUT_BRK2))
\r
183 #define IS_TIM_BREAKINPUTSOURCE(__SOURCE__) (((__SOURCE__) == TIM_BREAKINPUTSOURCE_BKIN) || \
\r
184 ((__SOURCE__) == TIM_BREAKINPUTSOURCE_DFSDM))
\r
186 #define IS_TIM_BREAKINPUTSOURCE_STATE(__STATE__) (((__STATE__) == TIM_BREAKINPUTSOURCE_DISABLE) || \
\r
187 ((__STATE__) == TIM_BREAKINPUTSOURCE_ENABLE))
\r
189 #define IS_TIM_BREAKINPUTSOURCE_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_BREAKINPUTSOURCE_POLARITY_LOW) || \
\r
190 ((__POLARITY__) == TIM_BREAKINPUTSOURCE_POLARITY_HIGH))
\r
191 #endif /* TIM_BREAK_INPUT_SUPPORT */
\r
196 /* End of private macro ------------------------------------------------------*/
\r
198 /* Exported functions --------------------------------------------------------*/
\r
199 /** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions
\r
203 /** @addtogroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions
\r
204 * @brief Timer Hall Sensor functions
\r
207 /* Timer Hall Sensor functions **********************************************/
\r
208 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef *sConfig);
\r
209 HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim);
\r
211 void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim);
\r
212 void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim);
\r
214 /* Blocking mode: Polling */
\r
215 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim);
\r
216 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim);
\r
217 /* Non-Blocking mode: Interrupt */
\r
218 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim);
\r
219 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim);
\r
220 /* Non-Blocking mode: DMA */
\r
221 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length);
\r
222 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim);
\r
227 /** @addtogroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions
\r
228 * @brief Timer Complementary Output Compare functions
\r
231 /* Timer Complementary Output Compare functions *****************************/
\r
232 /* Blocking mode: Polling */
\r
233 HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
\r
234 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
\r
236 /* Non-Blocking mode: Interrupt */
\r
237 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
\r
238 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
\r
240 /* Non-Blocking mode: DMA */
\r
241 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
\r
242 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
\r
247 /** @addtogroup TIMEx_Exported_Functions_Group3 Extended Timer Complementary PWM functions
\r
248 * @brief Timer Complementary PWM functions
\r
251 /* Timer Complementary PWM functions ****************************************/
\r
252 /* Blocking mode: Polling */
\r
253 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
\r
254 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
\r
256 /* Non-Blocking mode: Interrupt */
\r
257 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
\r
258 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
\r
259 /* Non-Blocking mode: DMA */
\r
260 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
\r
261 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
\r
266 /** @addtogroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions
\r
267 * @brief Timer Complementary One Pulse functions
\r
270 /* Timer Complementary One Pulse functions **********************************/
\r
271 /* Blocking mode: Polling */
\r
272 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
\r
273 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
\r
275 /* Non-Blocking mode: Interrupt */
\r
276 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
\r
277 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
\r
282 /** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions
\r
283 * @brief Peripheral Control functions
\r
286 /* Extended Control functions ************************************************/
\r
287 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource);
\r
288 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource);
\r
289 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource);
\r
290 HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, TIM_MasterConfigTypeDef *sMasterConfig);
\r
291 HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
\r
292 #if defined(TIM_BREAK_INPUT_SUPPORT)
\r
293 HAL_StatusTypeDef HAL_TIMEx_ConfigBreakInput(TIM_HandleTypeDef *htim, uint32_t BreakInput, TIMEx_BreakInputConfigTypeDef *sBreakInputConfig);
\r
294 #endif /* TIM_BREAK_INPUT_SUPPORT */
\r
295 HAL_StatusTypeDef HAL_TIMEx_GroupChannel5(TIM_HandleTypeDef *htim, uint32_t Channels);
\r
296 HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap);
\r
301 /** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions
\r
302 * @brief Extended Callbacks functions
\r
305 /* Extended Callback **********************************************************/
\r
306 void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim);
\r
307 void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim);
\r
308 void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim);
\r
309 void HAL_TIMEx_Break2Callback(TIM_HandleTypeDef *htim);
\r
314 /** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions
\r
315 * @brief Extended Peripheral State functions
\r
318 /* Extended Peripheral State functions ***************************************/
\r
319 HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim);
\r
327 /* End of exported functions -------------------------------------------------*/
\r
329 /* Private functions----------------------------------------------------------*/
\r
330 /** @defgroup TIMEx_Private_Functions TIM Extended Private Functions
\r
333 void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
\r
334 void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma);
\r
338 /* End of private functions --------------------------------------------------*/
\r
353 #endif /* STM32F7xx_HAL_TIM_EX_H */
\r
355 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r