cantata
Macros
TIM Exported Macros
Collaboration diagram for TIM Exported Macros:

Macros

#define __HAL_TIM_RESET_HANDLE_STATE(__HANDLE__)
 Reset TIM handle state. More...
 
#define __HAL_TIM_ENABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR1|=(TIM_CR1_CEN))
 Enable the TIM peripheral. More...
 
#define __HAL_TIM_MOE_ENABLE(__HANDLE__)   ((__HANDLE__)->Instance->BDTR|=(TIM_BDTR_MOE))
 Enable the TIM main Output. More...
 
#define __HAL_TIM_DISABLE(__HANDLE__)
 Disable the TIM peripheral. More...
 
#define __HAL_TIM_MOE_DISABLE(__HANDLE__)
 Disable the TIM main Output. More...
 
#define __HAL_TIM_MOE_DISABLE_UNCONDITIONALLY(__HANDLE__)   (__HANDLE__)->Instance->BDTR &= ~(TIM_BDTR_MOE)
 Disable the TIM main Output. More...
 
#define __HAL_TIM_ENABLE_IT(__HANDLE__, __INTERRUPT__)   ((__HANDLE__)->Instance->DIER |= (__INTERRUPT__))
 Enable the specified TIM interrupt. More...
 
#define __HAL_TIM_DISABLE_IT(__HANDLE__, __INTERRUPT__)   ((__HANDLE__)->Instance->DIER &= ~(__INTERRUPT__))
 Disable the specified TIM interrupt. More...
 
#define __HAL_TIM_ENABLE_DMA(__HANDLE__, __DMA__)   ((__HANDLE__)->Instance->DIER |= (__DMA__))
 Enable the specified DMA request. More...
 
#define __HAL_TIM_DISABLE_DMA(__HANDLE__, __DMA__)   ((__HANDLE__)->Instance->DIER &= ~(__DMA__))
 Disable the specified DMA request. More...
 
#define __HAL_TIM_GET_FLAG(__HANDLE__, __FLAG__)   (((__HANDLE__)->Instance->SR &(__FLAG__)) == (__FLAG__))
 Check whether the specified TIM interrupt flag is set or not. More...
 
#define __HAL_TIM_CLEAR_FLAG(__HANDLE__, __FLAG__)   ((__HANDLE__)->Instance->SR = ~(__FLAG__))
 Clear the specified TIM interrupt flag. More...
 
#define __HAL_TIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)
 Check whether the specified TIM interrupt source is enabled or not. More...
 
#define __HAL_TIM_CLEAR_IT(__HANDLE__, __INTERRUPT__)   ((__HANDLE__)->Instance->SR = ~(__INTERRUPT__))
 Clear the TIM interrupt pending bits. More...
 
#define __HAL_TIM_IS_TIM_COUNTING_DOWN(__HANDLE__)   (((__HANDLE__)->Instance->CR1 &(TIM_CR1_DIR)) == (TIM_CR1_DIR))
 Indicates whether or not the TIM Counter is used as downcounter. More...
 
#define __HAL_TIM_SET_PRESCALER(__HANDLE__, __PRESC__)   ((__HANDLE__)->Instance->PSC = (__PRESC__))
 Set the TIM Prescaler on runtime. More...
 
#define __HAL_TIM_SET_COUNTER(__HANDLE__, __COUNTER__)   ((__HANDLE__)->Instance->CNT = (__COUNTER__))
 Set the TIM Counter Register value on runtime. More...
 
#define __HAL_TIM_GET_COUNTER(__HANDLE__)   ((__HANDLE__)->Instance->CNT)
 Get the TIM Counter Register value on runtime. More...
 
#define __HAL_TIM_SET_AUTORELOAD(__HANDLE__, __AUTORELOAD__)
 Set the TIM Autoreload Register value on runtime without calling another time any Init function. More...
 
#define __HAL_TIM_GET_AUTORELOAD(__HANDLE__)   ((__HANDLE__)->Instance->ARR)
 Get the TIM Autoreload Register value on runtime. More...
 
#define __HAL_TIM_SET_CLOCKDIVISION(__HANDLE__, __CKD__)
 Set the TIM Clock Division value on runtime without calling another time any Init function. More...
 
#define __HAL_TIM_GET_CLOCKDIVISION(__HANDLE__)   ((__HANDLE__)->Instance->CR1 & TIM_CR1_CKD)
 Get the TIM Clock Division value on runtime. More...
 
#define __HAL_TIM_SET_ICPRESCALER(__HANDLE__, __CHANNEL__, __ICPSC__)
 Set the TIM Input Capture prescaler on runtime without calling another time HAL_TIM_IC_ConfigChannel() function. More...
 
#define __HAL_TIM_GET_ICPRESCALER(__HANDLE__, __CHANNEL__)
 Get the TIM Input Capture prescaler on runtime. More...
 
#define __HAL_TIM_SET_COMPARE(__HANDLE__, __CHANNEL__, __COMPARE__)
 Set the TIM Capture Compare Register value on runtime without calling another time ConfigChannel function. More...
 
#define __HAL_TIM_GET_COMPARE(__HANDLE__, __CHANNEL__)
 Get the TIM Capture Compare Register value on runtime. More...
 
#define __HAL_TIM_ENABLE_OCxPRELOAD(__HANDLE__, __CHANNEL__)
 Set the TIM Output compare preload. More...
 
#define __HAL_TIM_DISABLE_OCxPRELOAD(__HANDLE__, __CHANNEL__)
 Reset the TIM Output compare preload. More...
 
#define __HAL_TIM_ENABLE_OCxFAST(__HANDLE__, __CHANNEL__)
 Enable fast mode for a given channel. More...
 
#define __HAL_TIM_DISABLE_OCxFAST(__HANDLE__, __CHANNEL__)
 Disable fast mode for a given channel. More...
 
#define __HAL_TIM_URS_ENABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR1|= TIM_CR1_URS)
 Set the Update Request Source (URS) bit of the TIMx_CR1 register. More...
 
#define __HAL_TIM_URS_DISABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR1&=~TIM_CR1_URS)
 Reset the Update Request Source (URS) bit of the TIMx_CR1 register. More...
 
#define __HAL_TIM_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__)
 Set the TIM Capture x input polarity on runtime. More...
 

Detailed Description

Macro Definition Documentation

◆ __HAL_TIM_CLEAR_FLAG

#define __HAL_TIM_CLEAR_FLAG (   __HANDLE__,
  __FLAG__ 
)    ((__HANDLE__)->Instance->SR = ~(__FLAG__))

Clear the specified TIM interrupt flag.

Parameters
<strong>HANDLE</strong>specifies the TIM Handle.
<strong>FLAG</strong>specifies the TIM interrupt flag to clear. This parameter can be one of the following values:
  • TIM_FLAG_UPDATE: Update interrupt flag
  • TIM_FLAG_CC1: Capture/Compare 1 interrupt flag
  • TIM_FLAG_CC2: Capture/Compare 2 interrupt flag
  • TIM_FLAG_CC3: Capture/Compare 3 interrupt flag
  • TIM_FLAG_CC4: Capture/Compare 4 interrupt flag
  • TIM_FLAG_COM: Commutation interrupt flag
  • TIM_FLAG_TRIGGER: Trigger interrupt flag
  • TIM_FLAG_BREAK: Break interrupt flag
  • TIM_FLAG_CC1OF: Capture/Compare 1 overcapture flag
  • TIM_FLAG_CC2OF: Capture/Compare 2 overcapture flag
  • TIM_FLAG_CC3OF: Capture/Compare 3 overcapture flag
  • TIM_FLAG_CC4OF: Capture/Compare 4 overcapture flag
Return values
Thenew state of FLAG (TRUE or FALSE).

◆ __HAL_TIM_CLEAR_IT

#define __HAL_TIM_CLEAR_IT (   __HANDLE__,
  __INTERRUPT__ 
)    ((__HANDLE__)->Instance->SR = ~(__INTERRUPT__))

Clear the TIM interrupt pending bits.

Parameters
<strong>HANDLE</strong>TIM handle
<strong>INTERRUPT</strong>specifies the interrupt pending bit to clear. This parameter can be one of the following values:
  • TIM_IT_UPDATE: Update interrupt
  • TIM_IT_CC1: Capture/Compare 1 interrupt
  • TIM_IT_CC2: Capture/Compare 2 interrupt
  • TIM_IT_CC3: Capture/Compare 3 interrupt
  • TIM_IT_CC4: Capture/Compare 4 interrupt
  • TIM_IT_COM: Commutation interrupt
  • TIM_IT_TRIGGER: Trigger interrupt
  • TIM_IT_BREAK: Break interrupt
Return values
None

◆ __HAL_TIM_DISABLE

#define __HAL_TIM_DISABLE (   __HANDLE__)
Value:
do { \
if (((__HANDLE__)->Instance->CCER & TIM_CCER_CCxE_MASK) == 0UL) \
{ \
if(((__HANDLE__)->Instance->CCER & TIM_CCER_CCxNE_MASK) == 0UL) \
{ \
(__HANDLE__)->Instance->CR1 &= ~(TIM_CR1_CEN); \
} \
} \
} while(0)
#define TIM_CR1_CEN
Definition: stm32f103xb.h:3807

Disable the TIM peripheral.

Parameters
<strong>HANDLE</strong>TIM handle
Return values
None

◆ __HAL_TIM_DISABLE_DMA

#define __HAL_TIM_DISABLE_DMA (   __HANDLE__,
  __DMA__ 
)    ((__HANDLE__)->Instance->DIER &= ~(__DMA__))

Disable the specified DMA request.

Parameters
<strong>HANDLE</strong>specifies the TIM Handle.
<strong>DMA</strong>specifies the TIM DMA request to disable. This parameter can be one of the following values:
  • TIM_DMA_UPDATE: Update DMA request
  • TIM_DMA_CC1: Capture/Compare 1 DMA request
  • TIM_DMA_CC2: Capture/Compare 2 DMA request
  • TIM_DMA_CC3: Capture/Compare 3 DMA request
  • TIM_DMA_CC4: Capture/Compare 4 DMA request
  • TIM_DMA_COM: Commutation DMA request
  • TIM_DMA_TRIGGER: Trigger DMA request
Return values
None

◆ __HAL_TIM_DISABLE_IT

#define __HAL_TIM_DISABLE_IT (   __HANDLE__,
  __INTERRUPT__ 
)    ((__HANDLE__)->Instance->DIER &= ~(__INTERRUPT__))

Disable the specified TIM interrupt.

Parameters
<strong>HANDLE</strong>specifies the TIM Handle.
<strong>INTERRUPT</strong>specifies the TIM interrupt source to disable. This parameter can be one of the following values:
  • TIM_IT_UPDATE: Update interrupt
  • TIM_IT_CC1: Capture/Compare 1 interrupt
  • TIM_IT_CC2: Capture/Compare 2 interrupt
  • TIM_IT_CC3: Capture/Compare 3 interrupt
  • TIM_IT_CC4: Capture/Compare 4 interrupt
  • TIM_IT_COM: Commutation interrupt
  • TIM_IT_TRIGGER: Trigger interrupt
  • TIM_IT_BREAK: Break interrupt
Return values
None

◆ __HAL_TIM_DISABLE_OCxFAST

#define __HAL_TIM_DISABLE_OCxFAST (   __HANDLE__,
  __CHANNEL__ 
)
Value:
(((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC1FE) :\
((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC2FE) :\
((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC3FE) :\
((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC4FE))
#define TIM_CCMR1_OC1FE
Definition: stm32f103xb.h:4040
#define TIM_CCMR1_OC2FE
Definition: stm32f103xb.h:4064
#define TIM_CCMR2_OC4FE
Definition: stm32f103xb.h:4143
#define TIM_CCMR2_OC3FE
Definition: stm32f103xb.h:4119
#define TIM_CHANNEL_2
Definition: stm32f1xx_hal_tim.h:733
#define TIM_CHANNEL_1
Definition: stm32f1xx_hal_tim.h:732
#define TIM_CHANNEL_3
Definition: stm32f1xx_hal_tim.h:734

Disable fast mode for a given channel.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>CHANNEL</strong>TIM Channels to be configured. This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
  • TIM_CHANNEL_3: TIM Channel 3 selected
  • TIM_CHANNEL_4: TIM Channel 4 selected
Note
When fast mode is disabled CCx output behaves normally depending on counter and CCRx values even when the trigger is ON. The minimum delay to activate CCx output when an active edge occurs on the trigger input is 5 clock cycles.
Return values
None

◆ __HAL_TIM_DISABLE_OCxPRELOAD

#define __HAL_TIM_DISABLE_OCxPRELOAD (   __HANDLE__,
  __CHANNEL__ 
)
Value:
(((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC1PE) :\
((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC2PE) :\
((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC3PE) :\
((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC4PE))
#define TIM_CCMR1_OC2PE
Definition: stm32f103xb.h:4067
#define TIM_CHANNEL_2
Definition: stm32f1xx_hal_tim.h:733
#define TIM_CCMR2_OC4PE
Definition: stm32f103xb.h:4146
#define TIM_CCMR2_OC3PE
Definition: stm32f103xb.h:4122
#define TIM_CHANNEL_1
Definition: stm32f1xx_hal_tim.h:732
#define TIM_CCMR1_OC1PE
Definition: stm32f103xb.h:4043
#define TIM_CHANNEL_3
Definition: stm32f1xx_hal_tim.h:734

Reset the TIM Output compare preload.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>CHANNEL</strong>TIM Channels to be configured. This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
  • TIM_CHANNEL_3: TIM Channel 3 selected
  • TIM_CHANNEL_4: TIM Channel 4 selected
Return values
None

◆ __HAL_TIM_ENABLE

#define __HAL_TIM_ENABLE (   __HANDLE__)    ((__HANDLE__)->Instance->CR1|=(TIM_CR1_CEN))

Enable the TIM peripheral.

Parameters
<strong>HANDLE</strong>TIM handle
Return values
None

◆ __HAL_TIM_ENABLE_DMA

#define __HAL_TIM_ENABLE_DMA (   __HANDLE__,
  __DMA__ 
)    ((__HANDLE__)->Instance->DIER |= (__DMA__))

Enable the specified DMA request.

Parameters
<strong>HANDLE</strong>specifies the TIM Handle.
<strong>DMA</strong>specifies the TIM DMA request to enable. This parameter can be one of the following values:
  • TIM_DMA_UPDATE: Update DMA request
  • TIM_DMA_CC1: Capture/Compare 1 DMA request
  • TIM_DMA_CC2: Capture/Compare 2 DMA request
  • TIM_DMA_CC3: Capture/Compare 3 DMA request
  • TIM_DMA_CC4: Capture/Compare 4 DMA request
  • TIM_DMA_COM: Commutation DMA request
  • TIM_DMA_TRIGGER: Trigger DMA request
Return values
None

◆ __HAL_TIM_ENABLE_IT

#define __HAL_TIM_ENABLE_IT (   __HANDLE__,
  __INTERRUPT__ 
)    ((__HANDLE__)->Instance->DIER |= (__INTERRUPT__))

Enable the specified TIM interrupt.

Parameters
<strong>HANDLE</strong>specifies the TIM Handle.
<strong>INTERRUPT</strong>specifies the TIM interrupt source to enable. This parameter can be one of the following values:
  • TIM_IT_UPDATE: Update interrupt
  • TIM_IT_CC1: Capture/Compare 1 interrupt
  • TIM_IT_CC2: Capture/Compare 2 interrupt
  • TIM_IT_CC3: Capture/Compare 3 interrupt
  • TIM_IT_CC4: Capture/Compare 4 interrupt
  • TIM_IT_COM: Commutation interrupt
  • TIM_IT_TRIGGER: Trigger interrupt
  • TIM_IT_BREAK: Break interrupt
Return values
None

◆ __HAL_TIM_ENABLE_OCxFAST

#define __HAL_TIM_ENABLE_OCxFAST (   __HANDLE__,
  __CHANNEL__ 
)
Value:
(((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC1FE) :\
((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC2FE) :\
((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC3FE) :\
((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC4FE))
#define TIM_CCMR1_OC1FE
Definition: stm32f103xb.h:4040
#define TIM_CCMR1_OC2FE
Definition: stm32f103xb.h:4064
#define TIM_CCMR2_OC4FE
Definition: stm32f103xb.h:4143
#define TIM_CCMR2_OC3FE
Definition: stm32f103xb.h:4119
#define TIM_CHANNEL_2
Definition: stm32f1xx_hal_tim.h:733
#define TIM_CHANNEL_1
Definition: stm32f1xx_hal_tim.h:732
#define TIM_CHANNEL_3
Definition: stm32f1xx_hal_tim.h:734

Enable fast mode for a given channel.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>CHANNEL</strong>TIM Channels to be configured. This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
  • TIM_CHANNEL_3: TIM Channel 3 selected
  • TIM_CHANNEL_4: TIM Channel 4 selected
Note
When fast mode is enabled an active edge on the trigger input acts like a compare match on CCx output. Delay to sample the trigger input and to activate CCx output is reduced to 3 clock cycles.
Fast mode acts only if the channel is configured in PWM1 or PWM2 mode.
Return values
None

◆ __HAL_TIM_ENABLE_OCxPRELOAD

#define __HAL_TIM_ENABLE_OCxPRELOAD (   __HANDLE__,
  __CHANNEL__ 
)
Value:
(((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC1PE) :\
((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC2PE) :\
((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC3PE) :\
((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC4PE))
#define TIM_CCMR1_OC2PE
Definition: stm32f103xb.h:4067
#define TIM_CHANNEL_2
Definition: stm32f1xx_hal_tim.h:733
#define TIM_CCMR2_OC4PE
Definition: stm32f103xb.h:4146
#define TIM_CCMR2_OC3PE
Definition: stm32f103xb.h:4122
#define TIM_CHANNEL_1
Definition: stm32f1xx_hal_tim.h:732
#define TIM_CCMR1_OC1PE
Definition: stm32f103xb.h:4043
#define TIM_CHANNEL_3
Definition: stm32f1xx_hal_tim.h:734

Set the TIM Output compare preload.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>CHANNEL</strong>TIM Channels to be configured. This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
  • TIM_CHANNEL_3: TIM Channel 3 selected
  • TIM_CHANNEL_4: TIM Channel 4 selected
Return values
None

◆ __HAL_TIM_GET_AUTORELOAD

#define __HAL_TIM_GET_AUTORELOAD (   __HANDLE__)    ((__HANDLE__)->Instance->ARR)

Get the TIM Autoreload Register value on runtime.

Parameters
<strong>HANDLE</strong>TIM handle.
Return values
16-bitor 32-bit value of the timer auto-reload register(TIMx_ARR)

◆ __HAL_TIM_GET_CLOCKDIVISION

#define __HAL_TIM_GET_CLOCKDIVISION (   __HANDLE__)    ((__HANDLE__)->Instance->CR1 & TIM_CR1_CKD)

Get the TIM Clock Division value on runtime.

Parameters
<strong>HANDLE</strong>TIM handle.
Return values
Theclock division can be one of the following values:
  • TIM_CLOCKDIVISION_DIV1: tDTS=tCK_INT
  • TIM_CLOCKDIVISION_DIV2: tDTS=2*tCK_INT
  • TIM_CLOCKDIVISION_DIV4: tDTS=4*tCK_INT

◆ __HAL_TIM_GET_COMPARE

#define __HAL_TIM_GET_COMPARE (   __HANDLE__,
  __CHANNEL__ 
)
Value:
(((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCR1) :\
((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCR2) :\
((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCR3) :\
((__HANDLE__)->Instance->CCR4))
#define TIM_CHANNEL_2
Definition: stm32f1xx_hal_tim.h:733
#define TIM_CHANNEL_1
Definition: stm32f1xx_hal_tim.h:732
#define TIM_CHANNEL_3
Definition: stm32f1xx_hal_tim.h:734

Get the TIM Capture Compare Register value on runtime.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>CHANNEL</strong>TIM Channel associated with the capture compare register This parameter can be one of the following values:
  • TIM_CHANNEL_1: get capture/compare 1 register value
  • TIM_CHANNEL_2: get capture/compare 2 register value
  • TIM_CHANNEL_3: get capture/compare 3 register value
  • TIM_CHANNEL_4: get capture/compare 4 register value
Return values
16-bitor 32-bit value of the capture/compare register (TIMx_CCRy)

◆ __HAL_TIM_GET_COUNTER

#define __HAL_TIM_GET_COUNTER (   __HANDLE__)    ((__HANDLE__)->Instance->CNT)

Get the TIM Counter Register value on runtime.

Parameters
<strong>HANDLE</strong>TIM handle.
Return values
16-bitor 32-bit value of the timer counter register (TIMx_CNT)

◆ __HAL_TIM_GET_FLAG

#define __HAL_TIM_GET_FLAG (   __HANDLE__,
  __FLAG__ 
)    (((__HANDLE__)->Instance->SR &(__FLAG__)) == (__FLAG__))

Check whether the specified TIM interrupt flag is set or not.

Parameters
<strong>HANDLE</strong>specifies the TIM Handle.
<strong>FLAG</strong>specifies the TIM interrupt flag to check. This parameter can be one of the following values:
  • TIM_FLAG_UPDATE: Update interrupt flag
  • TIM_FLAG_CC1: Capture/Compare 1 interrupt flag
  • TIM_FLAG_CC2: Capture/Compare 2 interrupt flag
  • TIM_FLAG_CC3: Capture/Compare 3 interrupt flag
  • TIM_FLAG_CC4: Capture/Compare 4 interrupt flag
  • TIM_FLAG_COM: Commutation interrupt flag
  • TIM_FLAG_TRIGGER: Trigger interrupt flag
  • TIM_FLAG_BREAK: Break interrupt flag
  • TIM_FLAG_CC1OF: Capture/Compare 1 overcapture flag
  • TIM_FLAG_CC2OF: Capture/Compare 2 overcapture flag
  • TIM_FLAG_CC3OF: Capture/Compare 3 overcapture flag
  • TIM_FLAG_CC4OF: Capture/Compare 4 overcapture flag
Return values
Thenew state of FLAG (TRUE or FALSE).

◆ __HAL_TIM_GET_ICPRESCALER

#define __HAL_TIM_GET_ICPRESCALER (   __HANDLE__,
  __CHANNEL__ 
)
Value:
(((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 & TIM_CCMR1_IC1PSC) :\
((__CHANNEL__) == TIM_CHANNEL_2) ? (((__HANDLE__)->Instance->CCMR1 & TIM_CCMR1_IC2PSC) >> 8U) :\
((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 & TIM_CCMR2_IC3PSC) :\
(((__HANDLE__)->Instance->CCMR2 & TIM_CCMR2_IC4PSC)) >> 8U)
#define TIM_CHANNEL_2
Definition: stm32f1xx_hal_tim.h:733
#define TIM_CCMR2_IC3PSC
Definition: stm32f103xb.h:4163
#define TIM_CCMR1_IC1PSC
Definition: stm32f103xb.h:4084
#define TIM_CHANNEL_1
Definition: stm32f1xx_hal_tim.h:732
#define TIM_CCMR2_IC4PSC
Definition: stm32f103xb.h:4177
#define TIM_CHANNEL_3
Definition: stm32f1xx_hal_tim.h:734
#define TIM_CCMR1_IC2PSC
Definition: stm32f103xb.h:4098

Get the TIM Input Capture prescaler on runtime.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>CHANNEL</strong>TIM Channels to be configured. This parameter can be one of the following values:
  • TIM_CHANNEL_1: get input capture 1 prescaler value
  • TIM_CHANNEL_2: get input capture 2 prescaler value
  • TIM_CHANNEL_3: get input capture 3 prescaler value
  • TIM_CHANNEL_4: get input capture 4 prescaler value
Return values
Theinput capture prescaler can be one of the following values:
  • TIM_ICPSC_DIV1: no prescaler
  • TIM_ICPSC_DIV2: capture is done once every 2 events
  • TIM_ICPSC_DIV4: capture is done once every 4 events
  • TIM_ICPSC_DIV8: capture is done once every 8 events

◆ __HAL_TIM_GET_IT_SOURCE

#define __HAL_TIM_GET_IT_SOURCE (   __HANDLE__,
  __INTERRUPT__ 
)
Value:
((((__HANDLE__)->Instance->DIER & (__INTERRUPT__)) \
== (__INTERRUPT__)) ? SET : RESET)

Check whether the specified TIM interrupt source is enabled or not.

Parameters
<strong>HANDLE</strong>TIM handle
<strong>INTERRUPT</strong>specifies the TIM interrupt source to check. This parameter can be one of the following values:
  • TIM_IT_UPDATE: Update interrupt
  • TIM_IT_CC1: Capture/Compare 1 interrupt
  • TIM_IT_CC2: Capture/Compare 2 interrupt
  • TIM_IT_CC3: Capture/Compare 3 interrupt
  • TIM_IT_CC4: Capture/Compare 4 interrupt
  • TIM_IT_COM: Commutation interrupt
  • TIM_IT_TRIGGER: Trigger interrupt
  • TIM_IT_BREAK: Break interrupt
Return values
Thestate of TIM_IT (SET or RESET).

◆ __HAL_TIM_IS_TIM_COUNTING_DOWN

#define __HAL_TIM_IS_TIM_COUNTING_DOWN (   __HANDLE__)    (((__HANDLE__)->Instance->CR1 &(TIM_CR1_DIR)) == (TIM_CR1_DIR))

Indicates whether or not the TIM Counter is used as downcounter.

Parameters
<strong>HANDLE</strong>TIM handle.
Return values
False(Counter used as upcounter) or True (Counter used as downcounter)
Note
This macro is particularly useful to get the counting mode when the timer operates in Center-aligned mode or Encoder mode.

◆ __HAL_TIM_MOE_DISABLE

#define __HAL_TIM_MOE_DISABLE (   __HANDLE__)
Value:
do { \
if (((__HANDLE__)->Instance->CCER & TIM_CCER_CCxE_MASK) == 0UL) \
{ \
if(((__HANDLE__)->Instance->CCER & TIM_CCER_CCxNE_MASK) == 0UL) \
{ \
(__HANDLE__)->Instance->BDTR &= ~(TIM_BDTR_MOE); \
} \
} \
} while(0)
#define TIM_BDTR_MOE
Definition: stm32f103xb.h:4309

Disable the TIM main Output.

Parameters
<strong>HANDLE</strong>TIM handle
Return values
None
Note
The Main Output Enable of a timer instance is disabled only if all the CCx and CCxN channels have been disabled

◆ __HAL_TIM_MOE_DISABLE_UNCONDITIONALLY

#define __HAL_TIM_MOE_DISABLE_UNCONDITIONALLY (   __HANDLE__)    (__HANDLE__)->Instance->BDTR &= ~(TIM_BDTR_MOE)

Disable the TIM main Output.

Parameters
<strong>HANDLE</strong>TIM handle
Return values
None
Note
The Main Output Enable of a timer instance is disabled unconditionally

◆ __HAL_TIM_MOE_ENABLE

#define __HAL_TIM_MOE_ENABLE (   __HANDLE__)    ((__HANDLE__)->Instance->BDTR|=(TIM_BDTR_MOE))

Enable the TIM main Output.

Parameters
<strong>HANDLE</strong>TIM handle
Return values
None

◆ __HAL_TIM_RESET_HANDLE_STATE

#define __HAL_TIM_RESET_HANDLE_STATE (   __HANDLE__)
Value:
do { \
(__HANDLE__)->State = HAL_TIM_STATE_RESET; \
(__HANDLE__)->ChannelState[0] = HAL_TIM_CHANNEL_STATE_RESET; \
(__HANDLE__)->ChannelState[1] = HAL_TIM_CHANNEL_STATE_RESET; \
(__HANDLE__)->ChannelState[2] = HAL_TIM_CHANNEL_STATE_RESET; \
(__HANDLE__)->ChannelState[3] = HAL_TIM_CHANNEL_STATE_RESET; \
(__HANDLE__)->ChannelNState[0] = HAL_TIM_CHANNEL_STATE_RESET; \
(__HANDLE__)->ChannelNState[1] = HAL_TIM_CHANNEL_STATE_RESET; \
(__HANDLE__)->ChannelNState[2] = HAL_TIM_CHANNEL_STATE_RESET; \
(__HANDLE__)->ChannelNState[3] = HAL_TIM_CHANNEL_STATE_RESET; \
(__HANDLE__)->DMABurstState = HAL_DMA_BURST_STATE_RESET; \
} while(0)
Definition: stm32f1xx_hal_tim.h:312
Definition: stm32f1xx_hal_tim.h:302
Definition: stm32f1xx_hal_tim.h:290

Reset TIM handle state.

Parameters
<strong>HANDLE</strong>TIM handle.
Return values
None

◆ __HAL_TIM_SET_AUTORELOAD

#define __HAL_TIM_SET_AUTORELOAD (   __HANDLE__,
  __AUTORELOAD__ 
)
Value:
do{ \
(__HANDLE__)->Instance->ARR = (__AUTORELOAD__); \
(__HANDLE__)->Init.Period = (__AUTORELOAD__); \
} while(0)

Set the TIM Autoreload Register value on runtime without calling another time any Init function.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>AUTORELOAD</strong>specifies the Counter register new value.
Return values
None

◆ __HAL_TIM_SET_CAPTUREPOLARITY

#define __HAL_TIM_SET_CAPTUREPOLARITY (   __HANDLE__,
  __CHANNEL__,
  __POLARITY__ 
)
Value:
do{ \
TIM_RESET_CAPTUREPOLARITY((__HANDLE__), (__CHANNEL__)); \
TIM_SET_CAPTUREPOLARITY((__HANDLE__), (__CHANNEL__), (__POLARITY__)); \
}while(0)

Set the TIM Capture x input polarity on runtime.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>CHANNEL</strong>TIM Channels to be configured. This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
  • TIM_CHANNEL_3: TIM Channel 3 selected
  • TIM_CHANNEL_4: TIM Channel 4 selected
<strong>POLARITY</strong>Polarity for TIx source
  • TIM_INPUTCHANNELPOLARITY_RISING: Rising Edge
  • TIM_INPUTCHANNELPOLARITY_FALLING: Falling Edge
  • TIM_INPUTCHANNELPOLARITY_BOTHEDGE: Rising and Falling Edge
Return values
None

◆ __HAL_TIM_SET_CLOCKDIVISION

#define __HAL_TIM_SET_CLOCKDIVISION (   __HANDLE__,
  __CKD__ 
)
Value:
do{ \
(__HANDLE__)->Instance->CR1 &= (~TIM_CR1_CKD); \
(__HANDLE__)->Instance->CR1 |= (__CKD__); \
(__HANDLE__)->Init.ClockDivision = (__CKD__); \
} while(0)
#define TIM_CR1_CKD
Definition: stm32f103xb.h:3833

Set the TIM Clock Division value on runtime without calling another time any Init function.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>CKD</strong>specifies the clock division value. This parameter can be one of the following value:
  • TIM_CLOCKDIVISION_DIV1: tDTS=tCK_INT
  • TIM_CLOCKDIVISION_DIV2: tDTS=2*tCK_INT
  • TIM_CLOCKDIVISION_DIV4: tDTS=4*tCK_INT
Return values
None

◆ __HAL_TIM_SET_COMPARE

#define __HAL_TIM_SET_COMPARE (   __HANDLE__,
  __CHANNEL__,
  __COMPARE__ 
)
Value:
(((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCR1 = (__COMPARE__)) :\
((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCR2 = (__COMPARE__)) :\
((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCR3 = (__COMPARE__)) :\
((__HANDLE__)->Instance->CCR4 = (__COMPARE__)))
#define TIM_CHANNEL_2
Definition: stm32f1xx_hal_tim.h:733
#define TIM_CHANNEL_1
Definition: stm32f1xx_hal_tim.h:732
#define TIM_CHANNEL_3
Definition: stm32f1xx_hal_tim.h:734

Set the TIM Capture Compare Register value on runtime without calling another time ConfigChannel function.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>CHANNEL</strong>TIM Channels to be configured. This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
  • TIM_CHANNEL_3: TIM Channel 3 selected
  • TIM_CHANNEL_4: TIM Channel 4 selected
<strong>COMPARE</strong>specifies the Capture Compare register new value.
Return values
None

◆ __HAL_TIM_SET_COUNTER

#define __HAL_TIM_SET_COUNTER (   __HANDLE__,
  __COUNTER__ 
)    ((__HANDLE__)->Instance->CNT = (__COUNTER__))

Set the TIM Counter Register value on runtime.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>COUNTER</strong>specifies the Counter register new value.
Return values
None

◆ __HAL_TIM_SET_ICPRESCALER

#define __HAL_TIM_SET_ICPRESCALER (   __HANDLE__,
  __CHANNEL__,
  __ICPSC__ 
)
Value:
do{ \
TIM_RESET_ICPRESCALERVALUE((__HANDLE__), (__CHANNEL__)); \
TIM_SET_ICPRESCALERVALUE((__HANDLE__), (__CHANNEL__), (__ICPSC__)); \
} while(0)

Set the TIM Input Capture prescaler on runtime without calling another time HAL_TIM_IC_ConfigChannel() function.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>CHANNEL</strong>TIM Channels to be configured. This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
  • TIM_CHANNEL_3: TIM Channel 3 selected
  • TIM_CHANNEL_4: TIM Channel 4 selected
<strong>ICPSC</strong>specifies the Input Capture4 prescaler new value. This parameter can be one of the following values:
  • TIM_ICPSC_DIV1: no prescaler
  • TIM_ICPSC_DIV2: capture is done once every 2 events
  • TIM_ICPSC_DIV4: capture is done once every 4 events
  • TIM_ICPSC_DIV8: capture is done once every 8 events
Return values
None

◆ __HAL_TIM_SET_PRESCALER

#define __HAL_TIM_SET_PRESCALER (   __HANDLE__,
  __PRESC__ 
)    ((__HANDLE__)->Instance->PSC = (__PRESC__))

Set the TIM Prescaler on runtime.

Parameters
<strong>HANDLE</strong>TIM handle.
<strong>PRESC</strong>specifies the Prescaler new value.
Return values
None

◆ __HAL_TIM_URS_DISABLE

#define __HAL_TIM_URS_DISABLE (   __HANDLE__)    ((__HANDLE__)->Instance->CR1&=~TIM_CR1_URS)

Reset the Update Request Source (URS) bit of the TIMx_CR1 register.

Parameters
<strong>HANDLE</strong>TIM handle.
Note
When the URS bit of the TIMx_CR1 register is reset, any of the following events generate an update interrupt or DMA request (if enabled): _ Counter overflow underflow _ Setting the UG bit _ Update generation through the slave mode controller
Return values
None

◆ __HAL_TIM_URS_ENABLE

#define __HAL_TIM_URS_ENABLE (   __HANDLE__)    ((__HANDLE__)->Instance->CR1|= TIM_CR1_URS)

Set the Update Request Source (URS) bit of the TIMx_CR1 register.

Parameters
<strong>HANDLE</strong>TIM handle.
Note
When the URS bit of the TIMx_CR1 register is set, only counter overflow/underflow generates an update interrupt or DMA request (if enabled)
Return values
None