Synchronization management functions.
More...
Synchronization management functions.
===============================================================================
##### Synchronization management functions #####
===============================================================================
*** TIM Driver: how to use it in synchronization Mode ***
===============================================================================
[..] Case of two/several Timers
(#) 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);
(#) 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)
(#) Configure the Etrenal trigger using this function:
(++) void TIM_ETRConfig(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler,
uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter);
(#) 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);
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 2, 3, 4, 5 and 19 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
-
void TIM_SelectInputTrigger |
( |
TIM_TypeDef * |
TIMx, |
|
|
uint16_t |
TIM_InputTriggerSource |
|
) |
| |
Selects the Input Trigger source.
- Parameters
-
TIMx,: | where x can be 2, 3, 4, 5, 12, 15 and 19 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
-
void TIM_SelectMasterSlaveMode |
( |
TIM_TypeDef * |
TIMx, |
|
|
uint16_t |
TIM_MasterSlaveMode |
|
) |
| |
Sets or Resets the TIMx Master/Slave Mode.
- Parameters
-
TIMx,: | where x can be 2, 3, 4, 5, 12, 15 and 19 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
-
void TIM_SelectOutputTrigger |
( |
TIM_TypeDef * |
TIMx, |
|
|
uint16_t |
TIM_TRGOSource |
|
) |
| |
Selects the TIMx Trigger Output Mode.
- Parameters
-
TIMx,: | where x can be 2, 3, 4, 5, 6, 7, 12, 15, 18 and 19 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
- 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
-
void TIM_SelectSlaveMode |
( |
TIM_TypeDef * |
TIMx, |
|
|
uint16_t |
TIM_SlaveMode |
|
) |
| |
Selects the TIMx Slave Mode.
- Parameters
-
TIMx,: | where x can be 2, 3, 4, 5, 12, 15 and 19 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) re-initializes 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
-