Merge pull request #11270 from haslinghuis/rename_attr
[betaflight.git] / lib / main / STM32F1 / Drivers / STM32F1xx_HAL_Driver / Inc / stm32f1xx_ll_tim.h
bloba5d95eaf5ccd40614bb294b9d640fba8a688bc3b
1 /**
2 ******************************************************************************
3 * @file stm32f1xx_ll_tim.h
4 * @author MCD Application Team
5 * @version V1.1.1
6 * @date 12-May-2017
7 * @brief Header file of TIM LL module.
8 ******************************************************************************
9 * @attention
11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
13 * Redistribution and use in source and binary forms, with or without modification,
14 * are permitted provided that the following conditions are met:
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 ******************************************************************************
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F1xx_LL_TIM_H
40 #define __STM32F1xx_LL_TIM_H
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f1xx.h"
49 /** @addtogroup STM32F1xx_LL_Driver
50 * @{
53 #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)
55 /** @defgroup TIM_LL TIM
56 * @{
59 /* Private types -------------------------------------------------------------*/
60 /* Private variables ---------------------------------------------------------*/
61 /** @defgroup TIM_LL_Private_Variables TIM Private Variables
62 * @{
64 static const uint8_t OFFSET_TAB_CCMRx[] =
66 0x00U, /* 0: TIMx_CH1 */
67 0x00U, /* 1: TIMx_CH1N */
68 0x00U, /* 2: TIMx_CH2 */
69 0x00U, /* 3: TIMx_CH2N */
70 0x04U, /* 4: TIMx_CH3 */
71 0x04U, /* 5: TIMx_CH3N */
72 0x04U /* 6: TIMx_CH4 */
75 static const uint8_t SHIFT_TAB_OCxx[] =
77 0U, /* 0: OC1M, OC1FE, OC1PE */
78 0U, /* 1: - NA */
79 8U, /* 2: OC2M, OC2FE, OC2PE */
80 0U, /* 3: - NA */
81 0U, /* 4: OC3M, OC3FE, OC3PE */
82 0U, /* 5: - NA */
83 8U /* 6: OC4M, OC4FE, OC4PE */
86 static const uint8_t SHIFT_TAB_ICxx[] =
88 0U, /* 0: CC1S, IC1PSC, IC1F */
89 0U, /* 1: - NA */
90 8U, /* 2: CC2S, IC2PSC, IC2F */
91 0U, /* 3: - NA */
92 0U, /* 4: CC3S, IC3PSC, IC3F */
93 0U, /* 5: - NA */
94 8U /* 6: CC4S, IC4PSC, IC4F */
97 static const uint8_t SHIFT_TAB_CCxP[] =
99 0U, /* 0: CC1P */
100 2U, /* 1: CC1NP */
101 4U, /* 2: CC2P */
102 6U, /* 3: CC2NP */
103 8U, /* 4: CC3P */
104 10U, /* 5: CC3NP */
105 12U /* 6: CC4P */
108 static const uint8_t SHIFT_TAB_OISx[] =
110 0U, /* 0: OIS1 */
111 1U, /* 1: OIS1N */
112 2U, /* 2: OIS2 */
113 3U, /* 3: OIS2N */
114 4U, /* 4: OIS3 */
115 5U, /* 5: OIS3N */
116 6U /* 6: OIS4 */
119 * @}
123 /* Private constants ---------------------------------------------------------*/
124 /** @defgroup TIM_LL_Private_Constants TIM Private Constants
125 * @{
130 /* Mask used to set the TDG[x:0] of the DTG bits of the TIMx_BDTR register */
131 #define DT_DELAY_1 ((uint8_t)0x7F)
132 #define DT_DELAY_2 ((uint8_t)0x3F)
133 #define DT_DELAY_3 ((uint8_t)0x1F)
134 #define DT_DELAY_4 ((uint8_t)0x1F)
136 /* Mask used to set the DTG[7:5] bits of the DTG bits of the TIMx_BDTR register */
137 #define DT_RANGE_1 ((uint8_t)0x00)
138 #define DT_RANGE_2 ((uint8_t)0x80)
139 #define DT_RANGE_3 ((uint8_t)0xC0)
140 #define DT_RANGE_4 ((uint8_t)0xE0)
144 * @}
147 /* Private macros ------------------------------------------------------------*/
148 /** @defgroup TIM_LL_Private_Macros TIM Private Macros
149 * @{
151 /** @brief Convert channel id into channel index.
152 * @param __CHANNEL__ This parameter can be one of the following values:
153 * @arg @ref LL_TIM_CHANNEL_CH1
154 * @arg @ref LL_TIM_CHANNEL_CH1N
155 * @arg @ref LL_TIM_CHANNEL_CH2
156 * @arg @ref LL_TIM_CHANNEL_CH2N
157 * @arg @ref LL_TIM_CHANNEL_CH3
158 * @arg @ref LL_TIM_CHANNEL_CH3N
159 * @arg @ref LL_TIM_CHANNEL_CH4
160 * @retval none
162 #define TIM_GET_CHANNEL_INDEX( __CHANNEL__) \
163 (((__CHANNEL__) == LL_TIM_CHANNEL_CH1) ? 0U :\
164 ((__CHANNEL__) == LL_TIM_CHANNEL_CH1N) ? 1U :\
165 ((__CHANNEL__) == LL_TIM_CHANNEL_CH2) ? 2U :\
166 ((__CHANNEL__) == LL_TIM_CHANNEL_CH2N) ? 3U :\
167 ((__CHANNEL__) == LL_TIM_CHANNEL_CH3) ? 4U :\
168 ((__CHANNEL__) == LL_TIM_CHANNEL_CH3N) ? 5U : 6U)
170 /** @brief Calculate the deadtime sampling period(in ps).
171 * @param __TIMCLK__ timer input clock frequency (in Hz).
172 * @param __CKD__ This parameter can be one of the following values:
173 * @arg @ref LL_TIM_CLOCKDIVISION_DIV1
174 * @arg @ref LL_TIM_CLOCKDIVISION_DIV2
175 * @arg @ref LL_TIM_CLOCKDIVISION_DIV4
176 * @retval none
178 #define TIM_CALC_DTS(__TIMCLK__, __CKD__) \
179 (((__CKD__) == LL_TIM_CLOCKDIVISION_DIV1) ? ((uint64_t)1000000000000U/(__TIMCLK__)) : \
180 ((__CKD__) == LL_TIM_CLOCKDIVISION_DIV2) ? ((uint64_t)1000000000000U/((__TIMCLK__) >> 1U)) : \
181 ((uint64_t)1000000000000U/((__TIMCLK__) >> 2U)))
183 * @}
187 /* Exported types ------------------------------------------------------------*/
188 #if defined(USE_FULL_LL_DRIVER)
189 /** @defgroup TIM_LL_ES_INIT TIM Exported Init structure
190 * @{
194 * @brief TIM Time Base configuration structure definition.
196 typedef struct
198 uint16_t Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock.
199 This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
201 This feature can be modified afterwards using unitary function @ref LL_TIM_SetPrescaler().*/
203 uint32_t CounterMode; /*!< Specifies the counter mode.
204 This parameter can be a value of @ref TIM_LL_EC_COUNTERMODE.
206 This feature can be modified afterwards using unitary function @ref LL_TIM_SetCounterMode().*/
208 uint32_t Autoreload; /*!< Specifies the auto reload value to be loaded into the active
209 Auto-Reload Register at the next update event.
210 This parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
211 Some timer instances may support 32 bits counters. In that case this parameter must be a number between 0x0000 and 0xFFFFFFFF.
213 This feature can be modified afterwards using unitary function @ref LL_TIM_SetAutoReload().*/
215 uint32_t ClockDivision; /*!< Specifies the clock division.
216 This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION.
218 This feature can be modified afterwards using unitary function @ref LL_TIM_SetClockDivision().*/
220 uint8_t RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter
221 reaches zero, an update event is generated and counting restarts
222 from the RCR value (N).
223 This means in PWM mode that (N+1) corresponds to:
224 - the number of PWM periods in edge-aligned mode
225 - the number of half PWM period in center-aligned mode
226 This parameter must be a number between 0x00 and 0xFF.
228 This feature can be modified afterwards using unitary function @ref LL_TIM_SetRepetitionCounter().*/
229 } LL_TIM_InitTypeDef;
232 * @brief TIM Output Compare configuration structure definition.
234 typedef struct
236 uint32_t OCMode; /*!< Specifies the output mode.
237 This parameter can be a value of @ref TIM_LL_EC_OCMODE.
239 This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetMode().*/
241 uint32_t OCState; /*!< Specifies the TIM Output Compare state.
242 This parameter can be a value of @ref TIM_LL_EC_OCSTATE.
244 This feature can be modified afterwards using unitary functions @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/
246 uint32_t OCNState; /*!< Specifies the TIM complementary Output Compare state.
247 This parameter can be a value of @ref TIM_LL_EC_OCSTATE.
249 This feature can be modified afterwards using unitary functions @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/
251 uint32_t CompareValue; /*!< Specifies the Compare value to be loaded into the Capture Compare Register.
252 This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
254 This feature can be modified afterwards using unitary function LL_TIM_OC_SetCompareCHx (x=1..6).*/
256 uint32_t OCPolarity; /*!< Specifies the output polarity.
257 This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY.
259 This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetPolarity().*/
261 uint32_t OCNPolarity; /*!< Specifies the complementary output polarity.
262 This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY.
264 This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetPolarity().*/
267 uint32_t OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state.
268 This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE.
270 This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetIdleState().*/
272 uint32_t OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state.
273 This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE.
275 This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetIdleState().*/
276 } LL_TIM_OC_InitTypeDef;
279 * @brief TIM Input Capture configuration structure definition.
282 typedef struct
285 uint32_t ICPolarity; /*!< Specifies the active edge of the input signal.
286 This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
288 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/
290 uint32_t ICActiveInput; /*!< Specifies the input.
291 This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT.
293 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/
295 uint32_t ICPrescaler; /*!< Specifies the Input Capture Prescaler.
296 This parameter can be a value of @ref TIM_LL_EC_ICPSC.
298 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/
300 uint32_t ICFilter; /*!< Specifies the input capture filter.
301 This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
303 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/
304 } LL_TIM_IC_InitTypeDef;
308 * @brief TIM Encoder interface configuration structure definition.
310 typedef struct
312 uint32_t EncoderMode; /*!< Specifies the encoder resolution (x2 or x4).
313 This parameter can be a value of @ref TIM_LL_EC_ENCODERMODE.
315 This feature can be modified afterwards using unitary function @ref LL_TIM_SetEncoderMode().*/
317 uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input.
318 This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
320 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/
322 uint32_t IC1ActiveInput; /*!< Specifies the TI1 input source
323 This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT.
325 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/
327 uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value.
328 This parameter can be a value of @ref TIM_LL_EC_ICPSC.
330 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/
332 uint32_t IC1Filter; /*!< Specifies the TI1 input filter.
333 This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
335 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/
337 uint32_t IC2Polarity; /*!< Specifies the active edge of TI2 input.
338 This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
340 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/
342 uint32_t IC2ActiveInput; /*!< Specifies the TI2 input source
343 This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT.
345 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/
347 uint32_t IC2Prescaler; /*!< Specifies the TI2 input prescaler value.
348 This parameter can be a value of @ref TIM_LL_EC_ICPSC.
350 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/
352 uint32_t IC2Filter; /*!< Specifies the TI2 input filter.
353 This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
355 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/
357 } LL_TIM_ENCODER_InitTypeDef;
360 * @brief TIM Hall sensor interface configuration structure definition.
362 typedef struct
365 uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input.
366 This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
368 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/
370 uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value.
371 Prescaler must be set to get a maximum counter period longer than the
372 time interval between 2 consecutive changes on the Hall inputs.
373 This parameter can be a value of @ref TIM_LL_EC_ICPSC.
375 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/
377 uint32_t IC1Filter; /*!< Specifies the TI1 input filter.
378 This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
380 This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/
382 uint32_t CommutationDelay; /*!< Specifies the compare value to be loaded into the Capture Compare Register.
383 A positive pulse (TRGO event) is generated with a programmable delay every time
384 a change occurs on the Hall inputs.
385 This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF.
387 This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetCompareCH2().*/
388 } LL_TIM_HALLSENSOR_InitTypeDef;
391 * @brief BDTR (Break and Dead Time) structure definition
393 typedef struct
395 uint32_t OSSRState; /*!< Specifies the Off-State selection used in Run mode.
396 This parameter can be a value of @ref TIM_LL_EC_OSSR
398 This feature can be modified afterwards using unitary function @ref LL_TIM_SetOffStates()
400 @note This bit-field cannot be modified as long as LOCK level 2 has been programmed. */
402 uint32_t OSSIState; /*!< Specifies the Off-State used in Idle state.
403 This parameter can be a value of @ref TIM_LL_EC_OSSI
405 This feature can be modified afterwards using unitary function @ref LL_TIM_SetOffStates()
407 @note This bit-field cannot be modified as long as LOCK level 2 has been programmed. */
409 uint32_t LockLevel; /*!< Specifies the LOCK level parameters.
410 This parameter can be a value of @ref TIM_LL_EC_LOCKLEVEL
412 @note The LOCK bits can be written only once after the reset. Once the TIMx_BDTR register
413 has been written, their content is frozen until the next reset.*/
415 uint8_t DeadTime; /*!< Specifies the delay time between the switching-off and the
416 switching-on of the outputs.
417 This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF.
419 This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetDeadTime()
421 @note This bit-field can not be modified as long as LOCK level 1, 2 or 3 has been programmed. */
423 uint16_t BreakState; /*!< Specifies whether the TIM Break input is enabled or not.
424 This parameter can be a value of @ref TIM_LL_EC_BREAK_ENABLE
426 This feature can be modified afterwards using unitary functions @ref LL_TIM_EnableBRK() or @ref LL_TIM_DisableBRK()
428 @note This bit-field can not be modified as long as LOCK level 1 has been programmed. */
430 uint32_t BreakPolarity; /*!< Specifies the TIM Break Input pin polarity.
431 This parameter can be a value of @ref TIM_LL_EC_BREAK_POLARITY
433 This feature can be modified afterwards using unitary function @ref LL_TIM_ConfigBRK()
435 @note This bit-field can not be modified as long as LOCK level 1 has been programmed. */
437 uint32_t AutomaticOutput; /*!< Specifies whether the TIM Automatic Output feature is enabled or not.
438 This parameter can be a value of @ref TIM_LL_EC_AUTOMATICOUTPUT_ENABLE
440 This feature can be modified afterwards using unitary functions @ref LL_TIM_EnableAutomaticOutput() or @ref LL_TIM_DisableAutomaticOutput()
442 @note This bit-field can not be modified as long as LOCK level 1 has been programmed. */
443 } LL_TIM_BDTR_InitTypeDef;
446 * @}
448 #endif /* USE_FULL_LL_DRIVER */
450 /* Exported constants --------------------------------------------------------*/
451 /** @defgroup TIM_LL_Exported_Constants TIM Exported Constants
452 * @{
455 /** @defgroup TIM_LL_EC_GET_FLAG Get Flags Defines
456 * @brief Flags defines which can be used with LL_TIM_ReadReg function.
457 * @{
459 #define LL_TIM_SR_UIF TIM_SR_UIF /*!< Update interrupt flag */
460 #define LL_TIM_SR_CC1IF TIM_SR_CC1IF /*!< Capture/compare 1 interrupt flag */
461 #define LL_TIM_SR_CC2IF TIM_SR_CC2IF /*!< Capture/compare 2 interrupt flag */
462 #define LL_TIM_SR_CC3IF TIM_SR_CC3IF /*!< Capture/compare 3 interrupt flag */
463 #define LL_TIM_SR_CC4IF TIM_SR_CC4IF /*!< Capture/compare 4 interrupt flag */
464 #define LL_TIM_SR_COMIF TIM_SR_COMIF /*!< COM interrupt flag */
465 #define LL_TIM_SR_TIF TIM_SR_TIF /*!< Trigger interrupt flag */
466 #define LL_TIM_SR_BIF TIM_SR_BIF /*!< Break interrupt flag */
467 #define LL_TIM_SR_CC1OF TIM_SR_CC1OF /*!< Capture/Compare 1 overcapture flag */
468 #define LL_TIM_SR_CC2OF TIM_SR_CC2OF /*!< Capture/Compare 2 overcapture flag */
469 #define LL_TIM_SR_CC3OF TIM_SR_CC3OF /*!< Capture/Compare 3 overcapture flag */
470 #define LL_TIM_SR_CC4OF TIM_SR_CC4OF /*!< Capture/Compare 4 overcapture flag */
472 * @}
475 #if defined(USE_FULL_LL_DRIVER)
476 /** @defgroup TIM_LL_EC_BREAK_ENABLE Break Enable
477 * @{
479 #define LL_TIM_BREAK_DISABLE 0x00000000U /*!< Break function disabled */
480 #define LL_TIM_BREAK_ENABLE TIM_BDTR_BKE /*!< Break function enabled */
482 * @}
485 /** @defgroup TIM_LL_EC_AUTOMATICOUTPUT_ENABLE Automatic output enable
486 * @{
488 #define LL_TIM_AUTOMATICOUTPUT_DISABLE 0x00000000U /*!< MOE can be set only by software */
489 #define LL_TIM_AUTOMATICOUTPUT_ENABLE TIM_BDTR_AOE /*!< MOE can be set by software or automatically at the next update event */
491 * @}
493 #endif /* USE_FULL_LL_DRIVER */
495 /** @defgroup TIM_LL_EC_IT IT Defines
496 * @brief IT defines which can be used with LL_TIM_ReadReg and LL_TIM_WriteReg functions.
497 * @{
499 #define LL_TIM_DIER_UIE TIM_DIER_UIE /*!< Update interrupt enable */
500 #define LL_TIM_DIER_CC1IE TIM_DIER_CC1IE /*!< Capture/compare 1 interrupt enable */
501 #define LL_TIM_DIER_CC2IE TIM_DIER_CC2IE /*!< Capture/compare 2 interrupt enable */
502 #define LL_TIM_DIER_CC3IE TIM_DIER_CC3IE /*!< Capture/compare 3 interrupt enable */
503 #define LL_TIM_DIER_CC4IE TIM_DIER_CC4IE /*!< Capture/compare 4 interrupt enable */
504 #define LL_TIM_DIER_COMIE TIM_DIER_COMIE /*!< COM interrupt enable */
505 #define LL_TIM_DIER_TIE TIM_DIER_TIE /*!< Trigger interrupt enable */
506 #define LL_TIM_DIER_BIE TIM_DIER_BIE /*!< Break interrupt enable */
508 * @}
511 /** @defgroup TIM_LL_EC_UPDATESOURCE Update Source
512 * @{
514 #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 */
515 #define LL_TIM_UPDATESOURCE_COUNTER TIM_CR1_URS /*!< Only counter overflow/underflow generates an update request */
517 * @}
520 /** @defgroup TIM_LL_EC_ONEPULSEMODE One Pulse Mode
521 * @{
523 #define LL_TIM_ONEPULSEMODE_SINGLE TIM_CR1_OPM /*!< Counter is not stopped at update event */
524 #define LL_TIM_ONEPULSEMODE_REPETITIVE 0x00000000U /*!< Counter stops counting at the next update event */
526 * @}
529 /** @defgroup TIM_LL_EC_COUNTERMODE Counter Mode
530 * @{
532 #define LL_TIM_COUNTERMODE_UP 0x00000000U /*!<Counter used as upcounter */
533 #define LL_TIM_COUNTERMODE_DOWN TIM_CR1_DIR /*!< Counter used as downcounter */
534 #define LL_TIM_COUNTERMODE_CENTER_UP 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. */
535 #define LL_TIM_COUNTERMODE_CENTER_DOWN 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 */
536 #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. */
538 * @}
541 /** @defgroup TIM_LL_EC_CLOCKDIVISION Clock Division
542 * @{
544 #define LL_TIM_CLOCKDIVISION_DIV1 0x00000000U /*!< tDTS=tCK_INT */
545 #define LL_TIM_CLOCKDIVISION_DIV2 TIM_CR1_CKD_0 /*!< tDTS=2*tCK_INT */
546 #define LL_TIM_CLOCKDIVISION_DIV4 TIM_CR1_CKD_1 /*!< tDTS=4*tCK_INT */
548 * @}
551 /** @defgroup TIM_LL_EC_COUNTERDIRECTION Counter Direction
552 * @{
554 #define LL_TIM_COUNTERDIRECTION_UP 0x00000000U /*!< Timer counter counts up */
555 #define LL_TIM_COUNTERDIRECTION_DOWN TIM_CR1_DIR /*!< Timer counter counts down */
557 * @}
560 /** @defgroup TIM_LL_EC_CCUPDATESOURCE Capture Compare Update Source
561 * @{
563 #define LL_TIM_CCUPDATESOURCE_COMG_ONLY 0x00000000U /*!< Capture/compare control bits are updated by setting the COMG bit only */
564 #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) */
566 * @}
569 /** @defgroup TIM_LL_EC_CCDMAREQUEST Capture Compare DMA Request
570 * @{
572 #define LL_TIM_CCDMAREQUEST_CC 0x00000000U /*!< CCx DMA request sent when CCx event occurs */
573 #define LL_TIM_CCDMAREQUEST_UPDATE TIM_CR2_CCDS /*!< CCx DMA requests sent when update event occurs */
575 * @}
578 /** @defgroup TIM_LL_EC_LOCKLEVEL Lock Level
579 * @{
581 #define LL_TIM_LOCKLEVEL_OFF 0x00000000U /*!< LOCK OFF - No bit is write protected */
582 #define LL_TIM_LOCKLEVEL_1 TIM_BDTR_LOCK_0 /*!< LOCK Level 1 */
583 #define LL_TIM_LOCKLEVEL_2 TIM_BDTR_LOCK_1 /*!< LOCK Level 2 */
584 #define LL_TIM_LOCKLEVEL_3 TIM_BDTR_LOCK /*!< LOCK Level 3 */
586 * @}
589 /** @defgroup TIM_LL_EC_CHANNEL Channel
590 * @{
592 #define LL_TIM_CHANNEL_CH1 TIM_CCER_CC1E /*!< Timer input/output channel 1 */
593 #define LL_TIM_CHANNEL_CH1N TIM_CCER_CC1NE /*!< Timer complementary output channel 1 */
594 #define LL_TIM_CHANNEL_CH2 TIM_CCER_CC2E /*!< Timer input/output channel 2 */
595 #define LL_TIM_CHANNEL_CH2N TIM_CCER_CC2NE /*!< Timer complementary output channel 2 */
596 #define LL_TIM_CHANNEL_CH3 TIM_CCER_CC3E /*!< Timer input/output channel 3 */
597 #define LL_TIM_CHANNEL_CH3N TIM_CCER_CC3NE /*!< Timer complementary output channel 3 */
598 #define LL_TIM_CHANNEL_CH4 TIM_CCER_CC4E /*!< Timer input/output channel 4 */
600 * @}
603 #if defined(USE_FULL_LL_DRIVER)
604 /** @defgroup TIM_LL_EC_OCSTATE Output Configuration State
605 * @{
607 #define LL_TIM_OCSTATE_DISABLE 0x00000000U /*!< OCx is not active */
608 #define LL_TIM_OCSTATE_ENABLE TIM_CCER_CC1E /*!< OCx signal is output on the corresponding output pin */
610 * @}
612 #endif /* USE_FULL_LL_DRIVER */
614 /** @defgroup TIM_LL_EC_OCMODE Output Configuration Mode
615 * @{
617 #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 */
618 #define LL_TIM_OCMODE_ACTIVE TIM_CCMR1_OC1M_0 /*!<OCyREF is forced high on compare match*/
619 #define LL_TIM_OCMODE_INACTIVE TIM_CCMR1_OC1M_1 /*!<OCyREF is forced low on compare match*/
620 #define LL_TIM_OCMODE_TOGGLE (TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!<OCyREF toggles on compare match*/
621 #define LL_TIM_OCMODE_FORCED_INACTIVE TIM_CCMR1_OC1M_2 /*!<OCyREF is forced low*/
622 #define LL_TIM_OCMODE_FORCED_ACTIVE (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0) /*!<OCyREF is forced high*/
623 #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.*/
624 #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*/
626 * @}
629 /** @defgroup TIM_LL_EC_OCPOLARITY Output Configuration Polarity
630 * @{
632 #define LL_TIM_OCPOLARITY_HIGH 0x00000000U /*!< OCxactive high*/
633 #define LL_TIM_OCPOLARITY_LOW TIM_CCER_CC1P /*!< OCxactive low*/
635 * @}
638 /** @defgroup TIM_LL_EC_OCIDLESTATE Output Configuration Idle State
639 * @{
641 #define LL_TIM_OCIDLESTATE_LOW 0x00000000U /*!<OCx=0 (after a dead-time if OC is implemented) when MOE=0*/
642 #define LL_TIM_OCIDLESTATE_HIGH TIM_CR2_OIS1 /*!<OCx=1 (after a dead-time if OC is implemented) when MOE=0*/
644 * @}
648 /** @defgroup TIM_LL_EC_ACTIVEINPUT Active Input Selection
649 * @{
651 #define LL_TIM_ACTIVEINPUT_DIRECTTI (TIM_CCMR1_CC1S_0 << 16U) /*!< ICx is mapped on TIx */
652 #define LL_TIM_ACTIVEINPUT_INDIRECTTI (TIM_CCMR1_CC1S_1 << 16U) /*!< ICx is mapped on TIy */
653 #define LL_TIM_ACTIVEINPUT_TRC (TIM_CCMR1_CC1S << 16U) /*!< ICx is mapped on TRC */
655 * @}
658 /** @defgroup TIM_LL_EC_ICPSC Input Configuration Prescaler
659 * @{
661 #define LL_TIM_ICPSC_DIV1 0x00000000U /*!< No prescaler, capture is done each time an edge is detected on the capture input */
662 #define LL_TIM_ICPSC_DIV2 (TIM_CCMR1_IC1PSC_0 << 16U) /*!< Capture is done once every 2 events */
663 #define LL_TIM_ICPSC_DIV4 (TIM_CCMR1_IC1PSC_1 << 16U) /*!< Capture is done once every 4 events */
664 #define LL_TIM_ICPSC_DIV8 (TIM_CCMR1_IC1PSC << 16U) /*!< Capture is done once every 8 events */
666 * @}
669 /** @defgroup TIM_LL_EC_IC_FILTER Input Configuration Filter
670 * @{
672 #define LL_TIM_IC_FILTER_FDIV1 0x00000000U /*!< No filter, sampling is done at fDTS */
673 #define LL_TIM_IC_FILTER_FDIV1_N2 (TIM_CCMR1_IC1F_0 << 16U) /*!< fSAMPLING=fCK_INT, N=2 */
674 #define LL_TIM_IC_FILTER_FDIV1_N4 (TIM_CCMR1_IC1F_1 << 16U) /*!< fSAMPLING=fCK_INT, N=4 */
675 #define LL_TIM_IC_FILTER_FDIV1_N8 ((TIM_CCMR1_IC1F_1 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fCK_INT, N=8 */
676 #define LL_TIM_IC_FILTER_FDIV2_N6 (TIM_CCMR1_IC1F_2 << 16U) /*!< fSAMPLING=fDTS/2, N=6 */
677 #define LL_TIM_IC_FILTER_FDIV2_N8 ((TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/2, N=8 */
678 #define LL_TIM_IC_FILTER_FDIV4_N6 ((TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_1) << 16U) /*!< fSAMPLING=fDTS/4, N=6 */
679 #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 */
680 #define LL_TIM_IC_FILTER_FDIV8_N6 (TIM_CCMR1_IC1F_3 << 16U) /*!< fSAMPLING=fDTS/8, N=6 */
681 #define LL_TIM_IC_FILTER_FDIV8_N8 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/8, N=8 */
682 #define LL_TIM_IC_FILTER_FDIV16_N5 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_1) << 16U) /*!< fSAMPLING=fDTS/16, N=5 */
683 #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 */
684 #define LL_TIM_IC_FILTER_FDIV16_N8 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_2) << 16U) /*!< fSAMPLING=fDTS/16, N=8 */
685 #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 */
686 #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 */
687 #define LL_TIM_IC_FILTER_FDIV32_N8 (TIM_CCMR1_IC1F << 16U) /*!< fSAMPLING=fDTS/32, N=8 */
689 * @}
692 /** @defgroup TIM_LL_EC_IC_POLARITY Input Configuration Polarity
693 * @{
695 #define LL_TIM_IC_POLARITY_RISING 0x00000000U /*!< The circuit is sensitive to TIxFP1 rising edge, TIxFP1 is not inverted */
696 #define LL_TIM_IC_POLARITY_FALLING TIM_CCER_CC1P /*!< The circuit is sensitive to TIxFP1 falling edge, TIxFP1 is inverted */
698 * @}
701 /** @defgroup TIM_LL_EC_CLOCKSOURCE Clock Source
702 * @{
704 #define LL_TIM_CLOCKSOURCE_INTERNAL 0x00000000U /*!< The timer is clocked by the internal clock provided from the RCC */
705 #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 inpu t*/
706 #define LL_TIM_CLOCKSOURCE_EXT_MODE2 TIM_SMCR_ECE /*!< Counter counts at each rising or falling edge on the external trigger input ETR */
708 * @}
711 /** @defgroup TIM_LL_EC_ENCODERMODE Encoder Mode
712 * @{
714 #define LL_TIM_ENCODERMODE_X2_TI1 TIM_SMCR_SMS_0 /*!< Encoder mode 1 - Counter counts up/down on TI2FP2 edge depending on TI1FP1 level */
715 #define LL_TIM_ENCODERMODE_X2_TI2 TIM_SMCR_SMS_1 /*!< Encoder mode 2 - Counter counts up/down on TI1FP1 edge depending on TI2FP2 level */
716 #define LL_TIM_ENCODERMODE_X4_TI12 (TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< Encoder mode 3 - Counter counts up/down on both TI1FP1 and TI2FP2 edges depending on the level of the other input l */
718 * @}
721 /** @defgroup TIM_LL_EC_TRGO Trigger Output
722 * @{
724 #define LL_TIM_TRGO_RESET 0x00000000U /*!< UG bit from the TIMx_EGR register is used as trigger output */
725 #define LL_TIM_TRGO_ENABLE TIM_CR2_MMS_0 /*!< Counter Enable signal (CNT_EN) is used as trigger output */
726 #define LL_TIM_TRGO_UPDATE TIM_CR2_MMS_1 /*!< Update event is used as trigger output */
727 #define LL_TIM_TRGO_CC1IF (TIM_CR2_MMS_1 | TIM_CR2_MMS_0) /*!< CC1 capture or a compare match is used as trigger output */
728 #define LL_TIM_TRGO_OC1REF TIM_CR2_MMS_2 /*!< OC1REF signal is used as trigger output */
729 #define LL_TIM_TRGO_OC2REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_0) /*!< OC2REF signal is used as trigger output */
730 #define LL_TIM_TRGO_OC3REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1) /*!< OC3REF signal is used as trigger output */
731 #define LL_TIM_TRGO_OC4REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1 | TIM_CR2_MMS_0) /*!< OC4REF signal is used as trigger output */
733 * @}
737 /** @defgroup TIM_LL_EC_SLAVEMODE Slave Mode
738 * @{
740 #define LL_TIM_SLAVEMODE_DISABLED 0x00000000U /*!< Slave mode disabled */
741 #define LL_TIM_SLAVEMODE_RESET TIM_SMCR_SMS_2 /*!< Reset Mode - Rising edge of the selected trigger input (TRGI) reinitializes the counter */
742 #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 */
743 #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 */
745 * @}
748 /** @defgroup TIM_LL_EC_TS Trigger Selection
749 * @{
751 #define LL_TIM_TS_ITR0 0x00000000U /*!< Internal Trigger 0 (ITR0) is used as trigger input */
752 #define LL_TIM_TS_ITR1 TIM_SMCR_TS_0 /*!< Internal Trigger 1 (ITR1) is used as trigger input */
753 #define LL_TIM_TS_ITR2 TIM_SMCR_TS_1 /*!< Internal Trigger 2 (ITR2) is used as trigger input */
754 #define LL_TIM_TS_ITR3 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1) /*!< Internal Trigger 3 (ITR3) is used as trigger input */
755 #define LL_TIM_TS_TI1F_ED TIM_SMCR_TS_2 /*!< TI1 Edge Detector (TI1F_ED) is used as trigger input */
756 #define LL_TIM_TS_TI1FP1 (TIM_SMCR_TS_2 | TIM_SMCR_TS_0) /*!< Filtered Timer Input 1 (TI1FP1) is used as trigger input */
757 #define LL_TIM_TS_TI2FP2 (TIM_SMCR_TS_2 | TIM_SMCR_TS_1) /*!< Filtered Timer Input 2 (TI12P2) is used as trigger input */
758 #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 */
760 * @}
763 /** @defgroup TIM_LL_EC_ETR_POLARITY External Trigger Polarity
764 * @{
766 #define LL_TIM_ETR_POLARITY_NONINVERTED 0x00000000U /*!< ETR is non-inverted, active at high level or rising edge */
767 #define LL_TIM_ETR_POLARITY_INVERTED TIM_SMCR_ETP /*!< ETR is inverted, active at low level or falling edge */
769 * @}
772 /** @defgroup TIM_LL_EC_ETR_PRESCALER External Trigger Prescaler
773 * @{
775 #define LL_TIM_ETR_PRESCALER_DIV1 0x00000000U /*!< ETR prescaler OFF */
776 #define LL_TIM_ETR_PRESCALER_DIV2 TIM_SMCR_ETPS_0 /*!< ETR frequency is divided by 2 */
777 #define LL_TIM_ETR_PRESCALER_DIV4 TIM_SMCR_ETPS_1 /*!< ETR frequency is divided by 4 */
778 #define LL_TIM_ETR_PRESCALER_DIV8 TIM_SMCR_ETPS /*!< ETR frequency is divided by 8 */
780 * @}
783 /** @defgroup TIM_LL_EC_ETR_FILTER External Trigger Filter
784 * @{
786 #define LL_TIM_ETR_FILTER_FDIV1 0x00000000U /*!< No filter, sampling is done at fDTS */
787 #define LL_TIM_ETR_FILTER_FDIV1_N2 TIM_SMCR_ETF_0 /*!< fSAMPLING=fCK_INT, N=2 */
788 #define LL_TIM_ETR_FILTER_FDIV1_N4 TIM_SMCR_ETF_1 /*!< fSAMPLING=fCK_INT, N=4 */
789 #define LL_TIM_ETR_FILTER_FDIV1_N8 (TIM_SMCR_ETF_1 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fCK_INT, N=8 */
790 #define LL_TIM_ETR_FILTER_FDIV2_N6 TIM_SMCR_ETF_2 /*!< fSAMPLING=fDTS/2, N=6 */
791 #define LL_TIM_ETR_FILTER_FDIV2_N8 (TIM_SMCR_ETF_2 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/2, N=8 */
792 #define LL_TIM_ETR_FILTER_FDIV4_N6 (TIM_SMCR_ETF_2 | TIM_SMCR_ETF_1) /*!< fSAMPLING=fDTS/4, N=6 */
793 #define LL_TIM_ETR_FILTER_FDIV4_N8 (TIM_SMCR_ETF_2 | TIM_SMCR_ETF_1 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/4, N=8 */
794 #define LL_TIM_ETR_FILTER_FDIV8_N6 TIM_SMCR_ETF_3 /*!< fSAMPLING=fDTS/8, N=8 */
795 #define LL_TIM_ETR_FILTER_FDIV8_N8 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/16, N=5 */
796 #define LL_TIM_ETR_FILTER_FDIV16_N5 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_1) /*!< fSAMPLING=fDTS/16, N=6 */
797 #define LL_TIM_ETR_FILTER_FDIV16_N6 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_1 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/16, N=8 */
798 #define LL_TIM_ETR_FILTER_FDIV16_N8 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_2) /*!< fSAMPLING=fDTS/16, N=5 */
799 #define LL_TIM_ETR_FILTER_FDIV32_N5 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_2 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/32, N=5 */
800 #define LL_TIM_ETR_FILTER_FDIV32_N6 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_2 | TIM_SMCR_ETF_1) /*!< fSAMPLING=fDTS/32, N=6 */
801 #define LL_TIM_ETR_FILTER_FDIV32_N8 TIM_SMCR_ETF /*!< fSAMPLING=fDTS/32, N=8 */
803 * @}
807 /** @defgroup TIM_LL_EC_BREAK_POLARITY break polarity
808 * @{
810 #define LL_TIM_BREAK_POLARITY_LOW 0x00000000U /*!< Break input BRK is active low */
811 #define LL_TIM_BREAK_POLARITY_HIGH TIM_BDTR_BKP /*!< Break input BRK is active high */
813 * @}
819 /** @defgroup TIM_LL_EC_OSSI OSSI
820 * @{
822 #define LL_TIM_OSSI_DISABLE 0x00000000U /*!< When inactive, OCx/OCxN outputs are disabled */
823 #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 */
825 * @}
828 /** @defgroup TIM_LL_EC_OSSR OSSR
829 * @{
831 #define LL_TIM_OSSR_DISABLE 0x00000000U /*!< When inactive, OCx/OCxN outputs are disabled */
832 #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 */
834 * @}
838 /** @defgroup TIM_LL_EC_DMABURST_BASEADDR DMA Burst Base Address
839 * @{
841 #define LL_TIM_DMABURST_BASEADDR_CR1 0x00000000U /*!< TIMx_CR1 register is the DMA base address for DMA burst */
842 #define LL_TIM_DMABURST_BASEADDR_CR2 TIM_DCR_DBA_0 /*!< TIMx_CR2 register is the DMA base address for DMA burst */
843 #define LL_TIM_DMABURST_BASEADDR_SMCR TIM_DCR_DBA_1 /*!< TIMx_SMCR register is the DMA base address for DMA burst */
844 #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 */
845 #define LL_TIM_DMABURST_BASEADDR_SR TIM_DCR_DBA_2 /*!< TIMx_SR register is the DMA base address for DMA burst */
846 #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 */
847 #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 */
848 #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 */
849 #define LL_TIM_DMABURST_BASEADDR_CCER TIM_DCR_DBA_3 /*!< TIMx_CCER register is the DMA base address for DMA burst */
850 #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 */
851 #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 */
852 #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 */
853 #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 */
854 #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 */
855 #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 */
856 #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 */
857 #define LL_TIM_DMABURST_BASEADDR_CCR4 TIM_DCR_DBA_4 /*!< TIMx_CCR4 register is the DMA base address for DMA burst */
858 #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 */
860 * @}
863 /** @defgroup TIM_LL_EC_DMABURST_LENGTH DMA Burst Length
864 * @{
866 #define LL_TIM_DMABURST_LENGTH_1TRANSFER 0x00000000U /*!< Transfer is done to 1 register starting from the DMA burst base address */
867 #define LL_TIM_DMABURST_LENGTH_2TRANSFERS TIM_DCR_DBL_0 /*!< Transfer is done to 2 registers starting from the DMA burst base address */
868 #define LL_TIM_DMABURST_LENGTH_3TRANSFERS TIM_DCR_DBL_1 /*!< Transfer is done to 3 registers starting from the DMA burst base address */
869 #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 */
870 #define LL_TIM_DMABURST_LENGTH_5TRANSFERS TIM_DCR_DBL_2 /*!< Transfer is done to 5 registers starting from the DMA burst base address */
871 #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 */
872 #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 */
873 #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 */
874 #define LL_TIM_DMABURST_LENGTH_9TRANSFERS TIM_DCR_DBL_3 /*!< Transfer is done to 9 registers starting from the DMA burst base address */
875 #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 */
876 #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 */
877 #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 */
878 #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 */
879 #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 */
880 #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 */
881 #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 */
882 #define LL_TIM_DMABURST_LENGTH_17TRANSFERS TIM_DCR_DBL_4 /*!< Transfer is done to 17 registers starting from the DMA burst base address */
883 #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 */
885 * @}
891 * @}
894 /* Exported macro ------------------------------------------------------------*/
895 /** @defgroup TIM_LL_Exported_Macros TIM Exported Macros
896 * @{
899 /** @defgroup TIM_LL_EM_WRITE_READ Common Write and read registers Macros
900 * @{
903 * @brief Write a value in TIM register.
904 * @param __INSTANCE__ TIM Instance
905 * @param __REG__ Register to be written
906 * @param __VALUE__ Value to be written in the register
907 * @retval None
909 #define LL_TIM_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
912 * @brief Read a value in TIM register.
913 * @param __INSTANCE__ TIM Instance
914 * @param __REG__ Register to be read
915 * @retval Register value
917 #define LL_TIM_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
919 * @}
922 /** @defgroup TIM_LL_EM_Exported_Macros Exported_Macros
923 * @{
927 * @brief HELPER macro calculating DTG[0:7] in the TIMx_BDTR register to achieve the requested dead time duration.
928 * @note ex: @ref __LL_TIM_CALC_DEADTIME (80000000, @ref LL_TIM_GetClockDivision (), 120);
929 * @param __TIMCLK__ timer input clock frequency (in Hz)
930 * @param __CKD__ This parameter can be one of the following values:
931 * @arg @ref LL_TIM_CLOCKDIVISION_DIV1
932 * @arg @ref LL_TIM_CLOCKDIVISION_DIV2
933 * @arg @ref LL_TIM_CLOCKDIVISION_DIV4
934 * @param __DT__ deadtime duration (in ns)
935 * @retval DTG[0:7]
937 #define __LL_TIM_CALC_DEADTIME(__TIMCLK__, __CKD__, __DT__) \
938 ( (((uint64_t)((__DT__)*1000U)) < ((DT_DELAY_1+1U) * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? (uint8_t)(((uint64_t)((__DT__)*1000U) / TIM_CALC_DTS((__TIMCLK__), (__CKD__))) & DT_DELAY_1) : \
939 (((uint64_t)((__DT__)*1000U)) < (64U + (DT_DELAY_2+1U)) * 2U * TIM_CALC_DTS((__TIMCLK__), (__CKD__))) ? (uint8_t)(DT_RANGE_2 | ((uint8_t)((uint8_t)((((uint64_t)((__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), (__CKD__))) >> 1U) - (uint8_t) 64) & DT_DELAY_2)) :\
940 (((uint64_t)((__DT__)*1000U)) < (32U + (DT_DELAY_3+1U)) * 8U * TIM_CALC_DTS((__TIMCLK__), (__CKD__))) ? (uint8_t)(DT_RANGE_3 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), (__CKD__))) >> 3U) - (uint8_t) 32) & DT_DELAY_3)) :\
941 (((uint64_t)((__DT__)*1000U)) < (32U + (DT_DELAY_4+1U)) * 16U * TIM_CALC_DTS((__TIMCLK__), (__CKD__))) ? (uint8_t)(DT_RANGE_4 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), (__CKD__))) >> 4U) - (uint8_t) 32) & DT_DELAY_4)) :\
945 * @brief HELPER macro calculating the prescaler value to achieve the required counter clock frequency.
946 * @note ex: @ref __LL_TIM_CALC_PSC (80000000, 1000000);
947 * @param __TIMCLK__ timer input clock frequency (in Hz)
948 * @param __CNTCLK__ counter clock frequency (in Hz)
949 * @retval Prescaler value (between Min_Data=0 and Max_Data=65535)
951 #define __LL_TIM_CALC_PSC(__TIMCLK__, __CNTCLK__) \
952 ((__TIMCLK__) >= (__CNTCLK__)) ? (uint32_t)((__TIMCLK__)/(__CNTCLK__) - 1U) : 0U
955 * @brief HELPER macro calculating the auto-reload value to achieve the required output signal frequency.
956 * @note ex: @ref __LL_TIM_CALC_ARR (1000000, @ref LL_TIM_GetPrescaler (), 10000);
957 * @param __TIMCLK__ timer input clock frequency (in Hz)
958 * @param __PSC__ prescaler
959 * @param __FREQ__ output signal frequency (in Hz)
960 * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535)
962 #define __LL_TIM_CALC_ARR(__TIMCLK__, __PSC__, __FREQ__) \
963 (((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? ((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U)) - 1U) : 0U
966 * @brief HELPER macro calculating the compare value required to achieve the required timer output compare active/inactive delay.
967 * @note ex: @ref __LL_TIM_CALC_DELAY (1000000, @ref LL_TIM_GetPrescaler (), 10);
968 * @param __TIMCLK__ timer input clock frequency (in Hz)
969 * @param __PSC__ prescaler
970 * @param __DELAY__ timer output compare active/inactive delay (in us)
971 * @retval Compare value (between Min_Data=0 and Max_Data=65535)
973 #define __LL_TIM_CALC_DELAY(__TIMCLK__, __PSC__, __DELAY__) \
974 ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__)) \
975 / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U))))
978 * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration (when the timer operates in one pulse mode).
979 * @note ex: @ref __LL_TIM_CALC_PULSE (1000000, @ref LL_TIM_GetPrescaler (), 10, 20);
980 * @param __TIMCLK__ timer input clock frequency (in Hz)
981 * @param __PSC__ prescaler
982 * @param __DELAY__ timer output compare active/inactive delay (in us)
983 * @param __PULSE__ pulse duration (in us)
984 * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535)
986 #define __LL_TIM_CALC_PULSE(__TIMCLK__, __PSC__, __DELAY__, __PULSE__) \
987 ((uint32_t)(__LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__PULSE__)) \
988 + __LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__DELAY__))))
991 * @brief HELPER macro retrieving the ratio of the input capture prescaler
992 * @note ex: @ref __LL_TIM_GET_ICPSC_RATIO (@ref LL_TIM_IC_GetPrescaler ());
993 * @param __ICPSC__ This parameter can be one of the following values:
994 * @arg @ref LL_TIM_ICPSC_DIV1
995 * @arg @ref LL_TIM_ICPSC_DIV2
996 * @arg @ref LL_TIM_ICPSC_DIV4
997 * @arg @ref LL_TIM_ICPSC_DIV8
998 * @retval Input capture prescaler ratio (1, 2, 4 or 8)
1000 #define __LL_TIM_GET_ICPSC_RATIO(__ICPSC__) \
1001 ((uint32_t)(0x01U << (((__ICPSC__) >> 16U) >> TIM_CCMR1_IC1PSC_Pos)))
1005 * @}
1010 * @}
1013 /* Exported functions --------------------------------------------------------*/
1014 /** @defgroup TIM_LL_Exported_Functions TIM Exported Functions
1015 * @{
1018 /** @defgroup TIM_LL_EF_Time_Base Time Base configuration
1019 * @{
1022 * @brief Enable timer counter.
1023 * @rmtoll CR1 CEN LL_TIM_EnableCounter
1024 * @param TIMx Timer instance
1025 * @retval None
1027 __STATIC_INLINE void LL_TIM_EnableCounter(TIM_TypeDef *TIMx)
1029 SET_BIT(TIMx->CR1, TIM_CR1_CEN);
1033 * @brief Disable timer counter.
1034 * @rmtoll CR1 CEN LL_TIM_DisableCounter
1035 * @param TIMx Timer instance
1036 * @retval None
1038 __STATIC_INLINE void LL_TIM_DisableCounter(TIM_TypeDef *TIMx)
1040 CLEAR_BIT(TIMx->CR1, TIM_CR1_CEN);
1044 * @brief Indicates whether the timer counter is enabled.
1045 * @rmtoll CR1 CEN LL_TIM_IsEnabledCounter
1046 * @param TIMx Timer instance
1047 * @retval State of bit (1 or 0).
1049 __STATIC_INLINE uint32_t LL_TIM_IsEnabledCounter(TIM_TypeDef *TIMx)
1051 return (READ_BIT(TIMx->CR1, TIM_CR1_CEN) == (TIM_CR1_CEN));
1055 * @brief Enable update event generation.
1056 * @rmtoll CR1 UDIS LL_TIM_EnableUpdateEvent
1057 * @param TIMx Timer instance
1058 * @retval None
1060 __STATIC_INLINE void LL_TIM_EnableUpdateEvent(TIM_TypeDef *TIMx)
1062 SET_BIT(TIMx->CR1, TIM_CR1_UDIS);
1066 * @brief Disable update event generation.
1067 * @rmtoll CR1 UDIS LL_TIM_DisableUpdateEvent
1068 * @param TIMx Timer instance
1069 * @retval None
1071 __STATIC_INLINE void LL_TIM_DisableUpdateEvent(TIM_TypeDef *TIMx)
1073 CLEAR_BIT(TIMx->CR1, TIM_CR1_UDIS);
1077 * @brief Indicates whether update event generation is enabled.
1078 * @rmtoll CR1 UDIS LL_TIM_IsEnabledUpdateEvent
1079 * @param TIMx Timer instance
1080 * @retval State of bit (1 or 0).
1082 __STATIC_INLINE uint32_t LL_TIM_IsEnabledUpdateEvent(TIM_TypeDef *TIMx)
1084 return (READ_BIT(TIMx->CR1, TIM_CR1_UDIS) == (TIM_CR1_UDIS));
1088 * @brief Set update event source
1089 * @note Update event source set to LL_TIM_UPDATESOURCE_REGULAR: any of the following events
1090 * generate an update interrupt or DMA request if enabled:
1091 * - Counter overflow/underflow
1092 * - Setting the UG bit
1093 * - Update generation through the slave mode controller
1094 * @note Update event source set to LL_TIM_UPDATESOURCE_COUNTER: only counter
1095 * overflow/underflow generates an update interrupt or DMA request if enabled.
1096 * @rmtoll CR1 URS LL_TIM_SetUpdateSource
1097 * @param TIMx Timer instance
1098 * @param UpdateSource This parameter can be one of the following values:
1099 * @arg @ref LL_TIM_UPDATESOURCE_REGULAR
1100 * @arg @ref LL_TIM_UPDATESOURCE_COUNTER
1101 * @retval None
1103 __STATIC_INLINE void LL_TIM_SetUpdateSource(TIM_TypeDef *TIMx, uint32_t UpdateSource)
1105 MODIFY_REG(TIMx->CR1, TIM_CR1_URS, UpdateSource);
1109 * @brief Get actual event update source
1110 * @rmtoll CR1 URS LL_TIM_GetUpdateSource
1111 * @param TIMx Timer instance
1112 * @retval Returned value can be one of the following values:
1113 * @arg @ref LL_TIM_UPDATESOURCE_REGULAR
1114 * @arg @ref LL_TIM_UPDATESOURCE_COUNTER
1116 __STATIC_INLINE uint32_t LL_TIM_GetUpdateSource(TIM_TypeDef *TIMx)
1118 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_URS));
1122 * @brief Set one pulse mode (one shot v.s. repetitive).
1123 * @rmtoll CR1 OPM LL_TIM_SetOnePulseMode
1124 * @param TIMx Timer instance
1125 * @param OnePulseMode This parameter can be one of the following values:
1126 * @arg @ref LL_TIM_ONEPULSEMODE_SINGLE
1127 * @arg @ref LL_TIM_ONEPULSEMODE_REPETITIVE
1128 * @retval None
1130 __STATIC_INLINE void LL_TIM_SetOnePulseMode(TIM_TypeDef *TIMx, uint32_t OnePulseMode)
1132 MODIFY_REG(TIMx->CR1, TIM_CR1_OPM, OnePulseMode);
1136 * @brief Get actual one pulse mode.
1137 * @rmtoll CR1 OPM LL_TIM_GetOnePulseMode
1138 * @param TIMx Timer instance
1139 * @retval Returned value can be one of the following values:
1140 * @arg @ref LL_TIM_ONEPULSEMODE_SINGLE
1141 * @arg @ref LL_TIM_ONEPULSEMODE_REPETITIVE
1143 __STATIC_INLINE uint32_t LL_TIM_GetOnePulseMode(TIM_TypeDef *TIMx)
1145 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_OPM));
1149 * @brief Set the timer counter counting mode.
1150 * @note Macro @ref IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to
1151 * check whether or not the counter mode selection feature is supported
1152 * by a timer instance.
1153 * @rmtoll CR1 DIR LL_TIM_SetCounterMode\n
1154 * CR1 CMS LL_TIM_SetCounterMode
1155 * @param TIMx Timer instance
1156 * @param CounterMode This parameter can be one of the following values:
1157 * @arg @ref LL_TIM_COUNTERMODE_UP
1158 * @arg @ref LL_TIM_COUNTERMODE_DOWN
1159 * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP
1160 * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN
1161 * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN
1162 * @retval None
1164 __STATIC_INLINE void LL_TIM_SetCounterMode(TIM_TypeDef *TIMx, uint32_t CounterMode)
1166 MODIFY_REG(TIMx->CR1, TIM_CR1_DIR | TIM_CR1_CMS, CounterMode);
1170 * @brief Get actual counter mode.
1171 * @note Macro @ref IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to
1172 * check whether or not the counter mode selection feature is supported
1173 * by a timer instance.
1174 * @rmtoll CR1 DIR LL_TIM_GetCounterMode\n
1175 * CR1 CMS LL_TIM_GetCounterMode
1176 * @param TIMx Timer instance
1177 * @retval Returned value can be one of the following values:
1178 * @arg @ref LL_TIM_COUNTERMODE_UP
1179 * @arg @ref LL_TIM_COUNTERMODE_DOWN
1180 * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP
1181 * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN
1182 * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN
1184 __STATIC_INLINE uint32_t LL_TIM_GetCounterMode(TIM_TypeDef *TIMx)
1186 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR | TIM_CR1_CMS));
1190 * @brief Enable auto-reload (ARR) preload.
1191 * @rmtoll CR1 ARPE LL_TIM_EnableARRPreload
1192 * @param TIMx Timer instance
1193 * @retval None
1195 __STATIC_INLINE void LL_TIM_EnableARRPreload(TIM_TypeDef *TIMx)
1197 SET_BIT(TIMx->CR1, TIM_CR1_ARPE);
1201 * @brief Disable auto-reload (ARR) preload.
1202 * @rmtoll CR1 ARPE LL_TIM_DisableARRPreload
1203 * @param TIMx Timer instance
1204 * @retval None
1206 __STATIC_INLINE void LL_TIM_DisableARRPreload(TIM_TypeDef *TIMx)
1208 CLEAR_BIT(TIMx->CR1, TIM_CR1_ARPE);
1212 * @brief Indicates whether auto-reload (ARR) preload is enabled.
1213 * @rmtoll CR1 ARPE LL_TIM_IsEnabledARRPreload
1214 * @param TIMx Timer instance
1215 * @retval State of bit (1 or 0).
1217 __STATIC_INLINE uint32_t LL_TIM_IsEnabledARRPreload(TIM_TypeDef *TIMx)
1219 return (READ_BIT(TIMx->CR1, TIM_CR1_ARPE) == (TIM_CR1_ARPE));
1223 * @brief Set the division ratio between the timer clock and the sampling clock used by the dead-time generators (when supported) and the digital filters.
1224 * @note Macro @ref IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check
1225 * whether or not the clock division feature is supported by the timer
1226 * instance.
1227 * @rmtoll CR1 CKD LL_TIM_SetClockDivision
1228 * @param TIMx Timer instance
1229 * @param ClockDivision This parameter can be one of the following values:
1230 * @arg @ref LL_TIM_CLOCKDIVISION_DIV1
1231 * @arg @ref LL_TIM_CLOCKDIVISION_DIV2
1232 * @arg @ref LL_TIM_CLOCKDIVISION_DIV4
1233 * @retval None
1235 __STATIC_INLINE void LL_TIM_SetClockDivision(TIM_TypeDef *TIMx, uint32_t ClockDivision)
1237 MODIFY_REG(TIMx->CR1, TIM_CR1_CKD, ClockDivision);
1241 * @brief Get the actual division ratio between the timer clock and the sampling clock used by the dead-time generators (when supported) and the digital filters.
1242 * @note Macro @ref IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check
1243 * whether or not the clock division feature is supported by the timer
1244 * instance.
1245 * @rmtoll CR1 CKD LL_TIM_GetClockDivision
1246 * @param TIMx Timer instance
1247 * @retval Returned value can be one of the following values:
1248 * @arg @ref LL_TIM_CLOCKDIVISION_DIV1
1249 * @arg @ref LL_TIM_CLOCKDIVISION_DIV2
1250 * @arg @ref LL_TIM_CLOCKDIVISION_DIV4
1252 __STATIC_INLINE uint32_t LL_TIM_GetClockDivision(TIM_TypeDef *TIMx)
1254 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_CKD));
1258 * @brief Set the counter value.
1259 * @rmtoll CNT CNT LL_TIM_SetCounter
1260 * @param TIMx Timer instance
1261 * @param Counter Counter value (between Min_Data=0 and Max_Data=0xFFFF)
1262 * @retval None
1264 __STATIC_INLINE void LL_TIM_SetCounter(TIM_TypeDef *TIMx, uint32_t Counter)
1266 WRITE_REG(TIMx->CNT, Counter);
1270 * @brief Get the counter value.
1271 * @rmtoll CNT CNT LL_TIM_GetCounter
1272 * @param TIMx Timer instance
1273 * @retval Counter value (between Min_Data=0 and Max_Data=0xFFFF)
1275 __STATIC_INLINE uint32_t LL_TIM_GetCounter(TIM_TypeDef *TIMx)
1277 return (uint32_t)(READ_REG(TIMx->CNT));
1281 * @brief Get the current direction of the counter
1282 * @rmtoll CR1 DIR LL_TIM_GetDirection
1283 * @param TIMx Timer instance
1284 * @retval Returned value can be one of the following values:
1285 * @arg @ref LL_TIM_COUNTERDIRECTION_UP
1286 * @arg @ref LL_TIM_COUNTERDIRECTION_DOWN
1288 __STATIC_INLINE uint32_t LL_TIM_GetDirection(TIM_TypeDef *TIMx)
1290 return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR));
1294 * @brief Set the prescaler value.
1295 * @note The counter clock frequency CK_CNT is equal to fCK_PSC / (PSC[15:0] + 1).
1296 * @note The prescaler can be changed on the fly as this control register is buffered. The new
1297 * prescaler ratio is taken into account at the next update event.
1298 * @note Helper macro @ref __LL_TIM_CALC_PSC can be used to calculate the Prescaler parameter
1299 * @rmtoll PSC PSC LL_TIM_SetPrescaler
1300 * @param TIMx Timer instance
1301 * @param Prescaler between Min_Data=0 and Max_Data=65535
1302 * @retval None
1304 __STATIC_INLINE void LL_TIM_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Prescaler)
1306 WRITE_REG(TIMx->PSC, Prescaler);
1310 * @brief Get the prescaler value.
1311 * @rmtoll PSC PSC LL_TIM_GetPrescaler
1312 * @param TIMx Timer instance
1313 * @retval Prescaler value between Min_Data=0 and Max_Data=65535
1315 __STATIC_INLINE uint32_t LL_TIM_GetPrescaler(TIM_TypeDef *TIMx)
1317 return (uint32_t)(READ_REG(TIMx->PSC));
1321 * @brief Set the auto-reload value.
1322 * @note The counter is blocked while the auto-reload value is null.
1323 * @note Helper macro @ref __LL_TIM_CALC_ARR can be used to calculate the AutoReload parameter
1324 * @rmtoll ARR ARR LL_TIM_SetAutoReload
1325 * @param TIMx Timer instance
1326 * @param AutoReload between Min_Data=0 and Max_Data=65535
1327 * @retval None
1329 __STATIC_INLINE void LL_TIM_SetAutoReload(TIM_TypeDef *TIMx, uint32_t AutoReload)
1331 WRITE_REG(TIMx->ARR, AutoReload);
1335 * @brief Get the auto-reload value.
1336 * @rmtoll ARR ARR LL_TIM_GetAutoReload
1337 * @param TIMx Timer instance
1338 * @retval Auto-reload value
1340 __STATIC_INLINE uint32_t LL_TIM_GetAutoReload(TIM_TypeDef *TIMx)
1342 return (uint32_t)(READ_REG(TIMx->ARR));
1346 * @brief Set the repetition counter value.
1347 * @note Macro @ref IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check
1348 * whether or not a timer instance supports a repetition counter.
1349 * @rmtoll RCR REP LL_TIM_SetRepetitionCounter
1350 * @param TIMx Timer instance
1351 * @param RepetitionCounter between Min_Data=0 and Max_Data=255
1352 * @retval None
1354 __STATIC_INLINE void LL_TIM_SetRepetitionCounter(TIM_TypeDef *TIMx, uint32_t RepetitionCounter)
1356 WRITE_REG(TIMx->RCR, RepetitionCounter);
1360 * @brief Get the repetition counter value.
1361 * @note Macro @ref IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check
1362 * whether or not a timer instance supports a repetition counter.
1363 * @rmtoll RCR REP LL_TIM_GetRepetitionCounter
1364 * @param TIMx Timer instance
1365 * @retval Repetition counter value
1367 __STATIC_INLINE uint32_t LL_TIM_GetRepetitionCounter(TIM_TypeDef *TIMx)
1369 return (uint32_t)(READ_REG(TIMx->RCR));
1373 * @}
1376 /** @defgroup TIM_LL_EF_Capture_Compare Capture Compare configuration
1377 * @{
1380 * @brief Enable the capture/compare control bits (CCxE, CCxNE and OCxM) preload.
1381 * @note CCxE, CCxNE and OCxM bits are preloaded, after having been written,
1382 * they are updated only when a commutation event (COM) occurs.
1383 * @note Only on channels that have a complementary output.
1384 * @note Macro @ref IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check
1385 * whether or not a timer instance is able to generate a commutation event.
1386 * @rmtoll CR2 CCPC LL_TIM_CC_EnablePreload
1387 * @param TIMx Timer instance
1388 * @retval None
1390 __STATIC_INLINE void LL_TIM_CC_EnablePreload(TIM_TypeDef *TIMx)
1392 SET_BIT(TIMx->CR2, TIM_CR2_CCPC);
1396 * @brief Disable the capture/compare control bits (CCxE, CCxNE and OCxM) preload.
1397 * @note Macro @ref IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check
1398 * whether or not a timer instance is able to generate a commutation event.
1399 * @rmtoll CR2 CCPC LL_TIM_CC_DisablePreload
1400 * @param TIMx Timer instance
1401 * @retval None
1403 __STATIC_INLINE void LL_TIM_CC_DisablePreload(TIM_TypeDef *TIMx)
1405 CLEAR_BIT(TIMx->CR2, TIM_CR2_CCPC);
1409 * @brief Set the updated source of the capture/compare control bits (CCxE, CCxNE and OCxM).
1410 * @note Macro @ref IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check
1411 * whether or not a timer instance is able to generate a commutation event.
1412 * @rmtoll CR2 CCUS LL_TIM_CC_SetUpdate
1413 * @param TIMx Timer instance
1414 * @param CCUpdateSource This parameter can be one of the following values:
1415 * @arg @ref LL_TIM_CCUPDATESOURCE_COMG_ONLY
1416 * @arg @ref LL_TIM_CCUPDATESOURCE_COMG_AND_TRGI
1417 * @retval None
1419 __STATIC_INLINE void LL_TIM_CC_SetUpdate(TIM_TypeDef *TIMx, uint32_t CCUpdateSource)
1421 MODIFY_REG(TIMx->CR2, TIM_CR2_CCUS, CCUpdateSource);
1425 * @brief Set the trigger of the capture/compare DMA request.
1426 * @rmtoll CR2 CCDS LL_TIM_CC_SetDMAReqTrigger
1427 * @param TIMx Timer instance
1428 * @param DMAReqTrigger This parameter can be one of the following values:
1429 * @arg @ref LL_TIM_CCDMAREQUEST_CC
1430 * @arg @ref LL_TIM_CCDMAREQUEST_UPDATE
1431 * @retval None
1433 __STATIC_INLINE void LL_TIM_CC_SetDMAReqTrigger(TIM_TypeDef *TIMx, uint32_t DMAReqTrigger)
1435 MODIFY_REG(TIMx->CR2, TIM_CR2_CCDS, DMAReqTrigger);
1439 * @brief Get actual trigger of the capture/compare DMA request.
1440 * @rmtoll CR2 CCDS LL_TIM_CC_GetDMAReqTrigger
1441 * @param TIMx Timer instance
1442 * @retval Returned value can be one of the following values:
1443 * @arg @ref LL_TIM_CCDMAREQUEST_CC
1444 * @arg @ref LL_TIM_CCDMAREQUEST_UPDATE
1446 __STATIC_INLINE uint32_t LL_TIM_CC_GetDMAReqTrigger(TIM_TypeDef *TIMx)
1448 return (uint32_t)(READ_BIT(TIMx->CR2, TIM_CR2_CCDS));
1452 * @brief Set the lock level to freeze the
1453 * configuration of several capture/compare parameters.
1454 * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
1455 * the lock mechanism is supported by a timer instance.
1456 * @rmtoll BDTR LOCK LL_TIM_CC_SetLockLevel
1457 * @param TIMx Timer instance
1458 * @param LockLevel This parameter can be one of the following values:
1459 * @arg @ref LL_TIM_LOCKLEVEL_OFF
1460 * @arg @ref LL_TIM_LOCKLEVEL_1
1461 * @arg @ref LL_TIM_LOCKLEVEL_2
1462 * @arg @ref LL_TIM_LOCKLEVEL_3
1463 * @retval None
1465 __STATIC_INLINE void LL_TIM_CC_SetLockLevel(TIM_TypeDef *TIMx, uint32_t LockLevel)
1467 MODIFY_REG(TIMx->BDTR, TIM_BDTR_LOCK, LockLevel);
1471 * @brief Enable capture/compare channels.
1472 * @rmtoll CCER CC1E LL_TIM_CC_EnableChannel\n
1473 * CCER CC1NE LL_TIM_CC_EnableChannel\n
1474 * CCER CC2E LL_TIM_CC_EnableChannel\n
1475 * CCER CC2NE LL_TIM_CC_EnableChannel\n
1476 * CCER CC3E LL_TIM_CC_EnableChannel\n
1477 * CCER CC3NE LL_TIM_CC_EnableChannel\n
1478 * CCER CC4E LL_TIM_CC_EnableChannel
1479 * @param TIMx Timer instance
1480 * @param Channels This parameter can be a combination of the following values:
1481 * @arg @ref LL_TIM_CHANNEL_CH1
1482 * @arg @ref LL_TIM_CHANNEL_CH1N
1483 * @arg @ref LL_TIM_CHANNEL_CH2
1484 * @arg @ref LL_TIM_CHANNEL_CH2N
1485 * @arg @ref LL_TIM_CHANNEL_CH3
1486 * @arg @ref LL_TIM_CHANNEL_CH3N
1487 * @arg @ref LL_TIM_CHANNEL_CH4
1488 * @retval None
1490 __STATIC_INLINE void LL_TIM_CC_EnableChannel(TIM_TypeDef *TIMx, uint32_t Channels)
1492 SET_BIT(TIMx->CCER, Channels);
1496 * @brief Disable capture/compare channels.
1497 * @rmtoll CCER CC1E LL_TIM_CC_DisableChannel\n
1498 * CCER CC1NE LL_TIM_CC_DisableChannel\n
1499 * CCER CC2E LL_TIM_CC_DisableChannel\n
1500 * CCER CC2NE LL_TIM_CC_DisableChannel\n
1501 * CCER CC3E LL_TIM_CC_DisableChannel\n
1502 * CCER CC3NE LL_TIM_CC_DisableChannel\n
1503 * CCER CC4E LL_TIM_CC_DisableChannel
1504 * @param TIMx Timer instance
1505 * @param Channels This parameter can be a combination of the following values:
1506 * @arg @ref LL_TIM_CHANNEL_CH1
1507 * @arg @ref LL_TIM_CHANNEL_CH1N
1508 * @arg @ref LL_TIM_CHANNEL_CH2
1509 * @arg @ref LL_TIM_CHANNEL_CH2N
1510 * @arg @ref LL_TIM_CHANNEL_CH3
1511 * @arg @ref LL_TIM_CHANNEL_CH3N
1512 * @arg @ref LL_TIM_CHANNEL_CH4
1513 * @retval None
1515 __STATIC_INLINE void LL_TIM_CC_DisableChannel(TIM_TypeDef *TIMx, uint32_t Channels)
1517 CLEAR_BIT(TIMx->CCER, Channels);
1521 * @brief Indicate whether channel(s) is(are) enabled.
1522 * @rmtoll CCER CC1E LL_TIM_CC_IsEnabledChannel\n
1523 * CCER CC1NE LL_TIM_CC_IsEnabledChannel\n
1524 * CCER CC2E LL_TIM_CC_IsEnabledChannel\n
1525 * CCER CC2NE LL_TIM_CC_IsEnabledChannel\n
1526 * CCER CC3E LL_TIM_CC_IsEnabledChannel\n
1527 * CCER CC3NE LL_TIM_CC_IsEnabledChannel\n
1528 * CCER CC4E LL_TIM_CC_IsEnabledChannel
1529 * @param TIMx Timer instance
1530 * @param Channels This parameter can be a combination of the following values:
1531 * @arg @ref LL_TIM_CHANNEL_CH1
1532 * @arg @ref LL_TIM_CHANNEL_CH1N
1533 * @arg @ref LL_TIM_CHANNEL_CH2
1534 * @arg @ref LL_TIM_CHANNEL_CH2N
1535 * @arg @ref LL_TIM_CHANNEL_CH3
1536 * @arg @ref LL_TIM_CHANNEL_CH3N
1537 * @arg @ref LL_TIM_CHANNEL_CH4
1538 * @retval State of bit (1 or 0).
1540 __STATIC_INLINE uint32_t LL_TIM_CC_IsEnabledChannel(TIM_TypeDef *TIMx, uint32_t Channels)
1542 return (READ_BIT(TIMx->CCER, Channels) == (Channels));
1546 * @}
1549 /** @defgroup TIM_LL_EF_Output_Channel Output channel configuration
1550 * @{
1553 * @brief Configure an output channel.
1554 * @rmtoll CCMR1 CC1S LL_TIM_OC_ConfigOutput\n
1555 * CCMR1 CC2S LL_TIM_OC_ConfigOutput\n
1556 * CCMR2 CC3S LL_TIM_OC_ConfigOutput\n
1557 * CCMR2 CC4S LL_TIM_OC_ConfigOutput\n
1558 * CCER CC1P LL_TIM_OC_ConfigOutput\n
1559 * CCER CC2P LL_TIM_OC_ConfigOutput\n
1560 * CCER CC3P LL_TIM_OC_ConfigOutput\n
1561 * CCER CC4P LL_TIM_OC_ConfigOutput\n
1562 * CR2 OIS1 LL_TIM_OC_ConfigOutput\n
1563 * CR2 OIS2 LL_TIM_OC_ConfigOutput\n
1564 * CR2 OIS3 LL_TIM_OC_ConfigOutput\n
1565 * CR2 OIS4 LL_TIM_OC_ConfigOutput
1566 * @param TIMx Timer instance
1567 * @param Channel This parameter can be one of the following values:
1568 * @arg @ref LL_TIM_CHANNEL_CH1
1569 * @arg @ref LL_TIM_CHANNEL_CH2
1570 * @arg @ref LL_TIM_CHANNEL_CH3
1571 * @arg @ref LL_TIM_CHANNEL_CH4
1572 * @param Configuration This parameter must be a combination of all the following values:
1573 * @arg @ref LL_TIM_OCPOLARITY_HIGH or @ref LL_TIM_OCPOLARITY_LOW
1574 * @arg @ref LL_TIM_OCIDLESTATE_LOW or @ref LL_TIM_OCIDLESTATE_HIGH
1575 * @retval None
1577 __STATIC_INLINE void LL_TIM_OC_ConfigOutput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration)
1579 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1580 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
1581 CLEAR_BIT(*pReg, (TIM_CCMR1_CC1S << SHIFT_TAB_OCxx[iChannel]));
1582 MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]),
1583 (Configuration & TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]);
1584 MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]),
1585 (Configuration & TIM_CR2_OIS1) << SHIFT_TAB_OISx[iChannel]);
1589 * @brief Define the behavior of the output reference signal OCxREF from which
1590 * OCx and OCxN (when relevant) are derived.
1591 * @rmtoll CCMR1 OC1M LL_TIM_OC_SetMode\n
1592 * CCMR1 OC2M LL_TIM_OC_SetMode\n
1593 * CCMR2 OC3M LL_TIM_OC_SetMode\n
1594 * CCMR2 OC4M LL_TIM_OC_SetMode
1595 * @param TIMx Timer instance
1596 * @param Channel This parameter can be one of the following values:
1597 * @arg @ref LL_TIM_CHANNEL_CH1
1598 * @arg @ref LL_TIM_CHANNEL_CH2
1599 * @arg @ref LL_TIM_CHANNEL_CH3
1600 * @arg @ref LL_TIM_CHANNEL_CH4
1601 * @param Mode This parameter can be one of the following values:
1602 * @arg @ref LL_TIM_OCMODE_FROZEN
1603 * @arg @ref LL_TIM_OCMODE_ACTIVE
1604 * @arg @ref LL_TIM_OCMODE_INACTIVE
1605 * @arg @ref LL_TIM_OCMODE_TOGGLE
1606 * @arg @ref LL_TIM_OCMODE_FORCED_INACTIVE
1607 * @arg @ref LL_TIM_OCMODE_FORCED_ACTIVE
1608 * @arg @ref LL_TIM_OCMODE_PWM1
1609 * @arg @ref LL_TIM_OCMODE_PWM2
1610 * @retval None
1612 __STATIC_INLINE void LL_TIM_OC_SetMode(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Mode)
1614 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1615 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
1616 MODIFY_REG(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel]), Mode << SHIFT_TAB_OCxx[iChannel]);
1620 * @brief Get the output compare mode of an output channel.
1621 * @rmtoll CCMR1 OC1M LL_TIM_OC_GetMode\n
1622 * CCMR1 OC2M LL_TIM_OC_GetMode\n
1623 * CCMR2 OC3M LL_TIM_OC_GetMode\n
1624 * CCMR2 OC4M LL_TIM_OC_GetMode
1625 * @param TIMx Timer instance
1626 * @param Channel This parameter can be one of the following values:
1627 * @arg @ref LL_TIM_CHANNEL_CH1
1628 * @arg @ref LL_TIM_CHANNEL_CH2
1629 * @arg @ref LL_TIM_CHANNEL_CH3
1630 * @arg @ref LL_TIM_CHANNEL_CH4
1631 * @retval Returned value can be one of the following values:
1632 * @arg @ref LL_TIM_OCMODE_FROZEN
1633 * @arg @ref LL_TIM_OCMODE_ACTIVE
1634 * @arg @ref LL_TIM_OCMODE_INACTIVE
1635 * @arg @ref LL_TIM_OCMODE_TOGGLE
1636 * @arg @ref LL_TIM_OCMODE_FORCED_INACTIVE
1637 * @arg @ref LL_TIM_OCMODE_FORCED_ACTIVE
1638 * @arg @ref LL_TIM_OCMODE_PWM1
1639 * @arg @ref LL_TIM_OCMODE_PWM2
1641 __STATIC_INLINE uint32_t LL_TIM_OC_GetMode(TIM_TypeDef *TIMx, uint32_t Channel)
1643 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1644 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
1645 return (READ_BIT(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel])) >> SHIFT_TAB_OCxx[iChannel]);
1649 * @brief Set the polarity of an output channel.
1650 * @rmtoll CCER CC1P LL_TIM_OC_SetPolarity\n
1651 * CCER CC1NP LL_TIM_OC_SetPolarity\n
1652 * CCER CC2P LL_TIM_OC_SetPolarity\n
1653 * CCER CC2NP LL_TIM_OC_SetPolarity\n
1654 * CCER CC3P LL_TIM_OC_SetPolarity\n
1655 * CCER CC3NP LL_TIM_OC_SetPolarity\n
1656 * CCER CC4P LL_TIM_OC_SetPolarity
1657 * @param TIMx Timer instance
1658 * @param Channel This parameter can be one of the following values:
1659 * @arg @ref LL_TIM_CHANNEL_CH1
1660 * @arg @ref LL_TIM_CHANNEL_CH1N
1661 * @arg @ref LL_TIM_CHANNEL_CH2
1662 * @arg @ref LL_TIM_CHANNEL_CH2N
1663 * @arg @ref LL_TIM_CHANNEL_CH3
1664 * @arg @ref LL_TIM_CHANNEL_CH3N
1665 * @arg @ref LL_TIM_CHANNEL_CH4
1666 * @param Polarity This parameter can be one of the following values:
1667 * @arg @ref LL_TIM_OCPOLARITY_HIGH
1668 * @arg @ref LL_TIM_OCPOLARITY_LOW
1669 * @retval None
1671 __STATIC_INLINE void LL_TIM_OC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Polarity)
1673 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1674 MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), Polarity << SHIFT_TAB_CCxP[iChannel]);
1678 * @brief Get the polarity of an output channel.
1679 * @rmtoll CCER CC1P LL_TIM_OC_GetPolarity\n
1680 * CCER CC1NP LL_TIM_OC_GetPolarity\n
1681 * CCER CC2P LL_TIM_OC_GetPolarity\n
1682 * CCER CC2NP LL_TIM_OC_GetPolarity\n
1683 * CCER CC3P LL_TIM_OC_GetPolarity\n
1684 * CCER CC3NP LL_TIM_OC_GetPolarity\n
1685 * CCER CC4P LL_TIM_OC_GetPolarity
1686 * @param TIMx Timer instance
1687 * @param Channel This parameter can be one of the following values:
1688 * @arg @ref LL_TIM_CHANNEL_CH1
1689 * @arg @ref LL_TIM_CHANNEL_CH1N
1690 * @arg @ref LL_TIM_CHANNEL_CH2
1691 * @arg @ref LL_TIM_CHANNEL_CH2N
1692 * @arg @ref LL_TIM_CHANNEL_CH3
1693 * @arg @ref LL_TIM_CHANNEL_CH3N
1694 * @arg @ref LL_TIM_CHANNEL_CH4
1695 * @retval Returned value can be one of the following values:
1696 * @arg @ref LL_TIM_OCPOLARITY_HIGH
1697 * @arg @ref LL_TIM_OCPOLARITY_LOW
1699 __STATIC_INLINE uint32_t LL_TIM_OC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel)
1701 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1702 return (READ_BIT(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel])) >> SHIFT_TAB_CCxP[iChannel]);
1706 * @brief Set the IDLE state of an output channel
1707 * @note This function is significant only for the timer instances
1708 * supporting the break feature. Macro @ref IS_TIM_BREAK_INSTANCE(TIMx)
1709 * can be used to check whether or not a timer instance provides
1710 * a break input.
1711 * @rmtoll CR2 OIS1 LL_TIM_OC_SetIdleState\n
1712 * CR2 OIS1N LL_TIM_OC_SetIdleState\n
1713 * CR2 OIS2 LL_TIM_OC_SetIdleState\n
1714 * CR2 OIS2N LL_TIM_OC_SetIdleState\n
1715 * CR2 OIS3 LL_TIM_OC_SetIdleState\n
1716 * CR2 OIS3N LL_TIM_OC_SetIdleState\n
1717 * CR2 OIS4 LL_TIM_OC_SetIdleState
1718 * @param TIMx Timer instance
1719 * @param Channel This parameter can be one of the following values:
1720 * @arg @ref LL_TIM_CHANNEL_CH1
1721 * @arg @ref LL_TIM_CHANNEL_CH1N
1722 * @arg @ref LL_TIM_CHANNEL_CH2
1723 * @arg @ref LL_TIM_CHANNEL_CH2N
1724 * @arg @ref LL_TIM_CHANNEL_CH3
1725 * @arg @ref LL_TIM_CHANNEL_CH3N
1726 * @arg @ref LL_TIM_CHANNEL_CH4
1727 * @param IdleState This parameter can be one of the following values:
1728 * @arg @ref LL_TIM_OCIDLESTATE_LOW
1729 * @arg @ref LL_TIM_OCIDLESTATE_HIGH
1730 * @retval None
1732 __STATIC_INLINE void LL_TIM_OC_SetIdleState(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t IdleState)
1734 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1735 MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]), IdleState << SHIFT_TAB_OISx[iChannel]);
1739 * @brief Get the IDLE state of an output channel
1740 * @rmtoll CR2 OIS1 LL_TIM_OC_GetIdleState\n
1741 * CR2 OIS1N LL_TIM_OC_GetIdleState\n
1742 * CR2 OIS2 LL_TIM_OC_GetIdleState\n
1743 * CR2 OIS2N LL_TIM_OC_GetIdleState\n
1744 * CR2 OIS3 LL_TIM_OC_GetIdleState\n
1745 * CR2 OIS3N LL_TIM_OC_GetIdleState\n
1746 * CR2 OIS4 LL_TIM_OC_GetIdleState
1747 * @param TIMx Timer instance
1748 * @param Channel This parameter can be one of the following values:
1749 * @arg @ref LL_TIM_CHANNEL_CH1
1750 * @arg @ref LL_TIM_CHANNEL_CH1N
1751 * @arg @ref LL_TIM_CHANNEL_CH2
1752 * @arg @ref LL_TIM_CHANNEL_CH2N
1753 * @arg @ref LL_TIM_CHANNEL_CH3
1754 * @arg @ref LL_TIM_CHANNEL_CH3N
1755 * @arg @ref LL_TIM_CHANNEL_CH4
1756 * @retval Returned value can be one of the following values:
1757 * @arg @ref LL_TIM_OCIDLESTATE_LOW
1758 * @arg @ref LL_TIM_OCIDLESTATE_HIGH
1760 __STATIC_INLINE uint32_t LL_TIM_OC_GetIdleState(TIM_TypeDef *TIMx, uint32_t Channel)
1762 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1763 return (READ_BIT(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel])) >> SHIFT_TAB_OISx[iChannel]);
1767 * @brief Enable fast mode for the output channel.
1768 * @note Acts only if the channel is configured in PWM1 or PWM2 mode.
1769 * @rmtoll CCMR1 OC1FE LL_TIM_OC_EnableFast\n
1770 * CCMR1 OC2FE LL_TIM_OC_EnableFast\n
1771 * CCMR2 OC3FE LL_TIM_OC_EnableFast\n
1772 * CCMR2 OC4FE LL_TIM_OC_EnableFast
1773 * @param TIMx Timer instance
1774 * @param Channel This parameter can be one of the following values:
1775 * @arg @ref LL_TIM_CHANNEL_CH1
1776 * @arg @ref LL_TIM_CHANNEL_CH2
1777 * @arg @ref LL_TIM_CHANNEL_CH3
1778 * @arg @ref LL_TIM_CHANNEL_CH4
1779 * @retval None
1781 __STATIC_INLINE void LL_TIM_OC_EnableFast(TIM_TypeDef *TIMx, uint32_t Channel)
1783 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1784 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
1785 SET_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]));
1790 * @brief Disable fast mode for the output channel.
1791 * @rmtoll CCMR1 OC1FE LL_TIM_OC_DisableFast\n
1792 * CCMR1 OC2FE LL_TIM_OC_DisableFast\n
1793 * CCMR2 OC3FE LL_TIM_OC_DisableFast\n
1794 * CCMR2 OC4FE LL_TIM_OC_DisableFast
1795 * @param TIMx Timer instance
1796 * @param Channel This parameter can be one of the following values:
1797 * @arg @ref LL_TIM_CHANNEL_CH1
1798 * @arg @ref LL_TIM_CHANNEL_CH2
1799 * @arg @ref LL_TIM_CHANNEL_CH3
1800 * @arg @ref LL_TIM_CHANNEL_CH4
1801 * @retval None
1803 __STATIC_INLINE void LL_TIM_OC_DisableFast(TIM_TypeDef *TIMx, uint32_t Channel)
1805 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1806 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
1807 CLEAR_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]));
1812 * @brief Indicates whether fast mode is enabled for the output channel.
1813 * @rmtoll CCMR1 OC1FE LL_TIM_OC_IsEnabledFast\n
1814 * CCMR1 OC2FE LL_TIM_OC_IsEnabledFast\n
1815 * CCMR2 OC3FE LL_TIM_OC_IsEnabledFast\n
1816 * CCMR2 OC4FE LL_TIM_OC_IsEnabledFast\n
1817 * @param TIMx Timer instance
1818 * @param Channel This parameter can be one of the following values:
1819 * @arg @ref LL_TIM_CHANNEL_CH1
1820 * @arg @ref LL_TIM_CHANNEL_CH2
1821 * @arg @ref LL_TIM_CHANNEL_CH3
1822 * @arg @ref LL_TIM_CHANNEL_CH4
1823 * @retval State of bit (1 or 0).
1825 __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledFast(TIM_TypeDef *TIMx, uint32_t Channel)
1827 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1828 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
1829 register uint32_t bitfield = TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel];
1830 return (READ_BIT(*pReg, bitfield) == bitfield);
1834 * @brief Enable compare register (TIMx_CCRx) preload for the output channel.
1835 * @rmtoll CCMR1 OC1PE LL_TIM_OC_EnablePreload\n
1836 * CCMR1 OC2PE LL_TIM_OC_EnablePreload\n
1837 * CCMR2 OC3PE LL_TIM_OC_EnablePreload\n
1838 * CCMR2 OC4PE LL_TIM_OC_EnablePreload
1839 * @param TIMx Timer instance
1840 * @param Channel This parameter can be one of the following values:
1841 * @arg @ref LL_TIM_CHANNEL_CH1
1842 * @arg @ref LL_TIM_CHANNEL_CH2
1843 * @arg @ref LL_TIM_CHANNEL_CH3
1844 * @arg @ref LL_TIM_CHANNEL_CH4
1845 * @retval None
1847 __STATIC_INLINE void LL_TIM_OC_EnablePreload(TIM_TypeDef *TIMx, uint32_t Channel)
1849 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1850 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
1851 SET_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]));
1855 * @brief Disable compare register (TIMx_CCRx) preload for the output channel.
1856 * @rmtoll CCMR1 OC1PE LL_TIM_OC_DisablePreload\n
1857 * CCMR1 OC2PE LL_TIM_OC_DisablePreload\n
1858 * CCMR2 OC3PE LL_TIM_OC_DisablePreload\n
1859 * CCMR2 OC4PE LL_TIM_OC_DisablePreload
1860 * @param TIMx Timer instance
1861 * @param Channel This parameter can be one of the following values:
1862 * @arg @ref LL_TIM_CHANNEL_CH1
1863 * @arg @ref LL_TIM_CHANNEL_CH2
1864 * @arg @ref LL_TIM_CHANNEL_CH3
1865 * @arg @ref LL_TIM_CHANNEL_CH4
1866 * @retval None
1868 __STATIC_INLINE void LL_TIM_OC_DisablePreload(TIM_TypeDef *TIMx, uint32_t Channel)
1870 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1871 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
1872 CLEAR_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]));
1876 * @brief Indicates whether compare register (TIMx_CCRx) preload is enabled for the output channel.
1877 * @rmtoll CCMR1 OC1PE LL_TIM_OC_IsEnabledPreload\n
1878 * CCMR1 OC2PE LL_TIM_OC_IsEnabledPreload\n
1879 * CCMR2 OC3PE LL_TIM_OC_IsEnabledPreload\n
1880 * CCMR2 OC4PE LL_TIM_OC_IsEnabledPreload\n
1881 * @param TIMx Timer instance
1882 * @param Channel This parameter can be one of the following values:
1883 * @arg @ref LL_TIM_CHANNEL_CH1
1884 * @arg @ref LL_TIM_CHANNEL_CH2
1885 * @arg @ref LL_TIM_CHANNEL_CH3
1886 * @arg @ref LL_TIM_CHANNEL_CH4
1887 * @retval State of bit (1 or 0).
1889 __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledPreload(TIM_TypeDef *TIMx, uint32_t Channel)
1891 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1892 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
1893 register uint32_t bitfield = TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel];
1894 return (READ_BIT(*pReg, bitfield) == bitfield);
1898 * @brief Enable clearing the output channel on an external event.
1899 * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode.
1900 * @note Macro @ref IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether
1901 * or not a timer instance can clear the OCxREF signal on an external event.
1902 * @rmtoll CCMR1 OC1CE LL_TIM_OC_EnableClear\n
1903 * CCMR1 OC2CE LL_TIM_OC_EnableClear\n
1904 * CCMR2 OC3CE LL_TIM_OC_EnableClear\n
1905 * CCMR2 OC4CE LL_TIM_OC_EnableClear
1906 * @param TIMx Timer instance
1907 * @param Channel This parameter can be one of the following values:
1908 * @arg @ref LL_TIM_CHANNEL_CH1
1909 * @arg @ref LL_TIM_CHANNEL_CH2
1910 * @arg @ref LL_TIM_CHANNEL_CH3
1911 * @arg @ref LL_TIM_CHANNEL_CH4
1912 * @retval None
1914 __STATIC_INLINE void LL_TIM_OC_EnableClear(TIM_TypeDef *TIMx, uint32_t Channel)
1916 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1917 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
1918 SET_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]));
1922 * @brief Disable clearing the output channel on an external event.
1923 * @note Macro @ref IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether
1924 * or not a timer instance can clear the OCxREF signal on an external event.
1925 * @rmtoll CCMR1 OC1CE LL_TIM_OC_DisableClear\n
1926 * CCMR1 OC2CE LL_TIM_OC_DisableClear\n
1927 * CCMR2 OC3CE LL_TIM_OC_DisableClear\n
1928 * CCMR2 OC4CE LL_TIM_OC_DisableClear
1929 * @param TIMx Timer instance
1930 * @param Channel This parameter can be one of the following values:
1931 * @arg @ref LL_TIM_CHANNEL_CH1
1932 * @arg @ref LL_TIM_CHANNEL_CH2
1933 * @arg @ref LL_TIM_CHANNEL_CH3
1934 * @arg @ref LL_TIM_CHANNEL_CH4
1935 * @retval None
1937 __STATIC_INLINE void LL_TIM_OC_DisableClear(TIM_TypeDef *TIMx, uint32_t Channel)
1939 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1940 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
1941 CLEAR_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]));
1945 * @brief Indicates clearing the output channel on an external event is enabled for the output channel.
1946 * @note This function enables clearing the output channel on an external event.
1947 * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode.
1948 * @note Macro @ref IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether
1949 * or not a timer instance can clear the OCxREF signal on an external event.
1950 * @rmtoll CCMR1 OC1CE LL_TIM_OC_IsEnabledClear\n
1951 * CCMR1 OC2CE LL_TIM_OC_IsEnabledClear\n
1952 * CCMR2 OC3CE LL_TIM_OC_IsEnabledClear\n
1953 * CCMR2 OC4CE LL_TIM_OC_IsEnabledClear\n
1954 * @param TIMx Timer instance
1955 * @param Channel This parameter can be one of the following values:
1956 * @arg @ref LL_TIM_CHANNEL_CH1
1957 * @arg @ref LL_TIM_CHANNEL_CH2
1958 * @arg @ref LL_TIM_CHANNEL_CH3
1959 * @arg @ref LL_TIM_CHANNEL_CH4
1960 * @retval State of bit (1 or 0).
1962 __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledClear(TIM_TypeDef *TIMx, uint32_t Channel)
1964 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
1965 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
1966 register uint32_t bitfield = TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel];
1967 return (READ_BIT(*pReg, bitfield) == bitfield);
1971 * @brief Set the dead-time delay (delay inserted between the rising edge of the OCxREF signal and the rising edge if the Ocx and OCxN signals).
1972 * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
1973 * dead-time insertion feature is supported by a timer instance.
1974 * @note Helper macro @ref __LL_TIM_CALC_DEADTIME can be used to calculate the DeadTime parameter
1975 * @rmtoll BDTR DTG LL_TIM_OC_SetDeadTime
1976 * @param TIMx Timer instance
1977 * @param DeadTime between Min_Data=0 and Max_Data=255
1978 * @retval None
1980 __STATIC_INLINE void LL_TIM_OC_SetDeadTime(TIM_TypeDef *TIMx, uint32_t DeadTime)
1982 MODIFY_REG(TIMx->BDTR, TIM_BDTR_DTG, DeadTime);
1986 * @brief Set compare value for output channel 1 (TIMx_CCR1).
1987 * @note Macro @ref IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not
1988 * output channel 1 is supported by a timer instance.
1989 * @rmtoll CCR1 CCR1 LL_TIM_OC_SetCompareCH1
1990 * @param TIMx Timer instance
1991 * @param CompareValue between Min_Data=0 and Max_Data=65535
1992 * @retval None
1994 __STATIC_INLINE void LL_TIM_OC_SetCompareCH1(TIM_TypeDef *TIMx, uint32_t CompareValue)
1996 WRITE_REG(TIMx->CCR1, CompareValue);
2000 * @brief Set compare value for output channel 2 (TIMx_CCR2).
2001 * @note Macro @ref IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not
2002 * output channel 2 is supported by a timer instance.
2003 * @rmtoll CCR2 CCR2 LL_TIM_OC_SetCompareCH2
2004 * @param TIMx Timer instance
2005 * @param CompareValue between Min_Data=0 and Max_Data=65535
2006 * @retval None
2008 __STATIC_INLINE void LL_TIM_OC_SetCompareCH2(TIM_TypeDef *TIMx, uint32_t CompareValue)
2010 WRITE_REG(TIMx->CCR2, CompareValue);
2014 * @brief Set compare value for output channel 3 (TIMx_CCR3).
2015 * @note Macro @ref IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not
2016 * output channel is supported by a timer instance.
2017 * @rmtoll CCR3 CCR3 LL_TIM_OC_SetCompareCH3
2018 * @param TIMx Timer instance
2019 * @param CompareValue between Min_Data=0 and Max_Data=65535
2020 * @retval None
2022 __STATIC_INLINE void LL_TIM_OC_SetCompareCH3(TIM_TypeDef *TIMx, uint32_t CompareValue)
2024 WRITE_REG(TIMx->CCR3, CompareValue);
2028 * @brief Set compare value for output channel 4 (TIMx_CCR4).
2029 * @note Macro @ref IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not
2030 * output channel 4 is supported by a timer instance.
2031 * @rmtoll CCR4 CCR4 LL_TIM_OC_SetCompareCH4
2032 * @param TIMx Timer instance
2033 * @param CompareValue between Min_Data=0 and Max_Data=65535
2034 * @retval None
2036 __STATIC_INLINE void LL_TIM_OC_SetCompareCH4(TIM_TypeDef *TIMx, uint32_t CompareValue)
2038 WRITE_REG(TIMx->CCR4, CompareValue);
2042 * @brief Get compare value (TIMx_CCR1) set for output channel 1.
2043 * @note Macro @ref IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not
2044 * output channel 1 is supported by a timer instance.
2045 * @rmtoll CCR1 CCR1 LL_TIM_OC_GetCompareCH1
2046 * @param TIMx Timer instance
2047 * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
2049 __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH1(TIM_TypeDef *TIMx)
2051 return (uint32_t)(READ_REG(TIMx->CCR1));
2055 * @brief Get compare value (TIMx_CCR2) set for output channel 2.
2056 * @note Macro @ref IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not
2057 * output channel 2 is supported by a timer instance.
2058 * @rmtoll CCR2 CCR2 LL_TIM_OC_GetCompareCH2
2059 * @param TIMx Timer instance
2060 * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
2062 __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH2(TIM_TypeDef *TIMx)
2064 return (uint32_t)(READ_REG(TIMx->CCR2));
2068 * @brief Get compare value (TIMx_CCR3) set for output channel 3.
2069 * @note Macro @ref IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not
2070 * output channel 3 is supported by a timer instance.
2071 * @rmtoll CCR3 CCR3 LL_TIM_OC_GetCompareCH3
2072 * @param TIMx Timer instance
2073 * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
2075 __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH3(TIM_TypeDef *TIMx)
2077 return (uint32_t)(READ_REG(TIMx->CCR3));
2081 * @brief Get compare value (TIMx_CCR4) set for output channel 4.
2082 * @note Macro @ref IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not
2083 * output channel 4 is supported by a timer instance.
2084 * @rmtoll CCR4 CCR4 LL_TIM_OC_GetCompareCH4
2085 * @param TIMx Timer instance
2086 * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
2088 __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH4(TIM_TypeDef *TIMx)
2090 return (uint32_t)(READ_REG(TIMx->CCR4));
2094 * @}
2097 /** @defgroup TIM_LL_EF_Input_Channel Input channel configuration
2098 * @{
2101 * @brief Configure input channel.
2102 * @rmtoll CCMR1 CC1S LL_TIM_IC_Config\n
2103 * CCMR1 IC1PSC LL_TIM_IC_Config\n
2104 * CCMR1 IC1F LL_TIM_IC_Config\n
2105 * CCMR1 CC2S LL_TIM_IC_Config\n
2106 * CCMR1 IC2PSC LL_TIM_IC_Config\n
2107 * CCMR1 IC2F LL_TIM_IC_Config\n
2108 * CCMR2 CC3S LL_TIM_IC_Config\n
2109 * CCMR2 IC3PSC LL_TIM_IC_Config\n
2110 * CCMR2 IC3F LL_TIM_IC_Config\n
2111 * CCMR2 CC4S LL_TIM_IC_Config\n
2112 * CCMR2 IC4PSC LL_TIM_IC_Config\n
2113 * CCMR2 IC4F LL_TIM_IC_Config\n
2114 * CCER CC1P LL_TIM_IC_Config\n
2115 * CCER CC1NP LL_TIM_IC_Config\n
2116 * CCER CC2P LL_TIM_IC_Config\n
2117 * CCER CC2NP LL_TIM_IC_Config\n
2118 * CCER CC3P LL_TIM_IC_Config\n
2119 * CCER CC3NP LL_TIM_IC_Config\n
2120 * CCER CC4P LL_TIM_IC_Config\n
2121 * @param TIMx Timer instance
2122 * @param Channel This parameter can be one of the following values:
2123 * @arg @ref LL_TIM_CHANNEL_CH1
2124 * @arg @ref LL_TIM_CHANNEL_CH2
2125 * @arg @ref LL_TIM_CHANNEL_CH3
2126 * @arg @ref LL_TIM_CHANNEL_CH4
2127 * @param Configuration This parameter must be a combination of all the following values:
2128 * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI or @ref LL_TIM_ACTIVEINPUT_INDIRECTTI or @ref LL_TIM_ACTIVEINPUT_TRC
2129 * @arg @ref LL_TIM_ICPSC_DIV1 or ... or @ref LL_TIM_ICPSC_DIV8
2130 * @arg @ref LL_TIM_IC_FILTER_FDIV1 or ... or @ref LL_TIM_IC_FILTER_FDIV32_N8
2131 * @arg @ref LL_TIM_IC_POLARITY_RISING or @ref LL_TIM_IC_POLARITY_FALLING
2132 * @retval None
2134 __STATIC_INLINE void LL_TIM_IC_Config(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration)
2136 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
2137 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
2138 MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]),
2139 ((Configuration >> 16U) & (TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S)) << SHIFT_TAB_ICxx[iChannel]);
2140 MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]),
2141 (Configuration & (TIM_CCER_CC1NP | TIM_CCER_CC1P)) << SHIFT_TAB_CCxP[iChannel]);
2145 * @brief Set the active input.
2146 * @rmtoll CCMR1 CC1S LL_TIM_IC_SetActiveInput\n
2147 * CCMR1 CC2S LL_TIM_IC_SetActiveInput\n
2148 * CCMR2 CC3S LL_TIM_IC_SetActiveInput\n
2149 * CCMR2 CC4S LL_TIM_IC_SetActiveInput
2150 * @param TIMx Timer instance
2151 * @param Channel This parameter can be one of the following values:
2152 * @arg @ref LL_TIM_CHANNEL_CH1
2153 * @arg @ref LL_TIM_CHANNEL_CH2
2154 * @arg @ref LL_TIM_CHANNEL_CH3
2155 * @arg @ref LL_TIM_CHANNEL_CH4
2156 * @param ICActiveInput This parameter can be one of the following values:
2157 * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI
2158 * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI
2159 * @arg @ref LL_TIM_ACTIVEINPUT_TRC
2160 * @retval None
2162 __STATIC_INLINE void LL_TIM_IC_SetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICActiveInput)
2164 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
2165 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
2166 MODIFY_REG(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), (ICActiveInput >> 16U) << SHIFT_TAB_ICxx[iChannel]);
2170 * @brief Get the current active input.
2171 * @rmtoll CCMR1 CC1S LL_TIM_IC_GetActiveInput\n
2172 * CCMR1 CC2S LL_TIM_IC_GetActiveInput\n
2173 * CCMR2 CC3S LL_TIM_IC_GetActiveInput\n
2174 * CCMR2 CC4S LL_TIM_IC_GetActiveInput
2175 * @param TIMx Timer instance
2176 * @param Channel This parameter can be one of the following values:
2177 * @arg @ref LL_TIM_CHANNEL_CH1
2178 * @arg @ref LL_TIM_CHANNEL_CH2
2179 * @arg @ref LL_TIM_CHANNEL_CH3
2180 * @arg @ref LL_TIM_CHANNEL_CH4
2181 * @retval Returned value can be one of the following values:
2182 * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI
2183 * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI
2184 * @arg @ref LL_TIM_ACTIVEINPUT_TRC
2186 __STATIC_INLINE uint32_t LL_TIM_IC_GetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel)
2188 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
2189 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
2190 return ((READ_BIT(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U);
2194 * @brief Set the prescaler of input channel.
2195 * @rmtoll CCMR1 IC1PSC LL_TIM_IC_SetPrescaler\n
2196 * CCMR1 IC2PSC LL_TIM_IC_SetPrescaler\n
2197 * CCMR2 IC3PSC LL_TIM_IC_SetPrescaler\n
2198 * CCMR2 IC4PSC LL_TIM_IC_SetPrescaler
2199 * @param TIMx Timer instance
2200 * @param Channel This parameter can be one of the following values:
2201 * @arg @ref LL_TIM_CHANNEL_CH1
2202 * @arg @ref LL_TIM_CHANNEL_CH2
2203 * @arg @ref LL_TIM_CHANNEL_CH3
2204 * @arg @ref LL_TIM_CHANNEL_CH4
2205 * @param ICPrescaler This parameter can be one of the following values:
2206 * @arg @ref LL_TIM_ICPSC_DIV1
2207 * @arg @ref LL_TIM_ICPSC_DIV2
2208 * @arg @ref LL_TIM_ICPSC_DIV4
2209 * @arg @ref LL_TIM_ICPSC_DIV8
2210 * @retval None
2212 __STATIC_INLINE void LL_TIM_IC_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPrescaler)
2214 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
2215 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
2216 MODIFY_REG(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel]), (ICPrescaler >> 16U) << SHIFT_TAB_ICxx[iChannel]);
2220 * @brief Get the current prescaler value acting on an input channel.
2221 * @rmtoll CCMR1 IC1PSC LL_TIM_IC_GetPrescaler\n
2222 * CCMR1 IC2PSC LL_TIM_IC_GetPrescaler\n
2223 * CCMR2 IC3PSC LL_TIM_IC_GetPrescaler\n
2224 * CCMR2 IC4PSC LL_TIM_IC_GetPrescaler
2225 * @param TIMx Timer instance
2226 * @param Channel This parameter can be one of the following values:
2227 * @arg @ref LL_TIM_CHANNEL_CH1
2228 * @arg @ref LL_TIM_CHANNEL_CH2
2229 * @arg @ref LL_TIM_CHANNEL_CH3
2230 * @arg @ref LL_TIM_CHANNEL_CH4
2231 * @retval Returned value can be one of the following values:
2232 * @arg @ref LL_TIM_ICPSC_DIV1
2233 * @arg @ref LL_TIM_ICPSC_DIV2
2234 * @arg @ref LL_TIM_ICPSC_DIV4
2235 * @arg @ref LL_TIM_ICPSC_DIV8
2237 __STATIC_INLINE uint32_t LL_TIM_IC_GetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel)
2239 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
2240 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
2241 return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U);
2245 * @brief Set the input filter duration.
2246 * @rmtoll CCMR1 IC1F LL_TIM_IC_SetFilter\n
2247 * CCMR1 IC2F LL_TIM_IC_SetFilter\n
2248 * CCMR2 IC3F LL_TIM_IC_SetFilter\n
2249 * CCMR2 IC4F LL_TIM_IC_SetFilter
2250 * @param TIMx Timer instance
2251 * @param Channel This parameter can be one of the following values:
2252 * @arg @ref LL_TIM_CHANNEL_CH1
2253 * @arg @ref LL_TIM_CHANNEL_CH2
2254 * @arg @ref LL_TIM_CHANNEL_CH3
2255 * @arg @ref LL_TIM_CHANNEL_CH4
2256 * @param ICFilter This parameter can be one of the following values:
2257 * @arg @ref LL_TIM_IC_FILTER_FDIV1
2258 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N2
2259 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N4
2260 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N8
2261 * @arg @ref LL_TIM_IC_FILTER_FDIV2_N6
2262 * @arg @ref LL_TIM_IC_FILTER_FDIV2_N8
2263 * @arg @ref LL_TIM_IC_FILTER_FDIV4_N6
2264 * @arg @ref LL_TIM_IC_FILTER_FDIV4_N8
2265 * @arg @ref LL_TIM_IC_FILTER_FDIV8_N6
2266 * @arg @ref LL_TIM_IC_FILTER_FDIV8_N8
2267 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N5
2268 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N6
2269 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N8
2270 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N5
2271 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6
2272 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8
2273 * @retval None
2275 __STATIC_INLINE void LL_TIM_IC_SetFilter(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICFilter)
2277 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
2278 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
2279 MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel]), (ICFilter >> 16U) << SHIFT_TAB_ICxx[iChannel]);
2283 * @brief Get the input filter duration.
2284 * @rmtoll CCMR1 IC1F LL_TIM_IC_GetFilter\n
2285 * CCMR1 IC2F LL_TIM_IC_GetFilter\n
2286 * CCMR2 IC3F LL_TIM_IC_GetFilter\n
2287 * CCMR2 IC4F LL_TIM_IC_GetFilter
2288 * @param TIMx Timer instance
2289 * @param Channel This parameter can be one of the following values:
2290 * @arg @ref LL_TIM_CHANNEL_CH1
2291 * @arg @ref LL_TIM_CHANNEL_CH2
2292 * @arg @ref LL_TIM_CHANNEL_CH3
2293 * @arg @ref LL_TIM_CHANNEL_CH4
2294 * @retval Returned value can be one of the following values:
2295 * @arg @ref LL_TIM_IC_FILTER_FDIV1
2296 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N2
2297 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N4
2298 * @arg @ref LL_TIM_IC_FILTER_FDIV1_N8
2299 * @arg @ref LL_TIM_IC_FILTER_FDIV2_N6
2300 * @arg @ref LL_TIM_IC_FILTER_FDIV2_N8
2301 * @arg @ref LL_TIM_IC_FILTER_FDIV4_N6
2302 * @arg @ref LL_TIM_IC_FILTER_FDIV4_N8
2303 * @arg @ref LL_TIM_IC_FILTER_FDIV8_N6
2304 * @arg @ref LL_TIM_IC_FILTER_FDIV8_N8
2305 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N5
2306 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N6
2307 * @arg @ref LL_TIM_IC_FILTER_FDIV16_N8
2308 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N5
2309 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6
2310 * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8
2312 __STATIC_INLINE uint32_t LL_TIM_IC_GetFilter(TIM_TypeDef *TIMx, uint32_t Channel)
2314 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
2315 register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
2316 return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U);
2320 * @brief Set the input channel polarity.
2321 * @rmtoll CCER CC1P LL_TIM_IC_SetPolarity\n
2322 * CCER CC1NP LL_TIM_IC_SetPolarity\n
2323 * CCER CC2P LL_TIM_IC_SetPolarity\n
2324 * CCER CC2NP LL_TIM_IC_SetPolarity\n
2325 * CCER CC3P LL_TIM_IC_SetPolarity\n
2326 * CCER CC3NP LL_TIM_IC_SetPolarity\n
2327 * CCER CC4P LL_TIM_IC_SetPolarity\n
2328 * @param TIMx Timer instance
2329 * @param Channel This parameter can be one of the following values:
2330 * @arg @ref LL_TIM_CHANNEL_CH1
2331 * @arg @ref LL_TIM_CHANNEL_CH2
2332 * @arg @ref LL_TIM_CHANNEL_CH3
2333 * @arg @ref LL_TIM_CHANNEL_CH4
2334 * @param ICPolarity This parameter can be one of the following values:
2335 * @arg @ref LL_TIM_IC_POLARITY_RISING
2336 * @arg @ref LL_TIM_IC_POLARITY_FALLING
2337 * @retval None
2339 __STATIC_INLINE void LL_TIM_IC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPolarity)
2341 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
2342 MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]),
2343 ICPolarity << SHIFT_TAB_CCxP[iChannel]);
2347 * @brief Get the current input channel polarity.
2348 * @rmtoll CCER CC1P LL_TIM_IC_GetPolarity\n
2349 * CCER CC1NP LL_TIM_IC_GetPolarity\n
2350 * CCER CC2P LL_TIM_IC_GetPolarity\n
2351 * CCER CC2NP LL_TIM_IC_GetPolarity\n
2352 * CCER CC3P LL_TIM_IC_GetPolarity\n
2353 * CCER CC3NP LL_TIM_IC_GetPolarity\n
2354 * CCER CC4P LL_TIM_IC_GetPolarity\n
2355 * @param TIMx Timer instance
2356 * @param Channel This parameter can be one of the following values:
2357 * @arg @ref LL_TIM_CHANNEL_CH1
2358 * @arg @ref LL_TIM_CHANNEL_CH2
2359 * @arg @ref LL_TIM_CHANNEL_CH3
2360 * @arg @ref LL_TIM_CHANNEL_CH4
2361 * @retval Returned value can be one of the following values:
2362 * @arg @ref LL_TIM_IC_POLARITY_RISING
2363 * @arg @ref LL_TIM_IC_POLARITY_FALLING
2365 __STATIC_INLINE uint32_t LL_TIM_IC_GetPolarity(TIM_TypeDef *TIMx, uint32_t Channel)
2367 register uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
2368 return (READ_BIT(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel])) >>
2369 SHIFT_TAB_CCxP[iChannel]);
2373 * @brief Connect the TIMx_CH1, CH2 and CH3 pins to the TI1 input (XOR combination).
2374 * @note Macro @ref IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not
2375 * a timer instance provides an XOR input.
2376 * @rmtoll CR2 TI1S LL_TIM_IC_EnableXORCombination
2377 * @param TIMx Timer instance
2378 * @retval None
2380 __STATIC_INLINE void LL_TIM_IC_EnableXORCombination(TIM_TypeDef *TIMx)
2382 SET_BIT(TIMx->CR2, TIM_CR2_TI1S);
2386 * @brief Disconnect the TIMx_CH1, CH2 and CH3 pins from the TI1 input.
2387 * @note Macro @ref IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not
2388 * a timer instance provides an XOR input.
2389 * @rmtoll CR2 TI1S LL_TIM_IC_DisableXORCombination
2390 * @param TIMx Timer instance
2391 * @retval None
2393 __STATIC_INLINE void LL_TIM_IC_DisableXORCombination(TIM_TypeDef *TIMx)
2395 CLEAR_BIT(TIMx->CR2, TIM_CR2_TI1S);
2399 * @brief Indicates whether the TIMx_CH1, CH2 and CH3 pins are connectected to the TI1 input.
2400 * @note Macro @ref IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not
2401 * a timer instance provides an XOR input.
2402 * @rmtoll CR2 TI1S LL_TIM_IC_IsEnabledXORCombination
2403 * @param TIMx Timer instance
2404 * @retval State of bit (1 or 0).
2406 __STATIC_INLINE uint32_t LL_TIM_IC_IsEnabledXORCombination(TIM_TypeDef *TIMx)
2408 return (READ_BIT(TIMx->CR2, TIM_CR2_TI1S) == (TIM_CR2_TI1S));
2412 * @brief Get captured value for input channel 1.
2413 * @note Macro @ref IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not
2414 * input channel 1 is supported by a timer instance.
2415 * @rmtoll CCR1 CCR1 LL_TIM_IC_GetCaptureCH1
2416 * @param TIMx Timer instance
2417 * @retval CapturedValue (between Min_Data=0 and Max_Data=65535)
2419 __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH1(TIM_TypeDef *TIMx)
2421 return (uint32_t)(READ_REG(TIMx->CCR1));
2425 * @brief Get captured value for input channel 2.
2426 * @note Macro @ref IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not
2427 * input channel 2 is supported by a timer instance.
2428 * @rmtoll CCR2 CCR2 LL_TIM_IC_GetCaptureCH2
2429 * @param TIMx Timer instance
2430 * @retval CapturedValue (between Min_Data=0 and Max_Data=65535)
2432 __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH2(TIM_TypeDef *TIMx)
2434 return (uint32_t)(READ_REG(TIMx->CCR2));
2438 * @brief Get captured value for input channel 3.
2439 * @note Macro @ref IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not
2440 * input channel 3 is supported by a timer instance.
2441 * @rmtoll CCR3 CCR3 LL_TIM_IC_GetCaptureCH3
2442 * @param TIMx Timer instance
2443 * @retval CapturedValue (between Min_Data=0 and Max_Data=65535)
2445 __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH3(TIM_TypeDef *TIMx)
2447 return (uint32_t)(READ_REG(TIMx->CCR3));
2451 * @brief Get captured value for input channel 4.
2452 * @note Macro @ref IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not
2453 * input channel 4 is supported by a timer instance.
2454 * @rmtoll CCR4 CCR4 LL_TIM_IC_GetCaptureCH4
2455 * @param TIMx Timer instance
2456 * @retval CapturedValue (between Min_Data=0 and Max_Data=65535)
2458 __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH4(TIM_TypeDef *TIMx)
2460 return (uint32_t)(READ_REG(TIMx->CCR4));
2464 * @}
2467 /** @defgroup TIM_LL_EF_Clock_Selection Counter clock selection
2468 * @{
2471 * @brief Enable external clock mode 2.
2472 * @note When external clock mode 2 is enabled the counter is clocked by any active edge on the ETRF signal.
2473 * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check
2474 * whether or not a timer instance supports external clock mode2.
2475 * @rmtoll SMCR ECE LL_TIM_EnableExternalClock
2476 * @param TIMx Timer instance
2477 * @retval None
2479 __STATIC_INLINE void LL_TIM_EnableExternalClock(TIM_TypeDef *TIMx)
2481 SET_BIT(TIMx->SMCR, TIM_SMCR_ECE);
2485 * @brief Disable external clock mode 2.
2486 * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check
2487 * whether or not a timer instance supports external clock mode2.
2488 * @rmtoll SMCR ECE LL_TIM_DisableExternalClock
2489 * @param TIMx Timer instance
2490 * @retval None
2492 __STATIC_INLINE void LL_TIM_DisableExternalClock(TIM_TypeDef *TIMx)
2494 CLEAR_BIT(TIMx->SMCR, TIM_SMCR_ECE);
2498 * @brief Indicate whether external clock mode 2 is enabled.
2499 * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check
2500 * whether or not a timer instance supports external clock mode2.
2501 * @rmtoll SMCR ECE LL_TIM_IsEnabledExternalClock
2502 * @param TIMx Timer instance
2503 * @retval State of bit (1 or 0).
2505 __STATIC_INLINE uint32_t LL_TIM_IsEnabledExternalClock(TIM_TypeDef *TIMx)
2507 return (READ_BIT(TIMx->SMCR, TIM_SMCR_ECE) == (TIM_SMCR_ECE));
2511 * @brief Set the clock source of the counter clock.
2512 * @note when selected clock source is external clock mode 1, the timer input
2513 * the external clock is applied is selected by calling the @ref LL_TIM_SetTriggerInput()
2514 * function. This timer input must be configured by calling
2515 * the @ref LL_TIM_IC_Config() function.
2516 * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(TIMx) can be used to check
2517 * whether or not a timer instance supports external clock mode1.
2518 * @note Macro @ref IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check
2519 * whether or not a timer instance supports external clock mode2.
2520 * @rmtoll SMCR SMS LL_TIM_SetClockSource\n
2521 * SMCR ECE LL_TIM_SetClockSource
2522 * @param TIMx Timer instance
2523 * @param ClockSource This parameter can be one of the following values:
2524 * @arg @ref LL_TIM_CLOCKSOURCE_INTERNAL
2525 * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE1
2526 * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE2
2527 * @retval None
2529 __STATIC_INLINE void LL_TIM_SetClockSource(TIM_TypeDef *TIMx, uint32_t ClockSource)
2531 MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS | TIM_SMCR_ECE, ClockSource);
2535 * @brief Set the encoder interface mode.
2536 * @note Macro @ref IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx) can be used to check
2537 * whether or not a timer instance supports the encoder mode.
2538 * @rmtoll SMCR SMS LL_TIM_SetEncoderMode
2539 * @param TIMx Timer instance
2540 * @param EncoderMode This parameter can be one of the following values:
2541 * @arg @ref LL_TIM_ENCODERMODE_X2_TI1
2542 * @arg @ref LL_TIM_ENCODERMODE_X2_TI2
2543 * @arg @ref LL_TIM_ENCODERMODE_X4_TI12
2544 * @retval None
2546 __STATIC_INLINE void LL_TIM_SetEncoderMode(TIM_TypeDef *TIMx, uint32_t EncoderMode)
2548 MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, EncoderMode);
2552 * @}
2555 /** @defgroup TIM_LL_EF_Timer_Synchronization Timer synchronisation configuration
2556 * @{
2559 * @brief Set the trigger output (TRGO) used for timer synchronization .
2560 * @note Macro @ref IS_TIM_MASTER_INSTANCE(TIMx) can be used to check
2561 * whether or not a timer instance can operate as a master timer.
2562 * @rmtoll CR2 MMS LL_TIM_SetTriggerOutput
2563 * @param TIMx Timer instance
2564 * @param TimerSynchronization This parameter can be one of the following values:
2565 * @arg @ref LL_TIM_TRGO_RESET
2566 * @arg @ref LL_TIM_TRGO_ENABLE
2567 * @arg @ref LL_TIM_TRGO_UPDATE
2568 * @arg @ref LL_TIM_TRGO_CC1IF
2569 * @arg @ref LL_TIM_TRGO_OC1REF
2570 * @arg @ref LL_TIM_TRGO_OC2REF
2571 * @arg @ref LL_TIM_TRGO_OC3REF
2572 * @arg @ref LL_TIM_TRGO_OC4REF
2573 * @retval None
2575 __STATIC_INLINE void LL_TIM_SetTriggerOutput(TIM_TypeDef *TIMx, uint32_t TimerSynchronization)
2577 MODIFY_REG(TIMx->CR2, TIM_CR2_MMS, TimerSynchronization);
2581 * @brief Set the synchronization mode of a slave timer.
2582 * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
2583 * a timer instance can operate as a slave timer.
2584 * @rmtoll SMCR SMS LL_TIM_SetSlaveMode
2585 * @param TIMx Timer instance
2586 * @param SlaveMode This parameter can be one of the following values:
2587 * @arg @ref LL_TIM_SLAVEMODE_DISABLED
2588 * @arg @ref LL_TIM_SLAVEMODE_RESET
2589 * @arg @ref LL_TIM_SLAVEMODE_GATED
2590 * @arg @ref LL_TIM_SLAVEMODE_TRIGGER
2591 * @retval None
2593 __STATIC_INLINE void LL_TIM_SetSlaveMode(TIM_TypeDef *TIMx, uint32_t SlaveMode)
2595 MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, SlaveMode);
2599 * @brief Set the selects the trigger input to be used to synchronize the counter.
2600 * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
2601 * a timer instance can operate as a slave timer.
2602 * @rmtoll SMCR TS LL_TIM_SetTriggerInput
2603 * @param TIMx Timer instance
2604 * @param TriggerInput This parameter can be one of the following values:
2605 * @arg @ref LL_TIM_TS_ITR0
2606 * @arg @ref LL_TIM_TS_ITR1
2607 * @arg @ref LL_TIM_TS_ITR2
2608 * @arg @ref LL_TIM_TS_ITR3
2609 * @arg @ref LL_TIM_TS_TI1F_ED
2610 * @arg @ref LL_TIM_TS_TI1FP1
2611 * @arg @ref LL_TIM_TS_TI2FP2
2612 * @arg @ref LL_TIM_TS_ETRF
2613 * @retval None
2615 __STATIC_INLINE void LL_TIM_SetTriggerInput(TIM_TypeDef *TIMx, uint32_t TriggerInput)
2617 MODIFY_REG(TIMx->SMCR, TIM_SMCR_TS, TriggerInput);
2621 * @brief Enable the Master/Slave mode.
2622 * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
2623 * a timer instance can operate as a slave timer.
2624 * @rmtoll SMCR MSM LL_TIM_EnableMasterSlaveMode
2625 * @param TIMx Timer instance
2626 * @retval None
2628 __STATIC_INLINE void LL_TIM_EnableMasterSlaveMode(TIM_TypeDef *TIMx)
2630 SET_BIT(TIMx->SMCR, TIM_SMCR_MSM);
2634 * @brief Disable the Master/Slave mode.
2635 * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
2636 * a timer instance can operate as a slave timer.
2637 * @rmtoll SMCR MSM LL_TIM_DisableMasterSlaveMode
2638 * @param TIMx Timer instance
2639 * @retval None
2641 __STATIC_INLINE void LL_TIM_DisableMasterSlaveMode(TIM_TypeDef *TIMx)
2643 CLEAR_BIT(TIMx->SMCR, TIM_SMCR_MSM);
2647 * @brief Indicates whether the Master/Slave mode is enabled.
2648 * @note Macro @ref IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
2649 * a timer instance can operate as a slave timer.
2650 * @rmtoll SMCR MSM LL_TIM_IsEnabledMasterSlaveMode
2651 * @param TIMx Timer instance
2652 * @retval State of bit (1 or 0).
2654 __STATIC_INLINE uint32_t LL_TIM_IsEnabledMasterSlaveMode(TIM_TypeDef *TIMx)
2656 return (READ_BIT(TIMx->SMCR, TIM_SMCR_MSM) == (TIM_SMCR_MSM));
2660 * @brief Configure the external trigger (ETR) input.
2661 * @note Macro @ref IS_TIM_ETR_INSTANCE(TIMx) can be used to check whether or not
2662 * a timer instance provides an external trigger input.
2663 * @rmtoll SMCR ETP LL_TIM_ConfigETR\n
2664 * SMCR ETPS LL_TIM_ConfigETR\n
2665 * SMCR ETF LL_TIM_ConfigETR
2666 * @param TIMx Timer instance
2667 * @param ETRPolarity This parameter can be one of the following values:
2668 * @arg @ref LL_TIM_ETR_POLARITY_NONINVERTED
2669 * @arg @ref LL_TIM_ETR_POLARITY_INVERTED
2670 * @param ETRPrescaler This parameter can be one of the following values:
2671 * @arg @ref LL_TIM_ETR_PRESCALER_DIV1
2672 * @arg @ref LL_TIM_ETR_PRESCALER_DIV2
2673 * @arg @ref LL_TIM_ETR_PRESCALER_DIV4
2674 * @arg @ref LL_TIM_ETR_PRESCALER_DIV8
2675 * @param ETRFilter This parameter can be one of the following values:
2676 * @arg @ref LL_TIM_ETR_FILTER_FDIV1
2677 * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N2
2678 * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N4
2679 * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N8
2680 * @arg @ref LL_TIM_ETR_FILTER_FDIV2_N6
2681 * @arg @ref LL_TIM_ETR_FILTER_FDIV2_N8
2682 * @arg @ref LL_TIM_ETR_FILTER_FDIV4_N6
2683 * @arg @ref LL_TIM_ETR_FILTER_FDIV4_N8
2684 * @arg @ref LL_TIM_ETR_FILTER_FDIV8_N6
2685 * @arg @ref LL_TIM_ETR_FILTER_FDIV8_N8
2686 * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N5
2687 * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N6
2688 * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N8
2689 * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N5
2690 * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N6
2691 * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N8
2692 * @retval None
2694 __STATIC_INLINE void LL_TIM_ConfigETR(TIM_TypeDef *TIMx, uint32_t ETRPolarity, uint32_t ETRPrescaler,
2695 uint32_t ETRFilter)
2697 MODIFY_REG(TIMx->SMCR, TIM_SMCR_ETP | TIM_SMCR_ETPS | TIM_SMCR_ETF, ETRPolarity | ETRPrescaler | ETRFilter);
2701 * @}
2704 /** @defgroup TIM_LL_EF_Break_Function Break function configuration
2705 * @{
2708 * @brief Enable the break function.
2709 * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
2710 * a timer instance provides a break input.
2711 * @rmtoll BDTR BKE LL_TIM_EnableBRK
2712 * @param TIMx Timer instance
2713 * @retval None
2715 __STATIC_INLINE void LL_TIM_EnableBRK(TIM_TypeDef *TIMx)
2717 SET_BIT(TIMx->BDTR, TIM_BDTR_BKE);
2721 * @brief Disable the break function.
2722 * @rmtoll BDTR BKE LL_TIM_DisableBRK
2723 * @param TIMx Timer instance
2724 * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
2725 * a timer instance provides a break input.
2726 * @retval None
2728 __STATIC_INLINE void LL_TIM_DisableBRK(TIM_TypeDef *TIMx)
2730 CLEAR_BIT(TIMx->BDTR, TIM_BDTR_BKE);
2734 * @brief Configure the break input.
2735 * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
2736 * a timer instance provides a break input.
2737 * @rmtoll BDTR BKP LL_TIM_ConfigBRK
2738 * @param TIMx Timer instance
2739 * @param BreakPolarity This parameter can be one of the following values:
2740 * @arg @ref LL_TIM_BREAK_POLARITY_LOW
2741 * @arg @ref LL_TIM_BREAK_POLARITY_HIGH
2742 * @retval None
2744 __STATIC_INLINE void LL_TIM_ConfigBRK(TIM_TypeDef *TIMx, uint32_t BreakPolarity)
2746 MODIFY_REG(TIMx->BDTR, TIM_BDTR_BKP, BreakPolarity);
2750 * @brief Select the outputs off state (enabled v.s. disabled) in Idle and Run modes.
2751 * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
2752 * a timer instance provides a break input.
2753 * @rmtoll BDTR OSSI LL_TIM_SetOffStates\n
2754 * BDTR OSSR LL_TIM_SetOffStates
2755 * @param TIMx Timer instance
2756 * @param OffStateIdle This parameter can be one of the following values:
2757 * @arg @ref LL_TIM_OSSI_DISABLE
2758 * @arg @ref LL_TIM_OSSI_ENABLE
2759 * @param OffStateRun This parameter can be one of the following values:
2760 * @arg @ref LL_TIM_OSSR_DISABLE
2761 * @arg @ref LL_TIM_OSSR_ENABLE
2762 * @retval None
2764 __STATIC_INLINE void LL_TIM_SetOffStates(TIM_TypeDef *TIMx, uint32_t OffStateIdle, uint32_t OffStateRun)
2766 MODIFY_REG(TIMx->BDTR, TIM_BDTR_OSSI | TIM_BDTR_OSSR, OffStateIdle | OffStateRun);
2770 * @brief Enable automatic output (MOE can be set by software or automatically when a break input is active).
2771 * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
2772 * a timer instance provides a break input.
2773 * @rmtoll BDTR AOE LL_TIM_EnableAutomaticOutput
2774 * @param TIMx Timer instance
2775 * @retval None
2777 __STATIC_INLINE void LL_TIM_EnableAutomaticOutput(TIM_TypeDef *TIMx)
2779 SET_BIT(TIMx->BDTR, TIM_BDTR_AOE);
2783 * @brief Disable automatic output (MOE can be set only by software).
2784 * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
2785 * a timer instance provides a break input.
2786 * @rmtoll BDTR AOE LL_TIM_DisableAutomaticOutput
2787 * @param TIMx Timer instance
2788 * @retval None
2790 __STATIC_INLINE void LL_TIM_DisableAutomaticOutput(TIM_TypeDef *TIMx)
2792 CLEAR_BIT(TIMx->BDTR, TIM_BDTR_AOE);
2796 * @brief Indicate whether automatic output is enabled.
2797 * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
2798 * a timer instance provides a break input.
2799 * @rmtoll BDTR AOE LL_TIM_IsEnabledAutomaticOutput
2800 * @param TIMx Timer instance
2801 * @retval State of bit (1 or 0).
2803 __STATIC_INLINE uint32_t LL_TIM_IsEnabledAutomaticOutput(TIM_TypeDef *TIMx)
2805 return (READ_BIT(TIMx->BDTR, TIM_BDTR_AOE) == (TIM_BDTR_AOE));
2809 * @brief Enable the outputs (set the MOE bit in TIMx_BDTR register).
2810 * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by
2811 * software and is reset in case of break or break2 event
2812 * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
2813 * a timer instance provides a break input.
2814 * @rmtoll BDTR MOE LL_TIM_EnableAllOutputs
2815 * @param TIMx Timer instance
2816 * @retval None
2818 __STATIC_INLINE void LL_TIM_EnableAllOutputs(TIM_TypeDef *TIMx)
2820 SET_BIT(TIMx->BDTR, TIM_BDTR_MOE);
2824 * @brief Disable the outputs (reset the MOE bit in TIMx_BDTR register).
2825 * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by
2826 * software and is reset in case of break or break2 event.
2827 * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
2828 * a timer instance provides a break input.
2829 * @rmtoll BDTR MOE LL_TIM_DisableAllOutputs
2830 * @param TIMx Timer instance
2831 * @retval None
2833 __STATIC_INLINE void LL_TIM_DisableAllOutputs(TIM_TypeDef *TIMx)
2835 CLEAR_BIT(TIMx->BDTR, TIM_BDTR_MOE);
2839 * @brief Indicates whether outputs are enabled.
2840 * @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
2841 * a timer instance provides a break input.
2842 * @rmtoll BDTR MOE LL_TIM_IsEnabledAllOutputs
2843 * @param TIMx Timer instance
2844 * @retval State of bit (1 or 0).
2846 __STATIC_INLINE uint32_t LL_TIM_IsEnabledAllOutputs(TIM_TypeDef *TIMx)
2848 return (READ_BIT(TIMx->BDTR, TIM_BDTR_MOE) == (TIM_BDTR_MOE));
2852 * @}
2855 /** @defgroup TIM_LL_EF_DMA_Burst_Mode DMA burst mode configuration
2856 * @{
2859 * @brief Configures the timer DMA burst feature.
2860 * @note Macro @ref IS_TIM_DMABURST_INSTANCE(TIMx) can be used to check whether or
2861 * not a timer instance supports the DMA burst mode.
2862 * @rmtoll DCR DBL LL_TIM_ConfigDMABurst\n
2863 * DCR DBA LL_TIM_ConfigDMABurst
2864 * @param TIMx Timer instance
2865 * @param DMABurstBaseAddress This parameter can be one of the following values:
2866 * @arg @ref LL_TIM_DMABURST_BASEADDR_CR1
2867 * @arg @ref LL_TIM_DMABURST_BASEADDR_CR2
2868 * @arg @ref LL_TIM_DMABURST_BASEADDR_SMCR
2869 * @arg @ref LL_TIM_DMABURST_BASEADDR_DIER
2870 * @arg @ref LL_TIM_DMABURST_BASEADDR_SR
2871 * @arg @ref LL_TIM_DMABURST_BASEADDR_EGR
2872 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR1
2873 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR2
2874 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCER
2875 * @arg @ref LL_TIM_DMABURST_BASEADDR_CNT
2876 * @arg @ref LL_TIM_DMABURST_BASEADDR_PSC
2877 * @arg @ref LL_TIM_DMABURST_BASEADDR_ARR
2878 * @arg @ref LL_TIM_DMABURST_BASEADDR_RCR
2879 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR1
2880 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR2
2881 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR3
2882 * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR4
2883 * @arg @ref LL_TIM_DMABURST_BASEADDR_BDTR
2884 * @param DMABurstLength This parameter can be one of the following values:
2885 * @arg @ref LL_TIM_DMABURST_LENGTH_1TRANSFER
2886 * @arg @ref LL_TIM_DMABURST_LENGTH_2TRANSFERS
2887 * @arg @ref LL_TIM_DMABURST_LENGTH_3TRANSFERS
2888 * @arg @ref LL_TIM_DMABURST_LENGTH_4TRANSFERS
2889 * @arg @ref LL_TIM_DMABURST_LENGTH_5TRANSFERS
2890 * @arg @ref LL_TIM_DMABURST_LENGTH_6TRANSFERS
2891 * @arg @ref LL_TIM_DMABURST_LENGTH_7TRANSFERS
2892 * @arg @ref LL_TIM_DMABURST_LENGTH_8TRANSFERS
2893 * @arg @ref LL_TIM_DMABURST_LENGTH_9TRANSFERS
2894 * @arg @ref LL_TIM_DMABURST_LENGTH_10TRANSFERS
2895 * @arg @ref LL_TIM_DMABURST_LENGTH_11TRANSFERS
2896 * @arg @ref LL_TIM_DMABURST_LENGTH_12TRANSFERS
2897 * @arg @ref LL_TIM_DMABURST_LENGTH_13TRANSFERS
2898 * @arg @ref LL_TIM_DMABURST_LENGTH_14TRANSFERS
2899 * @arg @ref LL_TIM_DMABURST_LENGTH_15TRANSFERS
2900 * @arg @ref LL_TIM_DMABURST_LENGTH_16TRANSFERS
2901 * @arg @ref LL_TIM_DMABURST_LENGTH_17TRANSFERS
2902 * @arg @ref LL_TIM_DMABURST_LENGTH_18TRANSFERS
2903 * @retval None
2905 __STATIC_INLINE void LL_TIM_ConfigDMABurst(TIM_TypeDef *TIMx, uint32_t DMABurstBaseAddress, uint32_t DMABurstLength)
2907 MODIFY_REG(TIMx->DCR, TIM_DCR_DBL | TIM_DCR_DBA, DMABurstBaseAddress | DMABurstLength);
2911 * @}
2916 * @}
2920 /** @defgroup TIM_LL_EF_FLAG_Management FLAG-Management
2921 * @{
2924 * @brief Clear the update interrupt flag (UIF).
2925 * @rmtoll SR UIF LL_TIM_ClearFlag_UPDATE
2926 * @param TIMx Timer instance
2927 * @retval None
2929 __STATIC_INLINE void LL_TIM_ClearFlag_UPDATE(TIM_TypeDef *TIMx)
2931 WRITE_REG(TIMx->SR, ~(TIM_SR_UIF));
2935 * @brief Indicate whether update interrupt flag (UIF) is set (update interrupt is pending).
2936 * @rmtoll SR UIF LL_TIM_IsActiveFlag_UPDATE
2937 * @param TIMx Timer instance
2938 * @retval State of bit (1 or 0).
2940 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_UPDATE(TIM_TypeDef *TIMx)
2942 return (READ_BIT(TIMx->SR, TIM_SR_UIF) == (TIM_SR_UIF));
2946 * @brief Clear the Capture/Compare 1 interrupt flag (CC1F).
2947 * @rmtoll SR CC1IF LL_TIM_ClearFlag_CC1
2948 * @param TIMx Timer instance
2949 * @retval None
2951 __STATIC_INLINE void LL_TIM_ClearFlag_CC1(TIM_TypeDef *TIMx)
2953 WRITE_REG(TIMx->SR, ~(TIM_SR_CC1IF));
2957 * @brief Indicate whether Capture/Compare 1 interrupt flag (CC1F) is set (Capture/Compare 1 interrupt is pending).
2958 * @rmtoll SR CC1IF LL_TIM_IsActiveFlag_CC1
2959 * @param TIMx Timer instance
2960 * @retval State of bit (1 or 0).
2962 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1(TIM_TypeDef *TIMx)
2964 return (READ_BIT(TIMx->SR, TIM_SR_CC1IF) == (TIM_SR_CC1IF));
2968 * @brief Clear the Capture/Compare 2 interrupt flag (CC2F).
2969 * @rmtoll SR CC2IF LL_TIM_ClearFlag_CC2
2970 * @param TIMx Timer instance
2971 * @retval None
2973 __STATIC_INLINE void LL_TIM_ClearFlag_CC2(TIM_TypeDef *TIMx)
2975 WRITE_REG(TIMx->SR, ~(TIM_SR_CC2IF));
2979 * @brief Indicate whether Capture/Compare 2 interrupt flag (CC2F) is set (Capture/Compare 2 interrupt is pending).
2980 * @rmtoll SR CC2IF LL_TIM_IsActiveFlag_CC2
2981 * @param TIMx Timer instance
2982 * @retval State of bit (1 or 0).
2984 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2(TIM_TypeDef *TIMx)
2986 return (READ_BIT(TIMx->SR, TIM_SR_CC2IF) == (TIM_SR_CC2IF));
2990 * @brief Clear the Capture/Compare 3 interrupt flag (CC3F).
2991 * @rmtoll SR CC3IF LL_TIM_ClearFlag_CC3
2992 * @param TIMx Timer instance
2993 * @retval None
2995 __STATIC_INLINE void LL_TIM_ClearFlag_CC3(TIM_TypeDef *TIMx)
2997 WRITE_REG(TIMx->SR, ~(TIM_SR_CC3IF));
3001 * @brief Indicate whether Capture/Compare 3 interrupt flag (CC3F) is set (Capture/Compare 3 interrupt is pending).
3002 * @rmtoll SR CC3IF LL_TIM_IsActiveFlag_CC3
3003 * @param TIMx Timer instance
3004 * @retval State of bit (1 or 0).
3006 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3(TIM_TypeDef *TIMx)
3008 return (READ_BIT(TIMx->SR, TIM_SR_CC3IF) == (TIM_SR_CC3IF));
3012 * @brief Clear the Capture/Compare 4 interrupt flag (CC4F).
3013 * @rmtoll SR CC4IF LL_TIM_ClearFlag_CC4
3014 * @param TIMx Timer instance
3015 * @retval None
3017 __STATIC_INLINE void LL_TIM_ClearFlag_CC4(TIM_TypeDef *TIMx)
3019 WRITE_REG(TIMx->SR, ~(TIM_SR_CC4IF));
3023 * @brief Indicate whether Capture/Compare 4 interrupt flag (CC4F) is set (Capture/Compare 4 interrupt is pending).
3024 * @rmtoll SR CC4IF LL_TIM_IsActiveFlag_CC4
3025 * @param TIMx Timer instance
3026 * @retval State of bit (1 or 0).
3028 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4(TIM_TypeDef *TIMx)
3030 return (READ_BIT(TIMx->SR, TIM_SR_CC4IF) == (TIM_SR_CC4IF));
3034 * @brief Clear the commutation interrupt flag (COMIF).
3035 * @rmtoll SR COMIF LL_TIM_ClearFlag_COM
3036 * @param TIMx Timer instance
3037 * @retval None
3039 __STATIC_INLINE void LL_TIM_ClearFlag_COM(TIM_TypeDef *TIMx)
3041 WRITE_REG(TIMx->SR, ~(TIM_SR_COMIF));
3045 * @brief Indicate whether commutation interrupt flag (COMIF) is set (commutation interrupt is pending).
3046 * @rmtoll SR COMIF LL_TIM_IsActiveFlag_COM
3047 * @param TIMx Timer instance
3048 * @retval State of bit (1 or 0).
3050 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_COM(TIM_TypeDef *TIMx)
3052 return (READ_BIT(TIMx->SR, TIM_SR_COMIF) == (TIM_SR_COMIF));
3056 * @brief Clear the trigger interrupt flag (TIF).
3057 * @rmtoll SR TIF LL_TIM_ClearFlag_TRIG
3058 * @param TIMx Timer instance
3059 * @retval None
3061 __STATIC_INLINE void LL_TIM_ClearFlag_TRIG(TIM_TypeDef *TIMx)
3063 WRITE_REG(TIMx->SR, ~(TIM_SR_TIF));
3067 * @brief Indicate whether trigger interrupt flag (TIF) is set (trigger interrupt is pending).
3068 * @rmtoll SR TIF LL_TIM_IsActiveFlag_TRIG
3069 * @param TIMx Timer instance
3070 * @retval State of bit (1 or 0).
3072 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_TRIG(TIM_TypeDef *TIMx)
3074 return (READ_BIT(TIMx->SR, TIM_SR_TIF) == (TIM_SR_TIF));
3078 * @brief Clear the break interrupt flag (BIF).
3079 * @rmtoll SR BIF LL_TIM_ClearFlag_BRK
3080 * @param TIMx Timer instance
3081 * @retval None
3083 __STATIC_INLINE void LL_TIM_ClearFlag_BRK(TIM_TypeDef *TIMx)
3085 WRITE_REG(TIMx->SR, ~(TIM_SR_BIF));
3089 * @brief Indicate whether break interrupt flag (BIF) is set (break interrupt is pending).
3090 * @rmtoll SR BIF LL_TIM_IsActiveFlag_BRK
3091 * @param TIMx Timer instance
3092 * @retval State of bit (1 or 0).
3094 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_BRK(TIM_TypeDef *TIMx)
3096 return (READ_BIT(TIMx->SR, TIM_SR_BIF) == (TIM_SR_BIF));
3100 * @brief Clear the Capture/Compare 1 over-capture interrupt flag (CC1OF).
3101 * @rmtoll SR CC1OF LL_TIM_ClearFlag_CC1OVR
3102 * @param TIMx Timer instance
3103 * @retval None
3105 __STATIC_INLINE void LL_TIM_ClearFlag_CC1OVR(TIM_TypeDef *TIMx)
3107 WRITE_REG(TIMx->SR, ~(TIM_SR_CC1OF));
3111 * @brief Indicate whether Capture/Compare 1 over-capture interrupt flag (CC1OF) is set (Capture/Compare 1 interrupt is pending).
3112 * @rmtoll SR CC1OF LL_TIM_IsActiveFlag_CC1OVR
3113 * @param TIMx Timer instance
3114 * @retval State of bit (1 or 0).
3116 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1OVR(TIM_TypeDef *TIMx)
3118 return (READ_BIT(TIMx->SR, TIM_SR_CC1OF) == (TIM_SR_CC1OF));
3122 * @brief Clear the Capture/Compare 2 over-capture interrupt flag (CC2OF).
3123 * @rmtoll SR CC2OF LL_TIM_ClearFlag_CC2OVR
3124 * @param TIMx Timer instance
3125 * @retval None
3127 __STATIC_INLINE void LL_TIM_ClearFlag_CC2OVR(TIM_TypeDef *TIMx)
3129 WRITE_REG(TIMx->SR, ~(TIM_SR_CC2OF));
3133 * @brief Indicate whether Capture/Compare 2 over-capture interrupt flag (CC2OF) is set (Capture/Compare 2 over-capture interrupt is pending).
3134 * @rmtoll SR CC2OF LL_TIM_IsActiveFlag_CC2OVR
3135 * @param TIMx Timer instance
3136 * @retval State of bit (1 or 0).
3138 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2OVR(TIM_TypeDef *TIMx)
3140 return (READ_BIT(TIMx->SR, TIM_SR_CC2OF) == (TIM_SR_CC2OF));
3144 * @brief Clear the Capture/Compare 3 over-capture interrupt flag (CC3OF).
3145 * @rmtoll SR CC3OF LL_TIM_ClearFlag_CC3OVR
3146 * @param TIMx Timer instance
3147 * @retval None
3149 __STATIC_INLINE void LL_TIM_ClearFlag_CC3OVR(TIM_TypeDef *TIMx)
3151 WRITE_REG(TIMx->SR, ~(TIM_SR_CC3OF));
3155 * @brief Indicate whether Capture/Compare 3 over-capture interrupt flag (CC3OF) is set (Capture/Compare 3 over-capture interrupt is pending).
3156 * @rmtoll SR CC3OF LL_TIM_IsActiveFlag_CC3OVR
3157 * @param TIMx Timer instance
3158 * @retval State of bit (1 or 0).
3160 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3OVR(TIM_TypeDef *TIMx)
3162 return (READ_BIT(TIMx->SR, TIM_SR_CC3OF) == (TIM_SR_CC3OF));
3166 * @brief Clear the Capture/Compare 4 over-capture interrupt flag (CC4OF).
3167 * @rmtoll SR CC4OF LL_TIM_ClearFlag_CC4OVR
3168 * @param TIMx Timer instance
3169 * @retval None
3171 __STATIC_INLINE void LL_TIM_ClearFlag_CC4OVR(TIM_TypeDef *TIMx)
3173 WRITE_REG(TIMx->SR, ~(TIM_SR_CC4OF));
3177 * @brief Indicate whether Capture/Compare 4 over-capture interrupt flag (CC4OF) is set (Capture/Compare 4 over-capture interrupt is pending).
3178 * @rmtoll SR CC4OF LL_TIM_IsActiveFlag_CC4OVR
3179 * @param TIMx Timer instance
3180 * @retval State of bit (1 or 0).
3182 __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4OVR(TIM_TypeDef *TIMx)
3184 return (READ_BIT(TIMx->SR, TIM_SR_CC4OF) == (TIM_SR_CC4OF));
3188 * @}
3191 /** @defgroup TIM_LL_EF_IT_Management IT-Management
3192 * @{
3195 * @brief Enable update interrupt (UIE).
3196 * @rmtoll DIER UIE LL_TIM_EnableIT_UPDATE
3197 * @param TIMx Timer instance
3198 * @retval None
3200 __STATIC_INLINE void LL_TIM_EnableIT_UPDATE(TIM_TypeDef *TIMx)
3202 SET_BIT(TIMx->DIER, TIM_DIER_UIE);
3206 * @brief Disable update interrupt (UIE).
3207 * @rmtoll DIER UIE LL_TIM_DisableIT_UPDATE
3208 * @param TIMx Timer instance
3209 * @retval None
3211 __STATIC_INLINE void LL_TIM_DisableIT_UPDATE(TIM_TypeDef *TIMx)
3213 CLEAR_BIT(TIMx->DIER, TIM_DIER_UIE);
3217 * @brief Indicates whether the update interrupt (UIE) is enabled.
3218 * @rmtoll DIER UIE LL_TIM_IsEnabledIT_UPDATE
3219 * @param TIMx Timer instance
3220 * @retval State of bit (1 or 0).
3222 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_UPDATE(TIM_TypeDef *TIMx)
3224 return (READ_BIT(TIMx->DIER, TIM_DIER_UIE) == (TIM_DIER_UIE));
3228 * @brief Enable capture/compare 1 interrupt (CC1IE).
3229 * @rmtoll DIER CC1IE LL_TIM_EnableIT_CC1
3230 * @param TIMx Timer instance
3231 * @retval None
3233 __STATIC_INLINE void LL_TIM_EnableIT_CC1(TIM_TypeDef *TIMx)
3235 SET_BIT(TIMx->DIER, TIM_DIER_CC1IE);
3239 * @brief Disable capture/compare 1 interrupt (CC1IE).
3240 * @rmtoll DIER CC1IE LL_TIM_DisableIT_CC1
3241 * @param TIMx Timer instance
3242 * @retval None
3244 __STATIC_INLINE void LL_TIM_DisableIT_CC1(TIM_TypeDef *TIMx)
3246 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC1IE);
3250 * @brief Indicates whether the capture/compare 1 interrupt (CC1IE) is enabled.
3251 * @rmtoll DIER CC1IE LL_TIM_IsEnabledIT_CC1
3252 * @param TIMx Timer instance
3253 * @retval State of bit (1 or 0).
3255 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC1(TIM_TypeDef *TIMx)
3257 return (READ_BIT(TIMx->DIER, TIM_DIER_CC1IE) == (TIM_DIER_CC1IE));
3261 * @brief Enable capture/compare 2 interrupt (CC2IE).
3262 * @rmtoll DIER CC2IE LL_TIM_EnableIT_CC2
3263 * @param TIMx Timer instance
3264 * @retval None
3266 __STATIC_INLINE void LL_TIM_EnableIT_CC2(TIM_TypeDef *TIMx)
3268 SET_BIT(TIMx->DIER, TIM_DIER_CC2IE);
3272 * @brief Disable capture/compare 2 interrupt (CC2IE).
3273 * @rmtoll DIER CC2IE LL_TIM_DisableIT_CC2
3274 * @param TIMx Timer instance
3275 * @retval None
3277 __STATIC_INLINE void LL_TIM_DisableIT_CC2(TIM_TypeDef *TIMx)
3279 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC2IE);
3283 * @brief Indicates whether the capture/compare 2 interrupt (CC2IE) is enabled.
3284 * @rmtoll DIER CC2IE LL_TIM_IsEnabledIT_CC2
3285 * @param TIMx Timer instance
3286 * @retval State of bit (1 or 0).
3288 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC2(TIM_TypeDef *TIMx)
3290 return (READ_BIT(TIMx->DIER, TIM_DIER_CC2IE) == (TIM_DIER_CC2IE));
3294 * @brief Enable capture/compare 3 interrupt (CC3IE).
3295 * @rmtoll DIER CC3IE LL_TIM_EnableIT_CC3
3296 * @param TIMx Timer instance
3297 * @retval None
3299 __STATIC_INLINE void LL_TIM_EnableIT_CC3(TIM_TypeDef *TIMx)
3301 SET_BIT(TIMx->DIER, TIM_DIER_CC3IE);
3305 * @brief Disable capture/compare 3 interrupt (CC3IE).
3306 * @rmtoll DIER CC3IE LL_TIM_DisableIT_CC3
3307 * @param TIMx Timer instance
3308 * @retval None
3310 __STATIC_INLINE void LL_TIM_DisableIT_CC3(TIM_TypeDef *TIMx)
3312 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC3IE);
3316 * @brief Indicates whether the capture/compare 3 interrupt (CC3IE) is enabled.
3317 * @rmtoll DIER CC3IE LL_TIM_IsEnabledIT_CC3
3318 * @param TIMx Timer instance
3319 * @retval State of bit (1 or 0).
3321 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC3(TIM_TypeDef *TIMx)
3323 return (READ_BIT(TIMx->DIER, TIM_DIER_CC3IE) == (TIM_DIER_CC3IE));
3327 * @brief Enable capture/compare 4 interrupt (CC4IE).
3328 * @rmtoll DIER CC4IE LL_TIM_EnableIT_CC4
3329 * @param TIMx Timer instance
3330 * @retval None
3332 __STATIC_INLINE void LL_TIM_EnableIT_CC4(TIM_TypeDef *TIMx)
3334 SET_BIT(TIMx->DIER, TIM_DIER_CC4IE);
3338 * @brief Disable capture/compare 4 interrupt (CC4IE).
3339 * @rmtoll DIER CC4IE LL_TIM_DisableIT_CC4
3340 * @param TIMx Timer instance
3341 * @retval None
3343 __STATIC_INLINE void LL_TIM_DisableIT_CC4(TIM_TypeDef *TIMx)
3345 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC4IE);
3349 * @brief Indicates whether the capture/compare 4 interrupt (CC4IE) is enabled.
3350 * @rmtoll DIER CC4IE LL_TIM_IsEnabledIT_CC4
3351 * @param TIMx Timer instance
3352 * @retval State of bit (1 or 0).
3354 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC4(TIM_TypeDef *TIMx)
3356 return (READ_BIT(TIMx->DIER, TIM_DIER_CC4IE) == (TIM_DIER_CC4IE));
3360 * @brief Enable commutation interrupt (COMIE).
3361 * @rmtoll DIER COMIE LL_TIM_EnableIT_COM
3362 * @param TIMx Timer instance
3363 * @retval None
3365 __STATIC_INLINE void LL_TIM_EnableIT_COM(TIM_TypeDef *TIMx)
3367 SET_BIT(TIMx->DIER, TIM_DIER_COMIE);
3371 * @brief Disable commutation interrupt (COMIE).
3372 * @rmtoll DIER COMIE LL_TIM_DisableIT_COM
3373 * @param TIMx Timer instance
3374 * @retval None
3376 __STATIC_INLINE void LL_TIM_DisableIT_COM(TIM_TypeDef *TIMx)
3378 CLEAR_BIT(TIMx->DIER, TIM_DIER_COMIE);
3382 * @brief Indicates whether the commutation interrupt (COMIE) is enabled.
3383 * @rmtoll DIER COMIE LL_TIM_IsEnabledIT_COM
3384 * @param TIMx Timer instance
3385 * @retval State of bit (1 or 0).
3387 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_COM(TIM_TypeDef *TIMx)
3389 return (READ_BIT(TIMx->DIER, TIM_DIER_COMIE) == (TIM_DIER_COMIE));
3393 * @brief Enable trigger interrupt (TIE).
3394 * @rmtoll DIER TIE LL_TIM_EnableIT_TRIG
3395 * @param TIMx Timer instance
3396 * @retval None
3398 __STATIC_INLINE void LL_TIM_EnableIT_TRIG(TIM_TypeDef *TIMx)
3400 SET_BIT(TIMx->DIER, TIM_DIER_TIE);
3404 * @brief Disable trigger interrupt (TIE).
3405 * @rmtoll DIER TIE LL_TIM_DisableIT_TRIG
3406 * @param TIMx Timer instance
3407 * @retval None
3409 __STATIC_INLINE void LL_TIM_DisableIT_TRIG(TIM_TypeDef *TIMx)
3411 CLEAR_BIT(TIMx->DIER, TIM_DIER_TIE);
3415 * @brief Indicates whether the trigger interrupt (TIE) is enabled.
3416 * @rmtoll DIER TIE LL_TIM_IsEnabledIT_TRIG
3417 * @param TIMx Timer instance
3418 * @retval State of bit (1 or 0).
3420 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_TRIG(TIM_TypeDef *TIMx)
3422 return (READ_BIT(TIMx->DIER, TIM_DIER_TIE) == (TIM_DIER_TIE));
3426 * @brief Enable break interrupt (BIE).
3427 * @rmtoll DIER BIE LL_TIM_EnableIT_BRK
3428 * @param TIMx Timer instance
3429 * @retval None
3431 __STATIC_INLINE void LL_TIM_EnableIT_BRK(TIM_TypeDef *TIMx)
3433 SET_BIT(TIMx->DIER, TIM_DIER_BIE);
3437 * @brief Disable break interrupt (BIE).
3438 * @rmtoll DIER BIE LL_TIM_DisableIT_BRK
3439 * @param TIMx Timer instance
3440 * @retval None
3442 __STATIC_INLINE void LL_TIM_DisableIT_BRK(TIM_TypeDef *TIMx)
3444 CLEAR_BIT(TIMx->DIER, TIM_DIER_BIE);
3448 * @brief Indicates whether the break interrupt (BIE) is enabled.
3449 * @rmtoll DIER BIE LL_TIM_IsEnabledIT_BRK
3450 * @param TIMx Timer instance
3451 * @retval State of bit (1 or 0).
3453 __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_BRK(TIM_TypeDef *TIMx)
3455 return (READ_BIT(TIMx->DIER, TIM_DIER_BIE) == (TIM_DIER_BIE));
3459 * @}
3462 /** @defgroup TIM_LL_EF_DMA_Management DMA-Management
3463 * @{
3466 * @brief Enable update DMA request (UDE).
3467 * @rmtoll DIER UDE LL_TIM_EnableDMAReq_UPDATE
3468 * @param TIMx Timer instance
3469 * @retval None
3471 __STATIC_INLINE void LL_TIM_EnableDMAReq_UPDATE(TIM_TypeDef *TIMx)
3473 SET_BIT(TIMx->DIER, TIM_DIER_UDE);
3477 * @brief Disable update DMA request (UDE).
3478 * @rmtoll DIER UDE LL_TIM_DisableDMAReq_UPDATE
3479 * @param TIMx Timer instance
3480 * @retval None
3482 __STATIC_INLINE void LL_TIM_DisableDMAReq_UPDATE(TIM_TypeDef *TIMx)
3484 CLEAR_BIT(TIMx->DIER, TIM_DIER_UDE);
3488 * @brief Indicates whether the update DMA request (UDE) is enabled.
3489 * @rmtoll DIER UDE LL_TIM_IsEnabledDMAReq_UPDATE
3490 * @param TIMx Timer instance
3491 * @retval State of bit (1 or 0).
3493 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_UPDATE(TIM_TypeDef *TIMx)
3495 return (READ_BIT(TIMx->DIER, TIM_DIER_UDE) == (TIM_DIER_UDE));
3499 * @brief Enable capture/compare 1 DMA request (CC1DE).
3500 * @rmtoll DIER CC1DE LL_TIM_EnableDMAReq_CC1
3501 * @param TIMx Timer instance
3502 * @retval None
3504 __STATIC_INLINE void LL_TIM_EnableDMAReq_CC1(TIM_TypeDef *TIMx)
3506 SET_BIT(TIMx->DIER, TIM_DIER_CC1DE);
3510 * @brief Disable capture/compare 1 DMA request (CC1DE).
3511 * @rmtoll DIER CC1DE LL_TIM_DisableDMAReq_CC1
3512 * @param TIMx Timer instance
3513 * @retval None
3515 __STATIC_INLINE void LL_TIM_DisableDMAReq_CC1(TIM_TypeDef *TIMx)
3517 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC1DE);
3521 * @brief Indicates whether the capture/compare 1 DMA request (CC1DE) is enabled.
3522 * @rmtoll DIER CC1DE LL_TIM_IsEnabledDMAReq_CC1
3523 * @param TIMx Timer instance
3524 * @retval State of bit (1 or 0).
3526 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC1(TIM_TypeDef *TIMx)
3528 return (READ_BIT(TIMx->DIER, TIM_DIER_CC1DE) == (TIM_DIER_CC1DE));
3532 * @brief Enable capture/compare 2 DMA request (CC2DE).
3533 * @rmtoll DIER CC2DE LL_TIM_EnableDMAReq_CC2
3534 * @param TIMx Timer instance
3535 * @retval None
3537 __STATIC_INLINE void LL_TIM_EnableDMAReq_CC2(TIM_TypeDef *TIMx)
3539 SET_BIT(TIMx->DIER, TIM_DIER_CC2DE);
3543 * @brief Disable capture/compare 2 DMA request (CC2DE).
3544 * @rmtoll DIER CC2DE LL_TIM_DisableDMAReq_CC2
3545 * @param TIMx Timer instance
3546 * @retval None
3548 __STATIC_INLINE void LL_TIM_DisableDMAReq_CC2(TIM_TypeDef *TIMx)
3550 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC2DE);
3554 * @brief Indicates whether the capture/compare 2 DMA request (CC2DE) is enabled.
3555 * @rmtoll DIER CC2DE LL_TIM_IsEnabledDMAReq_CC2
3556 * @param TIMx Timer instance
3557 * @retval State of bit (1 or 0).
3559 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC2(TIM_TypeDef *TIMx)
3561 return (READ_BIT(TIMx->DIER, TIM_DIER_CC2DE) == (TIM_DIER_CC2DE));
3565 * @brief Enable capture/compare 3 DMA request (CC3DE).
3566 * @rmtoll DIER CC3DE LL_TIM_EnableDMAReq_CC3
3567 * @param TIMx Timer instance
3568 * @retval None
3570 __STATIC_INLINE void LL_TIM_EnableDMAReq_CC3(TIM_TypeDef *TIMx)
3572 SET_BIT(TIMx->DIER, TIM_DIER_CC3DE);
3576 * @brief Disable capture/compare 3 DMA request (CC3DE).
3577 * @rmtoll DIER CC3DE LL_TIM_DisableDMAReq_CC3
3578 * @param TIMx Timer instance
3579 * @retval None
3581 __STATIC_INLINE void LL_TIM_DisableDMAReq_CC3(TIM_TypeDef *TIMx)
3583 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC3DE);
3587 * @brief Indicates whether the capture/compare 3 DMA request (CC3DE) is enabled.
3588 * @rmtoll DIER CC3DE LL_TIM_IsEnabledDMAReq_CC3
3589 * @param TIMx Timer instance
3590 * @retval State of bit (1 or 0).
3592 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC3(TIM_TypeDef *TIMx)
3594 return (READ_BIT(TIMx->DIER, TIM_DIER_CC3DE) == (TIM_DIER_CC3DE));
3598 * @brief Enable capture/compare 4 DMA request (CC4DE).
3599 * @rmtoll DIER CC4DE LL_TIM_EnableDMAReq_CC4
3600 * @param TIMx Timer instance
3601 * @retval None
3603 __STATIC_INLINE void LL_TIM_EnableDMAReq_CC4(TIM_TypeDef *TIMx)
3605 SET_BIT(TIMx->DIER, TIM_DIER_CC4DE);
3609 * @brief Disable capture/compare 4 DMA request (CC4DE).
3610 * @rmtoll DIER CC4DE LL_TIM_DisableDMAReq_CC4
3611 * @param TIMx Timer instance
3612 * @retval None
3614 __STATIC_INLINE void LL_TIM_DisableDMAReq_CC4(TIM_TypeDef *TIMx)
3616 CLEAR_BIT(TIMx->DIER, TIM_DIER_CC4DE);
3620 * @brief Indicates whether the capture/compare 4 DMA request (CC4DE) is enabled.
3621 * @rmtoll DIER CC4DE LL_TIM_IsEnabledDMAReq_CC4
3622 * @param TIMx Timer instance
3623 * @retval State of bit (1 or 0).
3625 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC4(TIM_TypeDef *TIMx)
3627 return (READ_BIT(TIMx->DIER, TIM_DIER_CC4DE) == (TIM_DIER_CC4DE));
3631 * @brief Enable commutation DMA request (COMDE).
3632 * @rmtoll DIER COMDE LL_TIM_EnableDMAReq_COM
3633 * @param TIMx Timer instance
3634 * @retval None
3636 __STATIC_INLINE void LL_TIM_EnableDMAReq_COM(TIM_TypeDef *TIMx)
3638 SET_BIT(TIMx->DIER, TIM_DIER_COMDE);
3642 * @brief Disable commutation DMA request (COMDE).
3643 * @rmtoll DIER COMDE LL_TIM_DisableDMAReq_COM
3644 * @param TIMx Timer instance
3645 * @retval None
3647 __STATIC_INLINE void LL_TIM_DisableDMAReq_COM(TIM_TypeDef *TIMx)
3649 CLEAR_BIT(TIMx->DIER, TIM_DIER_COMDE);
3653 * @brief Indicates whether the commutation DMA request (COMDE) is enabled.
3654 * @rmtoll DIER COMDE LL_TIM_IsEnabledDMAReq_COM
3655 * @param TIMx Timer instance
3656 * @retval State of bit (1 or 0).
3658 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_COM(TIM_TypeDef *TIMx)
3660 return (READ_BIT(TIMx->DIER, TIM_DIER_COMDE) == (TIM_DIER_COMDE));
3664 * @brief Enable trigger interrupt (TDE).
3665 * @rmtoll DIER TDE LL_TIM_EnableDMAReq_TRIG
3666 * @param TIMx Timer instance
3667 * @retval None
3669 __STATIC_INLINE void LL_TIM_EnableDMAReq_TRIG(TIM_TypeDef *TIMx)
3671 SET_BIT(TIMx->DIER, TIM_DIER_TDE);
3675 * @brief Disable trigger interrupt (TDE).
3676 * @rmtoll DIER TDE LL_TIM_DisableDMAReq_TRIG
3677 * @param TIMx Timer instance
3678 * @retval None
3680 __STATIC_INLINE void LL_TIM_DisableDMAReq_TRIG(TIM_TypeDef *TIMx)
3682 CLEAR_BIT(TIMx->DIER, TIM_DIER_TDE);
3686 * @brief Indicates whether the trigger interrupt (TDE) is enabled.
3687 * @rmtoll DIER TDE LL_TIM_IsEnabledDMAReq_TRIG
3688 * @param TIMx Timer instance
3689 * @retval State of bit (1 or 0).
3691 __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_TRIG(TIM_TypeDef *TIMx)
3693 return (READ_BIT(TIMx->DIER, TIM_DIER_TDE) == (TIM_DIER_TDE));
3697 * @}
3700 /** @defgroup TIM_LL_EF_EVENT_Management EVENT-Management
3701 * @{
3704 * @brief Generate an update event.
3705 * @rmtoll EGR UG LL_TIM_GenerateEvent_UPDATE
3706 * @param TIMx Timer instance
3707 * @retval None
3709 __STATIC_INLINE void LL_TIM_GenerateEvent_UPDATE(TIM_TypeDef *TIMx)
3711 SET_BIT(TIMx->EGR, TIM_EGR_UG);
3715 * @brief Generate Capture/Compare 1 event.
3716 * @rmtoll EGR CC1G LL_TIM_GenerateEvent_CC1
3717 * @param TIMx Timer instance
3718 * @retval None
3720 __STATIC_INLINE void LL_TIM_GenerateEvent_CC1(TIM_TypeDef *TIMx)
3722 SET_BIT(TIMx->EGR, TIM_EGR_CC1G);
3726 * @brief Generate Capture/Compare 2 event.
3727 * @rmtoll EGR CC2G LL_TIM_GenerateEvent_CC2
3728 * @param TIMx Timer instance
3729 * @retval None
3731 __STATIC_INLINE void LL_TIM_GenerateEvent_CC2(TIM_TypeDef *TIMx)
3733 SET_BIT(TIMx->EGR, TIM_EGR_CC2G);
3737 * @brief Generate Capture/Compare 3 event.
3738 * @rmtoll EGR CC3G LL_TIM_GenerateEvent_CC3
3739 * @param TIMx Timer instance
3740 * @retval None
3742 __STATIC_INLINE void LL_TIM_GenerateEvent_CC3(TIM_TypeDef *TIMx)
3744 SET_BIT(TIMx->EGR, TIM_EGR_CC3G);
3748 * @brief Generate Capture/Compare 4 event.
3749 * @rmtoll EGR CC4G LL_TIM_GenerateEvent_CC4
3750 * @param TIMx Timer instance
3751 * @retval None
3753 __STATIC_INLINE void LL_TIM_GenerateEvent_CC4(TIM_TypeDef *TIMx)
3755 SET_BIT(TIMx->EGR, TIM_EGR_CC4G);
3759 * @brief Generate commutation event.
3760 * @rmtoll EGR COMG LL_TIM_GenerateEvent_COM
3761 * @param TIMx Timer instance
3762 * @retval None
3764 __STATIC_INLINE void LL_TIM_GenerateEvent_COM(TIM_TypeDef *TIMx)
3766 SET_BIT(TIMx->EGR, TIM_EGR_COMG);
3770 * @brief Generate trigger event.
3771 * @rmtoll EGR TG LL_TIM_GenerateEvent_TRIG
3772 * @param TIMx Timer instance
3773 * @retval None
3775 __STATIC_INLINE void LL_TIM_GenerateEvent_TRIG(TIM_TypeDef *TIMx)
3777 SET_BIT(TIMx->EGR, TIM_EGR_TG);
3781 * @brief Generate break event.
3782 * @rmtoll EGR BG LL_TIM_GenerateEvent_BRK
3783 * @param TIMx Timer instance
3784 * @retval None
3786 __STATIC_INLINE void LL_TIM_GenerateEvent_BRK(TIM_TypeDef *TIMx)
3788 SET_BIT(TIMx->EGR, TIM_EGR_BG);
3792 * @}
3795 #if defined(USE_FULL_LL_DRIVER)
3796 /** @defgroup TIM_LL_EF_Init Initialisation and deinitialisation functions
3797 * @{
3800 ErrorStatus LL_TIM_DeInit(TIM_TypeDef *TIMx);
3801 void LL_TIM_StructInit(LL_TIM_InitTypeDef *TIM_InitStruct);
3802 ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct);
3803 void LL_TIM_OC_StructInit(LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct);
3804 ErrorStatus LL_TIM_OC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct);
3805 void LL_TIM_IC_StructInit(LL_TIM_IC_InitTypeDef *TIM_ICInitStruct);
3806 ErrorStatus LL_TIM_IC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_IC_InitTypeDef *TIM_IC_InitStruct);
3807 void LL_TIM_ENCODER_StructInit(LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct);
3808 ErrorStatus LL_TIM_ENCODER_Init(TIM_TypeDef *TIMx, LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct);
3809 void LL_TIM_HALLSENSOR_StructInit(LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct);
3810 ErrorStatus LL_TIM_HALLSENSOR_Init(TIM_TypeDef *TIMx, LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct);
3811 void LL_TIM_BDTR_StructInit(LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct);
3812 ErrorStatus LL_TIM_BDTR_Init(TIM_TypeDef *TIMx, LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct);
3814 * @}
3816 #endif /* USE_FULL_LL_DRIVER */
3819 * @}
3823 * @}
3826 #endif /* TIM1 || TIM2 || TIM3 || TIM4 || TIM5 || TIM6 || TIM7 || TIM8 || TIM9 || TIM10 || TIM11 || TIM12 || TIM13 || TIM14 || TIM15 || TIM16 || TIM17 */
3829 * @}
3832 #ifdef __cplusplus
3834 #endif
3836 #endif /* __STM32F1xx_LL_TIM_H */
3837 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/