STM8L15x Standard Peripherals Drivers
|
Input Capture management functions. More...
Functions | |
uint16_t | TIM5_GetCapture1 (void) |
Gets the TIM5 Input Capture 1 value. | |
uint16_t | TIM5_GetCapture2 (void) |
Gets the TIM5 Input Capture 2 value. | |
void | TIM5_ICInit (TIM5_Channel_TypeDef TIM5_Channel, TIM5_ICPolarity_TypeDef TIM5_ICPolarity, TIM5_ICSelection_TypeDef TIM5_ICSelection, TIM5_ICPSC_TypeDef TIM5_ICPrescaler, uint8_t TIM5_ICFilter) |
Initializes the TIM5 peripheral according to the specified parameters. | |
void | TIM5_PWMIConfig (TIM5_Channel_TypeDef TIM5_Channel, TIM5_ICPolarity_TypeDef TIM5_ICPolarity, TIM5_ICSelection_TypeDef TIM5_ICSelection, TIM5_ICPSC_TypeDef TIM5_ICPrescaler, uint8_t TIM5_ICFilter) |
Configures the TIM5 peripheral in PWM Input Mode according to the specified parameters. | |
void | TIM5_SetIC1Prescaler (TIM5_ICPSC_TypeDef TIM5_IC1Prescaler) |
Sets the TIM5 Input Capture 1 prescaler. | |
void | TIM5_SetIC2Prescaler (TIM5_ICPSC_TypeDef TIM5_IC2Prescaler) |
Sets the TIM5 Input Capture 2 prescaler. |
Detailed Description
Input Capture management functions.
=============================================================================== Input Capture management functions =============================================================================== =================================================================== TIM5 Driver: how to use it in Input Capture Mode =================================================================== To use the Timer in Input Capture mode, the following steps are mandatory: 1. Enable TIM5 clock using CLK_PeripheralClockConfig(CLK_Peripheral_TIM5, ENABLE) function. 2. Configure the TIM5 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 TIM5_ICInit() to configure the desired channel to measure only frequency or duty cycle of the input signal using the corresponding configuration: - TIM5 Channel: TIM5_Channel - TIM5 Input Capture polarity: TIM5_ICPolarity - TIM5 Input Capture selection: TIM5_ICSelection - TIM5 Input Capture Prescaler: TIM5_ICPSC - TIM5 Input Capture filter value or, Call TIM5_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 TIM5_ITConfig(TIM5_IT_CCx) (or TIM5_DMACmd(TIM5_DMASource_CCx)) 7. Call the TIM5_Cmd(ENABLE) function to enable the TIM5 counter. 8. Use TIM5_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 TIM5_GetCapture1 | ( | void | ) |
Gets the TIM5 Input Capture 1 value.
Definition at line 1298 of file stm8l15x_tim5.c.
References TIM5.
uint16_t TIM5_GetCapture2 | ( | void | ) |
Gets the TIM5 Input Capture 2 value.
Definition at line 1317 of file stm8l15x_tim5.c.
References TIM5.
void TIM5_ICInit | ( | TIM5_Channel_TypeDef | TIM5_Channel, |
TIM5_ICPolarity_TypeDef | TIM5_ICPolarity, | ||
TIM5_ICSelection_TypeDef | TIM5_ICSelection, | ||
TIM5_ICPSC_TypeDef | TIM5_ICPrescaler, | ||
uint8_t | TIM5_ICFilter | ||
) |
Initializes the TIM5 peripheral according to the specified parameters.
Definition at line 1178 of file stm8l15x_tim5.c.
References IS_TIM5_CHANNEL, TI1_Config(), TI2_Config(), TIM5_Channel_1, TIM5_SetIC1Prescaler(), and TIM5_SetIC2Prescaler().
void TIM5_PWMIConfig | ( | TIM5_Channel_TypeDef | TIM5_Channel, |
TIM5_ICPolarity_TypeDef | TIM5_ICPolarity, | ||
TIM5_ICSelection_TypeDef | TIM5_ICSelection, | ||
TIM5_ICPSC_TypeDef | TIM5_ICPrescaler, | ||
uint8_t | TIM5_ICFilter | ||
) |
Configures the TIM5 peripheral in PWM Input Mode according to the specified parameters.
Definition at line 1229 of file stm8l15x_tim5.c.
References IS_TIM5_CHANNEL, TI1_Config(), TI2_Config(), TIM5_Channel_1, TIM5_ICPolarity_Falling, TIM5_ICPolarity_Rising, TIM5_ICSelection_DirectTI, TIM5_ICSelection_IndirectTI, TIM5_SetIC1Prescaler(), and TIM5_SetIC2Prescaler().
void TIM5_SetIC1Prescaler | ( | TIM5_ICPSC_TypeDef | TIM5_IC1Prescaler | ) |
Sets the TIM5 Input Capture 1 prescaler.
Definition at line 1341 of file stm8l15x_tim5.c.
References IS_TIM5_IC_PRESCALER, TIM5, and TIM_CCMR_ICxPSC.
Referenced by TIM5_ICInit(), and TIM5_PWMIConfig().
void TIM5_SetIC2Prescaler | ( | TIM5_ICPSC_TypeDef | TIM5_IC2Prescaler | ) |
Sets the TIM5 Input Capture 2 prescaler.
Definition at line 1369 of file stm8l15x_tim5.c.
References IS_TIM5_IC_PRESCALER, TIM5, and TIM_CCMR_ICxPSC.
Referenced by TIM5_ICInit(), and TIM5_PWMIConfig().