STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_hal_tim.c File Reference

TIM HAL module driver. This file provides firmware functions to manage the following functionalities of the Timer (TIM) peripheral: More...

Go to the source code of this file.

Functions

static void TIM_OC1_SetConfig (TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
 Timer Output Compare 1 configuration. More...
 
static void TIM_OC3_SetConfig (TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
 Timer Output Compare 3 configuration. More...
 
static void TIM_OC4_SetConfig (TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
 Timer Output Compare 4 configuration. More...
 
static void TIM_OC5_SetConfig (TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
 Timer Output Compare 5 configuration. More...
 
static void TIM_OC6_SetConfig (TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
 Timer Output Compare 6 configuration. More...
 
static void TIM_TI1_ConfigInputStage (TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter)
 Configure the Polarity and Filter for TI1. More...
 
static void TIM_TI2_SetConfig (TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter)
 Configure the TI2 as Input. More...
 
static void TIM_TI2_ConfigInputStage (TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter)
 Configure the Polarity and Filter for TI2. More...
 
static void TIM_TI3_SetConfig (TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter)
 Configure the TI3 as Input. More...
 
static void TIM_TI4_SetConfig (TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter)
 Configure the TI4 as Input. More...
 
static void TIM_ITRx_SetConfig (TIM_TypeDef *TIMx, uint32_t InputTriggerSource)
 Selects the Input Trigger source. More...
 
static void TIM_DMAPeriodElapsedCplt (DMA_HandleTypeDef *hdma)
 TIM DMA Period Elapse complete callback. More...
 
static void TIM_DMAPeriodElapsedHalfCplt (DMA_HandleTypeDef *hdma)
 TIM DMA Period Elapse half complete callback. More...
 
static void TIM_DMATriggerCplt (DMA_HandleTypeDef *hdma)
 TIM DMA Trigger callback. More...
 
static void TIM_DMATriggerHalfCplt (DMA_HandleTypeDef *hdma)
 TIM DMA Trigger half complete callback. More...
 
static HAL_StatusTypeDef TIM_SlaveTimer_SetConfig (TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig)
 Slave Timer configuration function. More...
 
HAL_StatusTypeDef HAL_TIM_Base_Init (TIM_HandleTypeDef *htim)
 Initializes the TIM Time base Unit according to the specified parameters in the TIM_HandleTypeDef and initialize the associated handle. More...
 
HAL_StatusTypeDef HAL_TIM_Base_DeInit (TIM_HandleTypeDef *htim)
 DeInitializes the TIM Base peripheral. More...
 
void HAL_TIM_Base_MspInit (TIM_HandleTypeDef *htim)
 Initializes the TIM Base MSP. More...
 
void HAL_TIM_Base_MspDeInit (TIM_HandleTypeDef *htim)
 DeInitializes TIM Base MSP. More...
 
HAL_StatusTypeDef HAL_TIM_Base_Start (TIM_HandleTypeDef *htim)
 Starts the TIM Base generation. More...
 
HAL_StatusTypeDef HAL_TIM_Base_Stop (TIM_HandleTypeDef *htim)
 Stops the TIM Base generation. More...
 
HAL_StatusTypeDef HAL_TIM_Base_Start_IT (TIM_HandleTypeDef *htim)
 Starts the TIM Base generation in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_Base_Stop_IT (TIM_HandleTypeDef *htim)
 Stops the TIM Base generation in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_Base_Start_DMA (TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length)
 Starts the TIM Base generation in DMA mode. More...
 
HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA (TIM_HandleTypeDef *htim)
 Stops the TIM Base generation in DMA mode. More...
 
HAL_StatusTypeDef HAL_TIM_OC_Init (TIM_HandleTypeDef *htim)
 Initializes the TIM Output Compare according to the specified parameters in the TIM_HandleTypeDef and initializes the associated handle. More...
 
HAL_StatusTypeDef HAL_TIM_OC_DeInit (TIM_HandleTypeDef *htim)
 DeInitializes the TIM peripheral. More...
 
void HAL_TIM_OC_MspInit (TIM_HandleTypeDef *htim)
 Initializes the TIM Output Compare MSP. More...
 
void HAL_TIM_OC_MspDeInit (TIM_HandleTypeDef *htim)
 DeInitializes TIM Output Compare MSP. More...
 
HAL_StatusTypeDef HAL_TIM_OC_Start (TIM_HandleTypeDef *htim, uint32_t Channel)
 Starts the TIM Output Compare signal generation. More...
 
HAL_StatusTypeDef HAL_TIM_OC_Stop (TIM_HandleTypeDef *htim, uint32_t Channel)
 Stops the TIM Output Compare signal generation. More...
 
HAL_StatusTypeDef HAL_TIM_OC_Start_IT (TIM_HandleTypeDef *htim, uint32_t Channel)
 Starts the TIM Output Compare signal generation in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_OC_Stop_IT (TIM_HandleTypeDef *htim, uint32_t Channel)
 Stops the TIM Output Compare signal generation in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_OC_Start_DMA (TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
 Starts the TIM Output Compare signal generation in DMA mode. More...
 
HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA (TIM_HandleTypeDef *htim, uint32_t Channel)
 Stops the TIM Output Compare signal generation in DMA mode. More...
 
HAL_StatusTypeDef HAL_TIM_PWM_Init (TIM_HandleTypeDef *htim)
 Initializes the TIM PWM Time Base according to the specified parameters in the TIM_HandleTypeDef and initializes the associated handle. More...
 
HAL_StatusTypeDef HAL_TIM_PWM_DeInit (TIM_HandleTypeDef *htim)
 DeInitializes the TIM peripheral. More...
 
void HAL_TIM_PWM_MspInit (TIM_HandleTypeDef *htim)
 Initializes the TIM PWM MSP. More...
 
void HAL_TIM_PWM_MspDeInit (TIM_HandleTypeDef *htim)
 DeInitializes TIM PWM MSP. More...
 
HAL_StatusTypeDef HAL_TIM_PWM_Start (TIM_HandleTypeDef *htim, uint32_t Channel)
 Starts the PWM signal generation. More...
 
HAL_StatusTypeDef HAL_TIM_PWM_Stop (TIM_HandleTypeDef *htim, uint32_t Channel)
 Stops the PWM signal generation. More...
 
HAL_StatusTypeDef HAL_TIM_PWM_Start_IT (TIM_HandleTypeDef *htim, uint32_t Channel)
 Starts the PWM signal generation in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_PWM_Stop_IT (TIM_HandleTypeDef *htim, uint32_t Channel)
 Stops the PWM signal generation in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA (TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
 Starts the TIM PWM signal generation in DMA mode. More...
 
HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA (TIM_HandleTypeDef *htim, uint32_t Channel)
 Stops the TIM PWM signal generation in DMA mode. More...
 
HAL_StatusTypeDef HAL_TIM_IC_Init (TIM_HandleTypeDef *htim)
 Initializes the TIM Input Capture Time base according to the specified parameters in the TIM_HandleTypeDef and initializes the associated handle. More...
 
HAL_StatusTypeDef HAL_TIM_IC_DeInit (TIM_HandleTypeDef *htim)
 DeInitializes the TIM peripheral. More...
 
void HAL_TIM_IC_MspInit (TIM_HandleTypeDef *htim)
 Initializes the TIM Input Capture MSP. More...
 
void HAL_TIM_IC_MspDeInit (TIM_HandleTypeDef *htim)
 DeInitializes TIM Input Capture MSP. More...
 
HAL_StatusTypeDef HAL_TIM_IC_Start (TIM_HandleTypeDef *htim, uint32_t Channel)
 Starts the TIM Input Capture measurement. More...
 
HAL_StatusTypeDef HAL_TIM_IC_Stop (TIM_HandleTypeDef *htim, uint32_t Channel)
 Stops the TIM Input Capture measurement. More...
 
HAL_StatusTypeDef HAL_TIM_IC_Start_IT (TIM_HandleTypeDef *htim, uint32_t Channel)
 Starts the TIM Input Capture measurement in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_IC_Stop_IT (TIM_HandleTypeDef *htim, uint32_t Channel)
 Stops the TIM Input Capture measurement in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_IC_Start_DMA (TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
 Starts the TIM Input Capture measurement in DMA mode. More...
 
HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA (TIM_HandleTypeDef *htim, uint32_t Channel)
 Stops the TIM Input Capture measurement in DMA mode. More...
 
HAL_StatusTypeDef HAL_TIM_OnePulse_Init (TIM_HandleTypeDef *htim, uint32_t OnePulseMode)
 Initializes the TIM One Pulse Time Base according to the specified parameters in the TIM_HandleTypeDef and initializes the associated handle. More...
 
HAL_StatusTypeDef HAL_TIM_OnePulse_DeInit (TIM_HandleTypeDef *htim)
 DeInitializes the TIM One Pulse. More...
 
void HAL_TIM_OnePulse_MspInit (TIM_HandleTypeDef *htim)
 Initializes the TIM One Pulse MSP. More...
 
void HAL_TIM_OnePulse_MspDeInit (TIM_HandleTypeDef *htim)
 DeInitializes TIM One Pulse MSP. More...
 
HAL_StatusTypeDef HAL_TIM_OnePulse_Start (TIM_HandleTypeDef *htim, uint32_t OutputChannel)
 Starts the TIM One Pulse signal generation. More...
 
HAL_StatusTypeDef HAL_TIM_OnePulse_Stop (TIM_HandleTypeDef *htim, uint32_t OutputChannel)
 Stops the TIM One Pulse signal generation. More...
 
HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT (TIM_HandleTypeDef *htim, uint32_t OutputChannel)
 Starts the TIM One Pulse signal generation in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT (TIM_HandleTypeDef *htim, uint32_t OutputChannel)
 Stops the TIM One Pulse signal generation in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_Encoder_Init (TIM_HandleTypeDef *htim, TIM_Encoder_InitTypeDef *sConfig)
 Initializes the TIM Encoder Interface and initialize the associated handle. More...
 
HAL_StatusTypeDef HAL_TIM_Encoder_DeInit (TIM_HandleTypeDef *htim)
 DeInitializes the TIM Encoder interface. More...
 
void HAL_TIM_Encoder_MspInit (TIM_HandleTypeDef *htim)
 Initializes the TIM Encoder Interface MSP. More...
 
void HAL_TIM_Encoder_MspDeInit (TIM_HandleTypeDef *htim)
 DeInitializes TIM Encoder Interface MSP. More...
 
HAL_StatusTypeDef HAL_TIM_Encoder_Start (TIM_HandleTypeDef *htim, uint32_t Channel)
 Starts the TIM Encoder Interface. More...
 
HAL_StatusTypeDef HAL_TIM_Encoder_Stop (TIM_HandleTypeDef *htim, uint32_t Channel)
 Stops the TIM Encoder Interface. More...
 
HAL_StatusTypeDef HAL_TIM_Encoder_Start_IT (TIM_HandleTypeDef *htim, uint32_t Channel)
 Starts the TIM Encoder Interface in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_Encoder_Stop_IT (TIM_HandleTypeDef *htim, uint32_t Channel)
 Stops the TIM Encoder Interface in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA (TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1, uint32_t *pData2, uint16_t Length)
 Starts the TIM Encoder Interface in DMA mode. More...
 
HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA (TIM_HandleTypeDef *htim, uint32_t Channel)
 Stops the TIM Encoder Interface in DMA mode. More...
 
void HAL_TIM_IRQHandler (TIM_HandleTypeDef *htim)
 This function handles TIM interrupts requests. More...
 
HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel (TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef *sConfig, uint32_t Channel)
 Initializes the TIM Output Compare Channels according to the specified parameters in the TIM_OC_InitTypeDef. More...
 
HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel (TIM_HandleTypeDef *htim, TIM_IC_InitTypeDef *sConfig, uint32_t Channel)
 Initializes the TIM Input Capture Channels according to the specified parameters in the TIM_IC_InitTypeDef. More...
 
HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel (TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef *sConfig, uint32_t Channel)
 Initializes the TIM PWM channels according to the specified parameters in the TIM_OC_InitTypeDef. More...
 
HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel (TIM_HandleTypeDef *htim, TIM_OnePulse_InitTypeDef *sConfig, uint32_t OutputChannel, uint32_t InputChannel)
 Initializes the TIM One Pulse Channels according to the specified parameters in the TIM_OnePulse_InitTypeDef. More...
 
HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart (TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength)
 Configure the DMA Burst to transfer Data from the memory to the TIM peripheral. More...
 
HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop (TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc)
 Stops the TIM DMA Burst mode. More...
 
HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart (TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength)
 Configure the DMA Burst to transfer Data from the TIM peripheral to the memory. More...
 
HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop (TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc)
 Stop the DMA burst reading. More...
 
HAL_StatusTypeDef HAL_TIM_GenerateEvent (TIM_HandleTypeDef *htim, uint32_t EventSource)
 Generate a software event. More...
 
HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear (TIM_HandleTypeDef *htim, TIM_ClearInputConfigTypeDef *sClearInputConfig, uint32_t Channel)
 Configures the OCRef clear feature. More...
 
HAL_StatusTypeDef HAL_TIM_ConfigClockSource (TIM_HandleTypeDef *htim, TIM_ClockConfigTypeDef *sClockSourceConfig)
 Configures the clock source to be used. More...
 
HAL_StatusTypeDef HAL_TIM_ConfigTI1Input (TIM_HandleTypeDef *htim, uint32_t TI1_Selection)
 Selects the signal connected to the TI1 input: direct from CH1_input or a XOR combination between CH1_input, CH2_input & CH3_input. More...
 
HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro (TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig)
 Configures the TIM in Slave mode. More...
 
HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro_IT (TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig)
 Configures the TIM in Slave mode in interrupt mode. More...
 
uint32_t HAL_TIM_ReadCapturedValue (TIM_HandleTypeDef *htim, uint32_t Channel)
 Read the captured value from Capture Compare unit. More...
 
void HAL_TIM_PeriodElapsedCallback (TIM_HandleTypeDef *htim)
 Period elapsed callback in non-blocking mode. More...
 
void HAL_TIM_PeriodElapsedHalfCpltCallback (TIM_HandleTypeDef *htim)
 Period elapsed half complete callback in non-blocking mode. More...
 
void HAL_TIM_OC_DelayElapsedCallback (TIM_HandleTypeDef *htim)
 Output Compare callback in non-blocking mode. More...
 
void HAL_TIM_IC_CaptureCallback (TIM_HandleTypeDef *htim)
 Input Capture callback in non-blocking mode. More...
 
void HAL_TIM_IC_CaptureHalfCpltCallback (TIM_HandleTypeDef *htim)
 Input Capture half complete callback in non-blocking mode. More...
 
void HAL_TIM_PWM_PulseFinishedCallback (TIM_HandleTypeDef *htim)
 PWM Pulse finished callback in non-blocking mode. More...
 
void HAL_TIM_PWM_PulseFinishedHalfCpltCallback (TIM_HandleTypeDef *htim)
 PWM Pulse finished half complete callback in non-blocking mode. More...
 
void HAL_TIM_TriggerCallback (TIM_HandleTypeDef *htim)
 Hall Trigger detection callback in non-blocking mode. More...
 
void HAL_TIM_TriggerHalfCpltCallback (TIM_HandleTypeDef *htim)
 Hall Trigger detection half complete callback in non-blocking mode. More...
 
void HAL_TIM_ErrorCallback (TIM_HandleTypeDef *htim)
 Timer error callback in non-blocking mode. More...
 
HAL_StatusTypeDef HAL_TIM_RegisterCallback (TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID, pTIM_CallbackTypeDef pCallback)
 Register a User TIM callback to be used instead of the weak predefined callback. More...
 
HAL_StatusTypeDef HAL_TIM_UnRegisterCallback (TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID)
 Unregister a TIM callback TIM callback is redirected to the weak predefined callback. More...
 
HAL_TIM_StateTypeDef HAL_TIM_Base_GetState (TIM_HandleTypeDef *htim)
 Return the TIM Base handle state. More...
 
HAL_TIM_StateTypeDef HAL_TIM_OC_GetState (TIM_HandleTypeDef *htim)
 Return the TIM OC handle state. More...
 
HAL_TIM_StateTypeDef HAL_TIM_PWM_GetState (TIM_HandleTypeDef *htim)
 Return the TIM PWM handle state. More...
 
HAL_TIM_StateTypeDef HAL_TIM_IC_GetState (TIM_HandleTypeDef *htim)
 Return the TIM Input Capture handle state. More...
 
HAL_TIM_StateTypeDef HAL_TIM_OnePulse_GetState (TIM_HandleTypeDef *htim)
 Return the TIM One Pulse Mode handle state. More...
 
HAL_TIM_StateTypeDef HAL_TIM_Encoder_GetState (TIM_HandleTypeDef *htim)
 Return the TIM Encoder Mode handle state. More...
 
void TIM_DMAError (DMA_HandleTypeDef *hdma)
 TIM DMA error callback. More...
 
void TIM_DMADelayPulseCplt (DMA_HandleTypeDef *hdma)
 TIM DMA Delay Pulse complete callback. More...
 
void TIM_DMADelayPulseHalfCplt (DMA_HandleTypeDef *hdma)
 TIM DMA Delay Pulse half complete callback. More...
 
void TIM_DMACaptureCplt (DMA_HandleTypeDef *hdma)
 TIM DMA Capture complete callback. More...
 
void TIM_DMACaptureHalfCplt (DMA_HandleTypeDef *hdma)
 TIM DMA Capture half complete callback. More...
 
void TIM_Base_SetConfig (TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure)
 Time Base configuration. More...
 
void TIM_OC2_SetConfig (TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
 Timer Output Compare 2 configuration. More...
 
void TIM_TI1_SetConfig (TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter)
 Configure the TI1 as Input. More...
 
void TIM_ETR_SetConfig (TIM_TypeDef *TIMx, uint32_t TIM_ExtTRGPrescaler, uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter)
 Configures the TIMx External Trigger (ETR). More...
 
void TIM_CCxChannelCmd (TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState)
 Enables or disables the TIM Capture Compare Channel x. More...
 
void TIM_ResetCallback (TIM_HandleTypeDef *htim)
 Reset interrupt callbacks to the legacy weak callbacks. More...
 

Detailed Description

TIM HAL module driver. This file provides firmware functions to manage the following functionalities of the Timer (TIM) peripheral:

Author
MCD Application Team
  • TIM Time Base Initialization
  • TIM Time Base Start
  • TIM Time Base Start Interruption
  • TIM Time Base Start DMA
  • TIM Output Compare/PWM Initialization
  • TIM Output Compare/PWM Channel Configuration
  • TIM Output Compare/PWM Start
  • TIM Output Compare/PWM Start Interruption
  • TIM Output Compare/PWM Start DMA
  • TIM Input Capture Initialization
  • TIM Input Capture Channel Configuration
  • TIM Input Capture Start
  • TIM Input Capture Start Interruption
  • TIM Input Capture Start DMA
  • TIM One Pulse Initialization
  • TIM One Pulse Channel Configuration
  • TIM One Pulse Start
  • TIM Encoder Interface Initialization
  • TIM Encoder Interface Start
  • TIM Encoder Interface Start Interruption
  • TIM Encoder Interface Start DMA
  • Commutation Event configuration with Interruption and DMA
  • TIM OCRef clear configuration
  • TIM External Clock configuration
      ==============================================================================
                          ##### TIMER Generic features #####
      ==============================================================================
      [..] The Timer features include:
           (#) 16-bit up, down, up/down auto-reload counter.
           (#) 16-bit programmable prescaler allowing dividing (also on the fly) the
               counter clock frequency either by any factor between 1 and 65536.
           (#) Up to 4 independent channels for:
               (++) Input Capture
               (++) Output Compare
               (++) PWM generation (Edge and Center-aligned Mode)
               (++) One-pulse mode output
           (#) Synchronization circuit to control the timer with external signals and to interconnect
                several timers together.
           (#) Supports incremental encoder for positioning purposes
    
                ##### How to use this driver #####
      ==============================================================================
        [..]
         (#) Initialize the TIM low level resources by implementing the following functions
             depending on the selected feature:
               (++) Time Base : HAL_TIM_Base_MspInit()
               (++) Input Capture : HAL_TIM_IC_MspInit()
               (++) Output Compare : HAL_TIM_OC_MspInit()
               (++) PWM generation : HAL_TIM_PWM_MspInit()
               (++) One-pulse mode output : HAL_TIM_OnePulse_MspInit()
               (++) Encoder mode output : HAL_TIM_Encoder_MspInit()
    
         (#) Initialize the TIM low level resources :
            (##) Enable the TIM interface clock using __HAL_RCC_TIMx_CLK_ENABLE();
            (##) TIM pins configuration
                (+++) Enable the clock for the TIM GPIOs using the following function:
                 __HAL_RCC_GPIOx_CLK_ENABLE();
                (+++) Configure these TIM pins in Alternate function mode using HAL_GPIO_Init();
    
         (#) The external Clock can be configured, if needed (the default clock is the
             internal clock from the APBx), using the following function:
             HAL_TIM_ConfigClockSource, the clock configuration should be done before
             any start function.
    
         (#) Configure the TIM in the desired functioning mode using one of the
           Initialization function of this driver:
           (++) HAL_TIM_Base_Init: to use the Timer to generate a simple time base
           (++) HAL_TIM_OC_Init and HAL_TIM_OC_ConfigChannel: to use the Timer to generate an
                Output Compare signal.
           (++) HAL_TIM_PWM_Init and HAL_TIM_PWM_ConfigChannel: to use the Timer to generate a
                PWM signal.
           (++) HAL_TIM_IC_Init and HAL_TIM_IC_ConfigChannel: to use the Timer to measure an
                external signal.
           (++) HAL_TIM_OnePulse_Init and HAL_TIM_OnePulse_ConfigChannel: to use the Timer
                in One Pulse Mode.
           (++) HAL_TIM_Encoder_Init: to use the Timer Encoder Interface.
    
         (#) Activate the TIM peripheral using one of the start functions depending from the feature used:
               (++) Time Base : HAL_TIM_Base_Start(), HAL_TIM_Base_Start_DMA(), HAL_TIM_Base_Start_IT()
               (++) Input Capture :  HAL_TIM_IC_Start(), HAL_TIM_IC_Start_DMA(), HAL_TIM_IC_Start_IT()
               (++) Output Compare : HAL_TIM_OC_Start(), HAL_TIM_OC_Start_DMA(), HAL_TIM_OC_Start_IT()
               (++) PWM generation : HAL_TIM_PWM_Start(), HAL_TIM_PWM_Start_DMA(), HAL_TIM_PWM_Start_IT()
               (++) One-pulse mode output : HAL_TIM_OnePulse_Start(), HAL_TIM_OnePulse_Start_IT()
               (++) Encoder mode output : HAL_TIM_Encoder_Start(), HAL_TIM_Encoder_Start_DMA(), HAL_TIM_Encoder_Start_IT().
    
         (#) The DMA Burst is managed with the two following functions:
             HAL_TIM_DMABurst_WriteStart()
             HAL_TIM_DMABurst_ReadStart()
    
        *** Callback registration ***
      =============================================
    
      [..]
      The compilation define  USE_HAL_TIM_REGISTER_CALLBACKS when set to 1
      allows the user to configure dynamically the driver callbacks.
    
      [..]
      Use Function @ref HAL_TIM_RegisterCallback() to register a callback.
      @ref HAL_TIM_RegisterCallback() takes as parameters the HAL peripheral handle,
      the Callback ID and a pointer to the user callback function.
    
      [..]
      Use function @ref HAL_TIM_UnRegisterCallback() to reset a callback to the default
      weak function.
      @ref HAL_TIM_UnRegisterCallback takes as parameters the HAL peripheral handle,
      and the Callback ID.
    
      [..]
      These functions allow to register/unregister following callbacks:
        (+) Base_MspInitCallback              : TIM Base Msp Init Callback.
        (+) Base_MspDeInitCallback            : TIM Base Msp DeInit Callback.
        (+) IC_MspInitCallback                : TIM IC Msp Init Callback.
        (+) IC_MspDeInitCallback              : TIM IC Msp DeInit Callback.
        (+) OC_MspInitCallback                : TIM OC Msp Init Callback.
        (+) OC_MspDeInitCallback              : TIM OC Msp DeInit Callback.
        (+) PWM_MspInitCallback               : TIM PWM Msp Init Callback.
        (+) PWM_MspDeInitCallback             : TIM PWM Msp DeInit Callback.
        (+) OnePulse_MspInitCallback          : TIM One Pulse Msp Init Callback.
        (+) OnePulse_MspDeInitCallback        : TIM One Pulse Msp DeInit Callback.
        (+) Encoder_MspInitCallback           : TIM Encoder Msp Init Callback.
        (+) Encoder_MspDeInitCallback         : TIM Encoder Msp DeInit Callback.
        (+) HallSensor_MspInitCallback        : TIM Hall Sensor Msp Init Callback.
        (+) HallSensor_MspDeInitCallback      : TIM Hall Sensor Msp DeInit Callback.
        (+) PeriodElapsedCallback             : TIM Period Elapsed Callback.
        (+) PeriodElapsedHalfCpltCallback     : TIM Period Elapsed half complete Callback.
        (+) TriggerCallback                   : TIM Trigger Callback.
        (+) TriggerHalfCpltCallback           : TIM Trigger half complete Callback.
        (+) IC_CaptureCallback                : TIM Input Capture Callback.
        (+) IC_CaptureHalfCpltCallback        : TIM Input Capture half complete Callback.
        (+) OC_DelayElapsedCallback           : TIM Output Compare Delay Elapsed Callback.
        (+) PWM_PulseFinishedCallback         : TIM PWM Pulse Finished Callback.
        (+) PWM_PulseFinishedHalfCpltCallback : TIM PWM Pulse Finished half complete Callback.
        (+) ErrorCallback                     : TIM Error Callback.
        (+) CommutationCallback               : TIM Commutation Callback.
        (+) CommutationHalfCpltCallback       : TIM Commutation half complete Callback.
        (+) BreakCallback                     : TIM Break Callback.
        (+) Break2Callback                    : TIM Break2 Callback.
    
      [..]
    By default, after the Init and when the state is HAL_TIM_STATE_RESET
    all interrupt callbacks are set to the corresponding weak functions:
      examples @ref HAL_TIM_TriggerCallback(), @ref HAL_TIM_ErrorCallback().
    
      [..]
      Exception done for MspInit and MspDeInit functions that are reset to the legacy weak
      functionalities in the Init / DeInit only when these callbacks are null
      (not registered beforehand). If not, MspInit or MspDeInit are not null, the Init / DeInit
        keep and use the user MspInit / MspDeInit callbacks(registered beforehand)
    
      [..]
        Callbacks can be registered / unregistered in HAL_TIM_STATE_READY state only.
        Exception done MspInit / MspDeInit that can be registered / unregistered
        in HAL_TIM_STATE_READY or HAL_TIM_STATE_RESET state,
        thus registered(user) MspInit / DeInit callbacks can be used during the Init / DeInit.
      In that case first register the MspInit/MspDeInit user callbacks
          using @ref HAL_TIM_RegisterCallback() before calling DeInit or Init function.
    
      [..]
          When The compilation define USE_HAL_TIM_REGISTER_CALLBACKS is set to 0 or
          not defined, the callback registration feature is not available and all callbacks
          are set to the corresponding weak functions.
Attention

© Copyright (c) 2017 STMicroelectronics. All rights reserved.

This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this file except in compliance with the License. You may obtain a copy of the License at: opensource.org/licenses/BSD-3-Clause

Definition in file stm32l4xx_hal_tim.c.