STM32F439xx HAL User Manual
Defines
Exported_Macros
TIM Exported Macros

Defines

#define __LL_TIM_CALC_DEADTIME(__TIMCLK__, __CKD__, __DT__)
 HELPER macro calculating DTG[0:7] in the TIMx_BDTR register to achieve the requested dead time duration.
#define __LL_TIM_CALC_PSC(__TIMCLK__, __CNTCLK__)   ((__TIMCLK__) >= (__CNTCLK__)) ? (uint32_t)((__TIMCLK__)/(__CNTCLK__) - 1U) : 0U
 HELPER macro calculating the prescaler value to achieve the required counter clock frequency.
#define __LL_TIM_CALC_ARR(__TIMCLK__, __PSC__, __FREQ__)   (((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? ((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U)) - 1U) : 0U
 HELPER macro calculating the auto-reload value to achieve the required output signal frequency.
#define __LL_TIM_CALC_DELAY(__TIMCLK__, __PSC__, __DELAY__)
 HELPER macro calculating the compare value required to achieve the required timer output compare active/inactive delay.
#define __LL_TIM_CALC_PULSE(__TIMCLK__, __PSC__, __DELAY__, __PULSE__)
 HELPER macro calculating the auto-reload value to achieve the required pulse duration (when the timer operates in one pulse mode).
#define __LL_TIM_GET_ICPSC_RATIO(__ICPSC__)   ((uint32_t)(0x01U << (((__ICPSC__) >> 16U) >> TIM_CCMR1_IC1PSC_Pos)))
 HELPER macro retrieving the ratio of the input capture prescaler.

Define Documentation

#define __LL_TIM_CALC_ARR (   __TIMCLK__,
  __PSC__,
  __FREQ__ 
)    (((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? ((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U)) - 1U) : 0U

HELPER macro calculating the auto-reload value to achieve the required output signal frequency.

Note:
ex: __LL_TIM_CALC_ARR (1000000, LL_TIM_GetPrescaler (), 10000);
Parameters:
__TIMCLK__timer input clock frequency (in Hz)
__PSC__prescaler
__FREQ__output signal frequency (in Hz)
Return values:
Auto-reloadvalue (between Min_Data=0 and Max_Data=65535)

Definition at line 1000 of file stm32f4xx_ll_tim.h.

#define __LL_TIM_CALC_DEADTIME (   __TIMCLK__,
  __CKD__,
  __DT__ 
)
Value:
( (((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) :                                               \
      (((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) 64U) & DT_DELAY_2)) :\
      (((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) 32U) & DT_DELAY_3)) :\
      (((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) 32U) & DT_DELAY_4)) :\
       0U)

HELPER macro calculating DTG[0:7] in the TIMx_BDTR register to achieve the requested dead time duration.

Note:
ex: __LL_TIM_CALC_DEADTIME (80000000, LL_TIM_GetClockDivision (), 120);
Parameters:
__TIMCLK__timer input clock frequency (in Hz)
__CKD__This parameter can be one of the following values:
__DT__deadtime duration (in ns)
Return values:
DTG[0:7]

Definition at line 975 of file stm32f4xx_ll_tim.h.

#define __LL_TIM_CALC_DELAY (   __TIMCLK__,
  __PSC__,
  __DELAY__ 
)
Value:
((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__)) \
          / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U))))

HELPER macro calculating the compare value required to achieve the required timer output compare active/inactive delay.

Note:
ex: __LL_TIM_CALC_DELAY (1000000, LL_TIM_GetPrescaler (), 10);
Parameters:
__TIMCLK__timer input clock frequency (in Hz)
__PSC__prescaler
__DELAY__timer output compare active/inactive delay (in us)
Return values:
Comparevalue (between Min_Data=0 and Max_Data=65535)

Definition at line 1011 of file stm32f4xx_ll_tim.h.

#define __LL_TIM_CALC_PSC (   __TIMCLK__,
  __CNTCLK__ 
)    ((__TIMCLK__) >= (__CNTCLK__)) ? (uint32_t)((__TIMCLK__)/(__CNTCLK__) - 1U) : 0U

HELPER macro calculating the prescaler value to achieve the required counter clock frequency.

Note:
ex: __LL_TIM_CALC_PSC (80000000, 1000000);
Parameters:
__TIMCLK__timer input clock frequency (in Hz)
__CNTCLK__counter clock frequency (in Hz)
Return values:
Prescalervalue (between Min_Data=0 and Max_Data=65535)

Definition at line 989 of file stm32f4xx_ll_tim.h.

#define __LL_TIM_CALC_PULSE (   __TIMCLK__,
  __PSC__,
  __DELAY__,
  __PULSE__ 
)
Value:
((uint32_t)(__LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__PULSE__)) \
           + __LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__DELAY__))))

HELPER macro calculating the auto-reload value to achieve the required pulse duration (when the timer operates in one pulse mode).

Note:
ex: __LL_TIM_CALC_PULSE (1000000, LL_TIM_GetPrescaler (), 10, 20);
Parameters:
__TIMCLK__timer input clock frequency (in Hz)
__PSC__prescaler
__DELAY__timer output compare active/inactive delay (in us)
__PULSE__pulse duration (in us)
Return values:
Auto-reloadvalue (between Min_Data=0 and Max_Data=65535)

Definition at line 1024 of file stm32f4xx_ll_tim.h.

#define __LL_TIM_GET_ICPSC_RATIO (   __ICPSC__)    ((uint32_t)(0x01U << (((__ICPSC__) >> 16U) >> TIM_CCMR1_IC1PSC_Pos)))

HELPER macro retrieving the ratio of the input capture prescaler.

Note:
ex: __LL_TIM_GET_ICPSC_RATIO (LL_TIM_IC_GetPrescaler ());
Parameters:
__ICPSC__This parameter can be one of the following values:
Return values:
Inputcapture prescaler ratio (1, 2, 4 or 8)

Definition at line 1038 of file stm32f4xx_ll_tim.h.