STM8L15x Standard Peripherals Drivers
|
Output Compare management functions. More...
Modules | |
Input Capture management functions | |
Input Capture management functions. | |
Interrupts DMA and flags management functions | |
Interrupts, DMA and flags management functions. | |
Clocks management functions | |
Clocks management functions. | |
Synchronization management functions | |
Synchronization management functions. | |
Specific interface management functions | |
Specific interface management functions. | |
Functions | |
static void | TI1_Config (TIM2_ICPolarity_TypeDef TIM2_ICPolarity, TIM2_ICSelection_TypeDef TIM2_ICSelection, uint8_t TIM2_ICFilter) |
Configure the TI1 as Input. | |
static void | TI2_Config (TIM2_ICPolarity_TypeDef TIM2_ICPolarity, TIM2_ICSelection_TypeDef TIM2_ICSelection, uint8_t TIM2_ICFilter) |
Configure the TI2 as Input. | |
void | TIM2_BKRConfig (TIM2_OSSIState_TypeDef TIM2_OSSIState, TIM2_LockLevel_TypeDef TIM2_LockLevel, TIM2_BreakState_TypeDef TIM2_BreakState, TIM2_BreakPolarity_TypeDef TIM2_BreakPolarity, TIM2_AutomaticOutput_TypeDef TIM2_AutomaticOutput) |
Configures the Break feature, dead time, Lock level, the OSSI, and the AOE(automatic output enable). | |
void | TIM2_CCxCmd (TIM2_Channel_TypeDef TIM2_Channel, FunctionalState NewState) |
Enables or disables the TIM2 Capture Compare Channel x. | |
void | TIM2_CtrlPWMOutputs (FunctionalState NewState) |
Enables or disables the TIM2 peripheral Main Outputs. | |
void | TIM2_ForcedOC1Config (TIM2_ForcedAction_TypeDef TIM2_ForcedAction) |
Forces the TIM2 Channel1 output waveform to active or inactive level. | |
void | TIM2_ForcedOC2Config (TIM2_ForcedAction_TypeDef TIM2_ForcedAction) |
Forces the TIM2 Channel2 output waveform to active or inactive level. | |
void | TIM2_OC1FastConfig (FunctionalState NewState) |
Configures the TIM2 Capture Compare 1 Fast feature. | |
void | TIM2_OC1Init (TIM2_OCMode_TypeDef TIM2_OCMode, TIM2_OutputState_TypeDef TIM2_OutputState, uint16_t TIM2_Pulse, TIM2_OCPolarity_TypeDef TIM2_OCPolarity, TIM2_OCIdleState_TypeDef TIM2_OCIdleState) |
Initializes the TIM2 Channel1 according to the specified parameters. | |
void | TIM2_OC1PolarityConfig (TIM2_OCPolarity_TypeDef TIM2_OCPolarity) |
Configures the TIM2 Channel 1 polarity. | |
void | TIM2_OC1PreloadConfig (FunctionalState NewState) |
Enables or disables the TIM2 peripheral Preload Register on CCR1. | |
void | TIM2_OC2FastConfig (FunctionalState NewState) |
Configures the TIM2 Capture Compare 2 Fast feature. | |
void | TIM2_OC2Init (TIM2_OCMode_TypeDef TIM2_OCMode, TIM2_OutputState_TypeDef TIM2_OutputState, uint16_t TIM2_Pulse, TIM2_OCPolarity_TypeDef TIM2_OCPolarity, TIM2_OCIdleState_TypeDef TIM2_OCIdleState) |
Initializes the TIM2 Channel2 according to the specified parameters. | |
void | TIM2_OC2PolarityConfig (TIM2_OCPolarity_TypeDef TIM2_OCPolarity) |
Configures the TIM2 Channel 2 polarity. | |
void | TIM2_OC2PreloadConfig (FunctionalState NewState) |
Enables or disables the TIM2 peripheral Preload Register on CCR2. | |
void | TIM2_SelectOCxM (TIM2_Channel_TypeDef TIM2_Channel, TIM2_OCMode_TypeDef TIM2_OCMode) |
Selects the TIM2 Output Compare Mode. | |
void | TIM2_SetCompare1 (uint16_t Compare) |
Sets the TIM2 Capture Compare1 Register value. | |
void | TIM2_SetCompare2 (uint16_t Compare) |
Sets the TIM2 Capture Compare2 Register value. |
Detailed Description
Output Compare management functions.
=============================================================================== Output Compare management functions =============================================================================== =================================================================== TIM2 Driver: how to use it in Output Compare Mode =================================================================== To use the Timer in Output Compare mode, the following steps are mandatory: 1. Enable TIM2 clock using CLK_PeripheralClockConfig(CLK_Peripheral_TIM2, ENABLE) function. 2. Configure the TIM2 pins in output mode by configuring the corresponding GPIO pins 3. Configure the Time base unit as described in the first part of this driver, if needed, otherwise the Timer will run with the default configuration: - Autoreload value = 0xFFFF - Prescaler value = 0x0000 - Counter mode = Up counting 4. Call TIM2_OCxInit() to configure the channel x with the desired parameters including: - TIM2 Output Compare mode: TIM2_OCMode - TIM2 Output State: TIM2_OutputState - TIM2 Pulse value: TIM2_Pulse - TIM2 Output Compare Polarity: TIM2_OCPolarity - TIM2 Output Idle State: TIM2_OCIdleState 5. Call the TIM2_Cmd(ENABLE) function to enable the TIM2 counter. Note1: All other functions can be used separately to modify, if needed, a specific feature of the Timer. Note2: If the corresponding interrupt or DMA request are needed, the user should: 1. Enable global interrupts (or the DMA) to use the TIM2 interrupts (or DMA requests). 2. Enable the corresponding interrupt (or DMA request) using the function TIM2_ITConfig(TIM2_IT_CCx) (or TIM2_DMACmd(TIM2_DMASource_CCx))
Function Documentation
static void TI1_Config | ( | TIM2_ICPolarity_TypeDef | TIM2_ICPolarity, |
TIM2_ICSelection_TypeDef | TIM2_ICSelection, | ||
uint8_t | TIM2_ICFilter | ||
) | [static] |
Configure the TI1 as Input.
Definition at line 2044 of file stm8l15x_tim2.c.
References IS_TIM2_IC_FILTER, IS_TIM2_IC_POLARITY, IS_TIM2_IC_SELECTION, TIM2, TIM2_ICPolarity_Falling, TIM_CCER1_CC1E, TIM_CCER1_CC1P, TIM_CCMR_CCxS, and TIM_CCMR_ICxF.
Referenced by TIM2_ICInit(), TIM2_PWMIConfig(), and TIM2_TIxExternalClockConfig().
static void TI2_Config | ( | TIM2_ICPolarity_TypeDef | TIM2_ICPolarity, |
TIM2_ICSelection_TypeDef | TIM2_ICSelection, | ||
uint8_t | TIM2_ICFilter | ||
) | [static] |
Configure the TI2 as Input.
Definition at line 2095 of file stm8l15x_tim2.c.
References IS_TIM2_IC_FILTER, IS_TIM2_IC_POLARITY, IS_TIM2_IC_SELECTION, TIM2, TIM2_ICPolarity_Falling, TIM_CCER1_CC2E, TIM_CCER1_CC2P, TIM_CCMR_CCxS, and TIM_CCMR_ICxF.
Referenced by TIM2_ICInit(), TIM2_PWMIConfig(), and TIM2_TIxExternalClockConfig().
void TIM2_BKRConfig | ( | TIM2_OSSIState_TypeDef | TIM2_OSSIState, |
TIM2_LockLevel_TypeDef | TIM2_LockLevel, | ||
TIM2_BreakState_TypeDef | TIM2_BreakState, | ||
TIM2_BreakPolarity_TypeDef | TIM2_BreakPolarity, | ||
TIM2_AutomaticOutput_TypeDef | TIM2_AutomaticOutput | ||
) |
Configures the Break feature, dead time, Lock level, the OSSI, and the AOE(automatic output enable).
Definition at line 748 of file stm8l15x_tim2.c.
References IS_TIM2_AUTOMATIC_OUTPUT_STATE, IS_TIM2_BREAK_POLARITY, IS_TIM2_BREAK_STATE, IS_TIM2_LOCK_LEVEL, IS_TIM2_OSSI_STATE, and TIM2.
void TIM2_CCxCmd | ( | TIM2_Channel_TypeDef | TIM2_Channel, |
FunctionalState | NewState | ||
) |
Enables or disables the TIM2 Capture Compare Channel x.
Definition at line 1068 of file stm8l15x_tim2.c.
References DISABLE, IS_FUNCTIONAL_STATE, IS_TIM2_CHANNEL, TIM2, TIM2_Channel_1, TIM_CCER1_CC1E, and TIM_CCER1_CC2E.
void TIM2_CtrlPWMOutputs | ( | FunctionalState | NewState | ) |
Enables or disables the TIM2 peripheral Main Outputs.
Definition at line 777 of file stm8l15x_tim2.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM2, and TIM_BKR_MOE.
void TIM2_ForcedOC1Config | ( | TIM2_ForcedAction_TypeDef | TIM2_ForcedAction | ) |
Forces the TIM2 Channel1 output waveform to active or inactive level.
Definition at line 877 of file stm8l15x_tim2.c.
References IS_TIM2_FORCED_ACTION, TIM2, and TIM_CCMR_OCM.
void TIM2_ForcedOC2Config | ( | TIM2_ForcedAction_TypeDef | TIM2_ForcedAction | ) |
Forces the TIM2 Channel2 output waveform to active or inactive level.
Definition at line 903 of file stm8l15x_tim2.c.
References IS_TIM2_FORCED_ACTION, TIM2, and TIM_CCMR_OCM.
void TIM2_OC1FastConfig | ( | FunctionalState | NewState | ) |
Configures the TIM2 Capture Compare 1 Fast feature.
Definition at line 971 of file stm8l15x_tim2.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM2, and TIM_CCMR_OCxFE.
void TIM2_OC1Init | ( | TIM2_OCMode_TypeDef | TIM2_OCMode, |
TIM2_OutputState_TypeDef | TIM2_OutputState, | ||
uint16_t | TIM2_Pulse, | ||
TIM2_OCPolarity_TypeDef | TIM2_OCPolarity, | ||
TIM2_OCIdleState_TypeDef | TIM2_OCIdleState | ||
) |
Initializes the TIM2 Channel1 according to the specified parameters.
Definition at line 572 of file stm8l15x_tim2.c.
References IS_TIM2_OC_MODE, IS_TIM2_OC_POLARITY, IS_TIM2_OCIDLE_STATE, IS_TIM2_OUTPUT_STATE, TIM2, TIM2_OCIdleState_Set, TIM2_OCPolarity_Low, TIM2_OutputState_Enable, TIM_CCER1_CC1E, TIM_CCER1_CC1P, TIM_CCMR_OCM, and TIM_OISR_OIS1.
void TIM2_OC1PolarityConfig | ( | TIM2_OCPolarity_TypeDef | TIM2_OCPolarity | ) |
Configures the TIM2 Channel 1 polarity.
Definition at line 1018 of file stm8l15x_tim2.c.
References IS_TIM2_OC_POLARITY, TIM2, TIM2_OCPolarity_Low, and TIM_CCER1_CC1P.
void TIM2_OC1PreloadConfig | ( | FunctionalState | NewState | ) |
Enables or disables the TIM2 peripheral Preload Register on CCR1.
Definition at line 927 of file stm8l15x_tim2.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM2, and TIM_CCMR_OCxPE.
void TIM2_OC2FastConfig | ( | FunctionalState | NewState | ) |
Configures the TIM2 Capture Compare 2 Fast feature.
Definition at line 994 of file stm8l15x_tim2.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM2, and TIM_CCMR_OCxFE.
void TIM2_OC2Init | ( | TIM2_OCMode_TypeDef | TIM2_OCMode, |
TIM2_OutputState_TypeDef | TIM2_OutputState, | ||
uint16_t | TIM2_Pulse, | ||
TIM2_OCPolarity_TypeDef | TIM2_OCPolarity, | ||
TIM2_OCIdleState_TypeDef | TIM2_OCIdleState | ||
) |
Initializes the TIM2 Channel2 according to the specified parameters.
Definition at line 658 of file stm8l15x_tim2.c.
References IS_TIM2_OC_MODE, IS_TIM2_OC_POLARITY, IS_TIM2_OCIDLE_STATE, IS_TIM2_OUTPUT_STATE, TIM2, TIM2_OCIdleState_Set, TIM2_OCPolarity_Low, TIM2_OutputState_Enable, TIM_CCER1_CC2E, TIM_CCER1_CC2P, TIM_CCMR_OCM, and TIM_OISR_OIS2.
void TIM2_OC2PolarityConfig | ( | TIM2_OCPolarity_TypeDef | TIM2_OCPolarity | ) |
Configures the TIM2 Channel 2 polarity.
Definition at line 1042 of file stm8l15x_tim2.c.
References IS_TIM2_OC_POLARITY, TIM2, TIM2_OCPolarity_Low, and TIM_CCER1_CC2P.
void TIM2_OC2PreloadConfig | ( | FunctionalState | NewState | ) |
Enables or disables the TIM2 peripheral Preload Register on CCR2.
Definition at line 949 of file stm8l15x_tim2.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM2, and TIM_CCMR_OCxPE.
void TIM2_SelectOCxM | ( | TIM2_Channel_TypeDef | TIM2_Channel, |
TIM2_OCMode_TypeDef | TIM2_OCMode | ||
) |
Selects the TIM2 Output Compare Mode.
This function disables the selected channel before changing the Output Compare Mode. User has to enable this channel using TIM2_CCxCmd and TIM2_CCxNCmd functions.
Definition at line 812 of file stm8l15x_tim2.c.
References IS_TIM2_CHANNEL, IS_TIM2_OCM, TIM2, TIM2_Channel_1, TIM_CCER1_CC1E, TIM_CCER1_CC2E, and TIM_CCMR_OCM.
void TIM2_SetCompare1 | ( | uint16_t | Compare | ) |
Sets the TIM2 Capture Compare1 Register value.
Definition at line 849 of file stm8l15x_tim2.c.
References TIM2.
void TIM2_SetCompare2 | ( | uint16_t | Compare | ) |
Sets the TIM2 Capture Compare2 Register value.
Definition at line 862 of file stm8l15x_tim2.c.
References TIM2.