STM8L15x Standard Peripherals Drivers
|
Input Capture management functions. More...
Functions | |
uint16_t | TIM1_GetCapture1 (void) |
Gets the TIM1 Input Capture 1 value. | |
uint16_t | TIM1_GetCapture2 (void) |
Gets the TIM1 Input Capture 2 value. | |
uint16_t | TIM1_GetCapture3 (void) |
Gets the TIM1 Input Capture 3 value. | |
uint16_t | TIM1_GetCapture4 (void) |
Gets the TIM1 Input Capture 4 value. | |
void | TIM1_ICInit (TIM1_Channel_TypeDef TIM1_Channel, TIM1_ICPolarity_TypeDef TIM1_ICPolarity, TIM1_ICSelection_TypeDef TIM1_ICSelection, TIM1_ICPSC_TypeDef TIM1_ICPrescaler, uint8_t TIM1_ICFilter) |
Initializes the TIM1 peripheral according to the specified parameters. | |
void | TIM1_PWMIConfig (TIM1_Channel_TypeDef TIM1_Channel, TIM1_ICPolarity_TypeDef TIM1_ICPolarity, TIM1_ICSelection_TypeDef TIM1_ICSelection, TIM1_ICPSC_TypeDef TIM1_ICPrescaler, uint8_t TIM1_ICFilter) |
Configures the TIM1 peripheral in PWM Input Mode according to the specified parameters. | |
void | TIM1_SetIC1Prescaler (TIM1_ICPSC_TypeDef TIM1_IC1Prescaler) |
Sets the TIM1 Input Capture 1 prescaler. | |
void | TIM1_SetIC2Prescaler (TIM1_ICPSC_TypeDef TIM1_IC2Prescaler) |
Sets the TIM1 Input Capture 2 prescaler. | |
void | TIM1_SetIC3Prescaler (TIM1_ICPSC_TypeDef TIM1_IC3Prescaler) |
Sets the TIM1 Input Capture 3 prescaler. | |
void | TIM1_SetIC4Prescaler (TIM1_ICPSC_TypeDef TIM1_IC4Prescaler) |
Sets the TIM1 Input Capture 4 prescaler. |
Detailed Description
Input Capture management functions.
=============================================================================== Input Capture management functions =============================================================================== =================================================================== TIM1 Driver: how to use it in Input Capture Mode =================================================================== To use the Timer in Input Capture mode, the following steps are mandatory: 1. Enable TIM1 clock using CLK_PeripheralClockConfig(CLK_Peripheral_TIM1, ENABLE) function. 2. Configure the TIM1 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 = 0x0000 - Counter mode = Up counting 4. Call TIM1_ICInit() to configure the desired channel to measure only frequency or duty cycle of the input signal using the corresponding configuration: - TIM1 Channel: TIM1_Channel - TIM1 Input Capture polarity: TIM1_ICPolarity - TIM1 Input Capture selection: TIM1_ICSelection - TIM1 Input Capture Prescaler: TIM1_ICPSC - TIM1 Input Capture filter value or, Call TIM1_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 TIM1_ITConfig(TIM1_IT_CCx) (or TIM1_DMACmd(TIM1_DMASource_CCx)) 7. Call the TIM1_Cmd(ENABLE) function to enable the TIM1 counter. 8. Use TIM1_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 TIM1_GetCapture1 | ( | void | ) |
Gets the TIM1 Input Capture 1 value.
Definition at line 1797 of file stm8l15x_tim1.c.
References TIM1.
uint16_t TIM1_GetCapture2 | ( | void | ) |
Gets the TIM1 Input Capture 2 value.
Definition at line 1818 of file stm8l15x_tim1.c.
References TIM1.
uint16_t TIM1_GetCapture3 | ( | void | ) |
Gets the TIM1 Input Capture 3 value.
Definition at line 1839 of file stm8l15x_tim1.c.
References TIM1.
uint16_t TIM1_GetCapture4 | ( | void | ) |
Gets the TIM1 Input Capture 4 value.
Definition at line 1859 of file stm8l15x_tim1.c.
References TIM1.
void TIM1_ICInit | ( | TIM1_Channel_TypeDef | TIM1_Channel, |
TIM1_ICPolarity_TypeDef | TIM1_ICPolarity, | ||
TIM1_ICSelection_TypeDef | TIM1_ICSelection, | ||
TIM1_ICPSC_TypeDef | TIM1_ICPrescaler, | ||
uint8_t | TIM1_ICFilter | ||
) |
Initializes the TIM1 peripheral according to the specified parameters.
- Note:
- If the channel 3 is selected the TIM1_ICSelection_IndirectTI parameter is forbidden.
- If the channel 4 is selected the TIM1_ICSelection_DirectTI parameter is forbidden.
Definition at line 1658 of file stm8l15x_tim1.c.
References IS_TIM1_CHANNEL, IS_TIM1_IC_FILTER, IS_TIM1_IC_POLARITY, IS_TIM1_IC_PRESCALER, IS_TIM1_IC_SELECTION, TI1_Config(), TI2_Config(), TI3_Config(), TI4_Config(), TIM1_Channel_1, TIM1_Channel_2, TIM1_Channel_3, TIM1_SetIC1Prescaler(), TIM1_SetIC2Prescaler(), TIM1_SetIC3Prescaler(), and TIM1_SetIC4Prescaler().
void TIM1_PWMIConfig | ( | TIM1_Channel_TypeDef | TIM1_Channel, |
TIM1_ICPolarity_TypeDef | TIM1_ICPolarity, | ||
TIM1_ICSelection_TypeDef | TIM1_ICSelection, | ||
TIM1_ICPSC_TypeDef | TIM1_ICPrescaler, | ||
uint8_t | TIM1_ICFilter | ||
) |
Configures the TIM1 peripheral in PWM Input Mode according to the specified parameters.
Definition at line 1727 of file stm8l15x_tim1.c.
References IS_TIM1_IC_POLARITY, IS_TIM1_IC_PRESCALER, IS_TIM1_IC_SELECTION, IS_TIM1_PWMI_CHANNEL, TI1_Config(), TI2_Config(), TIM1_Channel_1, TIM1_ICPolarity_Falling, TIM1_ICPolarity_Rising, TIM1_ICSelection_DirectTI, TIM1_ICSelection_IndirectTI, TIM1_SetIC1Prescaler(), and TIM1_SetIC2Prescaler().
void TIM1_SetIC1Prescaler | ( | TIM1_ICPSC_TypeDef | TIM1_IC1Prescaler | ) |
Sets the TIM1 Input Capture 1 prescaler.
Definition at line 1884 of file stm8l15x_tim1.c.
References IS_TIM1_IC_PRESCALER, TIM1, and TIM1_CCMR_ICxPSC.
Referenced by TIM1_ICInit(), and TIM1_PWMIConfig().
void TIM1_SetIC2Prescaler | ( | TIM1_ICPSC_TypeDef | TIM1_IC2Prescaler | ) |
Sets the TIM1 Input Capture 2 prescaler.
Definition at line 1903 of file stm8l15x_tim1.c.
References IS_TIM1_IC_PRESCALER, TIM1, and TIM1_CCMR_ICxPSC.
Referenced by TIM1_ICInit(), and TIM1_PWMIConfig().
void TIM1_SetIC3Prescaler | ( | TIM1_ICPSC_TypeDef | TIM1_IC3Prescaler | ) |
Sets the TIM1 Input Capture 3 prescaler.
Definition at line 1922 of file stm8l15x_tim1.c.
References IS_TIM1_IC_PRESCALER, TIM1, and TIM1_CCMR_ICxPSC.
Referenced by TIM1_ICInit().
void TIM1_SetIC4Prescaler | ( | TIM1_ICPSC_TypeDef | TIM1_IC4Prescaler | ) |
Sets the TIM1 Input Capture 4 prescaler.
Definition at line 1942 of file stm8l15x_tim1.c.
References IS_TIM1_IC_PRESCALER, TIM1, and TIM1_CCMR_ICxPSC.
Referenced by TIM1_ICInit().