STM32F103xB HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f1xx_ll_tim.h 00004 * @author MCD Application Team 00005 * @brief Header file of TIM LL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© Copyright (c) 2016 STMicroelectronics. 00010 * All rights reserved.</center></h2> 00011 * 00012 * This software component is licensed by ST under BSD 3-Clause license, 00013 * the "License"; You may not use this file except in compliance with the 00014 * License. You may obtain a copy of the License at: 00015 * opensource.org/licenses/BSD-3-Clause 00016 * 00017 ****************************************************************************** 00018 */ 00019 00020 /* Define to prevent recursive inclusion -------------------------------------*/ 00021 #ifndef __STM32F1xx_LL_TIM_H 00022 #define __STM32F1xx_LL_TIM_H 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 /* Includes ------------------------------------------------------------------*/ 00029 #include "stm32f1xx.h" 00030 00031 /** @addtogroup STM32F1xx_LL_Driver 00032 * @{ 00033 */ 00034 00035 #if defined (TIM1) || defined (TIM2) || defined (TIM3) || defined (TIM4) || defined (TIM5) || defined (TIM6) || defined (TIM7) || defined (TIM8) || defined (TIM9) || defined (TIM10) || defined (TIM11) || defined (TIM12) || defined (TIM13) || defined (TIM14) || defined (TIM15) || defined (TIM16) || defined (TIM17) 00036 00037 /** @defgroup TIM_LL TIM 00038 * @{ 00039 */ 00040 00041 /* Private types -------------------------------------------------------------*/ 00042 /* Private variables ---------------------------------------------------------*/ 00043 /** @defgroup TIM_LL_Private_Variables TIM Private Variables 00044 * @{ 00045 */ 00046 static const uint8_t OFFSET_TAB_CCMRx[] = 00047 { 00048 0x00U, /* 0: TIMx_CH1 */ 00049 0x00U, /* 1: TIMx_CH1N */ 00050 0x00U, /* 2: TIMx_CH2 */ 00051 0x00U, /* 3: TIMx_CH2N */ 00052 0x04U, /* 4: TIMx_CH3 */ 00053 0x04U, /* 5: TIMx_CH3N */ 00054 0x04U /* 6: TIMx_CH4 */ 00055 }; 00056 00057 static const uint8_t SHIFT_TAB_OCxx[] = 00058 { 00059 0U, /* 0: OC1M, OC1FE, OC1PE */ 00060 0U, /* 1: - NA */ 00061 8U, /* 2: OC2M, OC2FE, OC2PE */ 00062 0U, /* 3: - NA */ 00063 0U, /* 4: OC3M, OC3FE, OC3PE */ 00064 0U, /* 5: - NA */ 00065 8U /* 6: OC4M, OC4FE, OC4PE */ 00066 }; 00067 00068 static const uint8_t SHIFT_TAB_ICxx[] = 00069 { 00070 0U, /* 0: CC1S, IC1PSC, IC1F */ 00071 0U, /* 1: - NA */ 00072 8U, /* 2: CC2S, IC2PSC, IC2F */ 00073 0U, /* 3: - NA */ 00074 0U, /* 4: CC3S, IC3PSC, IC3F */ 00075 0U, /* 5: - NA */ 00076 8U /* 6: CC4S, IC4PSC, IC4F */ 00077 }; 00078 00079 static const uint8_t SHIFT_TAB_CCxP[] = 00080 { 00081 0U, /* 0: CC1P */ 00082 2U, /* 1: CC1NP */ 00083 4U, /* 2: CC2P */ 00084 6U, /* 3: CC2NP */ 00085 8U, /* 4: CC3P */ 00086 10U, /* 5: CC3NP */ 00087 12U /* 6: CC4P */ 00088 }; 00089 00090 static const uint8_t SHIFT_TAB_OISx[] = 00091 { 00092 0U, /* 0: OIS1 */ 00093 1U, /* 1: OIS1N */ 00094 2U, /* 2: OIS2 */ 00095 3U, /* 3: OIS2N */ 00096 4U, /* 4: OIS3 */ 00097 5U, /* 5: OIS3N */ 00098 6U /* 6: OIS4 */ 00099 }; 00100 /** 00101 * @} 00102 */ 00103 00104 /* Private constants ---------------------------------------------------------*/ 00105 /** @defgroup TIM_LL_Private_Constants TIM Private Constants 00106 * @{ 00107 */ 00108 00109 00110 00111 /* Mask used to set the TDG[x:0] of the DTG bits of the TIMx_BDTR register */ 00112 #define DT_DELAY_1 ((uint8_t)0x7F) 00113 #define DT_DELAY_2 ((uint8_t)0x3F) 00114 #define DT_DELAY_3 ((uint8_t)0x1F) 00115 #define DT_DELAY_4 ((uint8_t)0x1F) 00116 00117 /* Mask used to set the DTG[7:5] bits of the DTG bits of the TIMx_BDTR register */ 00118 #define DT_RANGE_1 ((uint8_t)0x00) 00119 #define DT_RANGE_2 ((uint8_t)0x80) 00120 #define DT_RANGE_3 ((uint8_t)0xC0) 00121 #define DT_RANGE_4 ((uint8_t)0xE0) 00122 00123 00124 /** 00125 * @} 00126 */ 00127 00128 /* Private macros ------------------------------------------------------------*/ 00129 /** @defgroup TIM_LL_Private_Macros TIM Private Macros 00130 * @{ 00131 */ 00132 /** @brief Convert channel id into channel index. 00133 * @param __CHANNEL__ This parameter can be one of the following values: 00134 * @arg @ref LL_TIM_CHANNEL_CH1 00135 * @arg @ref LL_TIM_CHANNEL_CH1N 00136 * @arg @ref LL_TIM_CHANNEL_CH2 00137 * @arg @ref LL_TIM_CHANNEL_CH2N 00138 * @arg @ref LL_TIM_CHANNEL_CH3 00139 * @arg @ref LL_TIM_CHANNEL_CH3N 00140 * @arg @ref LL_TIM_CHANNEL_CH4 00141 * @retval none 00142 */ 00143 #define TIM_GET_CHANNEL_INDEX( __CHANNEL__) \ 00144 (((__CHANNEL__) == LL_TIM_CHANNEL_CH1) ? 0U :\ 00145 ((__CHANNEL__) == LL_TIM_CHANNEL_CH1N) ? 1U :\ 00146 ((__CHANNEL__) == LL_TIM_CHANNEL_CH2) ? 2U :\ 00147 ((__CHANNEL__) == LL_TIM_CHANNEL_CH2N) ? 3U :\ 00148 ((__CHANNEL__) == LL_TIM_CHANNEL_CH3) ? 4U :\ 00149 ((__CHANNEL__) == LL_TIM_CHANNEL_CH3N) ? 5U : 6U) 00150 00151 /** @brief Calculate the deadtime sampling period(in ps). 00152 * @param __TIMCLK__ timer input clock frequency (in Hz). 00153 * @param __CKD__ This parameter can be one of the following values: 00154 * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 00155 * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 00156 * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 00157 * @retval none 00158 */ 00159 #define TIM_CALC_DTS(__TIMCLK__, __CKD__) \ 00160 (((__CKD__) == LL_TIM_CLOCKDIVISION_DIV1) ? ((uint64_t)1000000000000U/(__TIMCLK__)) : \ 00161 ((__CKD__) == LL_TIM_CLOCKDIVISION_DIV2) ? ((uint64_t)1000000000000U/((__TIMCLK__) >> 1U)) : \ 00162 ((uint64_t)1000000000000U/((__TIMCLK__) >> 2U))) 00163 /** 00164 * @} 00165 */ 00166 00167 00168 /* Exported types ------------------------------------------------------------*/ 00169 #if defined(USE_FULL_LL_DRIVER) 00170 /** @defgroup TIM_LL_ES_INIT TIM Exported Init structure 00171 * @{ 00172 */ 00173 00174 /** 00175 * @brief TIM Time Base configuration structure definition. 00176 */ 00177 typedef struct 00178 { 00179 uint16_t Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock. 00180 This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF. 00181 00182 This feature can be modified afterwards using unitary function 00183 @ref LL_TIM_SetPrescaler().*/ 00184 00185 uint32_t CounterMode; /*!< Specifies the counter mode. 00186 This parameter can be a value of @ref TIM_LL_EC_COUNTERMODE. 00187 00188 This feature can be modified afterwards using unitary function 00189 @ref LL_TIM_SetCounterMode().*/ 00190 00191 uint32_t Autoreload; /*!< Specifies the auto reload value to be loaded into the active 00192 Auto-Reload Register at the next update event. 00193 This parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF. 00194 Some timer instances may support 32 bits counters. In that case this parameter must 00195 be a number between 0x0000 and 0xFFFFFFFF. 00196 00197 This feature can be modified afterwards using unitary function 00198 @ref LL_TIM_SetAutoReload().*/ 00199 00200 uint32_t ClockDivision; /*!< Specifies the clock division. 00201 This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION. 00202 00203 This feature can be modified afterwards using unitary function 00204 @ref LL_TIM_SetClockDivision().*/ 00205 00206 uint32_t RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter 00207 reaches zero, an update event is generated and counting restarts 00208 from the RCR value (N). 00209 This means in PWM mode that (N+1) corresponds to: 00210 - the number of PWM periods in edge-aligned mode 00211 - the number of half PWM period in center-aligned mode 00212 GP timers: this parameter must be a number between Min_Data = 0x00 and 00213 Max_Data = 0xFF. 00214 Advanced timers: this parameter must be a number between Min_Data = 0x0000 and 00215 Max_Data = 0xFFFF. 00216 00217 This feature can be modified afterwards using unitary function 00218 @ref LL_TIM_SetRepetitionCounter().*/ 00219 } LL_TIM_InitTypeDef; 00220 00221 /** 00222 * @brief TIM Output Compare configuration structure definition. 00223 */ 00224 typedef struct 00225 { 00226 uint32_t OCMode; /*!< Specifies the output mode. 00227 This parameter can be a value of @ref TIM_LL_EC_OCMODE. 00228 00229 This feature can be modified afterwards using unitary function 00230 @ref LL_TIM_OC_SetMode().*/ 00231 00232 uint32_t OCState; /*!< Specifies the TIM Output Compare state. 00233 This parameter can be a value of @ref TIM_LL_EC_OCSTATE. 00234 00235 This feature can be modified afterwards using unitary functions 00236 @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/ 00237 00238 uint32_t OCNState; /*!< Specifies the TIM complementary Output Compare state. 00239 This parameter can be a value of @ref TIM_LL_EC_OCSTATE. 00240 00241 This feature can be modified afterwards using unitary functions 00242 @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/ 00243 00244 uint32_t CompareValue; /*!< Specifies the Compare value to be loaded into the Capture Compare Register. 00245 This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF. 00246 00247 This feature can be modified afterwards using unitary function 00248 LL_TIM_OC_SetCompareCHx (x=1..6).*/ 00249 00250 uint32_t OCPolarity; /*!< Specifies the output polarity. 00251 This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY. 00252 00253 This feature can be modified afterwards using unitary function 00254 @ref LL_TIM_OC_SetPolarity().*/ 00255 00256 uint32_t OCNPolarity; /*!< Specifies the complementary output polarity. 00257 This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY. 00258 00259 This feature can be modified afterwards using unitary function 00260 @ref LL_TIM_OC_SetPolarity().*/ 00261 00262 00263 uint32_t OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. 00264 This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE. 00265 00266 This feature can be modified afterwards using unitary function 00267 @ref LL_TIM_OC_SetIdleState().*/ 00268 00269 uint32_t OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state. 00270 This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE. 00271 00272 This feature can be modified afterwards using unitary function 00273 @ref LL_TIM_OC_SetIdleState().*/ 00274 } LL_TIM_OC_InitTypeDef; 00275 00276 /** 00277 * @brief TIM Input Capture configuration structure definition. 00278 */ 00279 00280 typedef struct 00281 { 00282 00283 uint32_t ICPolarity; /*!< Specifies the active edge of the input signal. 00284 This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. 00285 00286 This feature can be modified afterwards using unitary function 00287 @ref LL_TIM_IC_SetPolarity().*/ 00288 00289 uint32_t ICActiveInput; /*!< Specifies the input. 00290 This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. 00291 00292 This feature can be modified afterwards using unitary function 00293 @ref LL_TIM_IC_SetActiveInput().*/ 00294 00295 uint32_t ICPrescaler; /*!< Specifies the Input Capture Prescaler. 00296 This parameter can be a value of @ref TIM_LL_EC_ICPSC. 00297 00298 This feature can be modified afterwards using unitary function 00299 @ref LL_TIM_IC_SetPrescaler().*/ 00300 00301 uint32_t ICFilter; /*!< Specifies the input capture filter. 00302 This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. 00303 00304 This feature can be modified afterwards using unitary function 00305 @ref LL_TIM_IC_SetFilter().*/ 00306 } LL_TIM_IC_InitTypeDef; 00307 00308 00309 /** 00310 * @brief TIM Encoder interface configuration structure definition. 00311 */ 00312 typedef struct 00313 { 00314 uint32_t EncoderMode; /*!< Specifies the encoder resolution (x2 or x4). 00315 This parameter can be a value of @ref TIM_LL_EC_ENCODERMODE. 00316 00317 This feature can be modified afterwards using unitary function 00318 @ref LL_TIM_SetEncoderMode().*/ 00319 00320 uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input. 00321 This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. 00322 00323 This feature can be modified afterwards using unitary function 00324 @ref LL_TIM_IC_SetPolarity().*/ 00325 00326 uint32_t IC1ActiveInput; /*!< Specifies the TI1 input source 00327 This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. 00328 00329 This feature can be modified afterwards using unitary function 00330 @ref LL_TIM_IC_SetActiveInput().*/ 00331 00332 uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value. 00333 This parameter can be a value of @ref TIM_LL_EC_ICPSC. 00334 00335 This feature can be modified afterwards using unitary function 00336 @ref LL_TIM_IC_SetPrescaler().*/ 00337 00338 uint32_t IC1Filter; /*!< Specifies the TI1 input filter. 00339 This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. 00340 00341 This feature can be modified afterwards using unitary function 00342 @ref LL_TIM_IC_SetFilter().*/ 00343 00344 uint32_t IC2Polarity; /*!< Specifies the active edge of TI2 input. 00345 This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. 00346 00347 This feature can be modified afterwards using unitary function 00348 @ref LL_TIM_IC_SetPolarity().*/ 00349 00350 uint32_t IC2ActiveInput; /*!< Specifies the TI2 input source 00351 This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT. 00352 00353 This feature can be modified afterwards using unitary function 00354 @ref LL_TIM_IC_SetActiveInput().*/ 00355 00356 uint32_t IC2Prescaler; /*!< Specifies the TI2 input prescaler value. 00357 This parameter can be a value of @ref TIM_LL_EC_ICPSC. 00358 00359 This feature can be modified afterwards using unitary function 00360 @ref LL_TIM_IC_SetPrescaler().*/ 00361 00362 uint32_t IC2Filter; /*!< Specifies the TI2 input filter. 00363 This parameter can be a value of @ref TIM_LL_EC_IC_FILTER. 00364 00365 This feature can be modified afterwards using unitary function 00366 @ref LL_TIM_IC_SetFilter().*/ 00367 00368 } LL_TIM_ENCODER_InitTypeDef; 00369 00370 /** 00371 * @brief TIM Hall sensor interface configuration structure definition. 00372 */ 00373 typedef struct 00374 { 00375 00376 uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input. 00377 This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY. 00378 00379 This feature can be modified afterwards using unitary function 00380 @ref LL_TIM_IC_SetPolarity().*/ 00381 00382 uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value. 00383 Prescaler must be set to get a maximum counter period longer than the 00384 time interval between 2 consecutive changes on the Hall inputs. 00385 This parameter can be a value of @ref TIM_LL_EC_ICPSC. 00386 00387 This feature can be modified afterwards using unitary function 00388 @ref LL_TIM_IC_SetPrescaler().*/ 00389 00390 uint32_t IC1Filter; /*!< Specifies the TI1 input filter. 00391 This parameter can be a value of 00392 @ref TIM_LL_EC_IC_FILTER. 00393 00394 This feature can be modified afterwards using unitary function 00395 @ref LL_TIM_IC_SetFilter().*/ 00396 00397 uint32_t CommutationDelay; /*!< Specifies the compare value to be loaded into the Capture Compare Register. 00398 A positive pulse (TRGO event) is generated with a programmable delay every time 00399 a change occurs on the Hall inputs. 00400 This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. 00401 00402 This feature can be modified afterwards using unitary function 00403 @ref LL_TIM_OC_SetCompareCH2().*/ 00404 } LL_TIM_HALLSENSOR_InitTypeDef; 00405 00406 /** 00407 * @brief BDTR (Break and Dead Time) structure definition 00408 */ 00409 typedef struct 00410 { 00411 uint32_t OSSRState; /*!< Specifies the Off-State selection used in Run mode. 00412 This parameter can be a value of @ref TIM_LL_EC_OSSR 00413 00414 This feature can be modified afterwards using unitary function 00415 @ref LL_TIM_SetOffStates() 00416 00417 @note This bit-field cannot be modified as long as LOCK level 2 has been 00418 programmed. */ 00419 00420 uint32_t OSSIState; /*!< Specifies the Off-State used in Idle state. 00421 This parameter can be a value of @ref TIM_LL_EC_OSSI 00422 00423 This feature can be modified afterwards using unitary function 00424 @ref LL_TIM_SetOffStates() 00425 00426 @note This bit-field cannot be modified as long as LOCK level 2 has been 00427 programmed. */ 00428 00429 uint32_t LockLevel; /*!< Specifies the LOCK level parameters. 00430 This parameter can be a value of @ref TIM_LL_EC_LOCKLEVEL 00431 00432 @note The LOCK bits can be written only once after the reset. Once the TIMx_BDTR 00433 register has been written, their content is frozen until the next reset.*/ 00434 00435 uint8_t DeadTime; /*!< Specifies the delay time between the switching-off and the 00436 switching-on of the outputs. 00437 This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF. 00438 00439 This feature can be modified afterwards using unitary function 00440 @ref LL_TIM_OC_SetDeadTime() 00441 00442 @note This bit-field can not be modified as long as LOCK level 1, 2 or 3 has been 00443 programmed. */ 00444 00445 uint16_t BreakState; /*!< Specifies whether the TIM Break input is enabled or not. 00446 This parameter can be a value of @ref TIM_LL_EC_BREAK_ENABLE 00447 00448 This feature can be modified afterwards using unitary functions 00449 @ref LL_TIM_EnableBRK() or @ref LL_TIM_DisableBRK() 00450 00451 @note This bit-field can not be modified as long as LOCK level 1 has been 00452 programmed. */ 00453 00454 uint32_t BreakPolarity; /*!< Specifies the TIM Break Input pin polarity. 00455 This parameter can be a value of @ref TIM_LL_EC_BREAK_POLARITY 00456 00457 This feature can be modified afterwards using unitary function 00458 @ref LL_TIM_ConfigBRK() 00459 00460 @note This bit-field can not be modified as long as LOCK level 1 has been 00461 programmed. */ 00462 00463 uint32_t AutomaticOutput; /*!< Specifies whether the TIM Automatic Output feature is enabled or not. 00464 This parameter can be a value of @ref TIM_LL_EC_AUTOMATICOUTPUT_ENABLE 00465 00466 This feature can be modified afterwards using unitary functions 00467 @ref LL_TIM_EnableAutomaticOutput() or @ref LL_TIM_DisableAutomaticOutput() 00468 00469 @note This bit-field can not be modified as long as LOCK level 1 has been 00470 programmed. */ 00471 } LL_TIM_BDTR_InitTypeDef; 00472 00473 /** 00474 * @} 00475 */ 00476 #endif /* USE_FULL_LL_DRIVER */ 00477 00478 /* Exported constants --------------------------------------------------------*/ 00479 /** @defgroup TIM_LL_Exported_Constants TIM Exported Constants 00480 * @{ 00481 */ 00482 00483 /** @defgroup TIM_LL_EC_GET_FLAG Get Flags Defines 00484 * @brief Flags defines which can be used with LL_TIM_ReadReg function. 00485 * @{ 00486 */ 00487 #define LL_TIM_SR_UIF TIM_SR_UIF /*!< Update interrupt flag */ 00488 #define LL_TIM_SR_CC1IF TIM_SR_CC1IF /*!< Capture/compare 1 interrupt flag */ 00489 #define LL_TIM_SR_CC2IF TIM_SR_CC2IF /*!< Capture/compare 2 interrupt flag */ 00490 #define LL_TIM_SR_CC3IF TIM_SR_CC3IF /*!< Capture/compare 3 interrupt flag */ 00491 #define LL_TIM_SR_CC4IF TIM_SR_CC4IF /*!< Capture/compare 4 interrupt flag */ 00492 #define LL_TIM_SR_COMIF TIM_SR_COMIF /*!< COM interrupt flag */ 00493 #define LL_TIM_SR_TIF TIM_SR_TIF /*!< Trigger interrupt flag */ 00494 #define LL_TIM_SR_BIF TIM_SR_BIF /*!< Break interrupt flag */ 00495 #define LL_TIM_SR_CC1OF TIM_SR_CC1OF /*!< Capture/Compare 1 overcapture flag */ 00496 #define LL_TIM_SR_CC2OF TIM_SR_CC2OF /*!< Capture/Compare 2 overcapture flag */ 00497 #define LL_TIM_SR_CC3OF TIM_SR_CC3OF /*!< Capture/Compare 3 overcapture flag */ 00498 #define LL_TIM_SR_CC4OF TIM_SR_CC4OF /*!< Capture/Compare 4 overcapture flag */ 00499 /** 00500 * @} 00501 */ 00502 00503 #if defined(USE_FULL_LL_DRIVER) 00504 /** @defgroup TIM_LL_EC_BREAK_ENABLE Break Enable 00505 * @{ 00506 */ 00507 #define LL_TIM_BREAK_DISABLE 0x00000000U /*!< Break function disabled */ 00508 #define LL_TIM_BREAK_ENABLE TIM_BDTR_BKE /*!< Break function enabled */ 00509 /** 00510 * @} 00511 */ 00512 00513 /** @defgroup TIM_LL_EC_AUTOMATICOUTPUT_ENABLE Automatic output enable 00514 * @{ 00515 */ 00516 #define LL_TIM_AUTOMATICOUTPUT_DISABLE 0x00000000U /*!< MOE can be set only by software */ 00517 #define LL_TIM_AUTOMATICOUTPUT_ENABLE TIM_BDTR_AOE /*!< MOE can be set by software or automatically at the next update event */ 00518 /** 00519 * @} 00520 */ 00521 #endif /* USE_FULL_LL_DRIVER */ 00522 00523 /** @defgroup TIM_LL_EC_IT IT Defines 00524 * @brief IT defines which can be used with LL_TIM_ReadReg and LL_TIM_WriteReg functions. 00525 * @{ 00526 */ 00527 #define LL_TIM_DIER_UIE TIM_DIER_UIE /*!< Update interrupt enable */ 00528 #define LL_TIM_DIER_CC1IE TIM_DIER_CC1IE /*!< Capture/compare 1 interrupt enable */ 00529 #define LL_TIM_DIER_CC2IE TIM_DIER_CC2IE /*!< Capture/compare 2 interrupt enable */ 00530 #define LL_TIM_DIER_CC3IE TIM_DIER_CC3IE /*!< Capture/compare 3 interrupt enable */ 00531 #define LL_TIM_DIER_CC4IE TIM_DIER_CC4IE /*!< Capture/compare 4 interrupt enable */ 00532 #define LL_TIM_DIER_COMIE TIM_DIER_COMIE /*!< COM interrupt enable */ 00533 #define LL_TIM_DIER_TIE TIM_DIER_TIE /*!< Trigger interrupt enable */ 00534 #define LL_TIM_DIER_BIE TIM_DIER_BIE /*!< Break interrupt enable */ 00535 /** 00536 * @} 00537 */ 00538 00539 /** @defgroup TIM_LL_EC_UPDATESOURCE Update Source 00540 * @{ 00541 */ 00542 #define LL_TIM_UPDATESOURCE_REGULAR 0x00000000U /*!< Counter overflow/underflow, Setting the UG bit or Update generation through the slave mode controller generates an update request */ 00543 #define LL_TIM_UPDATESOURCE_COUNTER TIM_CR1_URS /*!< Only counter overflow/underflow generates an update request */ 00544 /** 00545 * @} 00546 */ 00547 00548 /** @defgroup TIM_LL_EC_ONEPULSEMODE One Pulse Mode 00549 * @{ 00550 */ 00551 #define LL_TIM_ONEPULSEMODE_SINGLE TIM_CR1_OPM /*!< Counter stops counting at the next update event */ 00552 #define LL_TIM_ONEPULSEMODE_REPETITIVE 0x00000000U /*!< Counter is not stopped at update event */ 00553 /** 00554 * @} 00555 */ 00556 00557 /** @defgroup TIM_LL_EC_COUNTERMODE Counter Mode 00558 * @{ 00559 */ 00560 #define LL_TIM_COUNTERMODE_UP 0x00000000U /*!<Counter used as upcounter */ 00561 #define LL_TIM_COUNTERMODE_DOWN TIM_CR1_DIR /*!< Counter used as downcounter */ 00562 #define LL_TIM_COUNTERMODE_CENTER_DOWN TIM_CR1_CMS_0 /*!< The counter counts up and down alternatively. Output compare interrupt flags of output channels are set only when the counter is counting down. */ 00563 #define LL_TIM_COUNTERMODE_CENTER_UP TIM_CR1_CMS_1 /*!<The counter counts up and down alternatively. Output compare interrupt flags of output channels are set only when the counter is counting up */ 00564 #define LL_TIM_COUNTERMODE_CENTER_UP_DOWN TIM_CR1_CMS /*!< The counter counts up and down alternatively. Output compare interrupt flags of output channels are set only when the counter is counting up or down. */ 00565 /** 00566 * @} 00567 */ 00568 00569 /** @defgroup TIM_LL_EC_CLOCKDIVISION Clock Division 00570 * @{ 00571 */ 00572 #define LL_TIM_CLOCKDIVISION_DIV1 0x00000000U /*!< tDTS=tCK_INT */ 00573 #define LL_TIM_CLOCKDIVISION_DIV2 TIM_CR1_CKD_0 /*!< tDTS=2*tCK_INT */ 00574 #define LL_TIM_CLOCKDIVISION_DIV4 TIM_CR1_CKD_1 /*!< tDTS=4*tCK_INT */ 00575 /** 00576 * @} 00577 */ 00578 00579 /** @defgroup TIM_LL_EC_COUNTERDIRECTION Counter Direction 00580 * @{ 00581 */ 00582 #define LL_TIM_COUNTERDIRECTION_UP 0x00000000U /*!< Timer counter counts up */ 00583 #define LL_TIM_COUNTERDIRECTION_DOWN TIM_CR1_DIR /*!< Timer counter counts down */ 00584 /** 00585 * @} 00586 */ 00587 00588 /** @defgroup TIM_LL_EC_CCUPDATESOURCE Capture Compare Update Source 00589 * @{ 00590 */ 00591 #define LL_TIM_CCUPDATESOURCE_COMG_ONLY 0x00000000U /*!< Capture/compare control bits are updated by setting the COMG bit only */ 00592 #define LL_TIM_CCUPDATESOURCE_COMG_AND_TRGI TIM_CR2_CCUS /*!< Capture/compare control bits are updated by setting the COMG bit or when a rising edge occurs on trigger input (TRGI) */ 00593 /** 00594 * @} 00595 */ 00596 00597 /** @defgroup TIM_LL_EC_CCDMAREQUEST Capture Compare DMA Request 00598 * @{ 00599 */ 00600 #define LL_TIM_CCDMAREQUEST_CC 0x00000000U /*!< CCx DMA request sent when CCx event occurs */ 00601 #define LL_TIM_CCDMAREQUEST_UPDATE TIM_CR2_CCDS /*!< CCx DMA requests sent when update event occurs */ 00602 /** 00603 * @} 00604 */ 00605 00606 /** @defgroup TIM_LL_EC_LOCKLEVEL Lock Level 00607 * @{ 00608 */ 00609 #define LL_TIM_LOCKLEVEL_OFF 0x00000000U /*!< LOCK OFF - No bit is write protected */ 00610 #define LL_TIM_LOCKLEVEL_1 TIM_BDTR_LOCK_0 /*!< LOCK Level 1 */ 00611 #define LL_TIM_LOCKLEVEL_2 TIM_BDTR_LOCK_1 /*!< LOCK Level 2 */ 00612 #define LL_TIM_LOCKLEVEL_3 TIM_BDTR_LOCK /*!< LOCK Level 3 */ 00613 /** 00614 * @} 00615 */ 00616 00617 /** @defgroup TIM_LL_EC_CHANNEL Channel 00618 * @{ 00619 */ 00620 #define LL_TIM_CHANNEL_CH1 TIM_CCER_CC1E /*!< Timer input/output channel 1 */ 00621 #define LL_TIM_CHANNEL_CH1N TIM_CCER_CC1NE /*!< Timer complementary output channel 1 */ 00622 #define LL_TIM_CHANNEL_CH2 TIM_CCER_CC2E /*!< Timer input/output channel 2 */ 00623 #define LL_TIM_CHANNEL_CH2N TIM_CCER_CC2NE /*!< Timer complementary output channel 2 */ 00624 #define LL_TIM_CHANNEL_CH3 TIM_CCER_CC3E /*!< Timer input/output channel 3 */ 00625 #define LL_TIM_CHANNEL_CH3N TIM_CCER_CC3NE /*!< Timer complementary output channel 3 */ 00626 #define LL_TIM_CHANNEL_CH4 TIM_CCER_CC4E /*!< Timer input/output channel 4 */ 00627 /** 00628 * @} 00629 */ 00630 00631 #if defined(USE_FULL_LL_DRIVER) 00632 /** @defgroup TIM_LL_EC_OCSTATE Output Configuration State 00633 * @{ 00634 */ 00635 #define LL_TIM_OCSTATE_DISABLE 0x00000000U /*!< OCx is not active */ 00636 #define LL_TIM_OCSTATE_ENABLE TIM_CCER_CC1E /*!< OCx signal is output on the corresponding output pin */ 00637 /** 00638 * @} 00639 */ 00640 #endif /* USE_FULL_LL_DRIVER */ 00641 00642 /** @defgroup TIM_LL_EC_OCMODE Output Configuration Mode 00643 * @{ 00644 */ 00645 #define LL_TIM_OCMODE_FROZEN 0x00000000U /*!<The comparison between the output compare register TIMx_CCRy and the counter TIMx_CNT has no effect on the output channel level */ 00646 #define LL_TIM_OCMODE_ACTIVE TIM_CCMR1_OC1M_0 /*!<OCyREF is forced high on compare match*/ 00647 #define LL_TIM_OCMODE_INACTIVE TIM_CCMR1_OC1M_1 /*!<OCyREF is forced low on compare match*/ 00648 #define LL_TIM_OCMODE_TOGGLE (TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!<OCyREF toggles on compare match*/ 00649 #define LL_TIM_OCMODE_FORCED_INACTIVE TIM_CCMR1_OC1M_2 /*!<OCyREF is forced low*/ 00650 #define LL_TIM_OCMODE_FORCED_ACTIVE (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0) /*!<OCyREF is forced high*/ 00651 #define LL_TIM_OCMODE_PWM1 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1) /*!<In upcounting, channel y is active as long as TIMx_CNT<TIMx_CCRy else inactive. In downcounting, channel y is inactive as long as TIMx_CNT>TIMx_CCRy else active.*/ 00652 #define LL_TIM_OCMODE_PWM2 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!<In upcounting, channel y is inactive as long as TIMx_CNT<TIMx_CCRy else active. In downcounting, channel y is active as long as TIMx_CNT>TIMx_CCRy else inactive*/ 00653 /** 00654 * @} 00655 */ 00656 00657 /** @defgroup TIM_LL_EC_OCPOLARITY Output Configuration Polarity 00658 * @{ 00659 */ 00660 #define LL_TIM_OCPOLARITY_HIGH 0x00000000U /*!< OCxactive high*/ 00661 #define LL_TIM_OCPOLARITY_LOW TIM_CCER_CC1P /*!< OCxactive low*/ 00662 /** 00663 * @} 00664 */ 00665 00666 /** @defgroup TIM_LL_EC_OCIDLESTATE Output Configuration Idle State 00667 * @{ 00668 */ 00669 #define LL_TIM_OCIDLESTATE_LOW 0x00000000U /*!<OCx=0 (after a dead-time if OC is implemented) when MOE=0*/ 00670 #define LL_TIM_OCIDLESTATE_HIGH TIM_CR2_OIS1 /*!<OCx=1 (after a dead-time if OC is implemented) when MOE=0*/ 00671 /** 00672 * @} 00673 */ 00674 00675 00676 /** @defgroup TIM_LL_EC_ACTIVEINPUT Active Input Selection 00677 * @{ 00678 */ 00679 #define LL_TIM_ACTIVEINPUT_DIRECTTI (TIM_CCMR1_CC1S_0 << 16U) /*!< ICx is mapped on TIx */ 00680 #define LL_TIM_ACTIVEINPUT_INDIRECTTI (TIM_CCMR1_CC1S_1 << 16U) /*!< ICx is mapped on TIy */ 00681 #define LL_TIM_ACTIVEINPUT_TRC (TIM_CCMR1_CC1S << 16U) /*!< ICx is mapped on TRC */ 00682 /** 00683 * @} 00684 */ 00685 00686 /** @defgroup TIM_LL_EC_ICPSC Input Configuration Prescaler 00687 * @{ 00688 */ 00689 #define LL_TIM_ICPSC_DIV1 0x00000000U /*!< No prescaler, capture is done each time an edge is detected on the capture input */ 00690 #define LL_TIM_ICPSC_DIV2 (TIM_CCMR1_IC1PSC_0 << 16U) /*!< Capture is done once every 2 events */ 00691 #define LL_TIM_ICPSC_DIV4 (TIM_CCMR1_IC1PSC_1 << 16U) /*!< Capture is done once every 4 events */ 00692 #define LL_TIM_ICPSC_DIV8 (TIM_CCMR1_IC1PSC << 16U) /*!< Capture is done once every 8 events */ 00693 /** 00694 * @} 00695 */ 00696 00697 /** @defgroup TIM_LL_EC_IC_FILTER Input Configuration Filter 00698 * @{ 00699 */ 00700 #define LL_TIM_IC_FILTER_FDIV1 0x00000000U /*!< No filter, sampling is done at fDTS */ 00701 #define LL_TIM_IC_FILTER_FDIV1_N2 (TIM_CCMR1_IC1F_0 << 16U) /*!< fSAMPLING=fCK_INT, N=2 */ 00702 #define LL_TIM_IC_FILTER_FDIV1_N4 (TIM_CCMR1_IC1F_1 << 16U) /*!< fSAMPLING=fCK_INT, N=4 */ 00703 #define LL_TIM_IC_FILTER_FDIV1_N8 ((TIM_CCMR1_IC1F_1 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fCK_INT, N=8 */ 00704 #define LL_TIM_IC_FILTER_FDIV2_N6 (TIM_CCMR1_IC1F_2 << 16U) /*!< fSAMPLING=fDTS/2, N=6 */ 00705 #define LL_TIM_IC_FILTER_FDIV2_N8 ((TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/2, N=8 */ 00706 #define LL_TIM_IC_FILTER_FDIV4_N6 ((TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_1) << 16U) /*!< fSAMPLING=fDTS/4, N=6 */ 00707 #define LL_TIM_IC_FILTER_FDIV4_N8 ((TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_1 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/4, N=8 */ 00708 #define LL_TIM_IC_FILTER_FDIV8_N6 (TIM_CCMR1_IC1F_3 << 16U) /*!< fSAMPLING=fDTS/8, N=6 */ 00709 #define LL_TIM_IC_FILTER_FDIV8_N8 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/8, N=8 */ 00710 #define LL_TIM_IC_FILTER_FDIV16_N5 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_1) << 16U) /*!< fSAMPLING=fDTS/16, N=5 */ 00711 #define LL_TIM_IC_FILTER_FDIV16_N6 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_1 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/16, N=6 */ 00712 #define LL_TIM_IC_FILTER_FDIV16_N8 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_2) << 16U) /*!< fSAMPLING=fDTS/16, N=8 */ 00713 #define LL_TIM_IC_FILTER_FDIV32_N5 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/32, N=5 */ 00714 #define LL_TIM_IC_FILTER_FDIV32_N6 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_1) << 16U) /*!< fSAMPLING=fDTS/32, N=6 */ 00715 #define LL_TIM_IC_FILTER_FDIV32_N8 (TIM_CCMR1_IC1F << 16U) /*!< fSAMPLING=fDTS/32, N=8 */ 00716 /** 00717 * @} 00718 */ 00719 00720 /** @defgroup TIM_LL_EC_IC_POLARITY Input Configuration Polarity 00721 * @{ 00722 */ 00723 #define LL_TIM_IC_POLARITY_RISING 0x00000000U /*!< The circuit is sensitive to TIxFP1 rising edge, TIxFP1 is not inverted */ 00724 #define LL_TIM_IC_POLARITY_FALLING TIM_CCER_CC1P /*!< The circuit is sensitive to TIxFP1 falling edge, TIxFP1 is inverted */ 00725 /** 00726 * @} 00727 */ 00728 00729 /** @defgroup TIM_LL_EC_CLOCKSOURCE Clock Source 00730 * @{ 00731 */ 00732 #define LL_TIM_CLOCKSOURCE_INTERNAL 0x00000000U /*!< The timer is clocked by the internal clock provided from the RCC */ 00733 #define LL_TIM_CLOCKSOURCE_EXT_MODE1 (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< Counter counts at each rising or falling edge on a selected input*/ 00734 #define LL_TIM_CLOCKSOURCE_EXT_MODE2 TIM_SMCR_ECE /*!< Counter counts at each rising or falling edge on the external trigger input ETR */ 00735 /** 00736 * @} 00737 */ 00738 00739 /** @defgroup TIM_LL_EC_ENCODERMODE Encoder Mode 00740 * @{ 00741 */ 00742 #define LL_TIM_ENCODERMODE_X2_TI1 TIM_SMCR_SMS_0 /*!< Quadrature encoder mode 1, x2 mode - Counter counts up/down on TI1FP1 edge depending on TI2FP2 level */ 00743 #define LL_TIM_ENCODERMODE_X2_TI2 TIM_SMCR_SMS_1 /*!< Quadrature encoder mode 2, x2 mode - Counter counts up/down on TI2FP2 edge depending on TI1FP1 level */ 00744 #define LL_TIM_ENCODERMODE_X4_TI12 (TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< Quadrature encoder mode 3, x4 mode - Counter counts up/down on both TI1FP1 and TI2FP2 edges depending on the level of the other input */ 00745 /** 00746 * @} 00747 */ 00748 00749 /** @defgroup TIM_LL_EC_TRGO Trigger Output 00750 * @{ 00751 */ 00752 #define LL_TIM_TRGO_RESET 0x00000000U /*!< UG bit from the TIMx_EGR register is used as trigger output */ 00753 #define LL_TIM_TRGO_ENABLE TIM_CR2_MMS_0 /*!< Counter Enable signal (CNT_EN) is used as trigger output */ 00754 #define LL_TIM_TRGO_UPDATE TIM_CR2_MMS_1 /*!< Update event is used as trigger output */ 00755 #define LL_TIM_TRGO_CC1IF (TIM_CR2_MMS_1 | TIM_CR2_MMS_0) /*!< CC1 capture or a compare match is used as trigger output */ 00756 #define LL_TIM_TRGO_OC1REF TIM_CR2_MMS_2 /*!< OC1REF signal is used as trigger output */ 00757 #define LL_TIM_TRGO_OC2REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_0) /*!< OC2REF signal is used as trigger output */ 00758 #define LL_TIM_TRGO_OC3REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1) /*!< OC3REF signal is used as trigger output */ 00759 #define LL_TIM_TRGO_OC4REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1 | TIM_CR2_MMS_0) /*!< OC4REF signal is used as trigger output */ 00760 /** 00761 * @} 00762 */ 00763 00764 00765 /** @defgroup TIM_LL_EC_SLAVEMODE Slave Mode 00766 * @{ 00767 */ 00768 #define LL_TIM_SLAVEMODE_DISABLED 0x00000000U /*!< Slave mode disabled */ 00769 #define LL_TIM_SLAVEMODE_RESET TIM_SMCR_SMS_2 /*!< Reset Mode - Rising edge of the selected trigger input (TRGI) reinitializes the counter */ 00770 #define LL_TIM_SLAVEMODE_GATED (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_0) /*!< Gated Mode - The counter clock is enabled when the trigger input (TRGI) is high */ 00771 #define LL_TIM_SLAVEMODE_TRIGGER (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1) /*!< Trigger Mode - The counter starts at a rising edge of the trigger TRGI */ 00772 /** 00773 * @} 00774 */ 00775 00776 /** @defgroup TIM_LL_EC_TS Trigger Selection 00777 * @{ 00778 */ 00779 #define LL_TIM_TS_ITR0 0x00000000U /*!< Internal Trigger 0 (ITR0) is used as trigger input */ 00780 #define LL_TIM_TS_ITR1 TIM_SMCR_TS_0 /*!< Internal Trigger 1 (ITR1) is used as trigger input */ 00781 #define LL_TIM_TS_ITR2 TIM_SMCR_TS_1 /*!< Internal Trigger 2 (ITR2) is used as trigger input */ 00782 #define LL_TIM_TS_ITR3 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1) /*!< Internal Trigger 3 (ITR3) is used as trigger input */ 00783 #define LL_TIM_TS_TI1F_ED TIM_SMCR_TS_2 /*!< TI1 Edge Detector (TI1F_ED) is used as trigger input */ 00784 #define LL_TIM_TS_TI1FP1 (TIM_SMCR_TS_2 | TIM_SMCR_TS_0) /*!< Filtered Timer Input 1 (TI1FP1) is used as trigger input */ 00785 #define LL_TIM_TS_TI2FP2 (TIM_SMCR_TS_2 | TIM_SMCR_TS_1) /*!< Filtered Timer Input 2 (TI12P2) is used as trigger input */ 00786 #define LL_TIM_TS_ETRF (TIM_SMCR_TS_2 | TIM_SMCR_TS_1 | TIM_SMCR_TS_0) /*!< Filtered external Trigger (ETRF) is used as trigger input */ 00787 /** 00788 * @} 00789 */ 00790 00791 /** @defgroup TIM_LL_EC_ETR_POLARITY External Trigger Polarity 00792 * @{ 00793 */ 00794 #define LL_TIM_ETR_POLARITY_NONINVERTED 0x00000000U /*!< ETR is non-inverted, active at high level or rising edge */ 00795 #define LL_TIM_ETR_POLARITY_INVERTED TIM_SMCR_ETP /*!< ETR is inverted, active at low level or falling edge */ 00796 /** 00797 * @} 00798 */ 00799 00800 /** @defgroup TIM_LL_EC_ETR_PRESCALER External Trigger Prescaler 00801 * @{ 00802 */ 00803 #define LL_TIM_ETR_PRESCALER_DIV1 0x00000000U /*!< ETR prescaler OFF */ 00804 #define LL_TIM_ETR_PRESCALER_DIV2 TIM_SMCR_ETPS_0 /*!< ETR frequency is divided by 2 */ 00805 #define LL_TIM_ETR_PRESCALER_DIV4 TIM_SMCR_ETPS_1 /*!< ETR frequency is divided by 4 */ 00806 #define LL_TIM_ETR_PRESCALER_DIV8 TIM_SMCR_ETPS /*!< ETR frequency is divided by 8 */ 00807 /** 00808 * @} 00809 */ 00810 00811 /** @defgroup TIM_LL_EC_ETR_FILTER External Trigger Filter 00812 * @{ 00813 */ 00814 #define LL_TIM_ETR_FILTER_FDIV1 0x00000000U /*!< No filter, sampling is done at fDTS */ 00815 #define LL_TIM_ETR_FILTER_FDIV1_N2 TIM_SMCR_ETF_0 /*!< fSAMPLING=fCK_INT, N=2 */ 00816 #define LL_TIM_ETR_FILTER_FDIV1_N4 TIM_SMCR_ETF_1 /*!< fSAMPLING=fCK_INT, N=4 */ 00817 #define LL_TIM_ETR_FILTER_FDIV1_N8 (TIM_SMCR_ETF_1 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fCK_INT, N=8 */ 00818 #define LL_TIM_ETR_FILTER_FDIV2_N6 TIM_SMCR_ETF_2 /*!< fSAMPLING=fDTS/2, N=6 */ 00819 #define LL_TIM_ETR_FILTER_FDIV2_N8 (TIM_SMCR_ETF_2 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/2, N=8 */ 00820 #define LL_TIM_ETR_FILTER_FDIV4_N6 (TIM_SMCR_ETF_2 | TIM_SMCR_ETF_1) /*!< fSAMPLING=fDTS/4, N=6 */ 00821 #define LL_TIM_ETR_FILTER_FDIV4_N8 (TIM_SMCR_ETF_2 | TIM_SMCR_ETF_1 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/4, N=8 */ 00822 #define LL_TIM_ETR_FILTER_FDIV8_N6 TIM_SMCR_ETF_3 /*!< fSAMPLING=fDTS/8, N=8 */ 00823 #define LL_TIM_ETR_FILTER_FDIV8_N8 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/16, N=5 */ 00824 #define LL_TIM_ETR_FILTER_FDIV16_N5 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_1) /*!< fSAMPLING=fDTS/16, N=6 */ 00825 #define LL_TIM_ETR_FILTER_FDIV16_N6 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_1 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/16, N=8 */ 00826 #define LL_TIM_ETR_FILTER_FDIV16_N8 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_2) /*!< fSAMPLING=fDTS/16, N=5 */ 00827 #define LL_TIM_ETR_FILTER_FDIV32_N5 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_2 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/32, N=5 */ 00828 #define LL_TIM_ETR_FILTER_FDIV32_N6 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_2 | TIM_SMCR_ETF_1) /*!< fSAMPLING=fDTS/32, N=6 */ 00829 #define LL_TIM_ETR_FILTER_FDIV32_N8 TIM_SMCR_ETF /*!< fSAMPLING=fDTS/32, N=8 */ 00830 /** 00831 * @} 00832 */ 00833 00834 00835 /** @defgroup TIM_LL_EC_BREAK_POLARITY break polarity 00836 * @{ 00837 */ 00838 #define LL_TIM_BREAK_POLARITY_LOW 0x00000000U /*!< Break input BRK is active low */ 00839 #define LL_TIM_BREAK_POLARITY_HIGH TIM_BDTR_BKP /*!< Break input BRK is active high */ 00840 /** 00841 * @} 00842 */ 00843 00844 00845 00846 00847 /** @defgroup TIM_LL_EC_OSSI OSSI 00848 * @{ 00849 */ 00850 #define LL_TIM_OSSI_DISABLE 0x00000000U /*!< When inactive, OCx/OCxN outputs are disabled */ 00851 #define LL_TIM_OSSI_ENABLE TIM_BDTR_OSSI /*!< When inactive, OxC/OCxN outputs are first forced with their inactive level then forced to their idle level after the deadtime */ 00852 /** 00853 * @} 00854 */ 00855 00856 /** @defgroup TIM_LL_EC_OSSR OSSR 00857 * @{ 00858 */ 00859 #define LL_TIM_OSSR_DISABLE 0x00000000U /*!< When inactive, OCx/OCxN outputs are disabled */ 00860 #define LL_TIM_OSSR_ENABLE TIM_BDTR_OSSR /*!< When inactive, OC/OCN outputs are enabled with their inactive level as soon as CCxE=1 or CCxNE=1 */ 00861 /** 00862 * @} 00863 */ 00864 00865 00866 /** @defgroup TIM_LL_EC_DMABURST_BASEADDR DMA Burst Base Address 00867 * @{ 00868 */ 00869 #define LL_TIM_DMABURST_BASEADDR_CR1 0x00000000U /*!< TIMx_CR1 register is the DMA base address for DMA burst */ 00870 #define LL_TIM_DMABURST_BASEADDR_CR2 TIM_DCR_DBA_0 /*!< TIMx_CR2 register is the DMA base address for DMA burst */ 00871 #define LL_TIM_DMABURST_BASEADDR_SMCR TIM_DCR_DBA_1 /*!< TIMx_SMCR register is the DMA base address for DMA burst */ 00872 #define LL_TIM_DMABURST_BASEADDR_DIER (TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_DIER register is the DMA base address for DMA burst */ 00873 #define LL_TIM_DMABURST_BASEADDR_SR TIM_DCR_DBA_2 /*!< TIMx_SR register is the DMA base address for DMA burst */ 00874 #define LL_TIM_DMABURST_BASEADDR_EGR (TIM_DCR_DBA_2 | TIM_DCR_DBA_0) /*!< TIMx_EGR register is the DMA base address for DMA burst */ 00875 #define LL_TIM_DMABURST_BASEADDR_CCMR1 (TIM_DCR_DBA_2 | TIM_DCR_DBA_1) /*!< TIMx_CCMR1 register is the DMA base address for DMA burst */ 00876 #define LL_TIM_DMABURST_BASEADDR_CCMR2 (TIM_DCR_DBA_2 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_CCMR2 register is the DMA base address for DMA burst */ 00877 #define LL_TIM_DMABURST_BASEADDR_CCER TIM_DCR_DBA_3 /*!< TIMx_CCER register is the DMA base address for DMA burst */ 00878 #define LL_TIM_DMABURST_BASEADDR_CNT (TIM_DCR_DBA_3 | TIM_DCR_DBA_0) /*!< TIMx_CNT register is the DMA base address for DMA burst */ 00879 #define LL_TIM_DMABURST_BASEADDR_PSC (TIM_DCR_DBA_3 | TIM_DCR_DBA_1) /*!< TIMx_PSC register is the DMA base address for DMA burst */ 00880 #define LL_TIM_DMABURST_BASEADDR_ARR (TIM_DCR_DBA_3 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_ARR register is the DMA base address for DMA burst */ 00881 #define LL_TIM_DMABURST_BASEADDR_RCR (TIM_DCR_DBA_3 | TIM_DCR_DBA_2) /*!< TIMx_RCR register is the DMA base address for DMA burst */ 00882 #define LL_TIM_DMABURST_BASEADDR_CCR1 (TIM_DCR_DBA_3 | TIM_DCR_DBA_2 | TIM_DCR_DBA_0) /*!< TIMx_CCR1 register is the DMA base address for DMA burst */ 00883 #define LL_TIM_DMABURST_BASEADDR_CCR2 (TIM_DCR_DBA_3 | TIM_DCR_DBA_2 | TIM_DCR_DBA_1) /*!< TIMx_CCR2 register is the DMA base address for DMA burst */ 00884 #define LL_TIM_DMABURST_BASEADDR_CCR3 (TIM_DCR_DBA_3 | TIM_DCR_DBA_2 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_CCR3 register is the DMA base address for DMA burst */ 00885 #define LL_TIM_DMABURST_BASEADDR_CCR4 TIM_DCR_DBA_4 /*!< TIMx_CCR4 register is the DMA base address for DMA burst */ 00886 #define LL_TIM_DMABURST_BASEADDR_BDTR (TIM_DCR_DBA_4 | TIM_DCR_DBA_0) /*!< TIMx_BDTR register is the DMA base address for DMA burst */ 00887 /** 00888 * @} 00889 */ 00890 00891 /** @defgroup TIM_LL_EC_DMABURST_LENGTH DMA Burst Length 00892 * @{ 00893 */ 00894 #define LL_TIM_DMABURST_LENGTH_1TRANSFER 0x00000000U /*!< Transfer is done to 1 register starting from the DMA burst base address */ 00895 #define LL_TIM_DMABURST_LENGTH_2TRANSFERS TIM_DCR_DBL_0 /*!< Transfer is done to 2 registers starting from the DMA burst base address */ 00896 #define LL_TIM_DMABURST_LENGTH_3TRANSFERS TIM_DCR_DBL_1 /*!< Transfer is done to 3 registers starting from the DMA burst base address */ 00897 #define LL_TIM_DMABURST_LENGTH_4TRANSFERS (TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 4 registers starting from the DMA burst base address */ 00898 #define LL_TIM_DMABURST_LENGTH_5TRANSFERS TIM_DCR_DBL_2 /*!< Transfer is done to 5 registers starting from the DMA burst base address */ 00899 #define LL_TIM_DMABURST_LENGTH_6TRANSFERS (TIM_DCR_DBL_2 | TIM_DCR_DBL_0) /*!< Transfer is done to 6 registers starting from the DMA burst base address */ 00900 #define LL_TIM_DMABURST_LENGTH_7TRANSFERS (TIM_DCR_DBL_2 | TIM_DCR_DBL_1) /*!< Transfer is done to 7 registers starting from the DMA burst base address */ 00901 #define LL_TIM_DMABURST_LENGTH_8TRANSFERS (TIM_DCR_DBL_2 | TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 1 registers starting from the DMA burst base address */ 00902 #define LL_TIM_DMABURST_LENGTH_9TRANSFERS TIM_DCR_DBL_3 /*!< Transfer is done to 9 registers starting from the DMA burst base address */ 00903 #define LL_TIM_DMABURST_LENGTH_10TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_0) /*!< Transfer is done to 10 registers starting from the DMA burst base address */ 00904 #define LL_TIM_DMABURST_LENGTH_11TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_1) /*!< Transfer is done to 11 registers starting from the DMA burst base address */ 00905 #define LL_TIM_DMABURST_LENGTH_12TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 12 registers starting from the DMA burst base address */ 00906 #define LL_TIM_DMABURST_LENGTH_13TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_2) /*!< Transfer is done to 13 registers starting from the DMA burst base address */ 00907 #define LL_TIM_DMABURST_LENGTH_14TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_2 | TIM_DCR_DBL_0) /*!< Transfer is done to 14 registers starting from the DMA burst base address */ 00908 #define LL_TIM_DMABURST_LENGTH_15TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_2 | TIM_DCR_DBL_1) /*!< Transfer is done to 15 registers starting from the DMA burst base address */ 00909 #define LL_TIM_DMABURST_LENGTH_16TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_2 | TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 16 registers starting from the DMA burst base address */ 00910 #define LL_TIM_DMABURST_LENGTH_17TRANSFERS TIM_DCR_DBL_4 /*!< Transfer is done to 17 registers starting from the DMA burst base address */ 00911 #define LL_TIM_DMABURST_LENGTH_18TRANSFERS (TIM_DCR_DBL_4 | TIM_DCR_DBL_0) /*!< Transfer is done to 18 registers starting from the DMA burst base address */ 00912 /** 00913 * @} 00914 */ 00915 00916 00917 /** 00918 * @} 00919 */ 00920 00921 /* Exported macro ------------------------------------------------------------*/ 00922 /** @defgroup TIM_LL_Exported_Macros TIM Exported Macros 00923 * @{ 00924 */ 00925 00926 /** @defgroup TIM_LL_EM_WRITE_READ Common Write and read registers Macros 00927 * @{ 00928 */ 00929 /** 00930 * @brief Write a value in TIM register. 00931 * @param __INSTANCE__ TIM Instance 00932 * @param __REG__ Register to be written 00933 * @param __VALUE__ Value to be written in the register 00934 * @retval None 00935 */ 00936 #define LL_TIM_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG((__INSTANCE__)->__REG__, (__VALUE__)) 00937 00938 /** 00939 * @brief Read a value in TIM register. 00940 * @param __INSTANCE__ TIM Instance 00941 * @param __REG__ Register to be read 00942 * @retval Register value 00943 */ 00944 #define LL_TIM_ReadReg(__INSTANCE__, __REG__) READ_REG((__INSTANCE__)->__REG__) 00945 /** 00946 * @} 00947 */ 00948 00949 /** @defgroup TIM_LL_EM_Exported_Macros Exported_Macros 00950 * @{ 00951 */ 00952 00953 /** 00954 * @brief HELPER macro calculating DTG[0:7] in the TIMx_BDTR register to achieve the requested dead time duration. 00955 * @note ex: @ref __LL_TIM_CALC_DEADTIME (80000000, @ref LL_TIM_GetClockDivision (), 120); 00956 * @param __TIMCLK__ timer input clock frequency (in Hz) 00957 * @param __CKD__ This parameter can be one of the following values: 00958 * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 00959 * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 00960 * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 00961 * @param __DT__ deadtime duration (in ns) 00962 * @retval DTG[0:7] 00963 */ 00964 #define __LL_TIM_CALC_DEADTIME(__TIMCLK__, __CKD__, __DT__) \ 00965 ( (((uint64_t)((__DT__)*1000U)) < ((DT_DELAY_1+1U) * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? \ 00966 (uint8_t)(((uint64_t)((__DT__)*1000U) / TIM_CALC_DTS((__TIMCLK__), (__CKD__))) & DT_DELAY_1) : \ 00967 (((uint64_t)((__DT__)*1000U)) < ((64U + (DT_DELAY_2+1U)) * 2U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? \ 00968 (uint8_t)(DT_RANGE_2 | ((uint8_t)((uint8_t)((((uint64_t)((__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), \ 00969 (__CKD__))) >> 1U) - (uint8_t) 64) & DT_DELAY_2)) :\ 00970 (((uint64_t)((__DT__)*1000U)) < ((32U + (DT_DELAY_3+1U)) * 8U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? \ 00971 (uint8_t)(DT_RANGE_3 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), \ 00972 (__CKD__))) >> 3U) - (uint8_t) 32) & DT_DELAY_3)) :\ 00973 (((uint64_t)((__DT__)*1000U)) < ((32U + (DT_DELAY_4+1U)) * 16U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? \ 00974 (uint8_t)(DT_RANGE_4 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), \ 00975 (__CKD__))) >> 4U) - (uint8_t) 32) & DT_DELAY_4)) :\ 00976 0U) 00977 00978 /** 00979 * @brief HELPER macro calculating the prescaler value to achieve the required counter clock frequency. 00980 * @note ex: @ref __LL_TIM_CALC_PSC (80000000, 1000000); 00981 * @param __TIMCLK__ timer input clock frequency (in Hz) 00982 * @param __CNTCLK__ counter clock frequency (in Hz) 00983 * @retval Prescaler value (between Min_Data=0 and Max_Data=65535) 00984 */ 00985 #define __LL_TIM_CALC_PSC(__TIMCLK__, __CNTCLK__) \ 00986 (((__TIMCLK__) >= (__CNTCLK__)) ? (uint32_t)(((__TIMCLK__)/(__CNTCLK__)) - 1U) : 0U) 00987 00988 /** 00989 * @brief HELPER macro calculating the auto-reload value to achieve the required output signal frequency. 00990 * @note ex: @ref __LL_TIM_CALC_ARR (1000000, @ref LL_TIM_GetPrescaler (), 10000); 00991 * @param __TIMCLK__ timer input clock frequency (in Hz) 00992 * @param __PSC__ prescaler 00993 * @param __FREQ__ output signal frequency (in Hz) 00994 * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535) 00995 */ 00996 #define __LL_TIM_CALC_ARR(__TIMCLK__, __PSC__, __FREQ__) \ 00997 ((((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? (((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U))) - 1U) : 0U) 00998 00999 /** 01000 * @brief HELPER macro calculating the compare value required to achieve the required timer output compare 01001 * active/inactive delay. 01002 * @note ex: @ref __LL_TIM_CALC_DELAY (1000000, @ref LL_TIM_GetPrescaler (), 10); 01003 * @param __TIMCLK__ timer input clock frequency (in Hz) 01004 * @param __PSC__ prescaler 01005 * @param __DELAY__ timer output compare active/inactive delay (in us) 01006 * @retval Compare value (between Min_Data=0 and Max_Data=65535) 01007 */ 01008 #define __LL_TIM_CALC_DELAY(__TIMCLK__, __PSC__, __DELAY__) \ 01009 ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__)) \ 01010 / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U)))) 01011 01012 /** 01013 * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration 01014 * (when the timer operates in one pulse mode). 01015 * @note ex: @ref __LL_TIM_CALC_PULSE (1000000, @ref LL_TIM_GetPrescaler (), 10, 20); 01016 * @param __TIMCLK__ timer input clock frequency (in Hz) 01017 * @param __PSC__ prescaler 01018 * @param __DELAY__ timer output compare active/inactive delay (in us) 01019 * @param __PULSE__ pulse duration (in us) 01020 * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535) 01021 */ 01022 #define __LL_TIM_CALC_PULSE(__TIMCLK__, __PSC__, __DELAY__, __PULSE__) \ 01023 ((uint32_t)(__LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__PULSE__)) \ 01024 + __LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__DELAY__)))) 01025 01026 /** 01027 * @brief HELPER macro retrieving the ratio of the input capture prescaler 01028 * @note ex: @ref __LL_TIM_GET_ICPSC_RATIO (@ref LL_TIM_IC_GetPrescaler ()); 01029 * @param __ICPSC__ This parameter can be one of the following values: 01030 * @arg @ref LL_TIM_ICPSC_DIV1 01031 * @arg @ref LL_TIM_ICPSC_DIV2 01032 * @arg @ref LL_TIM_ICPSC_DIV4 01033 * @arg @ref LL_TIM_ICPSC_DIV8 01034 * @retval Input capture prescaler ratio (1, 2, 4 or 8) 01035 */ 01036 #define __LL_TIM_GET_ICPSC_RATIO(__ICPSC__) \ 01037 ((uint32_t)(0x01U << (((__ICPSC__) >> 16U) >> TIM_CCMR1_IC1PSC_Pos))) 01038 01039 01040 /** 01041 * @} 01042 */ 01043 01044 01045 /** 01046 * @} 01047 */ 01048 01049 /* Exported functions --------------------------------------------------------*/ 01050 /** @defgroup TIM_LL_Exported_Functions TIM Exported Functions 01051 * @{ 01052 */ 01053 01054 /** @defgroup TIM_LL_EF_Time_Base Time Base configuration 01055 * @{ 01056 */ 01057 /** 01058 * @brief Enable timer counter. 01059 * @rmtoll CR1 CEN LL_TIM_EnableCounter 01060 * @param TIMx Timer instance 01061 * @retval None 01062 */ 01063 __STATIC_INLINE void LL_TIM_EnableCounter(TIM_TypeDef *TIMx) 01064 { 01065 SET_BIT(TIMx->CR1, TIM_CR1_CEN); 01066 } 01067 01068 /** 01069 * @brief Disable timer counter. 01070 * @rmtoll CR1 CEN LL_TIM_DisableCounter 01071 * @param TIMx Timer instance 01072 * @retval None 01073 */ 01074 __STATIC_INLINE void LL_TIM_DisableCounter(TIM_TypeDef *TIMx) 01075 { 01076 CLEAR_BIT(TIMx->CR1, TIM_CR1_CEN); 01077 } 01078 01079 /** 01080 * @brief Indicates whether the timer counter is enabled. 01081 * @rmtoll CR1 CEN LL_TIM_IsEnabledCounter 01082 * @param TIMx Timer instance 01083 * @retval State of bit (1 or 0). 01084 */ 01085 __STATIC_INLINE uint32_t LL_TIM_IsEnabledCounter(TIM_TypeDef *TIMx) 01086 { 01087 return ((READ_BIT(TIMx->CR1, TIM_CR1_CEN) == (TIM_CR1_CEN)) ? 1UL : 0UL); 01088 } 01089 01090 /** 01091 * @brief Enable update event generation. 01092 * @rmtoll CR1 UDIS LL_TIM_EnableUpdateEvent 01093 * @param TIMx Timer instance 01094 * @retval None 01095 */ 01096 __STATIC_INLINE void LL_TIM_EnableUpdateEvent(TIM_TypeDef *TIMx) 01097 { 01098 CLEAR_BIT(TIMx->CR1, TIM_CR1_UDIS); 01099 } 01100 01101 /** 01102 * @brief Disable update event generation. 01103 * @rmtoll CR1 UDIS LL_TIM_DisableUpdateEvent 01104 * @param TIMx Timer instance 01105 * @retval None 01106 */ 01107 __STATIC_INLINE void LL_TIM_DisableUpdateEvent(TIM_TypeDef *TIMx) 01108 { 01109 SET_BIT(TIMx->CR1, TIM_CR1_UDIS); 01110 } 01111 01112 /** 01113 * @brief Indicates whether update event generation is enabled. 01114 * @rmtoll CR1 UDIS LL_TIM_IsEnabledUpdateEvent 01115 * @param TIMx Timer instance 01116 * @retval Inverted state of bit (0 or 1). 01117 */ 01118 __STATIC_INLINE uint32_t LL_TIM_IsEnabledUpdateEvent(TIM_TypeDef *TIMx) 01119 { 01120 return ((READ_BIT(TIMx->CR1, TIM_CR1_UDIS) == (uint32_t)RESET) ? 1UL : 0UL); 01121 } 01122 01123 /** 01124 * @brief Set update event source 01125 * @note Update event source set to LL_TIM_UPDATESOURCE_REGULAR: any of the following events 01126 * generate an update interrupt or DMA request if enabled: 01127 * - Counter overflow/underflow 01128 * - Setting the UG bit 01129 * - Update generation through the slave mode controller 01130 * @note Update event source set to LL_TIM_UPDATESOURCE_COUNTER: only counter 01131 * overflow/underflow generates an update interrupt or DMA request if enabled. 01132 * @rmtoll CR1 URS LL_TIM_SetUpdateSource 01133 * @param TIMx Timer instance 01134 * @param UpdateSource This parameter can be one of the following values: 01135 * @arg @ref LL_TIM_UPDATESOURCE_REGULAR 01136 * @arg @ref LL_TIM_UPDATESOURCE_COUNTER 01137 * @retval None 01138 */ 01139 __STATIC_INLINE void LL_TIM_SetUpdateSource(TIM_TypeDef *TIMx, uint32_t UpdateSource) 01140 { 01141 MODIFY_REG(TIMx->CR1, TIM_CR1_URS, UpdateSource); 01142 } 01143 01144 /** 01145 * @brief Get actual event update source 01146 * @rmtoll CR1 URS LL_TIM_GetUpdateSource 01147 * @param TIMx Timer instance 01148 * @retval Returned value can be one of the following values: 01149 * @arg @ref LL_TIM_UPDATESOURCE_REGULAR 01150 * @arg @ref LL_TIM_UPDATESOURCE_COUNTER 01151 */ 01152 __STATIC_INLINE uint32_t LL_TIM_GetUpdateSource(TIM_TypeDef *TIMx) 01153 { 01154 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_URS)); 01155 } 01156 01157 /** 01158 * @brief Set one pulse mode (one shot v.s. repetitive). 01159 * @rmtoll CR1 OPM LL_TIM_SetOnePulseMode 01160 * @param TIMx Timer instance 01161 * @param OnePulseMode This parameter can be one of the following values: 01162 * @arg @ref LL_TIM_ONEPULSEMODE_SINGLE 01163 * @arg @ref LL_TIM_ONEPULSEMODE_REPETITIVE 01164 * @retval None 01165 */ 01166 __STATIC_INLINE void LL_TIM_SetOnePulseMode(TIM_TypeDef *TIMx, uint32_t OnePulseMode) 01167 { 01168 MODIFY_REG(TIMx->CR1, TIM_CR1_OPM, OnePulseMode); 01169 } 01170 01171 /** 01172 * @brief Get actual one pulse mode. 01173 * @rmtoll CR1 OPM LL_TIM_GetOnePulseMode 01174 * @param TIMx Timer instance 01175 * @retval Returned value can be one of the following values: 01176 * @arg @ref LL_TIM_ONEPULSEMODE_SINGLE 01177 * @arg @ref LL_TIM_ONEPULSEMODE_REPETITIVE 01178 */ 01179 __STATIC_INLINE uint32_t LL_TIM_GetOnePulseMode(TIM_TypeDef *TIMx) 01180 { 01181 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_OPM)); 01182 } 01183 01184 /** 01185 * @brief Set the timer counter counting mode. 01186 * @note Macro IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to 01187 * check whether or not the counter mode selection feature is supported 01188 * by a timer instance. 01189 * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse) 01190 * requires a timer reset to avoid unexpected direction 01191 * due to DIR bit readonly in center aligned mode. 01192 * @rmtoll CR1 DIR LL_TIM_SetCounterMode\n 01193 * CR1 CMS LL_TIM_SetCounterMode 01194 * @param TIMx Timer instance 01195 * @param CounterMode This parameter can be one of the following values: 01196 * @arg @ref LL_TIM_COUNTERMODE_UP 01197 * @arg @ref LL_TIM_COUNTERMODE_DOWN 01198 * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP 01199 * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN 01200 * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN 01201 * @retval None 01202 */ 01203 __STATIC_INLINE void LL_TIM_SetCounterMode(TIM_TypeDef *TIMx, uint32_t CounterMode) 01204 { 01205 MODIFY_REG(TIMx->CR1, (TIM_CR1_DIR | TIM_CR1_CMS), CounterMode); 01206 } 01207 01208 /** 01209 * @brief Get actual counter mode. 01210 * @note Macro IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to 01211 * check whether or not the counter mode selection feature is supported 01212 * by a timer instance. 01213 * @rmtoll CR1 DIR LL_TIM_GetCounterMode\n 01214 * CR1 CMS LL_TIM_GetCounterMode 01215 * @param TIMx Timer instance 01216 * @retval Returned value can be one of the following values: 01217 * @arg @ref LL_TIM_COUNTERMODE_UP 01218 * @arg @ref LL_TIM_COUNTERMODE_DOWN 01219 * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP 01220 * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN 01221 * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN 01222 */ 01223 __STATIC_INLINE uint32_t LL_TIM_GetCounterMode(TIM_TypeDef *TIMx) 01224 { 01225 uint32_t counter_mode; 01226 01227 counter_mode = (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_CMS)); 01228 01229 if (counter_mode == 0U) 01230 { 01231 counter_mode = (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR)); 01232 } 01233 01234 return counter_mode; 01235 } 01236 01237 /** 01238 * @brief Enable auto-reload (ARR) preload. 01239 * @rmtoll CR1 ARPE LL_TIM_EnableARRPreload 01240 * @param TIMx Timer instance 01241 * @retval None 01242 */ 01243 __STATIC_INLINE void LL_TIM_EnableARRPreload(TIM_TypeDef *TIMx) 01244 { 01245 SET_BIT(TIMx->CR1, TIM_CR1_ARPE); 01246 } 01247 01248 /** 01249 * @brief Disable auto-reload (ARR) preload. 01250 * @rmtoll CR1 ARPE LL_TIM_DisableARRPreload 01251 * @param TIMx Timer instance 01252 * @retval None 01253 */ 01254 __STATIC_INLINE void LL_TIM_DisableARRPreload(TIM_TypeDef *TIMx) 01255 { 01256 CLEAR_BIT(TIMx->CR1, TIM_CR1_ARPE); 01257 } 01258 01259 /** 01260 * @brief Indicates whether auto-reload (ARR) preload is enabled. 01261 * @rmtoll CR1 ARPE LL_TIM_IsEnabledARRPreload 01262 * @param TIMx Timer instance 01263 * @retval State of bit (1 or 0). 01264 */ 01265 __STATIC_INLINE uint32_t LL_TIM_IsEnabledARRPreload(TIM_TypeDef *TIMx) 01266 { 01267 return ((READ_BIT(TIMx->CR1, TIM_CR1_ARPE) == (TIM_CR1_ARPE)) ? 1UL : 0UL); 01268 } 01269 01270 /** 01271 * @brief Set the division ratio between the timer clock and the sampling clock used by the dead-time generators 01272 * (when supported) and the digital filters. 01273 * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check 01274 * whether or not the clock division feature is supported by the timer 01275 * instance. 01276 * @rmtoll CR1 CKD LL_TIM_SetClockDivision 01277 * @param TIMx Timer instance 01278 * @param ClockDivision This parameter can be one of the following values: 01279 * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 01280 * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 01281 * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 01282 * @retval None 01283 */ 01284 __STATIC_INLINE void LL_TIM_SetClockDivision(TIM_TypeDef *TIMx, uint32_t ClockDivision) 01285 { 01286 MODIFY_REG(TIMx->CR1, TIM_CR1_CKD, ClockDivision); 01287 } 01288 01289 /** 01290 * @brief Get the actual division ratio between the timer clock and the sampling clock used by the dead-time 01291 * generators (when supported) and the digital filters. 01292 * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check 01293 * whether or not the clock division feature is supported by the timer 01294 * instance. 01295 * @rmtoll CR1 CKD LL_TIM_GetClockDivision 01296 * @param TIMx Timer instance 01297 * @retval Returned value can be one of the following values: 01298 * @arg @ref LL_TIM_CLOCKDIVISION_DIV1 01299 * @arg @ref LL_TIM_CLOCKDIVISION_DIV2 01300 * @arg @ref LL_TIM_CLOCKDIVISION_DIV4 01301 */ 01302 __STATIC_INLINE uint32_t LL_TIM_GetClockDivision(TIM_TypeDef *TIMx) 01303 { 01304 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_CKD)); 01305 } 01306 01307 /** 01308 * @brief Set the counter value. 01309 * @rmtoll CNT CNT LL_TIM_SetCounter 01310 * @param TIMx Timer instance 01311 * @param Counter Counter value (between Min_Data=0 and Max_Data=0xFFFF) 01312 * @retval None 01313 */ 01314 __STATIC_INLINE void LL_TIM_SetCounter(TIM_TypeDef *TIMx, uint32_t Counter) 01315 { 01316 WRITE_REG(TIMx->CNT, Counter); 01317 } 01318 01319 /** 01320 * @brief Get the counter value. 01321 * @rmtoll CNT CNT LL_TIM_GetCounter 01322 * @param TIMx Timer instance 01323 * @retval Counter value (between Min_Data=0 and Max_Data=0xFFFF) 01324 */ 01325 __STATIC_INLINE uint32_t LL_TIM_GetCounter(TIM_TypeDef *TIMx) 01326 { 01327 return (uint32_t)(READ_REG(TIMx->CNT)); 01328 } 01329 01330 /** 01331 * @brief Get the current direction of the counter 01332 * @rmtoll CR1 DIR LL_TIM_GetDirection 01333 * @param TIMx Timer instance 01334 * @retval Returned value can be one of the following values: 01335 * @arg @ref LL_TIM_COUNTERDIRECTION_UP 01336 * @arg @ref LL_TIM_COUNTERDIRECTION_DOWN 01337 */ 01338 __STATIC_INLINE uint32_t LL_TIM_GetDirection(TIM_TypeDef *TIMx) 01339 { 01340 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR)); 01341 } 01342 01343 /** 01344 * @brief Set the prescaler value. 01345 * @note The counter clock frequency CK_CNT is equal to fCK_PSC / (PSC[15:0] + 1). 01346 * @note The prescaler can be changed on the fly as this control register is buffered. The new 01347 * prescaler ratio is taken into account at the next update event. 01348 * @note Helper macro @ref __LL_TIM_CALC_PSC can be used to calculate the Prescaler parameter 01349 * @rmtoll PSC PSC LL_TIM_SetPrescaler 01350 * @param TIMx Timer instance 01351 * @param Prescaler between Min_Data=0 and Max_Data=65535 01352 * @retval None 01353 */ 01354 __STATIC_INLINE void LL_TIM_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Prescaler) 01355 { 01356 WRITE_REG(TIMx->PSC, Prescaler); 01357 } 01358 01359 /** 01360 * @brief Get the prescaler value. 01361 * @rmtoll PSC PSC LL_TIM_GetPrescaler 01362 * @param TIMx Timer instance 01363 * @retval Prescaler value between Min_Data=0 and Max_Data=65535 01364 */ 01365 __STATIC_INLINE uint32_t LL_TIM_GetPrescaler(TIM_TypeDef *TIMx) 01366 { 01367 return (uint32_t)(READ_REG(TIMx->PSC)); 01368 } 01369 01370 /** 01371 * @brief Set the auto-reload value. 01372 * @note The counter is blocked while the auto-reload value is null. 01373 * @note Helper macro @ref __LL_TIM_CALC_ARR can be used to calculate the AutoReload parameter 01374 * @rmtoll ARR ARR LL_TIM_SetAutoReload 01375 * @param TIMx Timer instance 01376 * @param AutoReload between Min_Data=0 and Max_Data=65535 01377 * @retval None 01378 */ 01379 __STATIC_INLINE void LL_TIM_SetAutoReload(TIM_TypeDef *TIMx, uint32_t AutoReload) 01380 { 01381 WRITE_REG(TIMx->ARR, AutoReload); 01382 } 01383 01384 /** 01385 * @brief Get the auto-reload value. 01386 * @rmtoll ARR ARR LL_TIM_GetAutoReload 01387 * @param TIMx Timer instance 01388 * @retval Auto-reload value 01389 */ 01390 __STATIC_INLINE uint32_t LL_TIM_GetAutoReload(TIM_TypeDef *TIMx) 01391 { 01392 return (uint32_t)(READ_REG(TIMx->ARR)); 01393 } 01394 01395 /** 01396 * @brief Set the repetition counter value. 01397 * @note Macro IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check 01398 * whether or not a timer instance supports a repetition counter. 01399 * @rmtoll RCR REP LL_TIM_SetRepetitionCounter 01400 * @param TIMx Timer instance 01401 * @param RepetitionCounter between Min_Data=0 and Max_Data=255 or 65535 for advanced timer. 01402 * @retval None 01403 */ 01404 __STATIC_INLINE void LL_TIM_SetRepetitionCounter(TIM_TypeDef *TIMx, uint32_t RepetitionCounter) 01405 { 01406 WRITE_REG(TIMx->RCR, RepetitionCounter); 01407 } 01408 01409 /** 01410 * @brief Get the repetition counter value. 01411 * @note Macro IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check 01412 * whether or not a timer instance supports a repetition counter. 01413 * @rmtoll RCR REP LL_TIM_GetRepetitionCounter 01414 * @param TIMx Timer instance 01415 * @retval Repetition counter value 01416 */ 01417 __STATIC_INLINE uint32_t LL_TIM_GetRepetitionCounter(TIM_TypeDef *TIMx) 01418 { 01419 return (uint32_t)(READ_REG(TIMx->RCR)); 01420 } 01421 01422 /** 01423 * @} 01424 */ 01425 01426 /** @defgroup TIM_LL_EF_Capture_Compare Capture Compare configuration 01427 * @{ 01428 */ 01429 /** 01430 * @brief Enable the capture/compare control bits (CCxE, CCxNE and OCxM) preload. 01431 * @note CCxE, CCxNE and OCxM bits are preloaded, after having been written, 01432 * they are updated only when a commutation event (COM) occurs. 01433 * @note Only on channels that have a complementary output. 01434 * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check 01435 * whether or not a timer instance is able to generate a commutation event. 01436 * @rmtoll CR2 CCPC LL_TIM_CC_EnablePreload 01437 * @param TIMx Timer instance 01438 * @retval None 01439 */ 01440 __STATIC_INLINE void LL_TIM_CC_EnablePreload(TIM_TypeDef *TIMx) 01441 { 01442 SET_BIT(TIMx->CR2, TIM_CR2_CCPC); 01443 } 01444 01445 /** 01446 * @brief Disable the capture/compare control bits (CCxE, CCxNE and OCxM) preload. 01447 * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check 01448 * whether or not a timer instance is able to generate a commutation event. 01449 * @rmtoll CR2 CCPC LL_TIM_CC_DisablePreload 01450 * @param TIMx Timer instance 01451 * @retval None 01452 */ 01453 __STATIC_INLINE void LL_TIM_CC_DisablePreload(TIM_TypeDef *TIMx) 01454 { 01455 CLEAR_BIT(TIMx->CR2, TIM_CR2_CCPC); 01456 } 01457 01458 /** 01459 * @brief Set the updated source of the capture/compare control bits (CCxE, CCxNE and OCxM). 01460 * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check 01461 * whether or not a timer instance is able to generate a commutation event. 01462 * @rmtoll CR2 CCUS LL_TIM_CC_SetUpdate 01463 * @param TIMx Timer instance 01464 * @param CCUpdateSource This parameter can be one of the following values: 01465 * @arg @ref LL_TIM_CCUPDATESOURCE_COMG_ONLY 01466 * @arg @ref LL_TIM_CCUPDATESOURCE_COMG_AND_TRGI 01467 * @retval None 01468 */ 01469 __STATIC_INLINE void LL_TIM_CC_SetUpdate(TIM_TypeDef *TIMx, uint32_t CCUpdateSource) 01470 { 01471 MODIFY_REG(TIMx->CR2, TIM_CR2_CCUS, CCUpdateSource); 01472 } 01473 01474 /** 01475 * @brief Set the trigger of the capture/compare DMA request. 01476 * @rmtoll CR2 CCDS LL_TIM_CC_SetDMAReqTrigger 01477 * @param TIMx Timer instance 01478 * @param DMAReqTrigger This parameter can be one of the following values: 01479 * @arg @ref LL_TIM_CCDMAREQUEST_CC 01480 * @arg @ref LL_TIM_CCDMAREQUEST_UPDATE 01481 * @retval None 01482 */ 01483 __STATIC_INLINE void LL_TIM_CC_SetDMAReqTrigger(TIM_TypeDef *TIMx, uint32_t DMAReqTrigger) 01484 { 01485 MODIFY_REG(TIMx->CR2, TIM_CR2_CCDS, DMAReqTrigger); 01486 } 01487 01488 /** 01489 * @brief Get actual trigger of the capture/compare DMA request. 01490 * @rmtoll CR2 CCDS LL_TIM_CC_GetDMAReqTrigger 01491 * @param TIMx Timer instance 01492 * @retval Returned value can be one of the following values: 01493 * @arg @ref LL_TIM_CCDMAREQUEST_CC 01494 * @arg @ref LL_TIM_CCDMAREQUEST_UPDATE 01495 */ 01496 __STATIC_INLINE uint32_t LL_TIM_CC_GetDMAReqTrigger(TIM_TypeDef *TIMx) 01497 { 01498 return (uint32_t)(READ_BIT(TIMx->CR2, TIM_CR2_CCDS)); 01499 } 01500 01501 /** 01502 * @brief Set the lock level to freeze the 01503 * configuration of several capture/compare parameters. 01504 * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not 01505 * the lock mechanism is supported by a timer instance. 01506 * @rmtoll BDTR LOCK LL_TIM_CC_SetLockLevel 01507 * @param TIMx Timer instance 01508 * @param LockLevel This parameter can be one of the following values: 01509 * @arg @ref LL_TIM_LOCKLEVEL_OFF 01510 * @arg @ref LL_TIM_LOCKLEVEL_1 01511 * @arg @ref LL_TIM_LOCKLEVEL_2 01512 * @arg @ref LL_TIM_LOCKLEVEL_3 01513 * @retval None 01514 */ 01515 __STATIC_INLINE void LL_TIM_CC_SetLockLevel(TIM_TypeDef *TIMx, uint32_t LockLevel) 01516 { 01517 MODIFY_REG(TIMx->BDTR, TIM_BDTR_LOCK, LockLevel); 01518 } 01519 01520 /** 01521 * @brief Enable capture/compare channels. 01522 * @rmtoll CCER CC1E LL_TIM_CC_EnableChannel\n 01523 * CCER CC1NE LL_TIM_CC_EnableChannel\n 01524 * CCER CC2E LL_TIM_CC_EnableChannel\n 01525 * CCER CC2NE LL_TIM_CC_EnableChannel\n 01526 * CCER CC3E LL_TIM_CC_EnableChannel\n 01527 * CCER CC3NE LL_TIM_CC_EnableChannel\n 01528 * CCER CC4E LL_TIM_CC_EnableChannel 01529 * @param TIMx Timer instance 01530 * @param Channels This parameter can be a combination of the following values: 01531 * @arg @ref LL_TIM_CHANNEL_CH1 01532 * @arg @ref LL_TIM_CHANNEL_CH1N 01533 * @arg @ref LL_TIM_CHANNEL_CH2 01534 * @arg @ref LL_TIM_CHANNEL_CH2N 01535 * @arg @ref LL_TIM_CHANNEL_CH3 01536 * @arg @ref LL_TIM_CHANNEL_CH3N 01537 * @arg @ref LL_TIM_CHANNEL_CH4 01538 * @retval None 01539 */ 01540 __STATIC_INLINE void LL_TIM_CC_EnableChannel(TIM_TypeDef *TIMx, uint32_t Channels) 01541 { 01542 SET_BIT(TIMx->CCER, Channels); 01543 } 01544 01545 /** 01546 * @brief Disable capture/compare channels. 01547 * @rmtoll CCER CC1E LL_TIM_CC_DisableChannel\n 01548 * CCER CC1NE LL_TIM_CC_DisableChannel\n 01549 * CCER CC2E LL_TIM_CC_DisableChannel\n 01550 * CCER CC2NE LL_TIM_CC_DisableChannel\n 01551 * CCER CC3E LL_TIM_CC_DisableChannel\n 01552 * CCER CC3NE LL_TIM_CC_DisableChannel\n 01553 * CCER CC4E LL_TIM_CC_DisableChannel 01554 * @param TIMx Timer instance 01555 * @param Channels This parameter can be a combination of the following values: 01556 * @arg @ref LL_TIM_CHANNEL_CH1 01557 * @arg @ref LL_TIM_CHANNEL_CH1N 01558 * @arg @ref LL_TIM_CHANNEL_CH2 01559 * @arg @ref LL_TIM_CHANNEL_CH2N 01560 * @arg @ref LL_TIM_CHANNEL_CH3 01561 * @arg @ref LL_TIM_CHANNEL_CH3N 01562 * @arg @ref LL_TIM_CHANNEL_CH4 01563 * @retval None 01564 */ 01565 __STATIC_INLINE void LL_TIM_CC_DisableChannel(TIM_TypeDef *TIMx, uint32_t Channels) 01566 { 01567 CLEAR_BIT(TIMx->CCER, Channels); 01568 } 01569 01570 /** 01571 * @brief Indicate whether channel(s) is(are) enabled. 01572 * @rmtoll CCER CC1E LL_TIM_CC_IsEnabledChannel\n 01573 * CCER CC1NE LL_TIM_CC_IsEnabledChannel\n 01574 * CCER CC2E LL_TIM_CC_IsEnabledChannel\n 01575 * CCER CC2NE LL_TIM_CC_IsEnabledChannel\n 01576 * CCER CC3E LL_TIM_CC_IsEnabledChannel\n 01577 * CCER CC3NE LL_TIM_CC_IsEnabledChannel\n 01578 * CCER CC4E LL_TIM_CC_IsEnabledChannel 01579 * @param TIMx Timer instance 01580 * @param Channels This parameter can be a combination of the following values: 01581 * @arg @ref LL_TIM_CHANNEL_CH1 01582 * @arg @ref LL_TIM_CHANNEL_CH1N 01583 * @arg @ref LL_TIM_CHANNEL_CH2 01584 * @arg @ref LL_TIM_CHANNEL_CH2N 01585 * @arg @ref LL_TIM_CHANNEL_CH3 01586 * @arg @ref LL_TIM_CHANNEL_CH3N 01587 * @arg @ref LL_TIM_CHANNEL_CH4 01588 * @retval State of bit (1 or 0). 01589 */ 01590 __STATIC_INLINE uint32_t LL_TIM_CC_IsEnabledChannel(TIM_TypeDef *TIMx, uint32_t Channels) 01591 { 01592 return ((READ_BIT(TIMx->CCER, Channels) == (Channels)) ? 1UL : 0UL); 01593 } 01594 01595 /** 01596 * @} 01597 */ 01598 01599 /** @defgroup TIM_LL_EF_Output_Channel Output channel configuration 01600 * @{ 01601 */ 01602 /** 01603 * @brief Configure an output channel. 01604 * @rmtoll CCMR1 CC1S LL_TIM_OC_ConfigOutput\n 01605 * CCMR1 CC2S LL_TIM_OC_ConfigOutput\n 01606 * CCMR2 CC3S LL_TIM_OC_ConfigOutput\n 01607 * CCMR2 CC4S LL_TIM_OC_ConfigOutput\n 01608 * CCER CC1P LL_TIM_OC_ConfigOutput\n 01609 * CCER CC2P LL_TIM_OC_ConfigOutput\n 01610 * CCER CC3P LL_TIM_OC_ConfigOutput\n 01611 * CCER CC4P LL_TIM_OC_ConfigOutput\n 01612 * CR2 OIS1 LL_TIM_OC_ConfigOutput\n 01613 * CR2 OIS2 LL_TIM_OC_ConfigOutput\n 01614 * CR2 OIS3 LL_TIM_OC_ConfigOutput\n 01615 * CR2 OIS4 LL_TIM_OC_ConfigOutput 01616 * @param TIMx Timer instance 01617 * @param Channel This parameter can be one of the following values: 01618 * @arg @ref LL_TIM_CHANNEL_CH1 01619 * @arg @ref LL_TIM_CHANNEL_CH2 01620 * @arg @ref LL_TIM_CHANNEL_CH3 01621 * @arg @ref LL_TIM_CHANNEL_CH4 01622 * @param Configuration This parameter must be a combination of all the following values: 01623 * @arg @ref LL_TIM_OCPOLARITY_HIGH or @ref LL_TIM_OCPOLARITY_LOW 01624 * @arg @ref LL_TIM_OCIDLESTATE_LOW or @ref LL_TIM_OCIDLESTATE_HIGH 01625 * @retval None 01626 */ 01627 __STATIC_INLINE void LL_TIM_OC_ConfigOutput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) 01628 { 01629 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01630 __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 01631 CLEAR_BIT(*pReg, (TIM_CCMR1_CC1S << SHIFT_TAB_OCxx[iChannel])); 01632 MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), 01633 (Configuration & TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]); 01634 MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]), 01635 (Configuration & TIM_CR2_OIS1) << SHIFT_TAB_OISx[iChannel]); 01636 } 01637 01638 /** 01639 * @brief Define the behavior of the output reference signal OCxREF from which 01640 * OCx and OCxN (when relevant) are derived. 01641 * @rmtoll CCMR1 OC1M LL_TIM_OC_SetMode\n 01642 * CCMR1 OC2M LL_TIM_OC_SetMode\n 01643 * CCMR2 OC3M LL_TIM_OC_SetMode\n 01644 * CCMR2 OC4M LL_TIM_OC_SetMode 01645 * @param TIMx Timer instance 01646 * @param Channel This parameter can be one of the following values: 01647 * @arg @ref LL_TIM_CHANNEL_CH1 01648 * @arg @ref LL_TIM_CHANNEL_CH2 01649 * @arg @ref LL_TIM_CHANNEL_CH3 01650 * @arg @ref LL_TIM_CHANNEL_CH4 01651 * @param Mode This parameter can be one of the following values: 01652 * @arg @ref LL_TIM_OCMODE_FROZEN 01653 * @arg @ref LL_TIM_OCMODE_ACTIVE 01654 * @arg @ref LL_TIM_OCMODE_INACTIVE 01655 * @arg @ref LL_TIM_OCMODE_TOGGLE 01656 * @arg @ref LL_TIM_OCMODE_FORCED_INACTIVE 01657 * @arg @ref LL_TIM_OCMODE_FORCED_ACTIVE 01658 * @arg @ref LL_TIM_OCMODE_PWM1 01659 * @arg @ref LL_TIM_OCMODE_PWM2 01660 * @retval None 01661 */ 01662 __STATIC_INLINE void LL_TIM_OC_SetMode(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Mode) 01663 { 01664 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01665 __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 01666 MODIFY_REG(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel]), Mode << SHIFT_TAB_OCxx[iChannel]); 01667 } 01668 01669 /** 01670 * @brief Get the output compare mode of an output channel. 01671 * @rmtoll CCMR1 OC1M LL_TIM_OC_GetMode\n 01672 * CCMR1 OC2M LL_TIM_OC_GetMode\n 01673 * CCMR2 OC3M LL_TIM_OC_GetMode\n 01674 * CCMR2 OC4M LL_TIM_OC_GetMode 01675 * @param TIMx Timer instance 01676 * @param Channel This parameter can be one of the following values: 01677 * @arg @ref LL_TIM_CHANNEL_CH1 01678 * @arg @ref LL_TIM_CHANNEL_CH2 01679 * @arg @ref LL_TIM_CHANNEL_CH3 01680 * @arg @ref LL_TIM_CHANNEL_CH4 01681 * @retval Returned value can be one of the following values: 01682 * @arg @ref LL_TIM_OCMODE_FROZEN 01683 * @arg @ref LL_TIM_OCMODE_ACTIVE 01684 * @arg @ref LL_TIM_OCMODE_INACTIVE 01685 * @arg @ref LL_TIM_OCMODE_TOGGLE 01686 * @arg @ref LL_TIM_OCMODE_FORCED_INACTIVE 01687 * @arg @ref LL_TIM_OCMODE_FORCED_ACTIVE 01688 * @arg @ref LL_TIM_OCMODE_PWM1 01689 * @arg @ref LL_TIM_OCMODE_PWM2 01690 */ 01691 __STATIC_INLINE uint32_t LL_TIM_OC_GetMode(TIM_TypeDef *TIMx, uint32_t Channel) 01692 { 01693 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01694 const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 01695 return (READ_BIT(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel])) >> SHIFT_TAB_OCxx[iChannel]); 01696 } 01697 01698 /** 01699 * @brief Set the polarity of an output channel. 01700 * @rmtoll CCER CC1P LL_TIM_OC_SetPolarity\n 01701 * CCER CC1NP LL_TIM_OC_SetPolarity\n 01702 * CCER CC2P LL_TIM_OC_SetPolarity\n 01703 * CCER CC2NP LL_TIM_OC_SetPolarity\n 01704 * CCER CC3P LL_TIM_OC_SetPolarity\n 01705 * CCER CC3NP LL_TIM_OC_SetPolarity\n 01706 * CCER CC4P LL_TIM_OC_SetPolarity 01707 * @param TIMx Timer instance 01708 * @param Channel This parameter can be one of the following values: 01709 * @arg @ref LL_TIM_CHANNEL_CH1 01710 * @arg @ref LL_TIM_CHANNEL_CH1N 01711 * @arg @ref LL_TIM_CHANNEL_CH2 01712 * @arg @ref LL_TIM_CHANNEL_CH2N 01713 * @arg @ref LL_TIM_CHANNEL_CH3 01714 * @arg @ref LL_TIM_CHANNEL_CH3N 01715 * @arg @ref LL_TIM_CHANNEL_CH4 01716 * @param Polarity This parameter can be one of the following values: 01717 * @arg @ref LL_TIM_OCPOLARITY_HIGH 01718 * @arg @ref LL_TIM_OCPOLARITY_LOW 01719 * @retval None 01720 */ 01721 __STATIC_INLINE void LL_TIM_OC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Polarity) 01722 { 01723 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01724 MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), Polarity << SHIFT_TAB_CCxP[iChannel]); 01725 } 01726 01727 /** 01728 * @brief Get the polarity of an output channel. 01729 * @rmtoll CCER CC1P LL_TIM_OC_GetPolarity\n 01730 * CCER CC1NP LL_TIM_OC_GetPolarity\n 01731 * CCER CC2P LL_TIM_OC_GetPolarity\n 01732 * CCER CC2NP LL_TIM_OC_GetPolarity\n 01733 * CCER CC3P LL_TIM_OC_GetPolarity\n 01734 * CCER CC3NP LL_TIM_OC_GetPolarity\n 01735 * CCER CC4P LL_TIM_OC_GetPolarity 01736 * @param TIMx Timer instance 01737 * @param Channel This parameter can be one of the following values: 01738 * @arg @ref LL_TIM_CHANNEL_CH1 01739 * @arg @ref LL_TIM_CHANNEL_CH1N 01740 * @arg @ref LL_TIM_CHANNEL_CH2 01741 * @arg @ref LL_TIM_CHANNEL_CH2N 01742 * @arg @ref LL_TIM_CHANNEL_CH3 01743 * @arg @ref LL_TIM_CHANNEL_CH3N 01744 * @arg @ref LL_TIM_CHANNEL_CH4 01745 * @retval Returned value can be one of the following values: 01746 * @arg @ref LL_TIM_OCPOLARITY_HIGH 01747 * @arg @ref LL_TIM_OCPOLARITY_LOW 01748 */ 01749 __STATIC_INLINE uint32_t LL_TIM_OC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) 01750 { 01751 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01752 return (READ_BIT(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel])) >> SHIFT_TAB_CCxP[iChannel]); 01753 } 01754 01755 /** 01756 * @brief Set the IDLE state of an output channel 01757 * @note This function is significant only for the timer instances 01758 * supporting the break feature. Macro IS_TIM_BREAK_INSTANCE(TIMx) 01759 * can be used to check whether or not a timer instance provides 01760 * a break input. 01761 * @rmtoll CR2 OIS1 LL_TIM_OC_SetIdleState\n 01762 * CR2 OIS1N LL_TIM_OC_SetIdleState\n 01763 * CR2 OIS2 LL_TIM_OC_SetIdleState\n 01764 * CR2 OIS2N LL_TIM_OC_SetIdleState\n 01765 * CR2 OIS3 LL_TIM_OC_SetIdleState\n 01766 * CR2 OIS3N LL_TIM_OC_SetIdleState\n 01767 * CR2 OIS4 LL_TIM_OC_SetIdleState 01768 * @param TIMx Timer instance 01769 * @param Channel This parameter can be one of the following values: 01770 * @arg @ref LL_TIM_CHANNEL_CH1 01771 * @arg @ref LL_TIM_CHANNEL_CH1N 01772 * @arg @ref LL_TIM_CHANNEL_CH2 01773 * @arg @ref LL_TIM_CHANNEL_CH2N 01774 * @arg @ref LL_TIM_CHANNEL_CH3 01775 * @arg @ref LL_TIM_CHANNEL_CH3N 01776 * @arg @ref LL_TIM_CHANNEL_CH4 01777 * @param IdleState This parameter can be one of the following values: 01778 * @arg @ref LL_TIM_OCIDLESTATE_LOW 01779 * @arg @ref LL_TIM_OCIDLESTATE_HIGH 01780 * @retval None 01781 */ 01782 __STATIC_INLINE void LL_TIM_OC_SetIdleState(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t IdleState) 01783 { 01784 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01785 MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]), IdleState << SHIFT_TAB_OISx[iChannel]); 01786 } 01787 01788 /** 01789 * @brief Get the IDLE state of an output channel 01790 * @rmtoll CR2 OIS1 LL_TIM_OC_GetIdleState\n 01791 * CR2 OIS1N LL_TIM_OC_GetIdleState\n 01792 * CR2 OIS2 LL_TIM_OC_GetIdleState\n 01793 * CR2 OIS2N LL_TIM_OC_GetIdleState\n 01794 * CR2 OIS3 LL_TIM_OC_GetIdleState\n 01795 * CR2 OIS3N LL_TIM_OC_GetIdleState\n 01796 * CR2 OIS4 LL_TIM_OC_GetIdleState 01797 * @param TIMx Timer instance 01798 * @param Channel This parameter can be one of the following values: 01799 * @arg @ref LL_TIM_CHANNEL_CH1 01800 * @arg @ref LL_TIM_CHANNEL_CH1N 01801 * @arg @ref LL_TIM_CHANNEL_CH2 01802 * @arg @ref LL_TIM_CHANNEL_CH2N 01803 * @arg @ref LL_TIM_CHANNEL_CH3 01804 * @arg @ref LL_TIM_CHANNEL_CH3N 01805 * @arg @ref LL_TIM_CHANNEL_CH4 01806 * @retval Returned value can be one of the following values: 01807 * @arg @ref LL_TIM_OCIDLESTATE_LOW 01808 * @arg @ref LL_TIM_OCIDLESTATE_HIGH 01809 */ 01810 __STATIC_INLINE uint32_t LL_TIM_OC_GetIdleState(TIM_TypeDef *TIMx, uint32_t Channel) 01811 { 01812 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01813 return (READ_BIT(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel])) >> SHIFT_TAB_OISx[iChannel]); 01814 } 01815 01816 /** 01817 * @brief Enable fast mode for the output channel. 01818 * @note Acts only if the channel is configured in PWM1 or PWM2 mode. 01819 * @rmtoll CCMR1 OC1FE LL_TIM_OC_EnableFast\n 01820 * CCMR1 OC2FE LL_TIM_OC_EnableFast\n 01821 * CCMR2 OC3FE LL_TIM_OC_EnableFast\n 01822 * CCMR2 OC4FE LL_TIM_OC_EnableFast 01823 * @param TIMx Timer instance 01824 * @param Channel This parameter can be one of the following values: 01825 * @arg @ref LL_TIM_CHANNEL_CH1 01826 * @arg @ref LL_TIM_CHANNEL_CH2 01827 * @arg @ref LL_TIM_CHANNEL_CH3 01828 * @arg @ref LL_TIM_CHANNEL_CH4 01829 * @retval None 01830 */ 01831 __STATIC_INLINE void LL_TIM_OC_EnableFast(TIM_TypeDef *TIMx, uint32_t Channel) 01832 { 01833 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01834 __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 01835 SET_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); 01836 01837 } 01838 01839 /** 01840 * @brief Disable fast mode for the output channel. 01841 * @rmtoll CCMR1 OC1FE LL_TIM_OC_DisableFast\n 01842 * CCMR1 OC2FE LL_TIM_OC_DisableFast\n 01843 * CCMR2 OC3FE LL_TIM_OC_DisableFast\n 01844 * CCMR2 OC4FE LL_TIM_OC_DisableFast 01845 * @param TIMx Timer instance 01846 * @param Channel This parameter can be one of the following values: 01847 * @arg @ref LL_TIM_CHANNEL_CH1 01848 * @arg @ref LL_TIM_CHANNEL_CH2 01849 * @arg @ref LL_TIM_CHANNEL_CH3 01850 * @arg @ref LL_TIM_CHANNEL_CH4 01851 * @retval None 01852 */ 01853 __STATIC_INLINE void LL_TIM_OC_DisableFast(TIM_TypeDef *TIMx, uint32_t Channel) 01854 { 01855 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01856 __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 01857 CLEAR_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel])); 01858 01859 } 01860 01861 /** 01862 * @brief Indicates whether fast mode is enabled for the output channel. 01863 * @rmtoll CCMR1 OC1FE LL_TIM_OC_IsEnabledFast\n 01864 * CCMR1 OC2FE LL_TIM_OC_IsEnabledFast\n 01865 * CCMR2 OC3FE LL_TIM_OC_IsEnabledFast\n 01866 * CCMR2 OC4FE LL_TIM_OC_IsEnabledFast\n 01867 * @param TIMx Timer instance 01868 * @param Channel This parameter can be one of the following values: 01869 * @arg @ref LL_TIM_CHANNEL_CH1 01870 * @arg @ref LL_TIM_CHANNEL_CH2 01871 * @arg @ref LL_TIM_CHANNEL_CH3 01872 * @arg @ref LL_TIM_CHANNEL_CH4 01873 * @retval State of bit (1 or 0). 01874 */ 01875 __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledFast(TIM_TypeDef *TIMx, uint32_t Channel) 01876 { 01877 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01878 const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 01879 uint32_t bitfield = TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]; 01880 return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); 01881 } 01882 01883 /** 01884 * @brief Enable compare register (TIMx_CCRx) preload for the output channel. 01885 * @rmtoll CCMR1 OC1PE LL_TIM_OC_EnablePreload\n 01886 * CCMR1 OC2PE LL_TIM_OC_EnablePreload\n 01887 * CCMR2 OC3PE LL_TIM_OC_EnablePreload\n 01888 * CCMR2 OC4PE LL_TIM_OC_EnablePreload 01889 * @param TIMx Timer instance 01890 * @param Channel This parameter can be one of the following values: 01891 * @arg @ref LL_TIM_CHANNEL_CH1 01892 * @arg @ref LL_TIM_CHANNEL_CH2 01893 * @arg @ref LL_TIM_CHANNEL_CH3 01894 * @arg @ref LL_TIM_CHANNEL_CH4 01895 * @retval None 01896 */ 01897 __STATIC_INLINE void LL_TIM_OC_EnablePreload(TIM_TypeDef *TIMx, uint32_t Channel) 01898 { 01899 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01900 __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 01901 SET_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); 01902 } 01903 01904 /** 01905 * @brief Disable compare register (TIMx_CCRx) preload for the output channel. 01906 * @rmtoll CCMR1 OC1PE LL_TIM_OC_DisablePreload\n 01907 * CCMR1 OC2PE LL_TIM_OC_DisablePreload\n 01908 * CCMR2 OC3PE LL_TIM_OC_DisablePreload\n 01909 * CCMR2 OC4PE LL_TIM_OC_DisablePreload 01910 * @param TIMx Timer instance 01911 * @param Channel This parameter can be one of the following values: 01912 * @arg @ref LL_TIM_CHANNEL_CH1 01913 * @arg @ref LL_TIM_CHANNEL_CH2 01914 * @arg @ref LL_TIM_CHANNEL_CH3 01915 * @arg @ref LL_TIM_CHANNEL_CH4 01916 * @retval None 01917 */ 01918 __STATIC_INLINE void LL_TIM_OC_DisablePreload(TIM_TypeDef *TIMx, uint32_t Channel) 01919 { 01920 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01921 __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 01922 CLEAR_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel])); 01923 } 01924 01925 /** 01926 * @brief Indicates whether compare register (TIMx_CCRx) preload is enabled for the output channel. 01927 * @rmtoll CCMR1 OC1PE LL_TIM_OC_IsEnabledPreload\n 01928 * CCMR1 OC2PE LL_TIM_OC_IsEnabledPreload\n 01929 * CCMR2 OC3PE LL_TIM_OC_IsEnabledPreload\n 01930 * CCMR2 OC4PE LL_TIM_OC_IsEnabledPreload\n 01931 * @param TIMx Timer instance 01932 * @param Channel This parameter can be one of the following values: 01933 * @arg @ref LL_TIM_CHANNEL_CH1 01934 * @arg @ref LL_TIM_CHANNEL_CH2 01935 * @arg @ref LL_TIM_CHANNEL_CH3 01936 * @arg @ref LL_TIM_CHANNEL_CH4 01937 * @retval State of bit (1 or 0). 01938 */ 01939 __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledPreload(TIM_TypeDef *TIMx, uint32_t Channel) 01940 { 01941 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01942 const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 01943 uint32_t bitfield = TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]; 01944 return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); 01945 } 01946 01947 /** 01948 * @brief Enable clearing the output channel on an external event. 01949 * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode. 01950 * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether 01951 * or not a timer instance can clear the OCxREF signal on an external event. 01952 * @rmtoll CCMR1 OC1CE LL_TIM_OC_EnableClear\n 01953 * CCMR1 OC2CE LL_TIM_OC_EnableClear\n 01954 * CCMR2 OC3CE LL_TIM_OC_EnableClear\n 01955 * CCMR2 OC4CE LL_TIM_OC_EnableClear 01956 * @param TIMx Timer instance 01957 * @param Channel This parameter can be one of the following values: 01958 * @arg @ref LL_TIM_CHANNEL_CH1 01959 * @arg @ref LL_TIM_CHANNEL_CH2 01960 * @arg @ref LL_TIM_CHANNEL_CH3 01961 * @arg @ref LL_TIM_CHANNEL_CH4 01962 * @retval None 01963 */ 01964 __STATIC_INLINE void LL_TIM_OC_EnableClear(TIM_TypeDef *TIMx, uint32_t Channel) 01965 { 01966 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01967 __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 01968 SET_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); 01969 } 01970 01971 /** 01972 * @brief Disable clearing the output channel on an external event. 01973 * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether 01974 * or not a timer instance can clear the OCxREF signal on an external event. 01975 * @rmtoll CCMR1 OC1CE LL_TIM_OC_DisableClear\n 01976 * CCMR1 OC2CE LL_TIM_OC_DisableClear\n 01977 * CCMR2 OC3CE LL_TIM_OC_DisableClear\n 01978 * CCMR2 OC4CE LL_TIM_OC_DisableClear 01979 * @param TIMx Timer instance 01980 * @param Channel This parameter can be one of the following values: 01981 * @arg @ref LL_TIM_CHANNEL_CH1 01982 * @arg @ref LL_TIM_CHANNEL_CH2 01983 * @arg @ref LL_TIM_CHANNEL_CH3 01984 * @arg @ref LL_TIM_CHANNEL_CH4 01985 * @retval None 01986 */ 01987 __STATIC_INLINE void LL_TIM_OC_DisableClear(TIM_TypeDef *TIMx, uint32_t Channel) 01988 { 01989 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 01990 __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 01991 CLEAR_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel])); 01992 } 01993 01994 /** 01995 * @brief Indicates clearing the output channel on an external event is enabled for the output channel. 01996 * @note This function enables clearing the output channel on an external event. 01997 * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode. 01998 * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether 01999 * or not a timer instance can clear the OCxREF signal on an external event. 02000 * @rmtoll CCMR1 OC1CE LL_TIM_OC_IsEnabledClear\n 02001 * CCMR1 OC2CE LL_TIM_OC_IsEnabledClear\n 02002 * CCMR2 OC3CE LL_TIM_OC_IsEnabledClear\n 02003 * CCMR2 OC4CE LL_TIM_OC_IsEnabledClear\n 02004 * @param TIMx Timer instance 02005 * @param Channel This parameter can be one of the following values: 02006 * @arg @ref LL_TIM_CHANNEL_CH1 02007 * @arg @ref LL_TIM_CHANNEL_CH2 02008 * @arg @ref LL_TIM_CHANNEL_CH3 02009 * @arg @ref LL_TIM_CHANNEL_CH4 02010 * @retval State of bit (1 or 0). 02011 */ 02012 __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledClear(TIM_TypeDef *TIMx, uint32_t Channel) 02013 { 02014 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 02015 const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 02016 uint32_t bitfield = TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]; 02017 return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL); 02018 } 02019 02020 /** 02021 * @brief Set the dead-time delay (delay inserted between the rising edge of the OCxREF signal and the rising edge of 02022 * the Ocx and OCxN signals). 02023 * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not 02024 * dead-time insertion feature is supported by a timer instance. 02025 * @note Helper macro @ref __LL_TIM_CALC_DEADTIME can be used to calculate the DeadTime parameter 02026 * @rmtoll BDTR DTG LL_TIM_OC_SetDeadTime 02027 * @param TIMx Timer instance 02028 * @param DeadTime between Min_Data=0 and Max_Data=255 02029 * @retval None 02030 */ 02031 __STATIC_INLINE void LL_TIM_OC_SetDeadTime(TIM_TypeDef *TIMx, uint32_t DeadTime) 02032 { 02033 MODIFY_REG(TIMx->BDTR, TIM_BDTR_DTG, DeadTime); 02034 } 02035 02036 /** 02037 * @brief Set compare value for output channel 1 (TIMx_CCR1). 02038 * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not 02039 * output channel 1 is supported by a timer instance. 02040 * @rmtoll CCR1 CCR1 LL_TIM_OC_SetCompareCH1 02041 * @param TIMx Timer instance 02042 * @param CompareValue between Min_Data=0 and Max_Data=65535 02043 * @retval None 02044 */ 02045 __STATIC_INLINE void LL_TIM_OC_SetCompareCH1(TIM_TypeDef *TIMx, uint32_t CompareValue) 02046 { 02047 WRITE_REG(TIMx->CCR1, CompareValue); 02048 } 02049 02050 /** 02051 * @brief Set compare value for output channel 2 (TIMx_CCR2). 02052 * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not 02053 * output channel 2 is supported by a timer instance. 02054 * @rmtoll CCR2 CCR2 LL_TIM_OC_SetCompareCH2 02055 * @param TIMx Timer instance 02056 * @param CompareValue between Min_Data=0 and Max_Data=65535 02057 * @retval None 02058 */ 02059 __STATIC_INLINE void LL_TIM_OC_SetCompareCH2(TIM_TypeDef *TIMx, uint32_t CompareValue) 02060 { 02061 WRITE_REG(TIMx->CCR2, CompareValue); 02062 } 02063 02064 /** 02065 * @brief Set compare value for output channel 3 (TIMx_CCR3). 02066 * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not 02067 * output channel is supported by a timer instance. 02068 * @rmtoll CCR3 CCR3 LL_TIM_OC_SetCompareCH3 02069 * @param TIMx Timer instance 02070 * @param CompareValue between Min_Data=0 and Max_Data=65535 02071 * @retval None 02072 */ 02073 __STATIC_INLINE void LL_TIM_OC_SetCompareCH3(TIM_TypeDef *TIMx, uint32_t CompareValue) 02074 { 02075 WRITE_REG(TIMx->CCR3, CompareValue); 02076 } 02077 02078 /** 02079 * @brief Set compare value for output channel 4 (TIMx_CCR4). 02080 * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not 02081 * output channel 4 is supported by a timer instance. 02082 * @rmtoll CCR4 CCR4 LL_TIM_OC_SetCompareCH4 02083 * @param TIMx Timer instance 02084 * @param CompareValue between Min_Data=0 and Max_Data=65535 02085 * @retval None 02086 */ 02087 __STATIC_INLINE void LL_TIM_OC_SetCompareCH4(TIM_TypeDef *TIMx, uint32_t CompareValue) 02088 { 02089 WRITE_REG(TIMx->CCR4, CompareValue); 02090 } 02091 02092 /** 02093 * @brief Get compare value (TIMx_CCR1) set for output channel 1. 02094 * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not 02095 * output channel 1 is supported by a timer instance. 02096 * @rmtoll CCR1 CCR1 LL_TIM_OC_GetCompareCH1 02097 * @param TIMx Timer instance 02098 * @retval CompareValue (between Min_Data=0 and Max_Data=65535) 02099 */ 02100 __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH1(TIM_TypeDef *TIMx) 02101 { 02102 return (uint32_t)(READ_REG(TIMx->CCR1)); 02103 } 02104 02105 /** 02106 * @brief Get compare value (TIMx_CCR2) set for output channel 2. 02107 * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not 02108 * output channel 2 is supported by a timer instance. 02109 * @rmtoll CCR2 CCR2 LL_TIM_OC_GetCompareCH2 02110 * @param TIMx Timer instance 02111 * @retval CompareValue (between Min_Data=0 and Max_Data=65535) 02112 */ 02113 __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH2(TIM_TypeDef *TIMx) 02114 { 02115 return (uint32_t)(READ_REG(TIMx->CCR2)); 02116 } 02117 02118 /** 02119 * @brief Get compare value (TIMx_CCR3) set for output channel 3. 02120 * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not 02121 * output channel 3 is supported by a timer instance. 02122 * @rmtoll CCR3 CCR3 LL_TIM_OC_GetCompareCH3 02123 * @param TIMx Timer instance 02124 * @retval CompareValue (between Min_Data=0 and Max_Data=65535) 02125 */ 02126 __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH3(TIM_TypeDef *TIMx) 02127 { 02128 return (uint32_t)(READ_REG(TIMx->CCR3)); 02129 } 02130 02131 /** 02132 * @brief Get compare value (TIMx_CCR4) set for output channel 4. 02133 * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not 02134 * output channel 4 is supported by a timer instance. 02135 * @rmtoll CCR4 CCR4 LL_TIM_OC_GetCompareCH4 02136 * @param TIMx Timer instance 02137 * @retval CompareValue (between Min_Data=0 and Max_Data=65535) 02138 */ 02139 __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH4(TIM_TypeDef *TIMx) 02140 { 02141 return (uint32_t)(READ_REG(TIMx->CCR4)); 02142 } 02143 02144 /** 02145 * @} 02146 */ 02147 02148 /** @defgroup TIM_LL_EF_Input_Channel Input channel configuration 02149 * @{ 02150 */ 02151 /** 02152 * @brief Configure input channel. 02153 * @rmtoll CCMR1 CC1S LL_TIM_IC_Config\n 02154 * CCMR1 IC1PSC LL_TIM_IC_Config\n 02155 * CCMR1 IC1F LL_TIM_IC_Config\n 02156 * CCMR1 CC2S LL_TIM_IC_Config\n 02157 * CCMR1 IC2PSC LL_TIM_IC_Config\n 02158 * CCMR1 IC2F LL_TIM_IC_Config\n 02159 * CCMR2 CC3S LL_TIM_IC_Config\n 02160 * CCMR2 IC3PSC LL_TIM_IC_Config\n 02161 * CCMR2 IC3F LL_TIM_IC_Config\n 02162 * CCMR2 CC4S LL_TIM_IC_Config\n 02163 * CCMR2 IC4PSC LL_TIM_IC_Config\n 02164 * CCMR2 IC4F LL_TIM_IC_Config\n 02165 * CCER CC1P LL_TIM_IC_Config\n 02166 * CCER CC1NP LL_TIM_IC_Config\n 02167 * CCER CC2P LL_TIM_IC_Config\n 02168 * CCER CC2NP LL_TIM_IC_Config\n 02169 * CCER CC3P LL_TIM_IC_Config\n 02170 * CCER CC3NP LL_TIM_IC_Config\n 02171 * CCER CC4P LL_TIM_IC_Config\n 02172 * @param TIMx Timer instance 02173 * @param Channel This parameter can be one of the following values: 02174 * @arg @ref LL_TIM_CHANNEL_CH1 02175 * @arg @ref LL_TIM_CHANNEL_CH2 02176 * @arg @ref LL_TIM_CHANNEL_CH3 02177 * @arg @ref LL_TIM_CHANNEL_CH4 02178 * @param Configuration This parameter must be a combination of all the following values: 02179 * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI or @ref LL_TIM_ACTIVEINPUT_INDIRECTTI or @ref LL_TIM_ACTIVEINPUT_TRC 02180 * @arg @ref LL_TIM_ICPSC_DIV1 or ... or @ref LL_TIM_ICPSC_DIV8 02181 * @arg @ref LL_TIM_IC_FILTER_FDIV1 or ... or @ref LL_TIM_IC_FILTER_FDIV32_N8 02182 * @arg @ref LL_TIM_IC_POLARITY_RISING or @ref LL_TIM_IC_POLARITY_FALLING 02183 * @retval None 02184 */ 02185 __STATIC_INLINE void LL_TIM_IC_Config(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration) 02186 { 02187 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 02188 __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 02189 MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), 02190 ((Configuration >> 16U) & (TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S)) \ 02191 << SHIFT_TAB_ICxx[iChannel]); 02192 MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), 02193 (Configuration & (TIM_CCER_CC1NP | TIM_CCER_CC1P)) << SHIFT_TAB_CCxP[iChannel]); 02194 } 02195 02196 /** 02197 * @brief Set the active input. 02198 * @rmtoll CCMR1 CC1S LL_TIM_IC_SetActiveInput\n 02199 * CCMR1 CC2S LL_TIM_IC_SetActiveInput\n 02200 * CCMR2 CC3S LL_TIM_IC_SetActiveInput\n 02201 * CCMR2 CC4S LL_TIM_IC_SetActiveInput 02202 * @param TIMx Timer instance 02203 * @param Channel This parameter can be one of the following values: 02204 * @arg @ref LL_TIM_CHANNEL_CH1 02205 * @arg @ref LL_TIM_CHANNEL_CH2 02206 * @arg @ref LL_TIM_CHANNEL_CH3 02207 * @arg @ref LL_TIM_CHANNEL_CH4 02208 * @param ICActiveInput This parameter can be one of the following values: 02209 * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI 02210 * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI 02211 * @arg @ref LL_TIM_ACTIVEINPUT_TRC 02212 * @retval None 02213 */ 02214 __STATIC_INLINE void LL_TIM_IC_SetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICActiveInput) 02215 { 02216 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 02217 __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 02218 MODIFY_REG(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), (ICActiveInput >> 16U) << SHIFT_TAB_ICxx[iChannel]); 02219 } 02220 02221 /** 02222 * @brief Get the current active input. 02223 * @rmtoll CCMR1 CC1S LL_TIM_IC_GetActiveInput\n 02224 * CCMR1 CC2S LL_TIM_IC_GetActiveInput\n 02225 * CCMR2 CC3S LL_TIM_IC_GetActiveInput\n 02226 * CCMR2 CC4S LL_TIM_IC_GetActiveInput 02227 * @param TIMx Timer instance 02228 * @param Channel This parameter can be one of the following values: 02229 * @arg @ref LL_TIM_CHANNEL_CH1 02230 * @arg @ref LL_TIM_CHANNEL_CH2 02231 * @arg @ref LL_TIM_CHANNEL_CH3 02232 * @arg @ref LL_TIM_CHANNEL_CH4 02233 * @retval Returned value can be one of the following values: 02234 * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI 02235 * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI 02236 * @arg @ref LL_TIM_ACTIVEINPUT_TRC 02237 */ 02238 __STATIC_INLINE uint32_t LL_TIM_IC_GetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel) 02239 { 02240 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 02241 const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 02242 return ((READ_BIT(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); 02243 } 02244 02245 /** 02246 * @brief Set the prescaler of input channel. 02247 * @rmtoll CCMR1 IC1PSC LL_TIM_IC_SetPrescaler\n 02248 * CCMR1 IC2PSC LL_TIM_IC_SetPrescaler\n 02249 * CCMR2 IC3PSC LL_TIM_IC_SetPrescaler\n 02250 * CCMR2 IC4PSC LL_TIM_IC_SetPrescaler 02251 * @param TIMx Timer instance 02252 * @param Channel This parameter can be one of the following values: 02253 * @arg @ref LL_TIM_CHANNEL_CH1 02254 * @arg @ref LL_TIM_CHANNEL_CH2 02255 * @arg @ref LL_TIM_CHANNEL_CH3 02256 * @arg @ref LL_TIM_CHANNEL_CH4 02257 * @param ICPrescaler This parameter can be one of the following values: 02258 * @arg @ref LL_TIM_ICPSC_DIV1 02259 * @arg @ref LL_TIM_ICPSC_DIV2 02260 * @arg @ref LL_TIM_ICPSC_DIV4 02261 * @arg @ref LL_TIM_ICPSC_DIV8 02262 * @retval None 02263 */ 02264 __STATIC_INLINE void LL_TIM_IC_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPrescaler) 02265 { 02266 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 02267 __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 02268 MODIFY_REG(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel]), (ICPrescaler >> 16U) << SHIFT_TAB_ICxx[iChannel]); 02269 } 02270 02271 /** 02272 * @brief Get the current prescaler value acting on an input channel. 02273 * @rmtoll CCMR1 IC1PSC LL_TIM_IC_GetPrescaler\n 02274 * CCMR1 IC2PSC LL_TIM_IC_GetPrescaler\n 02275 * CCMR2 IC3PSC LL_TIM_IC_GetPrescaler\n 02276 * CCMR2 IC4PSC LL_TIM_IC_GetPrescaler 02277 * @param TIMx Timer instance 02278 * @param Channel This parameter can be one of the following values: 02279 * @arg @ref LL_TIM_CHANNEL_CH1 02280 * @arg @ref LL_TIM_CHANNEL_CH2 02281 * @arg @ref LL_TIM_CHANNEL_CH3 02282 * @arg @ref LL_TIM_CHANNEL_CH4 02283 * @retval Returned value can be one of the following values: 02284 * @arg @ref LL_TIM_ICPSC_DIV1 02285 * @arg @ref LL_TIM_ICPSC_DIV2 02286 * @arg @ref LL_TIM_ICPSC_DIV4 02287 * @arg @ref LL_TIM_ICPSC_DIV8 02288 */ 02289 __STATIC_INLINE uint32_t LL_TIM_IC_GetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel) 02290 { 02291 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 02292 const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 02293 return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); 02294 } 02295 02296 /** 02297 * @brief Set the input filter duration. 02298 * @rmtoll CCMR1 IC1F LL_TIM_IC_SetFilter\n 02299 * CCMR1 IC2F LL_TIM_IC_SetFilter\n 02300 * CCMR2 IC3F LL_TIM_IC_SetFilter\n 02301 * CCMR2 IC4F LL_TIM_IC_SetFilter 02302 * @param TIMx Timer instance 02303 * @param Channel This parameter can be one of the following values: 02304 * @arg @ref LL_TIM_CHANNEL_CH1 02305 * @arg @ref LL_TIM_CHANNEL_CH2 02306 * @arg @ref LL_TIM_CHANNEL_CH3 02307 * @arg @ref LL_TIM_CHANNEL_CH4 02308 * @param ICFilter This parameter can be one of the following values: 02309 * @arg @ref LL_TIM_IC_FILTER_FDIV1 02310 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N2 02311 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N4 02312 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N8 02313 * @arg @ref LL_TIM_IC_FILTER_FDIV2_N6 02314 * @arg @ref LL_TIM_IC_FILTER_FDIV2_N8 02315 * @arg @ref LL_TIM_IC_FILTER_FDIV4_N6 02316 * @arg @ref LL_TIM_IC_FILTER_FDIV4_N8 02317 * @arg @ref LL_TIM_IC_FILTER_FDIV8_N6 02318 * @arg @ref LL_TIM_IC_FILTER_FDIV8_N8 02319 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N5 02320 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N6 02321 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N8 02322 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N5 02323 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6 02324 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 02325 * @retval None 02326 */ 02327 __STATIC_INLINE void LL_TIM_IC_SetFilter(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICFilter) 02328 { 02329 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 02330 __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 02331 MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel]), (ICFilter >> 16U) << SHIFT_TAB_ICxx[iChannel]); 02332 } 02333 02334 /** 02335 * @brief Get the input filter duration. 02336 * @rmtoll CCMR1 IC1F LL_TIM_IC_GetFilter\n 02337 * CCMR1 IC2F LL_TIM_IC_GetFilter\n 02338 * CCMR2 IC3F LL_TIM_IC_GetFilter\n 02339 * CCMR2 IC4F LL_TIM_IC_GetFilter 02340 * @param TIMx Timer instance 02341 * @param Channel This parameter can be one of the following values: 02342 * @arg @ref LL_TIM_CHANNEL_CH1 02343 * @arg @ref LL_TIM_CHANNEL_CH2 02344 * @arg @ref LL_TIM_CHANNEL_CH3 02345 * @arg @ref LL_TIM_CHANNEL_CH4 02346 * @retval Returned value can be one of the following values: 02347 * @arg @ref LL_TIM_IC_FILTER_FDIV1 02348 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N2 02349 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N4 02350 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N8 02351 * @arg @ref LL_TIM_IC_FILTER_FDIV2_N6 02352 * @arg @ref LL_TIM_IC_FILTER_FDIV2_N8 02353 * @arg @ref LL_TIM_IC_FILTER_FDIV4_N6 02354 * @arg @ref LL_TIM_IC_FILTER_FDIV4_N8 02355 * @arg @ref LL_TIM_IC_FILTER_FDIV8_N6 02356 * @arg @ref LL_TIM_IC_FILTER_FDIV8_N8 02357 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N5 02358 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N6 02359 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N8 02360 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N5 02361 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6 02362 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8 02363 */ 02364 __STATIC_INLINE uint32_t LL_TIM_IC_GetFilter(TIM_TypeDef *TIMx, uint32_t Channel) 02365 { 02366 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 02367 const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel])); 02368 return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U); 02369 } 02370 02371 /** 02372 * @brief Set the input channel polarity. 02373 * @rmtoll CCER CC1P LL_TIM_IC_SetPolarity\n 02374 * CCER CC1NP LL_TIM_IC_SetPolarity\n 02375 * CCER CC2P LL_TIM_IC_SetPolarity\n 02376 * CCER CC2NP LL_TIM_IC_SetPolarity\n 02377 * CCER CC3P LL_TIM_IC_SetPolarity\n 02378 * CCER CC3NP LL_TIM_IC_SetPolarity\n 02379 * CCER CC4P LL_TIM_IC_SetPolarity\n 02380 * @param TIMx Timer instance 02381 * @param Channel This parameter can be one of the following values: 02382 * @arg @ref LL_TIM_CHANNEL_CH1 02383 * @arg @ref LL_TIM_CHANNEL_CH2 02384 * @arg @ref LL_TIM_CHANNEL_CH3 02385 * @arg @ref LL_TIM_CHANNEL_CH4 02386 * @param ICPolarity This parameter can be one of the following values: 02387 * @arg @ref LL_TIM_IC_POLARITY_RISING 02388 * @arg @ref LL_TIM_IC_POLARITY_FALLING 02389 * @retval None 02390 */ 02391 __STATIC_INLINE void LL_TIM_IC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPolarity) 02392 { 02393 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 02394 MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]), 02395 ICPolarity << SHIFT_TAB_CCxP[iChannel]); 02396 } 02397 02398 /** 02399 * @brief Get the current input channel polarity. 02400 * @rmtoll CCER CC1P LL_TIM_IC_GetPolarity\n 02401 * CCER CC1NP LL_TIM_IC_GetPolarity\n 02402 * CCER CC2P LL_TIM_IC_GetPolarity\n 02403 * CCER CC2NP LL_TIM_IC_GetPolarity\n 02404 * CCER CC3P LL_TIM_IC_GetPolarity\n 02405 * CCER CC3NP LL_TIM_IC_GetPolarity\n 02406 * CCER CC4P LL_TIM_IC_GetPolarity\n 02407 * @param TIMx Timer instance 02408 * @param Channel This parameter can be one of the following values: 02409 * @arg @ref LL_TIM_CHANNEL_CH1 02410 * @arg @ref LL_TIM_CHANNEL_CH2 02411 * @arg @ref LL_TIM_CHANNEL_CH3 02412 * @arg @ref LL_TIM_CHANNEL_CH4 02413 * @retval Returned value can be one of the following values: 02414 * @arg @ref LL_TIM_IC_POLARITY_RISING 02415 * @arg @ref LL_TIM_IC_POLARITY_FALLING 02416 */ 02417 __STATIC_INLINE uint32_t LL_TIM_IC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel) 02418 { 02419 uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel); 02420 return (READ_BIT(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel])) >> 02421 SHIFT_TAB_CCxP[iChannel]); 02422 } 02423 02424 /** 02425 * @brief Connect the TIMx_CH1, CH2 and CH3 pins to the TI1 input (XOR combination). 02426 * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not 02427 * a timer instance provides an XOR input. 02428 * @rmtoll CR2 TI1S LL_TIM_IC_EnableXORCombination 02429 * @param TIMx Timer instance 02430 * @retval None 02431 */ 02432 __STATIC_INLINE void LL_TIM_IC_EnableXORCombination(TIM_TypeDef *TIMx) 02433 { 02434 SET_BIT(TIMx->CR2, TIM_CR2_TI1S); 02435 } 02436 02437 /** 02438 * @brief Disconnect the TIMx_CH1, CH2 and CH3 pins from the TI1 input. 02439 * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not 02440 * a timer instance provides an XOR input. 02441 * @rmtoll CR2 TI1S LL_TIM_IC_DisableXORCombination 02442 * @param TIMx Timer instance 02443 * @retval None 02444 */ 02445 __STATIC_INLINE void LL_TIM_IC_DisableXORCombination(TIM_TypeDef *TIMx) 02446 { 02447 CLEAR_BIT(TIMx->CR2, TIM_CR2_TI1S); 02448 } 02449 02450 /** 02451 * @brief Indicates whether the TIMx_CH1, CH2 and CH3 pins are connectected to the TI1 input. 02452 * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not 02453 * a timer instance provides an XOR input. 02454 * @rmtoll CR2 TI1S LL_TIM_IC_IsEnabledXORCombination 02455 * @param TIMx Timer instance 02456 * @retval State of bit (1 or 0). 02457 */ 02458 __STATIC_INLINE uint32_t LL_TIM_IC_IsEnabledXORCombination(TIM_TypeDef *TIMx) 02459 { 02460 return ((READ_BIT(TIMx->CR2, TIM_CR2_TI1S) == (TIM_CR2_TI1S)) ? 1UL : 0UL); 02461 } 02462 02463 /** 02464 * @brief Get captured value for input channel 1. 02465 * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not 02466 * input channel 1 is supported by a timer instance. 02467 * @rmtoll CCR1 CCR1 LL_TIM_IC_GetCaptureCH1 02468 * @param TIMx Timer instance 02469 * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) 02470 */ 02471 __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH1(TIM_TypeDef *TIMx) 02472 { 02473 return (uint32_t)(READ_REG(TIMx->CCR1)); 02474 } 02475 02476 /** 02477 * @brief Get captured value for input channel 2. 02478 * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not 02479 * input channel 2 is supported by a timer instance. 02480 * @rmtoll CCR2 CCR2 LL_TIM_IC_GetCaptureCH2 02481 * @param TIMx Timer instance 02482 * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) 02483 */ 02484 __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH2(TIM_TypeDef *TIMx) 02485 { 02486 return (uint32_t)(READ_REG(TIMx->CCR2)); 02487 } 02488 02489 /** 02490 * @brief Get captured value for input channel 3. 02491 * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not 02492 * input channel 3 is supported by a timer instance. 02493 * @rmtoll CCR3 CCR3 LL_TIM_IC_GetCaptureCH3 02494 * @param TIMx Timer instance 02495 * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) 02496 */ 02497 __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH3(TIM_TypeDef *TIMx) 02498 { 02499 return (uint32_t)(READ_REG(TIMx->CCR3)); 02500 } 02501 02502 /** 02503 * @brief Get captured value for input channel 4. 02504 * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not 02505 * input channel 4 is supported by a timer instance. 02506 * @rmtoll CCR4 CCR4 LL_TIM_IC_GetCaptureCH4 02507 * @param TIMx Timer instance 02508 * @retval CapturedValue (between Min_Data=0 and Max_Data=65535) 02509 */ 02510 __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH4(TIM_TypeDef *TIMx) 02511 { 02512 return (uint32_t)(READ_REG(TIMx->CCR4)); 02513 } 02514 02515 /** 02516 * @} 02517 */ 02518 02519 /** @defgroup TIM_LL_EF_Clock_Selection Counter clock selection 02520 * @{ 02521 */ 02522 /** 02523 * @brief Enable external clock mode 2. 02524 * @note When external clock mode 2 is enabled the counter is clocked by any active edge on the ETRF signal. 02525 * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check 02526 * whether or not a timer instance supports external clock mode2. 02527 * @rmtoll SMCR ECE LL_TIM_EnableExternalClock 02528 * @param TIMx Timer instance 02529 * @retval None 02530 */ 02531 __STATIC_INLINE void LL_TIM_EnableExternalClock(TIM_TypeDef *TIMx) 02532 { 02533 SET_BIT(TIMx->SMCR, TIM_SMCR_ECE); 02534 } 02535 02536 /** 02537 * @brief Disable external clock mode 2. 02538 * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check 02539 * whether or not a timer instance supports external clock mode2. 02540 * @rmtoll SMCR ECE LL_TIM_DisableExternalClock 02541 * @param TIMx Timer instance 02542 * @retval None 02543 */ 02544 __STATIC_INLINE void LL_TIM_DisableExternalClock(TIM_TypeDef *TIMx) 02545 { 02546 CLEAR_BIT(TIMx->SMCR, TIM_SMCR_ECE); 02547 } 02548 02549 /** 02550 * @brief Indicate whether external clock mode 2 is enabled. 02551 * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check 02552 * whether or not a timer instance supports external clock mode2. 02553 * @rmtoll SMCR ECE LL_TIM_IsEnabledExternalClock 02554 * @param TIMx Timer instance 02555 * @retval State of bit (1 or 0). 02556 */ 02557 __STATIC_INLINE uint32_t LL_TIM_IsEnabledExternalClock(TIM_TypeDef *TIMx) 02558 { 02559 return ((READ_BIT(TIMx->SMCR, TIM_SMCR_ECE) == (TIM_SMCR_ECE)) ? 1UL : 0UL); 02560 } 02561 02562 /** 02563 * @brief Set the clock source of the counter clock. 02564 * @note when selected clock source is external clock mode 1, the timer input 02565 * the external clock is applied is selected by calling the @ref LL_TIM_SetTriggerInput() 02566 * function. This timer input must be configured by calling 02567 * the @ref LL_TIM_IC_Config() function. 02568 * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(TIMx) can be used to check 02569 * whether or not a timer instance supports external clock mode1. 02570 * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check 02571 * whether or not a timer instance supports external clock mode2. 02572 * @rmtoll SMCR SMS LL_TIM_SetClockSource\n 02573 * SMCR ECE LL_TIM_SetClockSource 02574 * @param TIMx Timer instance 02575 * @param ClockSource This parameter can be one of the following values: 02576 * @arg @ref LL_TIM_CLOCKSOURCE_INTERNAL 02577 * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE1 02578 * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE2 02579 * @retval None 02580 */ 02581 __STATIC_INLINE void LL_TIM_SetClockSource(TIM_TypeDef *TIMx, uint32_t ClockSource) 02582 { 02583 MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS | TIM_SMCR_ECE, ClockSource); 02584 } 02585 02586 /** 02587 * @brief Set the encoder interface mode. 02588 * @note Macro IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx) can be used to check 02589 * whether or not a timer instance supports the encoder mode. 02590 * @rmtoll SMCR SMS LL_TIM_SetEncoderMode 02591 * @param TIMx Timer instance 02592 * @param EncoderMode This parameter can be one of the following values: 02593 * @arg @ref LL_TIM_ENCODERMODE_X2_TI1 02594 * @arg @ref LL_TIM_ENCODERMODE_X2_TI2 02595 * @arg @ref LL_TIM_ENCODERMODE_X4_TI12 02596 * @retval None 02597 */ 02598 __STATIC_INLINE void LL_TIM_SetEncoderMode(TIM_TypeDef *TIMx, uint32_t EncoderMode) 02599 { 02600 MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, EncoderMode); 02601 } 02602 02603 /** 02604 * @} 02605 */ 02606 02607 /** @defgroup TIM_LL_EF_Timer_Synchronization Timer synchronisation configuration 02608 * @{ 02609 */ 02610 /** 02611 * @brief Set the trigger output (TRGO) used for timer synchronization . 02612 * @note Macro IS_TIM_MASTER_INSTANCE(TIMx) can be used to check 02613 * whether or not a timer instance can operate as a master timer. 02614 * @rmtoll CR2 MMS LL_TIM_SetTriggerOutput 02615 * @param TIMx Timer instance 02616 * @param TimerSynchronization This parameter can be one of the following values: 02617 * @arg @ref LL_TIM_TRGO_RESET 02618 * @arg @ref LL_TIM_TRGO_ENABLE 02619 * @arg @ref LL_TIM_TRGO_UPDATE 02620 * @arg @ref LL_TIM_TRGO_CC1IF 02621 * @arg @ref LL_TIM_TRGO_OC1REF 02622 * @arg @ref LL_TIM_TRGO_OC2REF 02623 * @arg @ref LL_TIM_TRGO_OC3REF 02624 * @arg @ref LL_TIM_TRGO_OC4REF 02625 * @retval None 02626 */ 02627 __STATIC_INLINE void LL_TIM_SetTriggerOutput(TIM_TypeDef *TIMx, uint32_t TimerSynchronization) 02628 { 02629 MODIFY_REG(TIMx->CR2, TIM_CR2_MMS, TimerSynchronization); 02630 } 02631 02632 /** 02633 * @brief Set the synchronization mode of a slave timer. 02634 * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not 02635 * a timer instance can operate as a slave timer. 02636 * @rmtoll SMCR SMS LL_TIM_SetSlaveMode 02637 * @param TIMx Timer instance 02638 * @param SlaveMode This parameter can be one of the following values: 02639 * @arg @ref LL_TIM_SLAVEMODE_DISABLED 02640 * @arg @ref LL_TIM_SLAVEMODE_RESET 02641 * @arg @ref LL_TIM_SLAVEMODE_GATED 02642 * @arg @ref LL_TIM_SLAVEMODE_TRIGGER 02643 * @retval None 02644 */ 02645 __STATIC_INLINE void LL_TIM_SetSlaveMode(TIM_TypeDef *TIMx, uint32_t SlaveMode) 02646 { 02647 MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, SlaveMode); 02648 } 02649 02650 /** 02651 * @brief Set the selects the trigger input to be used to synchronize the counter. 02652 * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not 02653 * a timer instance can operate as a slave timer. 02654 * @rmtoll SMCR TS LL_TIM_SetTriggerInput 02655 * @param TIMx Timer instance 02656 * @param TriggerInput This parameter can be one of the following values: 02657 * @arg @ref LL_TIM_TS_ITR0 02658 * @arg @ref LL_TIM_TS_ITR1 02659 * @arg @ref LL_TIM_TS_ITR2 02660 * @arg @ref LL_TIM_TS_ITR3 02661 * @arg @ref LL_TIM_TS_TI1F_ED 02662 * @arg @ref LL_TIM_TS_TI1FP1 02663 * @arg @ref LL_TIM_TS_TI2FP2 02664 * @arg @ref LL_TIM_TS_ETRF 02665 * @retval None 02666 */ 02667 __STATIC_INLINE void LL_TIM_SetTriggerInput(TIM_TypeDef *TIMx, uint32_t TriggerInput) 02668 { 02669 MODIFY_REG(TIMx->SMCR, TIM_SMCR_TS, TriggerInput); 02670 } 02671 02672 /** 02673 * @brief Enable the Master/Slave mode. 02674 * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not 02675 * a timer instance can operate as a slave timer. 02676 * @rmtoll SMCR MSM LL_TIM_EnableMasterSlaveMode 02677 * @param TIMx Timer instance 02678 * @retval None 02679 */ 02680 __STATIC_INLINE void LL_TIM_EnableMasterSlaveMode(TIM_TypeDef *TIMx) 02681 { 02682 SET_BIT(TIMx->SMCR, TIM_SMCR_MSM); 02683 } 02684 02685 /** 02686 * @brief Disable the Master/Slave mode. 02687 * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not 02688 * a timer instance can operate as a slave timer. 02689 * @rmtoll SMCR MSM LL_TIM_DisableMasterSlaveMode 02690 * @param TIMx Timer instance 02691 * @retval None 02692 */ 02693 __STATIC_INLINE void LL_TIM_DisableMasterSlaveMode(TIM_TypeDef *TIMx) 02694 { 02695 CLEAR_BIT(TIMx->SMCR, TIM_SMCR_MSM); 02696 } 02697 02698 /** 02699 * @brief Indicates whether the Master/Slave mode is enabled. 02700 * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not 02701 * a timer instance can operate as a slave timer. 02702 * @rmtoll SMCR MSM LL_TIM_IsEnabledMasterSlaveMode 02703 * @param TIMx Timer instance 02704 * @retval State of bit (1 or 0). 02705 */ 02706 __STATIC_INLINE uint32_t LL_TIM_IsEnabledMasterSlaveMode(TIM_TypeDef *TIMx) 02707 { 02708 return ((READ_BIT(TIMx->SMCR, TIM_SMCR_MSM) == (TIM_SMCR_MSM)) ? 1UL : 0UL); 02709 } 02710 02711 /** 02712 * @brief Configure the external trigger (ETR) input. 02713 * @note Macro IS_TIM_ETR_INSTANCE(TIMx) can be used to check whether or not 02714 * a timer instance provides an external trigger input. 02715 * @rmtoll SMCR ETP LL_TIM_ConfigETR\n 02716 * SMCR ETPS LL_TIM_ConfigETR\n 02717 * SMCR ETF LL_TIM_ConfigETR 02718 * @param TIMx Timer instance 02719 * @param ETRPolarity This parameter can be one of the following values: 02720 * @arg @ref LL_TIM_ETR_POLARITY_NONINVERTED 02721 * @arg @ref LL_TIM_ETR_POLARITY_INVERTED 02722 * @param ETRPrescaler This parameter can be one of the following values: 02723 * @arg @ref LL_TIM_ETR_PRESCALER_DIV1 02724 * @arg @ref LL_TIM_ETR_PRESCALER_DIV2 02725 * @arg @ref LL_TIM_ETR_PRESCALER_DIV4 02726 * @arg @ref LL_TIM_ETR_PRESCALER_DIV8 02727 * @param ETRFilter This parameter can be one of the following values: 02728 * @arg @ref LL_TIM_ETR_FILTER_FDIV1 02729 * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N2 02730 * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N4 02731 * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N8 02732 * @arg @ref LL_TIM_ETR_FILTER_FDIV2_N6 02733 * @arg @ref LL_TIM_ETR_FILTER_FDIV2_N8 02734 * @arg @ref LL_TIM_ETR_FILTER_FDIV4_N6 02735 * @arg @ref LL_TIM_ETR_FILTER_FDIV4_N8 02736 * @arg @ref LL_TIM_ETR_FILTER_FDIV8_N6 02737 * @arg @ref LL_TIM_ETR_FILTER_FDIV8_N8 02738 * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N5 02739 * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N6 02740 * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N8 02741 * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N5 02742 * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N6 02743 * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N8 02744 * @retval None 02745 */ 02746 __STATIC_INLINE void LL_TIM_ConfigETR(TIM_TypeDef *TIMx, uint32_t ETRPolarity, uint32_t ETRPrescaler, 02747 uint32_t ETRFilter) 02748 { 02749 MODIFY_REG(TIMx->SMCR, TIM_SMCR_ETP | TIM_SMCR_ETPS | TIM_SMCR_ETF, ETRPolarity | ETRPrescaler | ETRFilter); 02750 } 02751 02752 /** 02753 * @} 02754 */ 02755 02756 /** @defgroup TIM_LL_EF_Break_Function Break function configuration 02757 * @{ 02758 */ 02759 /** 02760 * @brief Enable the break function. 02761 * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not 02762 * a timer instance provides a break input. 02763 * @rmtoll BDTR BKE LL_TIM_EnableBRK 02764 * @param TIMx Timer instance 02765 * @retval None 02766 */ 02767 __STATIC_INLINE void LL_TIM_EnableBRK(TIM_TypeDef *TIMx) 02768 { 02769 __IO uint32_t tmpreg; 02770 SET_BIT(TIMx->BDTR, TIM_BDTR_BKE); 02771 /* Note: Any write operation to this bit takes a delay of 1 APB clock cycle to become effective. */ 02772 tmpreg = READ_REG(TIMx->BDTR); 02773 (void)(tmpreg); 02774 } 02775 02776 /** 02777 * @brief Disable the break function. 02778 * @rmtoll BDTR BKE LL_TIM_DisableBRK 02779 * @param TIMx Timer instance 02780 * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not 02781 * a timer instance provides a break input. 02782 * @retval None 02783 */ 02784 __STATIC_INLINE void LL_TIM_DisableBRK(TIM_TypeDef *TIMx) 02785 { 02786 __IO uint32_t tmpreg; 02787 CLEAR_BIT(TIMx->BDTR, TIM_BDTR_BKE); 02788 /* Note: Any write operation to this bit takes a delay of 1 APB clock cycle to become effective. */ 02789 tmpreg = READ_REG(TIMx->BDTR); 02790 (void)(tmpreg); 02791 } 02792 02793 /** 02794 * @brief Configure the break input. 02795 * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not 02796 * a timer instance provides a break input. 02797 * @rmtoll BDTR BKP LL_TIM_ConfigBRK 02798 * @param TIMx Timer instance 02799 * @param BreakPolarity This parameter can be one of the following values: 02800 * @arg @ref LL_TIM_BREAK_POLARITY_LOW 02801 * @arg @ref LL_TIM_BREAK_POLARITY_HIGH 02802 * @retval None 02803 */ 02804 __STATIC_INLINE void LL_TIM_ConfigBRK(TIM_TypeDef *TIMx, uint32_t BreakPolarity) 02805 { 02806 __IO uint32_t tmpreg; 02807 MODIFY_REG(TIMx->BDTR, TIM_BDTR_BKP, BreakPolarity); 02808 /* Note: Any write operation to BKP bit takes a delay of 1 APB clock cycle to become effective. */ 02809 tmpreg = READ_REG(TIMx->BDTR); 02810 (void)(tmpreg); 02811 } 02812 02813 /** 02814 * @brief Select the outputs off state (enabled v.s. disabled) in Idle and Run modes. 02815 * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not 02816 * a timer instance provides a break input. 02817 * @rmtoll BDTR OSSI LL_TIM_SetOffStates\n 02818 * BDTR OSSR LL_TIM_SetOffStates 02819 * @param TIMx Timer instance 02820 * @param OffStateIdle This parameter can be one of the following values: 02821 * @arg @ref LL_TIM_OSSI_DISABLE 02822 * @arg @ref LL_TIM_OSSI_ENABLE 02823 * @param OffStateRun This parameter can be one of the following values: 02824 * @arg @ref LL_TIM_OSSR_DISABLE 02825 * @arg @ref LL_TIM_OSSR_ENABLE 02826 * @retval None 02827 */ 02828 __STATIC_INLINE void LL_TIM_SetOffStates(TIM_TypeDef *TIMx, uint32_t OffStateIdle, uint32_t OffStateRun) 02829 { 02830 MODIFY_REG(TIMx->BDTR, TIM_BDTR_OSSI | TIM_BDTR_OSSR, OffStateIdle | OffStateRun); 02831 } 02832 02833 /** 02834 * @brief Enable automatic output (MOE can be set by software or automatically when a break input is active). 02835 * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not 02836 * a timer instance provides a break input. 02837 * @rmtoll BDTR AOE LL_TIM_EnableAutomaticOutput 02838 * @param TIMx Timer instance 02839 * @retval None 02840 */ 02841 __STATIC_INLINE void LL_TIM_EnableAutomaticOutput(TIM_TypeDef *TIMx) 02842 { 02843 SET_BIT(TIMx->BDTR, TIM_BDTR_AOE); 02844 } 02845 02846 /** 02847 * @brief Disable automatic output (MOE can be set only by software). 02848 * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not 02849 * a timer instance provides a break input. 02850 * @rmtoll BDTR AOE LL_TIM_DisableAutomaticOutput 02851 * @param TIMx Timer instance 02852 * @retval None 02853 */ 02854 __STATIC_INLINE void LL_TIM_DisableAutomaticOutput(TIM_TypeDef *TIMx) 02855 { 02856 CLEAR_BIT(TIMx->BDTR, TIM_BDTR_AOE); 02857 } 02858 02859 /** 02860 * @brief Indicate whether automatic output is enabled. 02861 * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not 02862 * a timer instance provides a break input. 02863 * @rmtoll BDTR AOE LL_TIM_IsEnabledAutomaticOutput 02864 * @param TIMx Timer instance 02865 * @retval State of bit (1 or 0). 02866 */ 02867 __STATIC_INLINE uint32_t LL_TIM_IsEnabledAutomaticOutput(TIM_TypeDef *TIMx) 02868 { 02869 return ((READ_BIT(TIMx->BDTR, TIM_BDTR_AOE) == (TIM_BDTR_AOE)) ? 1UL : 0UL); 02870 } 02871 02872 /** 02873 * @brief Enable the outputs (set the MOE bit in TIMx_BDTR register). 02874 * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by 02875 * software and is reset in case of break or break2 event 02876 * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not 02877 * a timer instance provides a break input. 02878 * @rmtoll BDTR MOE LL_TIM_EnableAllOutputs 02879 * @param TIMx Timer instance 02880 * @retval None 02881 */ 02882 __STATIC_INLINE void LL_TIM_EnableAllOutputs(TIM_TypeDef *TIMx) 02883 { 02884 SET_BIT(TIMx->BDTR, TIM_BDTR_MOE); 02885 } 02886 02887 /** 02888 * @brief Disable the outputs (reset the MOE bit in TIMx_BDTR register). 02889 * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by 02890 * software and is reset in case of break or break2 event. 02891 * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not 02892 * a timer instance provides a break input. 02893 * @rmtoll BDTR MOE LL_TIM_DisableAllOutputs 02894 * @param TIMx Timer instance 02895 * @retval None 02896 */ 02897 __STATIC_INLINE void LL_TIM_DisableAllOutputs(TIM_TypeDef *TIMx) 02898 { 02899 CLEAR_BIT(TIMx->BDTR, TIM_BDTR_MOE); 02900 } 02901 02902 /** 02903 * @brief Indicates whether outputs are enabled. 02904 * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not 02905 * a timer instance provides a break input. 02906 * @rmtoll BDTR MOE LL_TIM_IsEnabledAllOutputs 02907 * @param TIMx Timer instance 02908 * @retval State of bit (1 or 0). 02909 */ 02910 __STATIC_INLINE uint32_t LL_TIM_IsEnabledAllOutputs(TIM_TypeDef *TIMx) 02911 { 02912 return ((READ_BIT(TIMx->BDTR, TIM_BDTR_MOE) == (TIM_BDTR_MOE)) ? 1UL : 0UL); 02913 } 02914 02915 /** 02916 * @} 02917 */ 02918 02919 /** @defgroup TIM_LL_EF_DMA_Burst_Mode DMA burst mode configuration 02920 * @{ 02921 */ 02922 /** 02923 * @brief Configures the timer DMA burst feature. 02924 * @note Macro IS_TIM_DMABURST_INSTANCE(TIMx) can be used to check whether or 02925 * not a timer instance supports the DMA burst mode. 02926 * @rmtoll DCR DBL LL_TIM_ConfigDMABurst\n 02927 * DCR DBA LL_TIM_ConfigDMABurst 02928 * @param TIMx Timer instance 02929 * @param DMABurstBaseAddress This parameter can be one of the following values: 02930 * @arg @ref LL_TIM_DMABURST_BASEADDR_CR1 02931 * @arg @ref LL_TIM_DMABURST_BASEADDR_CR2 02932 * @arg @ref LL_TIM_DMABURST_BASEADDR_SMCR 02933 * @arg @ref LL_TIM_DMABURST_BASEADDR_DIER 02934 * @arg @ref LL_TIM_DMABURST_BASEADDR_SR 02935 * @arg @ref LL_TIM_DMABURST_BASEADDR_EGR 02936 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR1 02937 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR2 02938 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCER 02939 * @arg @ref LL_TIM_DMABURST_BASEADDR_CNT 02940 * @arg @ref LL_TIM_DMABURST_BASEADDR_PSC 02941 * @arg @ref LL_TIM_DMABURST_BASEADDR_ARR 02942 * @arg @ref LL_TIM_DMABURST_BASEADDR_RCR 02943 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR1 02944 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR2 02945 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR3 02946 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR4 02947 * @arg @ref LL_TIM_DMABURST_BASEADDR_BDTR 02948 * @param DMABurstLength This parameter can be one of the following values: 02949 * @arg @ref LL_TIM_DMABURST_LENGTH_1TRANSFER 02950 * @arg @ref LL_TIM_DMABURST_LENGTH_2TRANSFERS 02951 * @arg @ref LL_TIM_DMABURST_LENGTH_3TRANSFERS 02952 * @arg @ref LL_TIM_DMABURST_LENGTH_4TRANSFERS 02953 * @arg @ref LL_TIM_DMABURST_LENGTH_5TRANSFERS 02954 * @arg @ref LL_TIM_DMABURST_LENGTH_6TRANSFERS 02955 * @arg @ref LL_TIM_DMABURST_LENGTH_7TRANSFERS 02956 * @arg @ref LL_TIM_DMABURST_LENGTH_8TRANSFERS 02957 * @arg @ref LL_TIM_DMABURST_LENGTH_9TRANSFERS 02958 * @arg @ref LL_TIM_DMABURST_LENGTH_10TRANSFERS 02959 * @arg @ref LL_TIM_DMABURST_LENGTH_11TRANSFERS 02960 * @arg @ref LL_TIM_DMABURST_LENGTH_12TRANSFERS 02961 * @arg @ref LL_TIM_DMABURST_LENGTH_13TRANSFERS 02962 * @arg @ref LL_TIM_DMABURST_LENGTH_14TRANSFERS 02963 * @arg @ref LL_TIM_DMABURST_LENGTH_15TRANSFERS 02964 * @arg @ref LL_TIM_DMABURST_LENGTH_16TRANSFERS 02965 * @arg @ref LL_TIM_DMABURST_LENGTH_17TRANSFERS 02966 * @arg @ref LL_TIM_DMABURST_LENGTH_18TRANSFERS 02967 * @retval None 02968 */ 02969 __STATIC_INLINE void LL_TIM_ConfigDMABurst(TIM_TypeDef *TIMx, uint32_t DMABurstBaseAddress, uint32_t DMABurstLength) 02970 { 02971 MODIFY_REG(TIMx->DCR, (TIM_DCR_DBL | TIM_DCR_DBA), (DMABurstBaseAddress | DMABurstLength)); 02972 } 02973 02974 /** 02975 * @} 02976 */ 02977 02978 02979 /** 02980 * @} 02981 */ 02982 02983 /** @defgroup TIM_LL_EF_FLAG_Management FLAG-Management 02984 * @{ 02985 */ 02986 /** 02987 * @brief Clear the update interrupt flag (UIF). 02988 * @rmtoll SR UIF LL_TIM_ClearFlag_UPDATE 02989 * @param TIMx Timer instance 02990 * @retval None 02991 */ 02992 __STATIC_INLINE void LL_TIM_ClearFlag_UPDATE(TIM_TypeDef *TIMx) 02993 { 02994 WRITE_REG(TIMx->SR, ~(TIM_SR_UIF)); 02995 } 02996 02997 /** 02998 * @brief Indicate whether update interrupt flag (UIF) is set (update interrupt is pending). 02999 * @rmtoll SR UIF LL_TIM_IsActiveFlag_UPDATE 03000 * @param TIMx Timer instance 03001 * @retval State of bit (1 or 0). 03002 */ 03003 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_UPDATE(TIM_TypeDef *TIMx) 03004 { 03005 return ((READ_BIT(TIMx->SR, TIM_SR_UIF) == (TIM_SR_UIF)) ? 1UL : 0UL); 03006 } 03007 03008 /** 03009 * @brief Clear the Capture/Compare 1 interrupt flag (CC1F). 03010 * @rmtoll SR CC1IF LL_TIM_ClearFlag_CC1 03011 * @param TIMx Timer instance 03012 * @retval None 03013 */ 03014 __STATIC_INLINE void LL_TIM_ClearFlag_CC1(TIM_TypeDef *TIMx) 03015 { 03016 WRITE_REG(TIMx->SR, ~(TIM_SR_CC1IF)); 03017 } 03018 03019 /** 03020 * @brief Indicate whether Capture/Compare 1 interrupt flag (CC1F) is set (Capture/Compare 1 interrupt is pending). 03021 * @rmtoll SR CC1IF LL_TIM_IsActiveFlag_CC1 03022 * @param TIMx Timer instance 03023 * @retval State of bit (1 or 0). 03024 */ 03025 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1(TIM_TypeDef *TIMx) 03026 { 03027 return ((READ_BIT(TIMx->SR, TIM_SR_CC1IF) == (TIM_SR_CC1IF)) ? 1UL : 0UL); 03028 } 03029 03030 /** 03031 * @brief Clear the Capture/Compare 2 interrupt flag (CC2F). 03032 * @rmtoll SR CC2IF LL_TIM_ClearFlag_CC2 03033 * @param TIMx Timer instance 03034 * @retval None 03035 */ 03036 __STATIC_INLINE void LL_TIM_ClearFlag_CC2(TIM_TypeDef *TIMx) 03037 { 03038 WRITE_REG(TIMx->SR, ~(TIM_SR_CC2IF)); 03039 } 03040 03041 /** 03042 * @brief Indicate whether Capture/Compare 2 interrupt flag (CC2F) is set (Capture/Compare 2 interrupt is pending). 03043 * @rmtoll SR CC2IF LL_TIM_IsActiveFlag_CC2 03044 * @param TIMx Timer instance 03045 * @retval State of bit (1 or 0). 03046 */ 03047 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2(TIM_TypeDef *TIMx) 03048 { 03049 return ((READ_BIT(TIMx->SR, TIM_SR_CC2IF) == (TIM_SR_CC2IF)) ? 1UL : 0UL); 03050 } 03051 03052 /** 03053 * @brief Clear the Capture/Compare 3 interrupt flag (CC3F). 03054 * @rmtoll SR CC3IF LL_TIM_ClearFlag_CC3 03055 * @param TIMx Timer instance 03056 * @retval None 03057 */ 03058 __STATIC_INLINE void LL_TIM_ClearFlag_CC3(TIM_TypeDef *TIMx) 03059 { 03060 WRITE_REG(TIMx->SR, ~(TIM_SR_CC3IF)); 03061 } 03062 03063 /** 03064 * @brief Indicate whether Capture/Compare 3 interrupt flag (CC3F) is set (Capture/Compare 3 interrupt is pending). 03065 * @rmtoll SR CC3IF LL_TIM_IsActiveFlag_CC3 03066 * @param TIMx Timer instance 03067 * @retval State of bit (1 or 0). 03068 */ 03069 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3(TIM_TypeDef *TIMx) 03070 { 03071 return ((READ_BIT(TIMx->SR, TIM_SR_CC3IF) == (TIM_SR_CC3IF)) ? 1UL : 0UL); 03072 } 03073 03074 /** 03075 * @brief Clear the Capture/Compare 4 interrupt flag (CC4F). 03076 * @rmtoll SR CC4IF LL_TIM_ClearFlag_CC4 03077 * @param TIMx Timer instance 03078 * @retval None 03079 */ 03080 __STATIC_INLINE void LL_TIM_ClearFlag_CC4(TIM_TypeDef *TIMx) 03081 { 03082 WRITE_REG(TIMx->SR, ~(TIM_SR_CC4IF)); 03083 } 03084 03085 /** 03086 * @brief Indicate whether Capture/Compare 4 interrupt flag (CC4F) is set (Capture/Compare 4 interrupt is pending). 03087 * @rmtoll SR CC4IF LL_TIM_IsActiveFlag_CC4 03088 * @param TIMx Timer instance 03089 * @retval State of bit (1 or 0). 03090 */ 03091 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4(TIM_TypeDef *TIMx) 03092 { 03093 return ((READ_BIT(TIMx->SR, TIM_SR_CC4IF) == (TIM_SR_CC4IF)) ? 1UL : 0UL); 03094 } 03095 03096 /** 03097 * @brief Clear the commutation interrupt flag (COMIF). 03098 * @rmtoll SR COMIF LL_TIM_ClearFlag_COM 03099 * @param TIMx Timer instance 03100 * @retval None 03101 */ 03102 __STATIC_INLINE void LL_TIM_ClearFlag_COM(TIM_TypeDef *TIMx) 03103 { 03104 WRITE_REG(TIMx->SR, ~(TIM_SR_COMIF)); 03105 } 03106 03107 /** 03108 * @brief Indicate whether commutation interrupt flag (COMIF) is set (commutation interrupt is pending). 03109 * @rmtoll SR COMIF LL_TIM_IsActiveFlag_COM 03110 * @param TIMx Timer instance 03111 * @retval State of bit (1 or 0). 03112 */ 03113 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_COM(TIM_TypeDef *TIMx) 03114 { 03115 return ((READ_BIT(TIMx->SR, TIM_SR_COMIF) == (TIM_SR_COMIF)) ? 1UL : 0UL); 03116 } 03117 03118 /** 03119 * @brief Clear the trigger interrupt flag (TIF). 03120 * @rmtoll SR TIF LL_TIM_ClearFlag_TRIG 03121 * @param TIMx Timer instance 03122 * @retval None 03123 */ 03124 __STATIC_INLINE void LL_TIM_ClearFlag_TRIG(TIM_TypeDef *TIMx) 03125 { 03126 WRITE_REG(TIMx->SR, ~(TIM_SR_TIF)); 03127 } 03128 03129 /** 03130 * @brief Indicate whether trigger interrupt flag (TIF) is set (trigger interrupt is pending). 03131 * @rmtoll SR TIF LL_TIM_IsActiveFlag_TRIG 03132 * @param TIMx Timer instance 03133 * @retval State of bit (1 or 0). 03134 */ 03135 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_TRIG(TIM_TypeDef *TIMx) 03136 { 03137 return ((READ_BIT(TIMx->SR, TIM_SR_TIF) == (TIM_SR_TIF)) ? 1UL : 0UL); 03138 } 03139 03140 /** 03141 * @brief Clear the break interrupt flag (BIF). 03142 * @rmtoll SR BIF LL_TIM_ClearFlag_BRK 03143 * @param TIMx Timer instance 03144 * @retval None 03145 */ 03146 __STATIC_INLINE void LL_TIM_ClearFlag_BRK(TIM_TypeDef *TIMx) 03147 { 03148 WRITE_REG(TIMx->SR, ~(TIM_SR_BIF)); 03149 } 03150 03151 /** 03152 * @brief Indicate whether break interrupt flag (BIF) is set (break interrupt is pending). 03153 * @rmtoll SR BIF LL_TIM_IsActiveFlag_BRK 03154 * @param TIMx Timer instance 03155 * @retval State of bit (1 or 0). 03156 */ 03157 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_BRK(TIM_TypeDef *TIMx) 03158 { 03159 return ((READ_BIT(TIMx->SR, TIM_SR_BIF) == (TIM_SR_BIF)) ? 1UL : 0UL); 03160 } 03161 03162 /** 03163 * @brief Clear the Capture/Compare 1 over-capture interrupt flag (CC1OF). 03164 * @rmtoll SR CC1OF LL_TIM_ClearFlag_CC1OVR 03165 * @param TIMx Timer instance 03166 * @retval None 03167 */ 03168 __STATIC_INLINE void LL_TIM_ClearFlag_CC1OVR(TIM_TypeDef *TIMx) 03169 { 03170 WRITE_REG(TIMx->SR, ~(TIM_SR_CC1OF)); 03171 } 03172 03173 /** 03174 * @brief Indicate whether Capture/Compare 1 over-capture interrupt flag (CC1OF) is set 03175 * (Capture/Compare 1 interrupt is pending). 03176 * @rmtoll SR CC1OF LL_TIM_IsActiveFlag_CC1OVR 03177 * @param TIMx Timer instance 03178 * @retval State of bit (1 or 0). 03179 */ 03180 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1OVR(TIM_TypeDef *TIMx) 03181 { 03182 return ((READ_BIT(TIMx->SR, TIM_SR_CC1OF) == (TIM_SR_CC1OF)) ? 1UL : 0UL); 03183 } 03184 03185 /** 03186 * @brief Clear the Capture/Compare 2 over-capture interrupt flag (CC2OF). 03187 * @rmtoll SR CC2OF LL_TIM_ClearFlag_CC2OVR 03188 * @param TIMx Timer instance 03189 * @retval None 03190 */ 03191 __STATIC_INLINE void LL_TIM_ClearFlag_CC2OVR(TIM_TypeDef *TIMx) 03192 { 03193 WRITE_REG(TIMx->SR, ~(TIM_SR_CC2OF)); 03194 } 03195 03196 /** 03197 * @brief Indicate whether Capture/Compare 2 over-capture interrupt flag (CC2OF) is set 03198 * (Capture/Compare 2 over-capture interrupt is pending). 03199 * @rmtoll SR CC2OF LL_TIM_IsActiveFlag_CC2OVR 03200 * @param TIMx Timer instance 03201 * @retval State of bit (1 or 0). 03202 */ 03203 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2OVR(TIM_TypeDef *TIMx) 03204 { 03205 return ((READ_BIT(TIMx->SR, TIM_SR_CC2OF) == (TIM_SR_CC2OF)) ? 1UL : 0UL); 03206 } 03207 03208 /** 03209 * @brief Clear the Capture/Compare 3 over-capture interrupt flag (CC3OF). 03210 * @rmtoll SR CC3OF LL_TIM_ClearFlag_CC3OVR 03211 * @param TIMx Timer instance 03212 * @retval None 03213 */ 03214 __STATIC_INLINE void LL_TIM_ClearFlag_CC3OVR(TIM_TypeDef *TIMx) 03215 { 03216 WRITE_REG(TIMx->SR, ~(TIM_SR_CC3OF)); 03217 } 03218 03219 /** 03220 * @brief Indicate whether Capture/Compare 3 over-capture interrupt flag (CC3OF) is set 03221 * (Capture/Compare 3 over-capture interrupt is pending). 03222 * @rmtoll SR CC3OF LL_TIM_IsActiveFlag_CC3OVR 03223 * @param TIMx Timer instance 03224 * @retval State of bit (1 or 0). 03225 */ 03226 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3OVR(TIM_TypeDef *TIMx) 03227 { 03228 return ((READ_BIT(TIMx->SR, TIM_SR_CC3OF) == (TIM_SR_CC3OF)) ? 1UL : 0UL); 03229 } 03230 03231 /** 03232 * @brief Clear the Capture/Compare 4 over-capture interrupt flag (CC4OF). 03233 * @rmtoll SR CC4OF LL_TIM_ClearFlag_CC4OVR 03234 * @param TIMx Timer instance 03235 * @retval None 03236 */ 03237 __STATIC_INLINE void LL_TIM_ClearFlag_CC4OVR(TIM_TypeDef *TIMx) 03238 { 03239 WRITE_REG(TIMx->SR, ~(TIM_SR_CC4OF)); 03240 } 03241 03242 /** 03243 * @brief Indicate whether Capture/Compare 4 over-capture interrupt flag (CC4OF) is set 03244 * (Capture/Compare 4 over-capture interrupt is pending). 03245 * @rmtoll SR CC4OF LL_TIM_IsActiveFlag_CC4OVR 03246 * @param TIMx Timer instance 03247 * @retval State of bit (1 or 0). 03248 */ 03249 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4OVR(TIM_TypeDef *TIMx) 03250 { 03251 return ((READ_BIT(TIMx->SR, TIM_SR_CC4OF) == (TIM_SR_CC4OF)) ? 1UL : 0UL); 03252 } 03253 03254 /** 03255 * @} 03256 */ 03257 03258 /** @defgroup TIM_LL_EF_IT_Management IT-Management 03259 * @{ 03260 */ 03261 /** 03262 * @brief Enable update interrupt (UIE). 03263 * @rmtoll DIER UIE LL_TIM_EnableIT_UPDATE 03264 * @param TIMx Timer instance 03265 * @retval None 03266 */ 03267 __STATIC_INLINE void LL_TIM_EnableIT_UPDATE(TIM_TypeDef *TIMx) 03268 { 03269 SET_BIT(TIMx->DIER, TIM_DIER_UIE); 03270 } 03271 03272 /** 03273 * @brief Disable update interrupt (UIE). 03274 * @rmtoll DIER UIE LL_TIM_DisableIT_UPDATE 03275 * @param TIMx Timer instance 03276 * @retval None 03277 */ 03278 __STATIC_INLINE void LL_TIM_DisableIT_UPDATE(TIM_TypeDef *TIMx) 03279 { 03280 CLEAR_BIT(TIMx->DIER, TIM_DIER_UIE); 03281 } 03282 03283 /** 03284 * @brief Indicates whether the update interrupt (UIE) is enabled. 03285 * @rmtoll DIER UIE LL_TIM_IsEnabledIT_UPDATE 03286 * @param TIMx Timer instance 03287 * @retval State of bit (1 or 0). 03288 */ 03289 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_UPDATE(TIM_TypeDef *TIMx) 03290 { 03291 return ((READ_BIT(TIMx->DIER, TIM_DIER_UIE) == (TIM_DIER_UIE)) ? 1UL : 0UL); 03292 } 03293 03294 /** 03295 * @brief Enable capture/compare 1 interrupt (CC1IE). 03296 * @rmtoll DIER CC1IE LL_TIM_EnableIT_CC1 03297 * @param TIMx Timer instance 03298 * @retval None 03299 */ 03300 __STATIC_INLINE void LL_TIM_EnableIT_CC1(TIM_TypeDef *TIMx) 03301 { 03302 SET_BIT(TIMx->DIER, TIM_DIER_CC1IE); 03303 } 03304 03305 /** 03306 * @brief Disable capture/compare 1 interrupt (CC1IE). 03307 * @rmtoll DIER CC1IE LL_TIM_DisableIT_CC1 03308 * @param TIMx Timer instance 03309 * @retval None 03310 */ 03311 __STATIC_INLINE void LL_TIM_DisableIT_CC1(TIM_TypeDef *TIMx) 03312 { 03313 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC1IE); 03314 } 03315 03316 /** 03317 * @brief Indicates whether the capture/compare 1 interrupt (CC1IE) is enabled. 03318 * @rmtoll DIER CC1IE LL_TIM_IsEnabledIT_CC1 03319 * @param TIMx Timer instance 03320 * @retval State of bit (1 or 0). 03321 */ 03322 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC1(TIM_TypeDef *TIMx) 03323 { 03324 return ((READ_BIT(TIMx->DIER, TIM_DIER_CC1IE) == (TIM_DIER_CC1IE)) ? 1UL : 0UL); 03325 } 03326 03327 /** 03328 * @brief Enable capture/compare 2 interrupt (CC2IE). 03329 * @rmtoll DIER CC2IE LL_TIM_EnableIT_CC2 03330 * @param TIMx Timer instance 03331 * @retval None 03332 */ 03333 __STATIC_INLINE void LL_TIM_EnableIT_CC2(TIM_TypeDef *TIMx) 03334 { 03335 SET_BIT(TIMx->DIER, TIM_DIER_CC2IE); 03336 } 03337 03338 /** 03339 * @brief Disable capture/compare 2 interrupt (CC2IE). 03340 * @rmtoll DIER CC2IE LL_TIM_DisableIT_CC2 03341 * @param TIMx Timer instance 03342 * @retval None 03343 */ 03344 __STATIC_INLINE void LL_TIM_DisableIT_CC2(TIM_TypeDef *TIMx) 03345 { 03346 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC2IE); 03347 } 03348 03349 /** 03350 * @brief Indicates whether the capture/compare 2 interrupt (CC2IE) is enabled. 03351 * @rmtoll DIER CC2IE LL_TIM_IsEnabledIT_CC2 03352 * @param TIMx Timer instance 03353 * @retval State of bit (1 or 0). 03354 */ 03355 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC2(TIM_TypeDef *TIMx) 03356 { 03357 return ((READ_BIT(TIMx->DIER, TIM_DIER_CC2IE) == (TIM_DIER_CC2IE)) ? 1UL : 0UL); 03358 } 03359 03360 /** 03361 * @brief Enable capture/compare 3 interrupt (CC3IE). 03362 * @rmtoll DIER CC3IE LL_TIM_EnableIT_CC3 03363 * @param TIMx Timer instance 03364 * @retval None 03365 */ 03366 __STATIC_INLINE void LL_TIM_EnableIT_CC3(TIM_TypeDef *TIMx) 03367 { 03368 SET_BIT(TIMx->DIER, TIM_DIER_CC3IE); 03369 } 03370 03371 /** 03372 * @brief Disable capture/compare 3 interrupt (CC3IE). 03373 * @rmtoll DIER CC3IE LL_TIM_DisableIT_CC3 03374 * @param TIMx Timer instance 03375 * @retval None 03376 */ 03377 __STATIC_INLINE void LL_TIM_DisableIT_CC3(TIM_TypeDef *TIMx) 03378 { 03379 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC3IE); 03380 } 03381 03382 /** 03383 * @brief Indicates whether the capture/compare 3 interrupt (CC3IE) is enabled. 03384 * @rmtoll DIER CC3IE LL_TIM_IsEnabledIT_CC3 03385 * @param TIMx Timer instance 03386 * @retval State of bit (1 or 0). 03387 */ 03388 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC3(TIM_TypeDef *TIMx) 03389 { 03390 return ((READ_BIT(TIMx->DIER, TIM_DIER_CC3IE) == (TIM_DIER_CC3IE)) ? 1UL : 0UL); 03391 } 03392 03393 /** 03394 * @brief Enable capture/compare 4 interrupt (CC4IE). 03395 * @rmtoll DIER CC4IE LL_TIM_EnableIT_CC4 03396 * @param TIMx Timer instance 03397 * @retval None 03398 */ 03399 __STATIC_INLINE void LL_TIM_EnableIT_CC4(TIM_TypeDef *TIMx) 03400 { 03401 SET_BIT(TIMx->DIER, TIM_DIER_CC4IE); 03402 } 03403 03404 /** 03405 * @brief Disable capture/compare 4 interrupt (CC4IE). 03406 * @rmtoll DIER CC4IE LL_TIM_DisableIT_CC4 03407 * @param TIMx Timer instance 03408 * @retval None 03409 */ 03410 __STATIC_INLINE void LL_TIM_DisableIT_CC4(TIM_TypeDef *TIMx) 03411 { 03412 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC4IE); 03413 } 03414 03415 /** 03416 * @brief Indicates whether the capture/compare 4 interrupt (CC4IE) is enabled. 03417 * @rmtoll DIER CC4IE LL_TIM_IsEnabledIT_CC4 03418 * @param TIMx Timer instance 03419 * @retval State of bit (1 or 0). 03420 */ 03421 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC4(TIM_TypeDef *TIMx) 03422 { 03423 return ((READ_BIT(TIMx->DIER, TIM_DIER_CC4IE) == (TIM_DIER_CC4IE)) ? 1UL : 0UL); 03424 } 03425 03426 /** 03427 * @brief Enable commutation interrupt (COMIE). 03428 * @rmtoll DIER COMIE LL_TIM_EnableIT_COM 03429 * @param TIMx Timer instance 03430 * @retval None 03431 */ 03432 __STATIC_INLINE void LL_TIM_EnableIT_COM(TIM_TypeDef *TIMx) 03433 { 03434 SET_BIT(TIMx->DIER, TIM_DIER_COMIE); 03435 } 03436 03437 /** 03438 * @brief Disable commutation interrupt (COMIE). 03439 * @rmtoll DIER COMIE LL_TIM_DisableIT_COM 03440 * @param TIMx Timer instance 03441 * @retval None 03442 */ 03443 __STATIC_INLINE void LL_TIM_DisableIT_COM(TIM_TypeDef *TIMx) 03444 { 03445 CLEAR_BIT(TIMx->DIER, TIM_DIER_COMIE); 03446 } 03447 03448 /** 03449 * @brief Indicates whether the commutation interrupt (COMIE) is enabled. 03450 * @rmtoll DIER COMIE LL_TIM_IsEnabledIT_COM 03451 * @param TIMx Timer instance 03452 * @retval State of bit (1 or 0). 03453 */ 03454 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_COM(TIM_TypeDef *TIMx) 03455 { 03456 return ((READ_BIT(TIMx->DIER, TIM_DIER_COMIE) == (TIM_DIER_COMIE)) ? 1UL : 0UL); 03457 } 03458 03459 /** 03460 * @brief Enable trigger interrupt (TIE). 03461 * @rmtoll DIER TIE LL_TIM_EnableIT_TRIG 03462 * @param TIMx Timer instance 03463 * @retval None 03464 */ 03465 __STATIC_INLINE void LL_TIM_EnableIT_TRIG(TIM_TypeDef *TIMx) 03466 { 03467 SET_BIT(TIMx->DIER, TIM_DIER_TIE); 03468 } 03469 03470 /** 03471 * @brief Disable trigger interrupt (TIE). 03472 * @rmtoll DIER TIE LL_TIM_DisableIT_TRIG 03473 * @param TIMx Timer instance 03474 * @retval None 03475 */ 03476 __STATIC_INLINE void LL_TIM_DisableIT_TRIG(TIM_TypeDef *TIMx) 03477 { 03478 CLEAR_BIT(TIMx->DIER, TIM_DIER_TIE); 03479 } 03480 03481 /** 03482 * @brief Indicates whether the trigger interrupt (TIE) is enabled. 03483 * @rmtoll DIER TIE LL_TIM_IsEnabledIT_TRIG 03484 * @param TIMx Timer instance 03485 * @retval State of bit (1 or 0). 03486 */ 03487 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_TRIG(TIM_TypeDef *TIMx) 03488 { 03489 return ((READ_BIT(TIMx->DIER, TIM_DIER_TIE) == (TIM_DIER_TIE)) ? 1UL : 0UL); 03490 } 03491 03492 /** 03493 * @brief Enable break interrupt (BIE). 03494 * @rmtoll DIER BIE LL_TIM_EnableIT_BRK 03495 * @param TIMx Timer instance 03496 * @retval None 03497 */ 03498 __STATIC_INLINE void LL_TIM_EnableIT_BRK(TIM_TypeDef *TIMx) 03499 { 03500 SET_BIT(TIMx->DIER, TIM_DIER_BIE); 03501 } 03502 03503 /** 03504 * @brief Disable break interrupt (BIE). 03505 * @rmtoll DIER BIE LL_TIM_DisableIT_BRK 03506 * @param TIMx Timer instance 03507 * @retval None 03508 */ 03509 __STATIC_INLINE void LL_TIM_DisableIT_BRK(TIM_TypeDef *TIMx) 03510 { 03511 CLEAR_BIT(TIMx->DIER, TIM_DIER_BIE); 03512 } 03513 03514 /** 03515 * @brief Indicates whether the break interrupt (BIE) is enabled. 03516 * @rmtoll DIER BIE LL_TIM_IsEnabledIT_BRK 03517 * @param TIMx Timer instance 03518 * @retval State of bit (1 or 0). 03519 */ 03520 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_BRK(TIM_TypeDef *TIMx) 03521 { 03522 return ((READ_BIT(TIMx->DIER, TIM_DIER_BIE) == (TIM_DIER_BIE)) ? 1UL : 0UL); 03523 } 03524 03525 /** 03526 * @} 03527 */ 03528 03529 /** @defgroup TIM_LL_EF_DMA_Management DMA-Management 03530 * @{ 03531 */ 03532 /** 03533 * @brief Enable update DMA request (UDE). 03534 * @rmtoll DIER UDE LL_TIM_EnableDMAReq_UPDATE 03535 * @param TIMx Timer instance 03536 * @retval None 03537 */ 03538 __STATIC_INLINE void LL_TIM_EnableDMAReq_UPDATE(TIM_TypeDef *TIMx) 03539 { 03540 SET_BIT(TIMx->DIER, TIM_DIER_UDE); 03541 } 03542 03543 /** 03544 * @brief Disable update DMA request (UDE). 03545 * @rmtoll DIER UDE LL_TIM_DisableDMAReq_UPDATE 03546 * @param TIMx Timer instance 03547 * @retval None 03548 */ 03549 __STATIC_INLINE void LL_TIM_DisableDMAReq_UPDATE(TIM_TypeDef *TIMx) 03550 { 03551 CLEAR_BIT(TIMx->DIER, TIM_DIER_UDE); 03552 } 03553 03554 /** 03555 * @brief Indicates whether the update DMA request (UDE) is enabled. 03556 * @rmtoll DIER UDE LL_TIM_IsEnabledDMAReq_UPDATE 03557 * @param TIMx Timer instance 03558 * @retval State of bit (1 or 0). 03559 */ 03560 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_UPDATE(TIM_TypeDef *TIMx) 03561 { 03562 return ((READ_BIT(TIMx->DIER, TIM_DIER_UDE) == (TIM_DIER_UDE)) ? 1UL : 0UL); 03563 } 03564 03565 /** 03566 * @brief Enable capture/compare 1 DMA request (CC1DE). 03567 * @rmtoll DIER CC1DE LL_TIM_EnableDMAReq_CC1 03568 * @param TIMx Timer instance 03569 * @retval None 03570 */ 03571 __STATIC_INLINE void LL_TIM_EnableDMAReq_CC1(TIM_TypeDef *TIMx) 03572 { 03573 SET_BIT(TIMx->DIER, TIM_DIER_CC1DE); 03574 } 03575 03576 /** 03577 * @brief Disable capture/compare 1 DMA request (CC1DE). 03578 * @rmtoll DIER CC1DE LL_TIM_DisableDMAReq_CC1 03579 * @param TIMx Timer instance 03580 * @retval None 03581 */ 03582 __STATIC_INLINE void LL_TIM_DisableDMAReq_CC1(TIM_TypeDef *TIMx) 03583 { 03584 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC1DE); 03585 } 03586 03587 /** 03588 * @brief Indicates whether the capture/compare 1 DMA request (CC1DE) is enabled. 03589 * @rmtoll DIER CC1DE LL_TIM_IsEnabledDMAReq_CC1 03590 * @param TIMx Timer instance 03591 * @retval State of bit (1 or 0). 03592 */ 03593 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC1(TIM_TypeDef *TIMx) 03594 { 03595 return ((READ_BIT(TIMx->DIER, TIM_DIER_CC1DE) == (TIM_DIER_CC1DE)) ? 1UL : 0UL); 03596 } 03597 03598 /** 03599 * @brief Enable capture/compare 2 DMA request (CC2DE). 03600 * @rmtoll DIER CC2DE LL_TIM_EnableDMAReq_CC2 03601 * @param TIMx Timer instance 03602 * @retval None 03603 */ 03604 __STATIC_INLINE void LL_TIM_EnableDMAReq_CC2(TIM_TypeDef *TIMx) 03605 { 03606 SET_BIT(TIMx->DIER, TIM_DIER_CC2DE); 03607 } 03608 03609 /** 03610 * @brief Disable capture/compare 2 DMA request (CC2DE). 03611 * @rmtoll DIER CC2DE LL_TIM_DisableDMAReq_CC2 03612 * @param TIMx Timer instance 03613 * @retval None 03614 */ 03615 __STATIC_INLINE void LL_TIM_DisableDMAReq_CC2(TIM_TypeDef *TIMx) 03616 { 03617 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC2DE); 03618 } 03619 03620 /** 03621 * @brief Indicates whether the capture/compare 2 DMA request (CC2DE) is enabled. 03622 * @rmtoll DIER CC2DE LL_TIM_IsEnabledDMAReq_CC2 03623 * @param TIMx Timer instance 03624 * @retval State of bit (1 or 0). 03625 */ 03626 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC2(TIM_TypeDef *TIMx) 03627 { 03628 return ((READ_BIT(TIMx->DIER, TIM_DIER_CC2DE) == (TIM_DIER_CC2DE)) ? 1UL : 0UL); 03629 } 03630 03631 /** 03632 * @brief Enable capture/compare 3 DMA request (CC3DE). 03633 * @rmtoll DIER CC3DE LL_TIM_EnableDMAReq_CC3 03634 * @param TIMx Timer instance 03635 * @retval None 03636 */ 03637 __STATIC_INLINE void LL_TIM_EnableDMAReq_CC3(TIM_TypeDef *TIMx) 03638 { 03639 SET_BIT(TIMx->DIER, TIM_DIER_CC3DE); 03640 } 03641 03642 /** 03643 * @brief Disable capture/compare 3 DMA request (CC3DE). 03644 * @rmtoll DIER CC3DE LL_TIM_DisableDMAReq_CC3 03645 * @param TIMx Timer instance 03646 * @retval None 03647 */ 03648 __STATIC_INLINE void LL_TIM_DisableDMAReq_CC3(TIM_TypeDef *TIMx) 03649 { 03650 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC3DE); 03651 } 03652 03653 /** 03654 * @brief Indicates whether the capture/compare 3 DMA request (CC3DE) is enabled. 03655 * @rmtoll DIER CC3DE LL_TIM_IsEnabledDMAReq_CC3 03656 * @param TIMx Timer instance 03657 * @retval State of bit (1 or 0). 03658 */ 03659 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC3(TIM_TypeDef *TIMx) 03660 { 03661 return ((READ_BIT(TIMx->DIER, TIM_DIER_CC3DE) == (TIM_DIER_CC3DE)) ? 1UL : 0UL); 03662 } 03663 03664 /** 03665 * @brief Enable capture/compare 4 DMA request (CC4DE). 03666 * @rmtoll DIER CC4DE LL_TIM_EnableDMAReq_CC4 03667 * @param TIMx Timer instance 03668 * @retval None 03669 */ 03670 __STATIC_INLINE void LL_TIM_EnableDMAReq_CC4(TIM_TypeDef *TIMx) 03671 { 03672 SET_BIT(TIMx->DIER, TIM_DIER_CC4DE); 03673 } 03674 03675 /** 03676 * @brief Disable capture/compare 4 DMA request (CC4DE). 03677 * @rmtoll DIER CC4DE LL_TIM_DisableDMAReq_CC4 03678 * @param TIMx Timer instance 03679 * @retval None 03680 */ 03681 __STATIC_INLINE void LL_TIM_DisableDMAReq_CC4(TIM_TypeDef *TIMx) 03682 { 03683 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC4DE); 03684 } 03685 03686 /** 03687 * @brief Indicates whether the capture/compare 4 DMA request (CC4DE) is enabled. 03688 * @rmtoll DIER CC4DE LL_TIM_IsEnabledDMAReq_CC4 03689 * @param TIMx Timer instance 03690 * @retval State of bit (1 or 0). 03691 */ 03692 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC4(TIM_TypeDef *TIMx) 03693 { 03694 return ((READ_BIT(TIMx->DIER, TIM_DIER_CC4DE) == (TIM_DIER_CC4DE)) ? 1UL : 0UL); 03695 } 03696 03697 /** 03698 * @brief Enable commutation DMA request (COMDE). 03699 * @rmtoll DIER COMDE LL_TIM_EnableDMAReq_COM 03700 * @param TIMx Timer instance 03701 * @retval None 03702 */ 03703 __STATIC_INLINE void LL_TIM_EnableDMAReq_COM(TIM_TypeDef *TIMx) 03704 { 03705 SET_BIT(TIMx->DIER, TIM_DIER_COMDE); 03706 } 03707 03708 /** 03709 * @brief Disable commutation DMA request (COMDE). 03710 * @rmtoll DIER COMDE LL_TIM_DisableDMAReq_COM 03711 * @param TIMx Timer instance 03712 * @retval None 03713 */ 03714 __STATIC_INLINE void LL_TIM_DisableDMAReq_COM(TIM_TypeDef *TIMx) 03715 { 03716 CLEAR_BIT(TIMx->DIER, TIM_DIER_COMDE); 03717 } 03718 03719 /** 03720 * @brief Indicates whether the commutation DMA request (COMDE) is enabled. 03721 * @rmtoll DIER COMDE LL_TIM_IsEnabledDMAReq_COM 03722 * @param TIMx Timer instance 03723 * @retval State of bit (1 or 0). 03724 */ 03725 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_COM(TIM_TypeDef *TIMx) 03726 { 03727 return ((READ_BIT(TIMx->DIER, TIM_DIER_COMDE) == (TIM_DIER_COMDE)) ? 1UL : 0UL); 03728 } 03729 03730 /** 03731 * @brief Enable trigger interrupt (TDE). 03732 * @rmtoll DIER TDE LL_TIM_EnableDMAReq_TRIG 03733 * @param TIMx Timer instance 03734 * @retval None 03735 */ 03736 __STATIC_INLINE void LL_TIM_EnableDMAReq_TRIG(TIM_TypeDef *TIMx) 03737 { 03738 SET_BIT(TIMx->DIER, TIM_DIER_TDE); 03739 } 03740 03741 /** 03742 * @brief Disable trigger interrupt (TDE). 03743 * @rmtoll DIER TDE LL_TIM_DisableDMAReq_TRIG 03744 * @param TIMx Timer instance 03745 * @retval None 03746 */ 03747 __STATIC_INLINE void LL_TIM_DisableDMAReq_TRIG(TIM_TypeDef *TIMx) 03748 { 03749 CLEAR_BIT(TIMx->DIER, TIM_DIER_TDE); 03750 } 03751 03752 /** 03753 * @brief Indicates whether the trigger interrupt (TDE) is enabled. 03754 * @rmtoll DIER TDE LL_TIM_IsEnabledDMAReq_TRIG 03755 * @param TIMx Timer instance 03756 * @retval State of bit (1 or 0). 03757 */ 03758 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_TRIG(TIM_TypeDef *TIMx) 03759 { 03760 return ((READ_BIT(TIMx->DIER, TIM_DIER_TDE) == (TIM_DIER_TDE)) ? 1UL : 0UL); 03761 } 03762 03763 /** 03764 * @} 03765 */ 03766 03767 /** @defgroup TIM_LL_EF_EVENT_Management EVENT-Management 03768 * @{ 03769 */ 03770 /** 03771 * @brief Generate an update event. 03772 * @rmtoll EGR UG LL_TIM_GenerateEvent_UPDATE 03773 * @param TIMx Timer instance 03774 * @retval None 03775 */ 03776 __STATIC_INLINE void LL_TIM_GenerateEvent_UPDATE(TIM_TypeDef *TIMx) 03777 { 03778 SET_BIT(TIMx->EGR, TIM_EGR_UG); 03779 } 03780 03781 /** 03782 * @brief Generate Capture/Compare 1 event. 03783 * @rmtoll EGR CC1G LL_TIM_GenerateEvent_CC1 03784 * @param TIMx Timer instance 03785 * @retval None 03786 */ 03787 __STATIC_INLINE void LL_TIM_GenerateEvent_CC1(TIM_TypeDef *TIMx) 03788 { 03789 SET_BIT(TIMx->EGR, TIM_EGR_CC1G); 03790 } 03791 03792 /** 03793 * @brief Generate Capture/Compare 2 event. 03794 * @rmtoll EGR CC2G LL_TIM_GenerateEvent_CC2 03795 * @param TIMx Timer instance 03796 * @retval None 03797 */ 03798 __STATIC_INLINE void LL_TIM_GenerateEvent_CC2(TIM_TypeDef *TIMx) 03799 { 03800 SET_BIT(TIMx->EGR, TIM_EGR_CC2G); 03801 } 03802 03803 /** 03804 * @brief Generate Capture/Compare 3 event. 03805 * @rmtoll EGR CC3G LL_TIM_GenerateEvent_CC3 03806 * @param TIMx Timer instance 03807 * @retval None 03808 */ 03809 __STATIC_INLINE void LL_TIM_GenerateEvent_CC3(TIM_TypeDef *TIMx) 03810 { 03811 SET_BIT(TIMx->EGR, TIM_EGR_CC3G); 03812 } 03813 03814 /** 03815 * @brief Generate Capture/Compare 4 event. 03816 * @rmtoll EGR CC4G LL_TIM_GenerateEvent_CC4 03817 * @param TIMx Timer instance 03818 * @retval None 03819 */ 03820 __STATIC_INLINE void LL_TIM_GenerateEvent_CC4(TIM_TypeDef *TIMx) 03821 { 03822 SET_BIT(TIMx->EGR, TIM_EGR_CC4G); 03823 } 03824 03825 /** 03826 * @brief Generate commutation event. 03827 * @rmtoll EGR COMG LL_TIM_GenerateEvent_COM 03828 * @param TIMx Timer instance 03829 * @retval None 03830 */ 03831 __STATIC_INLINE void LL_TIM_GenerateEvent_COM(TIM_TypeDef *TIMx) 03832 { 03833 SET_BIT(TIMx->EGR, TIM_EGR_COMG); 03834 } 03835 03836 /** 03837 * @brief Generate trigger event. 03838 * @rmtoll EGR TG LL_TIM_GenerateEvent_TRIG 03839 * @param TIMx Timer instance 03840 * @retval None 03841 */ 03842 __STATIC_INLINE void LL_TIM_GenerateEvent_TRIG(TIM_TypeDef *TIMx) 03843 { 03844 SET_BIT(TIMx->EGR, TIM_EGR_TG); 03845 } 03846 03847 /** 03848 * @brief Generate break event. 03849 * @rmtoll EGR BG LL_TIM_GenerateEvent_BRK 03850 * @param TIMx Timer instance 03851 * @retval None 03852 */ 03853 __STATIC_INLINE void LL_TIM_GenerateEvent_BRK(TIM_TypeDef *TIMx) 03854 { 03855 SET_BIT(TIMx->EGR, TIM_EGR_BG); 03856 } 03857 03858 /** 03859 * @} 03860 */ 03861 03862 #if defined(USE_FULL_LL_DRIVER) 03863 /** @defgroup TIM_LL_EF_Init Initialisation and deinitialisation functions 03864 * @{ 03865 */ 03866 03867 ErrorStatus LL_TIM_DeInit(TIM_TypeDef *TIMx); 03868 void LL_TIM_StructInit(LL_TIM_InitTypeDef *TIM_InitStruct); 03869 ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct); 03870 void LL_TIM_OC_StructInit(LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct); 03871 ErrorStatus LL_TIM_OC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct); 03872 void LL_TIM_IC_StructInit(LL_TIM_IC_InitTypeDef *TIM_ICInitStruct); 03873 ErrorStatus LL_TIM_IC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_IC_InitTypeDef *TIM_IC_InitStruct); 03874 void LL_TIM_ENCODER_StructInit(LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct); 03875 ErrorStatus LL_TIM_ENCODER_Init(TIM_TypeDef *TIMx, LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct); 03876 void LL_TIM_HALLSENSOR_StructInit(LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct); 03877 ErrorStatus LL_TIM_HALLSENSOR_Init(TIM_TypeDef *TIMx, LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct); 03878 void LL_TIM_BDTR_StructInit(LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct); 03879 ErrorStatus LL_TIM_BDTR_Init(TIM_TypeDef *TIMx, LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct); 03880 /** 03881 * @} 03882 */ 03883 #endif /* USE_FULL_LL_DRIVER */ 03884 03885 /** 03886 * @} 03887 */ 03888 03889 /** 03890 * @} 03891 */ 03892 03893 #endif /* TIM1 || TIM2 || TIM3 || TIM4 || TIM5 || TIM6 || TIM7 || TIM8 || TIM9 || TIM10 || TIM11 || TIM12 || TIM13 || TIM14 || TIM15 || TIM16 || TIM17 */ 03894 03895 /** 03896 * @} 03897 */ 03898 03899 #ifdef __cplusplus 03900 } 03901 #endif 03902 03903 #endif /* __STM32F1xx_LL_TIM_H */ 03904 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/