1 /** 2 ****************************************************************************** 3 * @file stm32wbaxx_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) 2022 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 19 /* Define to prevent recursive inclusion -------------------------------------*/ 20 #ifndef STM32WBAxx_HAL_TIM_EX_H 21 #define STM32WBAxx_HAL_TIM_EX_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /* Includes ------------------------------------------------------------------*/ 28 #include "stm32wbaxx_hal_def.h" 29 30 /** @addtogroup STM32WBAxx_HAL_Driver 31 * @{ 32 */ 33 34 /** @addtogroup TIMEx 35 * @{ 36 */ 37 38 /* Exported types ------------------------------------------------------------*/ 39 /** @defgroup TIMEx_Exported_Types TIM Extended Exported Types 40 * @{ 41 */ 42 43 /** 44 * @brief TIM Hall sensor Configuration Structure definition 45 */ 46 47 typedef struct 48 { 49 uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal. 50 This parameter can be a value of @ref TIM_Input_Capture_Polarity */ 51 52 uint32_t IC1Prescaler; /*!< Specifies the Input Capture Prescaler. 53 This parameter can be a value of @ref TIM_Input_Capture_Prescaler */ 54 55 uint32_t IC1Filter; /*!< Specifies the input capture filter. 56 This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ 57 58 uint32_t Commutation_Delay; /*!< Specifies the pulse value to be loaded into the Capture Compare Register. 59 This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ 60 } TIM_HallSensor_InitTypeDef; 61 62 /** 63 * @brief TIM Break/Break2 input configuration 64 */ 65 typedef struct 66 { 67 uint32_t Source; /*!< Specifies the source of the timer break input. 68 This parameter can be a value of @ref TIMEx_Break_Input_Source */ 69 uint32_t Enable; /*!< Specifies whether or not the break input source is enabled. 70 This parameter can be a value of @ref TIMEx_Break_Input_Source_Enable */ 71 uint32_t Polarity; /*!< Specifies the break input source polarity. 72 This parameter can be a value of @ref TIMEx_Break_Input_Source_Polarity */ 73 } TIMEx_BreakInputConfigTypeDef; 74 75 /** 76 * @brief TIM Encoder index configuration 77 */ 78 typedef struct 79 { 80 uint32_t Polarity; /*!< TIM Encoder index polarity.This parameter can be a value of @ref TIMEx_Encoder_Index_Polarity */ 81 82 uint32_t Prescaler; /*!< TIM Encoder index prescaler.This parameter can be a value of @ref TIMEx_Encoder_Index_Prescaler */ 83 84 uint32_t Filter; /*!< TIM Encoder index filter.This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ 85 86 uint32_t Blanking; /*!< Specifies whether or not the encoder index event is conditioned by TI3 or TI4 input.This parameter can be a value of @ref TIMEx_Encoder_Index_Blanking */ 87 88 FunctionalState FirstIndexEnable; /*!< Specifies whether or not the encoder first index is enabled.This parameter value can be ENABLE or DISABLE. */ 89 90 uint32_t Position; /*!< Specifies in which AB input configuration the index event resets the counter.This parameter can be a value of @ref TIMEx_Encoder_Index_Position */ 91 92 uint32_t Direction; /*!< Specifies in which counter direction the index event resets the counter.This parameter can be a value of @ref TIMEx_Encoder_Index_Direction */ 93 94 } TIMEx_EncoderIndexConfigTypeDef; 95 96 /** 97 * @} 98 */ 99 /* End of exported types -----------------------------------------------------*/ 100 101 /* Exported constants --------------------------------------------------------*/ 102 /** @defgroup TIMEx_Exported_Constants TIM Extended Exported Constants 103 * @{ 104 */ 105 106 /** @defgroup TIMEx_Remap TIM Extended Remapping 107 * @{ 108 */ 109 #define TIM_TIM1_ETR_GPIO 0x00000000UL /*!< TIM1_ETR is not connected to I/O */ 110 #define TIM_TIM1_ETR_COMP1 TIM_AF1_ETRSEL_0 /*!< TIM1_ETR is connected to COMP1 output */ 111 #define TIM_TIM1_ETR_COMP2 TIM_AF1_ETRSEL_1 /*!< TIM1_ETR is connected to COMP2 output */ 112 #define TIM_TIM1_ETR_HSI TIM_AF1_ETRSEL_2 /*!< TIM1_ETR is connected to HSI */ 113 #define TIM_TIM1_ETR_ADC4_AWD1 (TIM_AF1_ETRSEL_3 | TIM_AF1_ETRSEL_1 | TIM_AF1_ETRSEL_0) /*!< TIM1_ETR is connected to ADC4 AWD1 */ 114 #define TIM_TIM1_ETR_ADC4_AWD2 (TIM_AF1_ETRSEL_3 | TIM_AF1_ETRSEL_2) /*!< TIM1_ETR is connected to ADC4 AWD2 */ 115 #define TIM_TIM1_ETR_ADC4_AWD3 (TIM_AF1_ETRSEL_3 | TIM_AF1_ETRSEL_2 | TIM_AF1_ETRSEL_0) /*!< TIM1_ETR is connected to ADC4 AWD3 */ 116 117 #define TIM_TIM2_ETR_GPIO 0x00000000UL /*!< TIM2_ETR is not connected to I/O */ 118 #define TIM_TIM2_ETR_COMP1 TIM_AF1_ETRSEL_0 /*!< TIM2_ETR is connected to COMP1 output */ 119 #define TIM_TIM2_ETR_COMP2 TIM_AF1_ETRSEL_1 /*!< TIM2_ETR is connected to COMP2 output */ 120 #define TIM_TIM2_ETR_HSI TIM_AF1_ETRSEL_2 /*!< TIM2_ETR is connected to HSI */ 121 #define TIM_TIM2_ETR_TIM3_ETR TIM_AF1_ETRSEL_3 /*!< TIM2_ETR is connected to TIM3 ETR */ 122 #define TIM_TIM2_ETR_LSE (TIM_AF1_ETRSEL_3 | TIM_AF1_ETRSEL_1 | TIM_AF1_ETRSEL_0) /*!< TIM2_ETR is connected to LSE */ 123 124 #define TIM_TIM3_ETR_GPIO 0x00000000UL /*!< TIM3_ETR is not connected to I/O */ 125 #define TIM_TIM3_ETR_COMP1 TIM_AF1_ETRSEL_0 /*!< TIM3_ETR is connected to COMP1 output */ 126 #define TIM_TIM3_ETR_COMP2 TIM_AF1_ETRSEL_1 /*!< TIM3_ETR is connected to COMP2 output */ 127 #define TIM_TIM3_ETR_HSI TIM_AF1_ETRSEL_2 /*!< TIM3_ETR is connected to HSI */ 128 #define TIM_TIM3_ETR_TIM2_ETR TIM_AF1_ETRSEL_3 /*!< TIM3_ETR is connected to TIM2 ETR */ 129 #define TIM_TIM3_ETR_ADC4_AWD1 (TIM_AF1_ETRSEL_3 | TIM_AF1_ETRSEL_1| TIM_AF1_ETRSEL_0) /*!< TIM3_ETR is connected to ADC4 AWD1 */ 130 #define TIM_TIM3_ETR_ADC4_AWD2 (TIM_AF1_ETRSEL_3 | TIM_AF1_ETRSEL_2) /*!< TIM3_ETR is connected to ADC4 AWD2 */ 131 #define TIM_TIM3_ETR_ADC4_AWD3 (TIM_AF1_ETRSEL_3 | TIM_AF1_ETRSEL_2 | TIM_AF1_ETRSEL_0) /*!< TIM3_ETR is connected to ADC4 AWD3 */ 132 /** 133 * @} 134 */ 135 136 /** @defgroup TIMEx_Break_Input TIM Extended Break input 137 * @{ 138 */ 139 #define TIM_BREAKINPUT_BRK 0x00000001U /*!< Timer break input */ 140 #define TIM_BREAKINPUT_BRK2 0x00000002U /*!< Timer break2 input */ 141 /** 142 * @} 143 */ 144 145 /** @defgroup TIMEx_Break_Input_Source TIM Extended Break input source 146 * @{ 147 */ 148 #define TIM_BREAKINPUTSOURCE_BKIN 0x00000001U /*!< An external source (GPIO) is connected to the BKIN pin */ 149 #define TIM_BREAKINPUTSOURCE_COMP1 0x00000002U /*!< The COMP1 output is connected to the break input */ 150 #define TIM_BREAKINPUTSOURCE_COMP2 0x00000004U /*!< The COMP2 output is connected to the break input */ 151 /** 152 * @} 153 */ 154 155 /** @defgroup TIMEx_Break_Input_Source_Enable TIM Extended Break input source enabling 156 * @{ 157 */ 158 #define TIM_BREAKINPUTSOURCE_DISABLE 0x00000000U /*!< Break input source is disabled */ 159 #define TIM_BREAKINPUTSOURCE_ENABLE 0x00000001U /*!< Break input source is enabled */ 160 /** 161 * @} 162 */ 163 164 /** @defgroup TIMEx_Break_Input_Source_Polarity TIM Extended Break input polarity 165 * @{ 166 */ 167 #define TIM_BREAKINPUTSOURCE_POLARITY_LOW 0x00000001U /*!< Break input source is active low */ 168 #define TIM_BREAKINPUTSOURCE_POLARITY_HIGH 0x00000000U /*!< Break input source is active_high */ 169 /** 170 * @} 171 */ 172 173 /** @defgroup TIMEx_Timer_Input_Selection TIM Extended Timer input selection 174 * @{ 175 */ 176 #define TIM_TIM1_TI1_GPIO 0x00000000UL /*!< TIM1_TI1 is connected to GPIO */ 177 #define TIM_TIM1_TI1_COMP1 TIM_TISEL_TI1SEL_0 /*!< TIM1_TI1 is connected to COMP1 OUT */ 178 #define TIM_TIM1_TI1_COMP2 TIM_TISEL_TI1SEL_1 /*!< TIM1_TI1 is connected to COMP2 OUT */ 179 #define TIM_TIM1_TI2_GPIO 0x00000000UL /*!< TIM1_TI2 is connected to GPIO */ 180 #define TIM_TIM1_TI3_GPIO 0x00000000UL /*!< TIM1_TI3 is connected to GPIO */ 181 #define TIM_TIM1_TI4_GPIO 0x00000000UL /*!< TIM1_TI4 is connected to GPIO */ 182 183 #define TIM_TIM2_TI1_GPIO 0x00000000UL /*!< TIM2_TI1 is connected to GPIO */ 184 #define TIM_TIM2_TI1_COMP1 TIM_TISEL_TI1SEL_0 /*!< TIM2_TI1 is connected to COMP1 OUT */ 185 #define TIM_TIM2_TI1_COMP2 TIM_TISEL_TI1SEL_1 /*!< TIM2_TI1 is connected to COMP2 OUT */ 186 #define TIM_TIM2_TI2_GPIO 0x00000000UL /*!< TIM2_TI2 is connected to GPIO */ 187 #define TIM_TIM2_TI2_COMP1 TIM_TISEL_TI2SEL_0 /*!< TIM2_TI2 is connected to COMP1 OUT */ 188 #define TIM_TIM2_TI2_COMP2 TIM_TISEL_TI2SEL_1 /*!< TIM2_TI2 is connected to COMP2 OUT */ 189 #define TIM_TIM2_TI3_GPIO 0x00000000UL /*!< TIM2_TI3 is connected to GPIO */ 190 #define TIM_TIM2_TI4_GPIO 0x00000000UL /*!< TIM2_TI4 is connected to GPIO */ 191 #define TIM_TIM2_TI4_COMP1 TIM_TISEL_TI4SEL_0 /*!< TIM2_TI4 is connected to COMP1 OUT */ 192 #define TIM_TIM2_TI4_COMP2 TIM_TISEL_TI4SEL_1 /*!< TIM2_TI4 is connected to COMP2 OUT */ 193 194 #define TIM_TIM3_TI1_GPIO 0x00000000UL /*!< TIM3_TI1 is connected to GPIO */ 195 #define TIM_TIM3_TI1_COMP1 TIM_TISEL_TI1SEL_0 /*!< TIM3_TI1 is connected to COMP1 OUT */ 196 #define TIM_TIM3_TI1_COMP2 TIM_TISEL_TI1SEL_1 /*!< TIM3_TI1 is connected to COMP2 OUT */ 197 #define TIM_TIM3_TI2_GPIO 0x00000000UL /*!< TIM3_TI2 is connected to GPIO */ 198 #define TIM_TIM3_TI2_COMP1 TIM_TISEL_TI2SEL_0 /*!< TIM3_TI2 is connected to COMP1 OUT */ 199 #define TIM_TIM3_TI2_COMP2 TIM_TISEL_TI2SEL_1 /*!< TIM3_TI2 is connected to COMP2 OUT */ 200 #define TIM_TIM3_TI3_GPIO 0x00000000UL /*!< TIM3_TI3 is connected to GPIO */ 201 #define TIM_TIM3_TI4_GPIO 0x00000000UL /*!< TIM3_TI4 is connected to GPIO */ 202 203 #define TIM_TIM16_TI1_GPIO 0x00000000UL /*!< TIM16_TI1 is connected to GPIO */ 204 #define TIM_TIM16_TI1_MCO TIM_TISEL_TI1SEL_1 /*!< TIM16_TI1 is connected to MCO */ 205 #define TIM_TIM16_TI1_HSE_DIV32 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM16_TI1 is connected to HSE/32 */ 206 #define TIM_TIM16_TI1_RTC_WKUP TIM_TISEL_TI1SEL_2 /*!< TIM16_TI1 is connected to RTC Wakeup */ 207 #define TIM_TIM16_TI1_LSE (TIM_TISEL_TI1SEL_2 | TIM_TISEL_TI1SEL_0) /*!< TIM16_TI1 is connected to LSE */ 208 #define TIM_TIM16_TI1_LSI (TIM_TISEL_TI1SEL_2 | TIM_TISEL_TI1SEL_1) /*!< TIM16_TI1 is connected to LSI */ 209 #define TIM_TIM16_TI1_HSI_256 (TIM_TISEL_TI1SEL_3 | TIM_TISEL_TI1SEL_0) /*!< TIM16_TI1 is connected to HSI/256 */ 210 211 #define TIM_TIM17_TI1_GPIO 0x00000000UL /*!< TIM17_TI1 is connected to GPIO */ 212 #define TIM_TIM17_TI1_MCO TIM_TISEL_TI1SEL_1 /*!< TIM17_TI1 is connected to MCO */ 213 #define TIM_TIM17_TI1_HSE_DIV32 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM17_TI1 is connected to HSE/32 */ 214 #define TIM_TIM17_TI1_RTC_WKUP TIM_TISEL_TI1SEL_2 /*!< TIM17_TI1 is connected to RTC Wakeup */ 215 #define TIM_TIM17_TI1_LSE (TIM_TISEL_TI1SEL_2 | TIM_TISEL_TI1SEL_0) /*!< TIM17_TI1 is connected to LSE */ 216 #define TIM_TIM17_TI1_LSI (TIM_TISEL_TI1SEL_2 | TIM_TISEL_TI1SEL_1) /*!< TIM17_TI1 is connected to LSI */ 217 #define TIM_TIM17_TI1_HSI_256 (TIM_TISEL_TI1SEL_3 | TIM_TISEL_TI1SEL_0) /*!< TIM17_TI1 is connected to HSI/256 */ 218 /** 219 * @} 220 */ 221 222 /** @defgroup TIMEx_SMS_Preload_Enable TIM Extended Bitfield SMS preload enabling 223 * @{ 224 */ 225 #define TIM_SMS_PRELOAD_SOURCE_UPDATE 0x00000000U /*!< Prelaod of SMS bitfield is disabled */ 226 #define TIM_SMS_PRELOAD_SOURCE_INDEX TIM_SMCR_SMSPS /*!< Preload of SMS bitfield is enabled */ 227 /** 228 * @} 229 */ 230 231 /** @defgroup TIMEx_Encoder_Index_Blanking TIM Extended Encoder index blanking 232 * @{ 233 */ 234 #define TIM_ENCODERINDEX_BLANKING_DISABLE 0x00000000U /*!< Encoder index blanking is disabled */ 235 #define TIM_ENCODERINDEX_BLANKING_TI3 TIM_ECR_IBLK_0 /*!< Encoder index blanking is enabled on TI3 */ 236 #define TIM_ENCODERINDEX_BLANKING_TI4 TIM_ECR_IBLK_1 /*!< Encoder index blanking is enabled on TI4 */ 237 238 /** 239 * @} 240 */ 241 242 /** @defgroup TIMEx_Encoder_Index_Position TIM Extended Encoder index position 243 * @{ 244 */ 245 #define TIM_ENCODERINDEX_POSITION_00 0x00000000U /*!< Encoder index position is AB=00 */ 246 #define TIM_ENCODERINDEX_POSITION_01 TIM_ECR_IPOS_0 /*!< Encoder index position is AB=01 */ 247 #define TIM_ENCODERINDEX_POSITION_10 TIM_ECR_IPOS_1 /*!< Encoder index position is AB=10 */ 248 #define TIM_ENCODERINDEX_POSITION_11 (TIM_ECR_IPOS_1 | TIM_ECR_IPOS_0) /*!< Encoder index position is AB=11 */ 249 #define TIM_ENCODERINDEX_POSITION_0 0x00000000U /*!< In directional clock mode or clock plus direction mode, index resets the counter when clock is 0 */ 250 #define TIM_ENCODERINDEX_POSITION_1 TIM_ECR_IPOS_0 /*!< In directional clock mode or clock plus direction mode, index resets the counter when clock is 1 */ 251 /** 252 * @} 253 */ 254 255 /** @defgroup TIMEx_Encoder_Index_Direction TIM Extended Encoder index direction 256 * @{ 257 */ 258 #define TIM_ENCODERINDEX_DIRECTION_UP_DOWN 0x00000000U /*!< Index resets the counter whatever the direction */ 259 #define TIM_ENCODERINDEX_DIRECTION_UP TIM_ECR_IDIR_0 /*!< Index resets the counter when up-counting only */ 260 #define TIM_ENCODERINDEX_DIRECTION_DOWN TIM_ECR_IDIR_1 /*!< Index resets the counter when down-counting only */ 261 /** 262 * @} 263 */ 264 265 /** @defgroup TIMEx_Encoder_Index_Polarity TIM Extended Encoder index polarity 266 * @{ 267 */ 268 #define TIM_ENCODERINDEX_POLARITY_INVERTED TIM_ETRPOLARITY_INVERTED /*!< Polarity for ETRx pin */ 269 #define TIM_ENCODERINDEX_POLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED /*!< Polarity for ETRx pin */ 270 /** 271 * @} 272 */ 273 274 /** @defgroup TIMEx_Encoder_Index_Prescaler TIM Extended Encodder index prescaler 275 * @{ 276 */ 277 #define TIM_ENCODERINDEX_PRESCALER_DIV1 TIM_ETRPRESCALER_DIV1 /*!< No prescaler is used */ 278 #define TIM_ENCODERINDEX_PRESCALER_DIV2 TIM_ETRPRESCALER_DIV2 /*!< Prescaler for External ETR pin: Capture performed once every 2 events. */ 279 #define TIM_ENCODERINDEX_PRESCALER_DIV4 TIM_ETRPRESCALER_DIV4 /*!< Prescaler for External ETR pin: Capture performed once every 4 events. */ 280 #define TIM_ENCODERINDEX_PRESCALER_DIV8 TIM_ETRPRESCALER_DIV8 /*!< Prescaler for External ETR pin: Capture performed once every 8 events. */ 281 /** 282 * @} 283 */ 284 285 /** 286 * @} 287 */ 288 /* End of exported constants -------------------------------------------------*/ 289 290 /* Exported macro ------------------------------------------------------------*/ 291 /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros 292 * @{ 293 */ 294 295 /** 296 * @brief HELPER macro calculating the prescaler value to achieve the required counter clock frequency. 297 * @note ex: @ref __HAL_TIM_CALC_PSC(80000000, 1000000); 298 * @param __TIMCLK__ timer input clock frequency (in Hz) 299 * @param __CNTCLK__ counter clock frequency (in Hz) 300 * @retval Prescaler value (between Min_Data=0 and Max_Data=65535) 301 */ 302 #define __HAL_TIM_CALC_PSC(__TIMCLK__, __CNTCLK__) \ 303 ((__TIMCLK__) >= (__CNTCLK__)) ? (uint32_t)((__TIMCLK__)/(__CNTCLK__) - 1U) : 0U 304 305 /** 306 * @brief HELPER macro calculating the auto-reload value to achieve the required output signal frequency. 307 * @note ex: @ref __HAL_TIM_CALC_PERIOD(1000000, 0, 10000); 308 * @param __TIMCLK__ timer input clock frequency (in Hz) 309 * @param __PSC__ prescaler 310 * @param __FREQ__ output signal frequency (in Hz) 311 * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535) 312 */ 313 #define __HAL_TIM_CALC_PERIOD(__TIMCLK__, __PSC__, __FREQ__) \ 314 (((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? ((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U)) - 1U) : 0U 315 316 /** 317 * @brief HELPER macro calculating the auto-reload value, with dithering feature enabled, to achieve the required 318 * output signal frequency. 319 * @note ex: @ref __HAL_TIM_CALC_PERIOD_DITHER(1000000, 0, 10000); 320 * @note This macro should be used only if dithering is already enabled 321 * @param __TIMCLK__ timer input clock frequency (in Hz) 322 * @param __PSC__ prescaler 323 * @param __FREQ__ output signal frequency (in Hz) 324 * @retval Auto-reload value (between Min_Data=0 and Max_Data=65519) 325 */ 326 #define __HAL_TIM_CALC_PERIOD_DITHER(__TIMCLK__, __PSC__, __FREQ__) \ 327 (((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? \ 328 (uint32_t)(((uint64_t)(__TIMCLK__)*16/((__FREQ__) * ((__PSC__) + 1U)) - 16U)) : 0U 329 330 /** 331 * @brief HELPER macro calculating the compare value required to achieve the required timer output compare 332 * active/inactive delay. 333 * @note ex: @ref __HAL_TIM_CALC_PULSE(1000000, 0, 10); 334 * @param __TIMCLK__ timer input clock frequency (in Hz) 335 * @param __PSC__ prescaler 336 * @param __DELAY__ timer output compare active/inactive delay (in us) 337 * @retval Compare value (between Min_Data=0 and Max_Data=65535) 338 */ 339 #define __HAL_TIM_CALC_PULSE(__TIMCLK__, __PSC__, __DELAY__) \ 340 ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__)) \ 341 / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U)))) 342 343 /** 344 * @brief HELPER macro calculating the compare value, with dithering feature enabled, to achieve the required timer 345 * output compare active/inactive delay. 346 * @note ex: @ref __HAL_TIM_CALC_PULSE_DITHER(1000000, 0, 10); 347 * @note This macro should be used only if dithering is already enabled 348 * @param __TIMCLK__ timer input clock frequency (in Hz) 349 * @param __PSC__ prescaler 350 * @param __DELAY__ timer output compare active/inactive delay (in us) 351 * @retval Compare value (between Min_Data=0 and Max_Data=65519) 352 */ 353 #define __HAL_TIM_CALC_PULSE_DITHER(__TIMCLK__, __PSC__, __DELAY__) \ 354 ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__) * 16U) \ 355 / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U)))) 356 357 /** 358 * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration 359 * (when the timer operates in one pulse mode). 360 * @note ex: @ref __HAL_TIM_CALC_PERIOD_BY_DELAY(1000000, 0, 10, 20); 361 * @param __TIMCLK__ timer input clock frequency (in Hz) 362 * @param __PSC__ prescaler 363 * @param __DELAY__ timer output compare active/inactive delay (in us) 364 * @param __PULSE__ pulse duration (in us) 365 * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535) 366 */ 367 #define __HAL_TIM_CALC_PERIOD_BY_DELAY(__TIMCLK__, __PSC__, __DELAY__, __PULSE__) \ 368 ((uint32_t)(__HAL_TIM_CALC_PULSE((__TIMCLK__), (__PSC__), (__PULSE__)) \ 369 + __HAL_TIM_CALC_PULSE((__TIMCLK__), (__PSC__), (__DELAY__)))) 370 371 /** 372 * @brief HELPER macro calculating the auto-reload value, with dithering feature enabled, to achieve the required 373 * pulse duration (when the timer operates in one pulse mode). 374 * @note ex: @ref __HAL_TIM_CALC_PERIOD_DITHER_BY_DELAY(1000000, 0, 10, 20); 375 * @note This macro should be used only if dithering is already enabled 376 * @param __TIMCLK__ timer input clock frequency (in Hz) 377 * @param __PSC__ prescaler 378 * @param __DELAY__ timer output compare active/inactive delay (in us) 379 * @param __PULSE__ pulse duration (in us) 380 * @retval Auto-reload value (between Min_Data=0 and Max_Data=65519) 381 */ 382 #define __HAL_TIM_CALC_PERIOD_DITHER_BY_DELAY(__TIMCLK__, __PSC__, __DELAY__, __PULSE__) \ 383 ((uint32_t)(__HAL_TIM_CALC_PULSE_DITHER((__TIMCLK__), (__PSC__), (__PULSE__)) \ 384 + __HAL_TIM_CALC_PULSE_DITHER((__TIMCLK__), (__PSC__), (__DELAY__)))) 385 386 /** 387 * @} 388 */ 389 /* End of exported macro -----------------------------------------------------*/ 390 391 /* Private macro -------------------------------------------------------------*/ 392 /** @defgroup TIMEx_Private_Macros TIM Extended Private Macros 393 * @{ 394 */ 395 #define IS_TIM_REMAP(__REMAP__) ((((__REMAP__) & 0xFFFC3FFFU) == 0x00000000U)) 396 #define IS_TIM_BREAKINPUT(__BREAKINPUT__) (((__BREAKINPUT__) == TIM_BREAKINPUT_BRK) || \ 397 ((__BREAKINPUT__) == TIM_BREAKINPUT_BRK2)) 398 399 #define IS_TIM_BREAKINPUTSOURCE(__SOURCE__) (((__SOURCE__) == TIM_BREAKINPUTSOURCE_BKIN) || \ 400 ((__SOURCE__) == TIM_BREAKINPUTSOURCE_COMP1) || \ 401 ((__SOURCE__) == TIM_BREAKINPUTSOURCE_COMP2)) 402 403 #define IS_TIM_BREAKINPUTSOURCE_STATE(__STATE__) (((__STATE__) == TIM_BREAKINPUTSOURCE_DISABLE) || \ 404 ((__STATE__) == TIM_BREAKINPUTSOURCE_ENABLE)) 405 406 #define IS_TIM_BREAKINPUTSOURCE_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_BREAKINPUTSOURCE_POLARITY_LOW) || \ 407 ((__POLARITY__) == TIM_BREAKINPUTSOURCE_POLARITY_HIGH)) 408 409 #define IS_TIM_TISEL(__TISEL__) ((((__TISEL__) & 0xF0F0F0F0U) == 0x00000000U)) 410 411 #define IS_TIM_TISEL_TIX_INSTANCE(INSTANCE, CHANNEL) \ 412 (IS_TIM_CCX_INSTANCE(INSTANCE, CHANNEL) && ((CHANNEL) < TIM_CHANNEL_5)) 413 414 #if defined(TIM3) 415 #define IS_TIM_CLOCKSOURCE_INSTANCE(INSTANCE, __CLOCK__) \ 416 ((((INSTANCE) == TIM1) && \ 417 (((__CLOCK__) == TIM_CLOCKSOURCE_INTERNAL) || \ 418 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE2) || \ 419 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR1) || \ 420 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR2) || \ 421 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1ED) || \ 422 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1) || \ 423 ((__CLOCK__) == TIM_CLOCKSOURCE_TI2) || \ 424 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE1) || \ 425 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR7) || \ 426 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR8))) \ 427 || \ 428 (((INSTANCE) == TIM2) && \ 429 (((__CLOCK__) == TIM_CLOCKSOURCE_INTERNAL) || \ 430 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE2) || \ 431 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR0) || \ 432 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR2) || \ 433 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1ED) || \ 434 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1) || \ 435 ((__CLOCK__) == TIM_CLOCKSOURCE_TI2) || \ 436 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE1) || \ 437 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR7) || \ 438 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR8))) \ 439 || \ 440 (((INSTANCE) == TIM3) && \ 441 (((__CLOCK__) == TIM_CLOCKSOURCE_INTERNAL) || \ 442 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE2) || \ 443 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR0) || \ 444 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR1) || \ 445 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1ED) || \ 446 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1) || \ 447 ((__CLOCK__) == TIM_CLOCKSOURCE_TI2) || \ 448 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE1) || \ 449 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR7) || \ 450 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR8)))) 451 #else 452 #define IS_TIM_CLOCKSOURCE_INSTANCE(INSTANCE, __CLOCK__) \ 453 ((((INSTANCE) == TIM1) && \ 454 (((__CLOCK__) == TIM_CLOCKSOURCE_INTERNAL) || \ 455 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE2) || \ 456 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR1) || \ 457 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR2) || \ 458 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1ED) || \ 459 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1) || \ 460 ((__CLOCK__) == TIM_CLOCKSOURCE_TI2) || \ 461 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE1) || \ 462 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR7) || \ 463 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR8))) \ 464 || \ 465 (((INSTANCE) == TIM2) && \ 466 (((__CLOCK__) == TIM_CLOCKSOURCE_INTERNAL) || \ 467 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE2) || \ 468 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR0) || \ 469 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR2) || \ 470 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1ED) || \ 471 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1) || \ 472 ((__CLOCK__) == TIM_CLOCKSOURCE_TI2) || \ 473 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE1) || \ 474 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR7) || \ 475 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR8)))) 476 #endif /* TIM3 */ 477 478 #if defined(TIM3) 479 #define IS_TIM_TRIGGER_INSTANCE(INSTANCE, __SELECTION__) \ 480 ((((INSTANCE) == TIM1) && \ 481 (((__SELECTION__) == TIM_TS_ITR1) || \ 482 ((__SELECTION__) == TIM_TS_ITR2) || \ 483 ((__SELECTION__) == TIM_TS_TI1F_ED) || \ 484 ((__SELECTION__) == TIM_TS_TI1FP1) || \ 485 ((__SELECTION__) == TIM_TS_TI2FP2) || \ 486 ((__SELECTION__) == TIM_TS_ETRF) || \ 487 ((__SELECTION__) == TIM_TS_ITR7) || \ 488 ((__SELECTION__) == TIM_TS_ITR8))) \ 489 || \ 490 (((INSTANCE) == TIM2) && \ 491 (((__SELECTION__) == TIM_TS_ITR0) || \ 492 ((__SELECTION__) == TIM_TS_ITR2) || \ 493 ((__SELECTION__) == TIM_TS_TI1F_ED) || \ 494 ((__SELECTION__) == TIM_TS_TI1FP1) || \ 495 ((__SELECTION__) == TIM_TS_TI2FP2) || \ 496 ((__SELECTION__) == TIM_TS_ETRF) || \ 497 ((__SELECTION__) == TIM_TS_ITR7) || \ 498 ((__SELECTION__) == TIM_TS_ITR8))) \ 499 || \ 500 (((INSTANCE) == TIM3) && \ 501 (((__SELECTION__) == TIM_TS_ITR0) || \ 502 ((__SELECTION__) == TIM_TS_ITR1) || \ 503 ((__SELECTION__) == TIM_TS_TI1F_ED) || \ 504 ((__SELECTION__) == TIM_TS_TI1FP1) || \ 505 ((__SELECTION__) == TIM_TS_TI2FP2) || \ 506 ((__SELECTION__) == TIM_TS_ETRF) || \ 507 ((__SELECTION__) == TIM_TS_ITR7) || \ 508 ((__SELECTION__) == TIM_TS_ITR8)))) 509 #else 510 #define IS_TIM_TRIGGER_INSTANCE(INSTANCE, __SELECTION__) \ 511 ((((INSTANCE) == TIM1) && \ 512 (((__SELECTION__) == TIM_TS_ITR1) || \ 513 ((__SELECTION__) == TIM_TS_ITR2) || \ 514 ((__SELECTION__) == TIM_TS_TI1F_ED) || \ 515 ((__SELECTION__) == TIM_TS_TI1FP1) || \ 516 ((__SELECTION__) == TIM_TS_TI2FP2) || \ 517 ((__SELECTION__) == TIM_TS_ETRF) || \ 518 ((__SELECTION__) == TIM_TS_ITR7) || \ 519 ((__SELECTION__) == TIM_TS_ITR8))) \ 520 || \ 521 (((INSTANCE) == TIM2) && \ 522 (((__SELECTION__) == TIM_TS_ITR0) || \ 523 ((__SELECTION__) == TIM_TS_ITR2) || \ 524 ((__SELECTION__) == TIM_TS_TI1F_ED) || \ 525 ((__SELECTION__) == TIM_TS_TI1FP1) || \ 526 ((__SELECTION__) == TIM_TS_TI2FP2) || \ 527 ((__SELECTION__) == TIM_TS_ETRF) || \ 528 ((__SELECTION__) == TIM_TS_ITR7) || \ 529 ((__SELECTION__) == TIM_TS_ITR8)))) 530 #endif /* TIM3 */ 531 532 #if defined(TIM3) 533 #define IS_TIM_INTERNAL_TRIGGEREVENT_INSTANCE(INSTANCE, __SELECTION__) \ 534 ((((INSTANCE) == TIM1) && \ 535 (((__SELECTION__) == TIM_TS_ITR1) || \ 536 ((__SELECTION__) == TIM_TS_ITR2) || \ 537 ((__SELECTION__) == TIM_TS_ITR7) || \ 538 ((__SELECTION__) == TIM_TS_ITR8) || \ 539 ((__SELECTION__) == TIM_TS_NONE))) \ 540 || \ 541 (((INSTANCE) == TIM2) && \ 542 (((__SELECTION__) == TIM_TS_ITR0) || \ 543 ((__SELECTION__) == TIM_TS_ITR2) || \ 544 ((__SELECTION__) == TIM_TS_ITR7) || \ 545 ((__SELECTION__) == TIM_TS_ITR8) || \ 546 ((__SELECTION__) == TIM_TS_NONE))) \ 547 || \ 548 (((INSTANCE) == TIM3) && \ 549 (((__SELECTION__) == TIM_TS_ITR0) || \ 550 ((__SELECTION__) == TIM_TS_ITR1) || \ 551 ((__SELECTION__) == TIM_TS_ITR7) || \ 552 ((__SELECTION__) == TIM_TS_ITR8) || \ 553 ((__SELECTION__) == TIM_TS_NONE)))) 554 #else 555 #define IS_TIM_INTERNAL_TRIGGEREVENT_INSTANCE(INSTANCE, __SELECTION__) \ 556 ((((INSTANCE) == TIM1) && \ 557 (((__SELECTION__) == TIM_TS_ITR1) || \ 558 ((__SELECTION__) == TIM_TS_ITR2) || \ 559 ((__SELECTION__) == TIM_TS_ITR7) || \ 560 ((__SELECTION__) == TIM_TS_ITR8) || \ 561 ((__SELECTION__) == TIM_TS_NONE))) \ 562 || \ 563 (((INSTANCE) == TIM2) && \ 564 (((__SELECTION__) == TIM_TS_ITR0) || \ 565 ((__SELECTION__) == TIM_TS_ITR2) || \ 566 ((__SELECTION__) == TIM_TS_ITR7) || \ 567 ((__SELECTION__) == TIM_TS_ITR8) || \ 568 ((__SELECTION__) == TIM_TS_NONE)))) 569 #endif /* TIM3 */ 570 571 #define IS_TIM_OC_CHANNEL_MODE(__MODE__, __CHANNEL__) \ 572 (IS_TIM_OC_MODE(__MODE__) \ 573 && ((((__MODE__) == TIM_OCMODE_DIRECTION_OUTPUT) || ((__MODE__) == TIM_OCMODE_PULSE_ON_COMPARE)) \ 574 ? (((__CHANNEL__) == TIM_CHANNEL_3) || ((__CHANNEL__) == TIM_CHANNEL_4)) : (1 == 1))) 575 576 #define IS_TIM_PULSEONCOMPARE_CHANNEL(__CHANNEL__) \ 577 (((__CHANNEL__) == TIM_CHANNEL_3) || \ 578 ((__CHANNEL__) == TIM_CHANNEL_4)) 579 580 #define IS_TIM_PULSEONCOMPARE_INSTANCE(INSTANCE) IS_TIM_CC3_INSTANCE(INSTANCE) 581 582 #define IS_TIM_PULSEONCOMPARE_WIDTH(__WIDTH__) ((__WIDTH__) <= 0xFFU) 583 584 #define IS_TIM_PULSEONCOMPARE_WIDTHPRESCALER(__PRESCALER__) ((__PRESCALER__) <= 0x7U) 585 586 #define IS_TIM_SLAVE_PRELOAD_SOURCE(__SOURCE__) (((__SOURCE__) == TIM_SMS_PRELOAD_SOURCE_UPDATE) \ 587 || ((__SOURCE__) == TIM_SMS_PRELOAD_SOURCE_INDEX)) 588 589 #define IS_TIM_ENCODERINDEX_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_ENCODERINDEX_POLARITY_INVERTED) || \ 590 ((__POLARITY__) == TIM_ENCODERINDEX_POLARITY_NONINVERTED)) 591 592 #define IS_TIM_ENCODERINDEX_PRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_ENCODERINDEX_PRESCALER_DIV1) || \ 593 ((__PRESCALER__) == TIM_ENCODERINDEX_PRESCALER_DIV2) || \ 594 ((__PRESCALER__) == TIM_ENCODERINDEX_PRESCALER_DIV4) || \ 595 ((__PRESCALER__) == TIM_ENCODERINDEX_PRESCALER_DIV8)) 596 597 #define IS_TIM_ENCODERINDEX_FILTER(__FILTER__) ((__FILTER__) <= 0xFUL) 598 599 #define IS_TIM_ENCODERINDEX_POSITION(__POSITION__) (((__POSITION__) == TIM_ENCODERINDEX_POSITION_00) || \ 600 ((__POSITION__) == TIM_ENCODERINDEX_POSITION_01) || \ 601 ((__POSITION__) == TIM_ENCODERINDEX_POSITION_10) || \ 602 ((__POSITION__) == TIM_ENCODERINDEX_POSITION_11) || \ 603 ((__POSITION__) == TIM_ENCODERINDEX_POSITION_0) || \ 604 ((__POSITION__) == TIM_ENCODERINDEX_POSITION_1)) 605 606 #define IS_TIM_ENCODERINDEX_DIRECTION(__DIRECTION__) (((__DIRECTION__) == TIM_ENCODERINDEX_DIRECTION_UP_DOWN) || \ 607 ((__DIRECTION__) == TIM_ENCODERINDEX_DIRECTION_UP) || \ 608 ((__DIRECTION__) == TIM_ENCODERINDEX_DIRECTION_DOWN)) 609 610 #define IS_TIM_ENCODERINDEX_BLANKING(__BLANKING__) (((__BLANKING__) == TIM_ENCODERINDEX_BLANKING_DISABLE) || \ 611 ((__BLANKING__) == TIM_ENCODERINDEX_BLANKING_TI3) || \ 612 ((__BLANKING__) == TIM_ENCODERINDEX_BLANKING_TI4)) 613 614 /** 615 * @} 616 */ 617 /* End of private macro ------------------------------------------------------*/ 618 619 /* Exported functions --------------------------------------------------------*/ 620 /** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions 621 * @{ 622 */ 623 624 /** @addtogroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions 625 * @brief Timer Hall Sensor functions 626 * @{ 627 */ 628 /* Timer Hall Sensor functions **********************************************/ 629 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, const TIM_HallSensor_InitTypeDef *sConfig); 630 HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim); 631 632 void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim); 633 void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim); 634 635 /* Blocking mode: Polling */ 636 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim); 637 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim); 638 /* Non-Blocking mode: Interrupt */ 639 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim); 640 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim); 641 /* Non-Blocking mode: DMA */ 642 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length); 643 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim); 644 /** 645 * @} 646 */ 647 648 /** @addtogroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions 649 * @brief Timer Complementary Output Compare functions 650 * @{ 651 */ 652 /* Timer Complementary Output Compare functions *****************************/ 653 /* Blocking mode: Polling */ 654 HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel); 655 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); 656 657 /* Non-Blocking mode: Interrupt */ 658 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); 659 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); 660 661 /* Non-Blocking mode: DMA */ 662 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData, 663 uint16_t Length); 664 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); 665 /** 666 * @} 667 */ 668 669 /** @addtogroup TIMEx_Exported_Functions_Group3 Extended Timer Complementary PWM functions 670 * @brief Timer Complementary PWM functions 671 * @{ 672 */ 673 /* Timer Complementary PWM functions ****************************************/ 674 /* Blocking mode: Polling */ 675 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel); 676 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); 677 678 /* Non-Blocking mode: Interrupt */ 679 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); 680 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); 681 /* Non-Blocking mode: DMA */ 682 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData, 683 uint16_t Length); 684 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); 685 /** 686 * @} 687 */ 688 689 /** @addtogroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions 690 * @brief Timer Complementary One Pulse functions 691 * @{ 692 */ 693 /* Timer Complementary One Pulse functions **********************************/ 694 /* Blocking mode: Polling */ 695 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel); 696 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel); 697 698 /* Non-Blocking mode: Interrupt */ 699 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); 700 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); 701 /** 702 * @} 703 */ 704 705 /** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions 706 * @brief Peripheral Control functions 707 * @{ 708 */ 709 /* Extended Control functions ************************************************/ 710 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, 711 uint32_t CommutationSource); 712 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, 713 uint32_t CommutationSource); 714 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, 715 uint32_t CommutationSource); 716 HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, 717 const TIM_MasterConfigTypeDef *sMasterConfig); 718 HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, 719 const TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig); 720 HAL_StatusTypeDef HAL_TIMEx_ConfigBreakInput(TIM_HandleTypeDef *htim, uint32_t BreakInput, 721 const TIMEx_BreakInputConfigTypeDef *sBreakInputConfig); 722 HAL_StatusTypeDef HAL_TIMEx_GroupChannel5(TIM_HandleTypeDef *htim, uint32_t Channels); 723 HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap); 724 HAL_StatusTypeDef HAL_TIMEx_TISelection(TIM_HandleTypeDef *htim, uint32_t TISelection, uint32_t Channel); 725 726 HAL_StatusTypeDef HAL_TIMEx_DisarmBreakInput(TIM_HandleTypeDef *htim, uint32_t BreakInput); 727 HAL_StatusTypeDef HAL_TIMEx_ReArmBreakInput(const TIM_HandleTypeDef *htim, uint32_t BreakInput); 728 HAL_StatusTypeDef HAL_TIMEx_DitheringEnable(TIM_HandleTypeDef *htim); 729 HAL_StatusTypeDef HAL_TIMEx_DitheringDisable(TIM_HandleTypeDef *htim); 730 HAL_StatusTypeDef HAL_TIMEx_OC_ConfigPulseOnCompare(TIM_HandleTypeDef *htim, uint32_t PulseWidthPrescaler, 731 uint32_t PulseWidth); 732 HAL_StatusTypeDef HAL_TIMEx_ConfigSlaveModePreload(TIM_HandleTypeDef *htim, uint32_t Source); 733 HAL_StatusTypeDef HAL_TIMEx_EnableSlaveModePreload(TIM_HandleTypeDef *htim); 734 HAL_StatusTypeDef HAL_TIMEx_DisableSlaveModePreload(TIM_HandleTypeDef *htim); 735 HAL_StatusTypeDef HAL_TIMEx_EnableDeadTimePreload(TIM_HandleTypeDef *htim); 736 HAL_StatusTypeDef HAL_TIMEx_DisableDeadTimePreload(TIM_HandleTypeDef *htim); 737 HAL_StatusTypeDef HAL_TIMEx_ConfigDeadTime(TIM_HandleTypeDef *htim, uint32_t Deadtime); 738 HAL_StatusTypeDef HAL_TIMEx_ConfigAsymmetricalDeadTime(TIM_HandleTypeDef *htim, uint32_t FallingDeadtime); 739 HAL_StatusTypeDef HAL_TIMEx_EnableAsymmetricalDeadTime(TIM_HandleTypeDef *htim); 740 HAL_StatusTypeDef HAL_TIMEx_DisableAsymmetricalDeadTime(TIM_HandleTypeDef *htim); 741 HAL_StatusTypeDef HAL_TIMEx_ConfigEncoderIndex(TIM_HandleTypeDef *htim, 742 TIMEx_EncoderIndexConfigTypeDef *sEncoderIndexConfig); 743 HAL_StatusTypeDef HAL_TIMEx_EnableEncoderIndex(TIM_HandleTypeDef *htim); 744 HAL_StatusTypeDef HAL_TIMEx_DisableEncoderIndex(TIM_HandleTypeDef *htim); 745 HAL_StatusTypeDef HAL_TIMEx_EnableEncoderFirstIndex(TIM_HandleTypeDef *htim); 746 HAL_StatusTypeDef HAL_TIMEx_DisableEncoderFirstIndex(TIM_HandleTypeDef *htim); 747 /** 748 * @} 749 */ 750 751 /** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions 752 * @brief Extended Callbacks functions 753 * @{ 754 */ 755 /* Extended Callback **********************************************************/ 756 void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim); 757 void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim); 758 void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim); 759 void HAL_TIMEx_Break2Callback(TIM_HandleTypeDef *htim); 760 void HAL_TIMEx_EncoderIndexCallback(TIM_HandleTypeDef *htim); 761 void HAL_TIMEx_DirectionChangeCallback(TIM_HandleTypeDef *htim); 762 void HAL_TIMEx_IndexErrorCallback(TIM_HandleTypeDef *htim); 763 void HAL_TIMEx_TransitionErrorCallback(TIM_HandleTypeDef *htim); 764 /** 765 * @} 766 */ 767 768 /** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions 769 * @brief Extended Peripheral State functions 770 * @{ 771 */ 772 /* Extended Peripheral State functions ***************************************/ 773 HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(const TIM_HandleTypeDef *htim); 774 HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(const TIM_HandleTypeDef *htim, uint32_t ChannelN); 775 /** 776 * @} 777 */ 778 779 /** 780 * @} 781 */ 782 /* End of exported functions -------------------------------------------------*/ 783 784 /* Private functions----------------------------------------------------------*/ 785 /** @addtogroup TIMEx_Private_Functions TIM Extended Private Functions 786 * @{ 787 */ 788 void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma); 789 void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma); 790 /** 791 * @} 792 */ 793 /* End of private functions --------------------------------------------------*/ 794 795 /** 796 * @} 797 */ 798 799 /** 800 * @} 801 */ 802 803 #ifdef __cplusplus 804 } 805 #endif 806 807 808 #endif /* STM32WBAxx_HAL_TIM_EX_H */ 809