STM8L15x Standard Peripherals Drivers
|
Input Capture management functions. More...
Functions | |
uint16_t | TIM3_GetCapture1 (void) |
Gets the TIM3 Input Capture 1 value. | |
uint16_t | TIM3_GetCapture2 (void) |
Gets the TIM3 Input Capture 2 value. | |
void | TIM3_ICInit (TIM3_Channel_TypeDef TIM3_Channel, TIM3_ICPolarity_TypeDef TIM3_ICPolarity, TIM3_ICSelection_TypeDef TIM3_ICSelection, TIM3_ICPSC_TypeDef TIM3_ICPrescaler, uint8_t TIM3_ICFilter) |
Initializes the TIM3 peripheral according to the specified parameters. | |
void | TIM3_PWMIConfig (TIM3_Channel_TypeDef TIM3_Channel, TIM3_ICPolarity_TypeDef TIM3_ICPolarity, TIM3_ICSelection_TypeDef TIM3_ICSelection, TIM3_ICPSC_TypeDef TIM3_ICPrescaler, uint8_t TIM3_ICFilter) |
Configures the TIM3 peripheral in PWM Input Mode according to the specified parameters. | |
void | TIM3_SetIC1Prescaler (TIM3_ICPSC_TypeDef TIM3_IC1Prescaler) |
Sets the TIM3 Input Capture 1 prescaler. | |
void | TIM3_SetIC2Prescaler (TIM3_ICPSC_TypeDef TIM3_IC2Prescaler) |
Sets the TIM3 Input Capture 2 prescaler. |
Detailed Description
Input Capture management functions.
=============================================================================== Input Capture management functions =============================================================================== =================================================================== TIM3 Driver: how to use it in Input Capture Mode =================================================================== To use the Timer in Input Capture mode, the following steps are mandatory: 1. Enable TIM3 clock using CLK_PeripheralClockConfig(CLK_Peripheral_TIM3, ENABLE) function. 2. Configure the TIM3 pins in input 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 = 0x0 - Counter mode = Up counting 4. Call TIM3_ICInit() to configure the desired channel to measure only frequency or duty cycle of the input signal using the corresponding configuration: - TIM3 Channel: TIM3_Channel - TIM3 Input Capture polarity: TIM3_ICPolarity - TIM3 Input Capture selection: TIM3_ICSelection - TIM3 Input Capture Prescaler: TIM3_ICPSC - TIM3 Input Capture filter value or, Call TIM3_PWMIConfig() to configure the desired channels with the corresponding configuration and to measure the frequency and the duty cycle of the input signal. 5. Enable global interrupts or the DMA to read the measured frequency. 6. Enable the corresponding interrupt (or DMA request) to read the captured value, using the function TIM3_ITConfig(TIM3_IT_CCx) (or TIM3_DMACmd(TIM3_DMASource_CCx)) 7. Call the TIM3_Cmd(ENABLE) function to enable the TIM3 counter. 8. Use TIM3_GetCapturex() to read the captured value corresponding to channel x. Note1: All other functions can be used separately to modify, if needed, a specific feature of the Timer.
Function Documentation
uint16_t TIM3_GetCapture1 | ( | void | ) |
Gets the TIM3 Input Capture 1 value.
Definition at line 1298 of file stm8l15x_tim3.c.
References TIM3.
uint16_t TIM3_GetCapture2 | ( | void | ) |
Gets the TIM3 Input Capture 2 value.
Definition at line 1317 of file stm8l15x_tim3.c.
References TIM3.
void TIM3_ICInit | ( | TIM3_Channel_TypeDef | TIM3_Channel, |
TIM3_ICPolarity_TypeDef | TIM3_ICPolarity, | ||
TIM3_ICSelection_TypeDef | TIM3_ICSelection, | ||
TIM3_ICPSC_TypeDef | TIM3_ICPrescaler, | ||
uint8_t | TIM3_ICFilter | ||
) |
Initializes the TIM3 peripheral according to the specified parameters.
Definition at line 1178 of file stm8l15x_tim3.c.
References IS_TIM3_CHANNEL, TI1_Config(), TI2_Config(), TIM3_Channel_1, TIM3_SetIC1Prescaler(), and TIM3_SetIC2Prescaler().
void TIM3_PWMIConfig | ( | TIM3_Channel_TypeDef | TIM3_Channel, |
TIM3_ICPolarity_TypeDef | TIM3_ICPolarity, | ||
TIM3_ICSelection_TypeDef | TIM3_ICSelection, | ||
TIM3_ICPSC_TypeDef | TIM3_ICPrescaler, | ||
uint8_t | TIM3_ICFilter | ||
) |
Configures the TIM3 peripheral in PWM Input Mode according to the specified parameters.
Definition at line 1229 of file stm8l15x_tim3.c.
References IS_TIM3_CHANNEL, TI1_Config(), TI2_Config(), TIM3_Channel_1, TIM3_ICPolarity_Falling, TIM3_ICPolarity_Rising, TIM3_ICSelection_DirectTI, TIM3_ICSelection_IndirectTI, TIM3_SetIC1Prescaler(), and TIM3_SetIC2Prescaler().
void TIM3_SetIC1Prescaler | ( | TIM3_ICPSC_TypeDef | TIM3_IC1Prescaler | ) |
Sets the TIM3 Input Capture 1 prescaler.
Definition at line 1341 of file stm8l15x_tim3.c.
References IS_TIM3_IC_PRESCALER, TIM3, and TIM_CCMR_ICxPSC.
Referenced by TIM3_ICInit(), and TIM3_PWMIConfig().
void TIM3_SetIC2Prescaler | ( | TIM3_ICPSC_TypeDef | TIM3_IC2Prescaler | ) |
Sets the TIM3 Input Capture 2 prescaler.
Definition at line 1369 of file stm8l15x_tim3.c.
References IS_TIM3_IC_PRESCALER, TIM3, and TIM_CCMR_ICxPSC.
Referenced by TIM3_ICInit(), and TIM3_PWMIConfig().