STM32F4 Standard Peripheral bibliotheek  1.0
ST Microelectronics bibliotheek documentatie voor de STM32F4 Standard Peripheral Library
 All Data Structures Files Functions Variables Enumerations Enumerator Groups
Synchronization management functions

Synchronization management functions. More...

Functions

void TIM_SelectInputTrigger (TIM_TypeDef *TIMx, uint16_t TIM_InputTriggerSource)
 Selects the Input Trigger source. More...
 
void TIM_SelectOutputTrigger (TIM_TypeDef *TIMx, uint16_t TIM_TRGOSource)
 Selects the TIMx Trigger Output Mode. More...
 
void TIM_SelectSlaveMode (TIM_TypeDef *TIMx, uint16_t TIM_SlaveMode)
 Selects the TIMx Slave Mode. More...
 
void TIM_SelectMasterSlaveMode (TIM_TypeDef *TIMx, uint16_t TIM_MasterSlaveMode)
 Sets or Resets the TIMx Master/Slave Mode. More...
 
void TIM_ETRConfig (TIM_TypeDef *TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter)
 Configures the TIMx External Trigger (ETR). More...
 

Detailed Description

Synchronization management functions.

 ===============================================================================
                       Synchronization management functions
 ===============================================================================  
                   
       ===================================================================      
              TIM Driver: how to use it in synchronization Mode
       =================================================================== 
       Case of two/several Timers
       **************************
       1. Configure the Master Timers using the following functions:
          - void TIM_SelectOutputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_TRGOSource); 
          - void TIM_SelectMasterSlaveMode(TIM_TypeDef* TIMx, uint16_t TIM_MasterSlaveMode);  
       2. Configure the Slave Timers using the following functions: 
          - void TIM_SelectInputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource);  
          - void TIM_SelectSlaveMode(TIM_TypeDef* TIMx, uint16_t TIM_SlaveMode); 
          
       Case of Timers and external trigger(ETR pin)
       ********************************************       
       1. Configure the External trigger using this function:
          - void TIM_ETRConfig(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity,
                               uint16_t ExtTRGFilter);
       2. Configure the Slave Timers using the following functions: 
          - void TIM_SelectInputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource);  
          - void TIM_SelectSlaveMode(TIM_TypeDef* TIMx, uint16_t TIM_SlaveMode); 

Function Documentation

void TIM_ETRConfig ( TIM_TypeDef *  TIMx,
uint16_t  TIM_ExtTRGPrescaler,
uint16_t  TIM_ExtTRGPolarity,
uint16_t  ExtTRGFilter 
)

Configures the TIMx External Trigger (ETR).

Parameters
TIMx,:where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral.
TIM_ExtTRGPrescaler,:The external Trigger Prescaler. This parameter can be one of the following values:
  • TIM_ExtTRGPSC_OFF: ETRP Prescaler OFF.
  • TIM_ExtTRGPSC_DIV2: ETRP frequency divided by 2.
  • TIM_ExtTRGPSC_DIV4: ETRP frequency divided by 4.
  • TIM_ExtTRGPSC_DIV8: ETRP frequency divided by 8.
TIM_ExtTRGPolarity,:The external Trigger Polarity. This parameter can be one of the following values:
  • TIM_ExtTRGPolarity_Inverted: active low or falling edge active.
  • TIM_ExtTRGPolarity_NonInverted: active high or rising edge active.
ExtTRGFilter,:External Trigger Filter. This parameter must be a value between 0x00 and 0x0F
Return values
None
void TIM_SelectInputTrigger ( TIM_TypeDef *  TIMx,
uint16_t  TIM_InputTriggerSource 
)

Selects the Input Trigger source.

Parameters
TIMx,:where x can be 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13 or 14 to select the TIM peripheral.
TIM_InputTriggerSource,:The Input Trigger source. This parameter can be one of the following values:
  • TIM_TS_ITR0: Internal Trigger 0
  • TIM_TS_ITR1: Internal Trigger 1
  • TIM_TS_ITR2: Internal Trigger 2
  • TIM_TS_ITR3: Internal Trigger 3
  • TIM_TS_TI1F_ED: TI1 Edge Detector
  • TIM_TS_TI1FP1: Filtered Timer Input 1
  • TIM_TS_TI2FP2: Filtered Timer Input 2
  • TIM_TS_ETRF: External Trigger input
Return values
None
void TIM_SelectMasterSlaveMode ( TIM_TypeDef *  TIMx,
uint16_t  TIM_MasterSlaveMode 
)

Sets or Resets the TIMx Master/Slave Mode.

Parameters
TIMx,:where x can be 1, 2, 3, 4, 5, 8, 9 or 12 to select the TIM peripheral.
TIM_MasterSlaveMode,:specifies the Timer Master Slave Mode. This parameter can be one of the following values:
  • TIM_MasterSlaveMode_Enable: synchronization between the current timer and its slaves (through TRGO)
  • TIM_MasterSlaveMode_Disable: No action
Return values
None
void TIM_SelectOutputTrigger ( TIM_TypeDef *  TIMx,
uint16_t  TIM_TRGOSource 
)

Selects the TIMx Trigger Output Mode.

Parameters
TIMx,:where x can be 1, 2, 3, 4, 5, 6, 7 or 8 to select the TIM peripheral.
TIM_TRGOSource,:specifies the Trigger Output source. This parameter can be one of the following values:
  • For all TIMx
    • TIM_TRGOSource_Reset: The UG bit in the TIM_EGR register is used as the trigger output(TRGO)
    • TIM_TRGOSource_Enable: The Counter Enable CEN is used as the trigger output(TRGO)
    • TIM_TRGOSource_Update: The update event is selected as the trigger output(TRGO)
  • For all TIMx except TIM6 and TIM7
    • TIM_TRGOSource_OC1: The trigger output sends a positive pulse when the CC1IF flag is to be set, as soon as a capture or compare match occurs(TRGO)
    • TIM_TRGOSource_OC1Ref: OC1REF signal is used as the trigger output(TRGO)
    • TIM_TRGOSource_OC2Ref: OC2REF signal is used as the trigger output(TRGO)
    • TIM_TRGOSource_OC3Ref: OC3REF signal is used as the trigger output(TRGO)
    • TIM_TRGOSource_OC4Ref: OC4REF signal is used as the trigger output(TRGO)
    Return values
    None
void TIM_SelectSlaveMode ( TIM_TypeDef *  TIMx,
uint16_t  TIM_SlaveMode 
)

Selects the TIMx Slave Mode.

Parameters
TIMx,:where x can be 1, 2, 3, 4, 5, 8, 9 or 12 to select the TIM peripheral.
TIM_SlaveMode,:specifies the Timer Slave Mode. This parameter can be one of the following values:
  • TIM_SlaveMode_Reset: Rising edge of the selected trigger signal(TRGI) reinitialize the counter and triggers an update of the registers
  • TIM_SlaveMode_Gated: The counter clock is enabled when the trigger signal (TRGI) is high
  • TIM_SlaveMode_Trigger: The counter starts at a rising edge of the trigger TRGI
  • TIM_SlaveMode_External1: Rising edges of the selected trigger (TRGI) clock the counter
Return values
None