STM8L15x Standard Peripherals Drivers
|
stm8l15x_tim2.h File Reference
This file contains all the functions prototypes for the TIM2 firmware library. More...
#include "stm8l15x.h"
Go to the source code of this file.
Defines | |
#define | IS_TIM2_AUTOMATIC_OUTPUT_STATE(STATE) |
Macro TIM2 AOE Bit Set/Reset. | |
#define | IS_TIM2_BREAK_POLARITY(POLARITY) |
Macro Break Polarity. | |
#define | IS_TIM2_BREAK_STATE(STATE) |
Macro Break Input enable/disable. | |
#define | IS_TIM2_CHANNEL(CHANNEL) |
Macro TIM2 Channel. | |
#define | IS_TIM2_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xE100) == 0x0000) && ((FLAG) != 0x0000)) |
#define | IS_TIM2_COUNTER_MODE(MODE) |
Macro TIM2 Counter Mode. | |
#define | IS_TIM2_DMA_SOURCE(SOURCE) |
Macro TIM2 DMA sources. | |
#define | IS_TIM2_ENCODER_MODE(MODE) |
Macro TIM2 encoder mode. | |
#define | IS_TIM2_EVENT_SOURCE(SOURCE) |
Macro TIM2 event source. | |
#define | IS_TIM2_EXT_FILTER(EXTFILTER) ((EXTFILTER) <= 0x0F) |
Macro TIM2 External Trigger Filter. | |
#define | IS_TIM2_EXT_POLARITY(POLARITY) |
Macro TIM2 Trigger Polarity. | |
#define | IS_TIM2_EXT_PRESCALER(PRESCALER) |
Macro TIM2 external trigger prescaler. | |
#define | IS_TIM2_FORCED_ACTION(ACTION) |
Macro used by the assert function to check the different functions parameters. | |
#define | IS_TIM2_GET_FLAG(FLAG) |
Macro TIM2 Flags. | |
#define | IS_TIM2_GET_IT(IT) |
#define | IS_TIM2_IC_FILTER(ICFILTER) ((ICFILTER) <= 0x0F) |
Macro TIM2 Input Capture Filter Value. | |
#define | IS_TIM2_IC_POLARITY(POLARITY) |
Macro TIM2 IC POLARITY. | |
#define | IS_TIM2_IC_PRESCALER(PRESCALER) |
Macro TIM2 IC PRESCALER. | |
#define | IS_TIM2_IC_SELECTION(SELECTION) |
Macro TIM2 IC SELECTION. | |
#define | IS_TIM2_IT(IT) ((IT) != 0x00) |
Macro TIM2 Interrupts. | |
#define | IS_TIM2_LOCK_LEVEL(LEVEL) |
Macro Lock levels. | |
#define | IS_TIM2_OC_MODE(MODE) |
Macro TIM2 Output Compare and PWM modes. | |
#define | IS_TIM2_OC_POLARITY(POLARITY) |
Macro TIM2 Output Compare Polarity. | |
#define | IS_TIM2_OCIDLE_STATE(STATE) |
Macro TIM2 OC IDLE STATE. | |
#define | IS_TIM2_OCM(MODE) |
#define | IS_TIM2_OPM_MODE(MODE) |
Macro TIM2 One Pulse Mode. | |
#define | IS_TIM2_OSSI_STATE(STATE) |
Macro OSSI: Off-State Selection for Idle mode states. | |
#define | IS_TIM2_OUTPUT_STATE(STATE) |
Macro TIM2 Output Compare states. | |
#define | IS_TIM2_PRESCALER(PRESCALER) |
Macro TIM2 Prescaler. | |
#define | IS_TIM2_PRESCALER_RELOAD(RELOAD) |
Macro TIM2 Prescaler Reload. | |
#define | IS_TIM2_SLAVE_MODE(MODE) |
Macro TIM2 Slave mode. | |
#define | IS_TIM2_TIX_TRIGGER_SELECTION(SELECTION) |
#define | IS_TIM2_TIXCLK_SOURCE(SOURCE) |
Macro TIM2 TIx external Clock Selection. | |
#define | IS_TIM2_TRGO_SOURCE(SOURCE) |
Macro TIM2 TRGO source. | |
#define | IS_TIM2_TRIGGER_SELECTION(SELECTION) |
Macro TIM2 Trigger Selection. | |
#define | IS_TIM2_UPDATE_SOURCE(SOURCE) |
Macro TIM2 update source. | |
Enumerations | |
enum | TIM2_AutomaticOutput_TypeDef { TIM2_AutomaticOutput_Enable = ((uint8_t)0x40), TIM2_AutomaticOutput_Disable = ((uint8_t)0x00) } |
enum | TIM2_BreakPolarity_TypeDef { TIM2_BreakPolarity_High = ((uint8_t)0x20), TIM2_BreakPolarity_Low = ((uint8_t)0x00) } |
enum | TIM2_BreakState_TypeDef { TIM2_BreakState_Disable = ((uint8_t)0x00), TIM2_BreakState_Enable = ((uint8_t)0x10) } |
enum | TIM2_Channel_TypeDef { TIM2_Channel_1 = ((uint8_t)0x00), TIM2_Channel_2 = ((uint8_t)0x01) } |
enum | TIM2_CounterMode_TypeDef { TIM2_CounterMode_Up = ((uint8_t)0x00), TIM2_CounterMode_Down = ((uint8_t)0x10), TIM2_CounterMode_CenterAligned1 = ((uint8_t)0x20), TIM2_CounterMode_CenterAligned2 = ((uint8_t)0x40), TIM2_CounterMode_CenterAligned3 = ((uint8_t)0x60) } |
enum | TIM2_DMASource_TypeDef { TIM2_DMASource_Update = ((uint8_t)0x01), TIM2_DMASource_CC1 = ((uint8_t)0x02), TIM2_DMASource_CC2 = ((uint8_t)0x04) } |
enum | TIM2_EncoderMode_TypeDef { TIM2_EncoderMode_TI1 = ((uint8_t)0x01), TIM2_EncoderMode_TI2 = ((uint8_t)0x02), TIM2_EncoderMode_TI12 = ((uint8_t)0x03) } |
enum | TIM2_EventSource_TypeDef { TIM2_EventSource_Update = ((uint8_t)0x01), TIM2_EventSource_CC1 = ((uint8_t)0x02), TIM2_EventSource_CC2 = ((uint8_t)0x04), TIM2_EventSource_Trigger = ((uint8_t)0x40), TIM2_EventSource_Break = ((uint8_t)0x80) } |
enum | TIM2_ExtTRGPolarity_TypeDef { TIM2_ExtTRGPolarity_Inverted = ((uint8_t)0x80), TIM2_ExtTRGPolarity_NonInverted = ((uint8_t)0x00) } |
enum | TIM2_ExtTRGPSC_TypeDef { TIM2_ExtTRGPSC_OFF = ((uint8_t)0x00), TIM2_ExtTRGPSC_DIV2 = ((uint8_t)0x10), TIM2_ExtTRGPSC_DIV4 = ((uint8_t)0x20), TIM2_ExtTRGPSC_DIV8 = ((uint8_t)0x30) } |
enum | TIM2_FLAG_TypeDef { TIM2_FLAG_Update = ((uint16_t)0x0001), TIM2_FLAG_CC1 = ((uint16_t)0x0002), TIM2_FLAG_CC2 = ((uint16_t)0x0004), TIM2_FLAG_Trigger = ((uint16_t)0x0040), TIM2_FLAG_Break = ((uint16_t)0x0080), TIM2_FLAG_CC1OF = ((uint16_t)0x0200), TIM2_FLAG_CC2OF = ((uint16_t)0x0400) } |
enum | TIM2_ForcedAction_TypeDef { TIM2_ForcedAction_Active = ((uint8_t)0x50), TIM2_ForcedAction_Inactive = ((uint8_t)0x40) } |
enum | TIM2_ICPolarity_TypeDef { TIM2_ICPolarity_Rising = ((uint8_t)0x00), TIM2_ICPolarity_Falling = ((uint8_t)0x01) } |
enum | TIM2_ICPSC_TypeDef { TIM2_ICPSC_DIV1 = ((uint8_t)0x00), TIM2_ICPSC_DIV2 = ((uint8_t)0x04), TIM2_ICPSC_DIV4 = ((uint8_t)0x08), TIM2_ICPSC_DIV8 = ((uint8_t)0x0C) } |
enum | TIM2_ICSelection_TypeDef { TIM2_ICSelection_DirectTI = ((uint8_t)0x01), TIM2_ICSelection_IndirectTI = ((uint8_t)0x02), TIM2_ICSelection_TRGI = ((uint8_t)0x03) } |
enum | TIM2_IT_TypeDef { TIM2_IT_Update = ((uint8_t)0x01), TIM2_IT_CC1 = ((uint8_t)0x02), TIM2_IT_CC2 = ((uint8_t)0x04), TIM2_IT_Trigger = ((uint8_t)0x40), TIM2_IT_Break = ((uint8_t)0x80) } |
enum | TIM2_LockLevel_TypeDef { TIM2_LockLevel_Off = ((uint8_t)0x00), TIM2_LockLevel_1 = ((uint8_t)0x01), TIM2_LockLevel_2 = ((uint8_t)0x02), TIM2_LockLevel_3 = ((uint8_t)0x03) } |
enum | TIM2_OCIdleState_TypeDef { TIM2_OCIdleState_Reset = ((uint8_t)0x00), TIM2_OCIdleState_Set = ((uint8_t)0x01) } |
enum | TIM2_OCMode_TypeDef { TIM2_OCMode_Timing = ((uint8_t)0x00), TIM2_OCMode_Active = ((uint8_t)0x10), TIM2_OCMode_Inactive = ((uint8_t)0x20), TIM2_OCMode_Toggle = ((uint8_t)0x30), TIM2_OCMode_PWM1 = ((uint8_t)0x60), TIM2_OCMode_PWM2 = ((uint8_t)0x70) } |
enum | TIM2_OCPolarity_TypeDef { TIM2_OCPolarity_High = ((uint8_t)0x00), TIM2_OCPolarity_Low = ((uint8_t)0x01) } |
enum | TIM2_OPMode_TypeDef { TIM2_OPMode_Single = ((uint8_t)0x01), TIM2_OPMode_Repetitive = ((uint8_t)0x00) } |
enum | TIM2_OSSIState_TypeDef { TIM2_OSSIState_Enable = ((uint8_t)0x04), TIM2_OSSIState_Disable = ((uint8_t)0x00) } |
enum | TIM2_OutputState_TypeDef { TIM2_OutputState_Disable = ((uint8_t)0x00), TIM2_OutputState_Enable = ((uint8_t)0x01) } |
enum | TIM2_Prescaler_TypeDef { TIM2_Prescaler_1 = ((uint8_t)0x00), TIM2_Prescaler_2 = ((uint8_t)0x01), TIM2_Prescaler_4 = ((uint8_t)0x02), TIM2_Prescaler_8 = ((uint8_t)0x03), TIM2_Prescaler_16 = ((uint8_t)0x04), TIM2_Prescaler_32 = ((uint8_t)0x05), TIM2_Prescaler_64 = ((uint8_t)0x06), TIM2_Prescaler_128 = ((uint8_t)0x07) } |
enum | TIM2_PSCReloadMode_TypeDef { TIM2_PSCReloadMode_Update = ((uint8_t)0x00), TIM2_PSCReloadMode_Immediate = ((uint8_t)0x01) } |
enum | TIM2_SlaveMode_TypeDef { TIM2_SlaveMode_Reset = ((uint8_t)0x04), TIM2_SlaveMode_Gated = ((uint8_t)0x05), TIM2_SlaveMode_Trigger = ((uint8_t)0x06), TIM2_SlaveMode_External1 = ((uint8_t)0x07) } |
enum | TIM2_TIxExternalCLK1Source_TypeDef { TIM2_TIxExternalCLK1Source_TI1ED = ((uint8_t)0x40), TIM2_TIxExternalCLK1Source_TI1 = ((uint8_t)0x50), TIM2_TIxExternalCLK1Source_TI2 = ((uint8_t)0x60) } |
enum | TIM2_TRGOSource_TypeDef { TIM2_TRGOSource_Reset = ((uint8_t)0x00), TIM2_TRGOSource_Enable = ((uint8_t)0x10), TIM2_TRGOSource_Update = ((uint8_t)0x20), TIM2_TRGOSource_OC1 = ((uint8_t)0x30), TIM2_TRGOSource_OC1REF = ((uint8_t)0x40), TIM2_TRGOSource_OC2REF = ((uint8_t)0x50) } |
enum | TIM2_TRGSelection_TypeDef { TIM2_TRGSelection_TIM4 = ((uint8_t)0x00), TIM2_TRGSelection_TIM1 = ((uint8_t)0x10), TIM2_TRGSelection_TIM3 = ((uint8_t)0x20), TIM2_TRGSelection_TIM5 = ((uint8_t)0x30), TIM2_TRGSelection_TI1F_ED = ((uint8_t)0x40), TIM2_TRGSelection_TI1FP1 = ((uint8_t)0x50), TIM2_TRGSelection_TI2FP2 = ((uint8_t)0x60), TIM2_TRGSelection_ETRF = ((uint8_t)0x70) } |
enum | TIM2_UpdateSource_TypeDef { TIM2_UpdateSource_Global = ((uint8_t)0x00), TIM2_UpdateSource_Regular = ((uint8_t)0x01) } |
Functions | |
void | TIM2_ARRPreloadConfig (FunctionalState NewState) |
Enables or disables TIM2 peripheral Preload register on ARR. | |
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_ClearFlag (TIM2_FLAG_TypeDef TIM2_FLAG) |
Clears the TIM�s pending flags. | |
void | TIM2_ClearITPendingBit (TIM2_IT_TypeDef TIM2_IT) |
Clears the TIM's interrupt pending bits. | |
void | TIM2_Cmd (FunctionalState NewState) |
Enables or disables the TIM2 peripheral. | |
void | TIM2_CounterModeConfig (TIM2_CounterMode_TypeDef TIM2_CounterMode) |
Specifies the TIM2 Counter Mode to be used. | |
void | TIM2_CtrlPWMOutputs (FunctionalState NewState) |
Enables or disables the TIM2 peripheral Main Outputs. | |
void | TIM2_DeInit (void) |
Deinitialize the TIM2 peripheral registers to their default reset values. | |
void | TIM2_DMACmd (TIM2_DMASource_TypeDef TIM2_DMASource, FunctionalState NewState) |
Enables or disables the TIM2 DMA Requests. | |
void | TIM2_EncoderInterfaceConfig (TIM2_EncoderMode_TypeDef TIM2_EncoderMode, TIM2_ICPolarity_TypeDef TIM2_IC1Polarity, TIM2_ICPolarity_TypeDef TIM2_IC2Polarity) |
Configures the TIM2 Encoder Interface. | |
void | TIM2_ETRClockMode1Config (TIM2_ExtTRGPSC_TypeDef TIM2_ExtTRGPrescaler, TIM2_ExtTRGPolarity_TypeDef TIM2_ExtTRGPolarity, uint8_t ExtTRGFilter) |
Configures the TIM2 External clock Mode1. | |
void | TIM2_ETRClockMode2Config (TIM2_ExtTRGPSC_TypeDef TIM2_ExtTRGPrescaler, TIM2_ExtTRGPolarity_TypeDef TIM2_ExtTRGPolarity, uint8_t ExtTRGFilter) |
Configures the TIM2 External clock Mode2. | |
void | TIM2_ETRConfig (TIM2_ExtTRGPSC_TypeDef TIM2_ExtTRGPrescaler, TIM2_ExtTRGPolarity_TypeDef TIM2_ExtTRGPolarity, uint8_t ExtTRGFilter) |
Configures the TIM2 External Trigger. | |
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_GenerateEvent (TIM2_EventSource_TypeDef TIM2_EventSource) |
Configures the TIM2 event to be generated by software. | |
uint16_t | TIM2_GetCapture1 (void) |
Gets the TIM2 Input Capture 1 value. | |
uint16_t | TIM2_GetCapture2 (void) |
Gets the TIM2 Input Capture 2 value. | |
uint16_t | TIM2_GetCounter (void) |
Gets the TIM2 Counter value. | |
FlagStatus | TIM2_GetFlagStatus (TIM2_FLAG_TypeDef TIM2_FLAG) |
Checks whether the specified TIM2 flag is set or not. | |
ITStatus | TIM2_GetITStatus (TIM2_IT_TypeDef TIM2_IT) |
Checks whether the TIM2 interrupt has occurred or not. | |
TIM2_Prescaler_TypeDef | TIM2_GetPrescaler (void) |
Gets the TIM2 Prescaler value. | |
void | TIM2_ICInit (TIM2_Channel_TypeDef TIM2_Channel, TIM2_ICPolarity_TypeDef TIM2_ICPolarity, TIM2_ICSelection_TypeDef TIM2_ICSelection, TIM2_ICPSC_TypeDef TIM2_ICPrescaler, uint8_t TIM2_ICFilter) |
Initializes the TIM2 peripheral according to the specified parameters. | |
void | TIM2_InternalClockConfig (void) |
Enables the TIM2 internal Clock. | |
void | TIM2_ITConfig (TIM2_IT_TypeDef TIM2_IT, FunctionalState NewState) |
Enables or disables the specified TIM2 interrupts. | |
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_PrescalerConfig (TIM2_Prescaler_TypeDef Prescaler, TIM2_PSCReloadMode_TypeDef TIM2_PSCReloadMode) |
Configures the TIM2 Prescaler. | |
void | TIM2_PWMIConfig (TIM2_Channel_TypeDef TIM2_Channel, TIM2_ICPolarity_TypeDef TIM2_ICPolarity, TIM2_ICSelection_TypeDef TIM2_ICSelection, TIM2_ICPSC_TypeDef TIM2_ICPrescaler, uint8_t TIM2_ICFilter) |
Configures the TIM2 peripheral in PWM Input Mode according to the specified parameters. | |
void | TIM2_SelectCCDMA (FunctionalState NewState) |
Selects the TIM2 peripheral Capture Compare DMA source. | |
void | TIM2_SelectHallSensor (FunctionalState NewState) |
Enables or Disables the TIM�s Hall sensor interface. | |
void | TIM2_SelectInputTrigger (TIM2_TRGSelection_TypeDef TIM2_InputTriggerSource) |
Selects the TIM2 Input Trigger source. | |
void | TIM2_SelectMasterSlaveMode (FunctionalState NewState) |
Sets or Resets the TIM2 Master/Slave Mode. | |
void | TIM2_SelectOCxM (TIM2_Channel_TypeDef TIM2_Channel, TIM2_OCMode_TypeDef TIM2_OCMode) |
Selects the TIM2 Output Compare Mode. | |
void | TIM2_SelectOnePulseMode (TIM2_OPMode_TypeDef TIM2_OPMode) |
Selects the TIM�s One Pulse Mode. | |
void | TIM2_SelectOutputTrigger (TIM2_TRGOSource_TypeDef TIM2_TRGOSource) |
Selects the TIM2 Trigger Output Mode. | |
void | TIM2_SelectSlaveMode (TIM2_SlaveMode_TypeDef TIM2_SlaveMode) |
Selects the TIM2 Slave Mode. | |
void | TIM2_SetAutoreload (uint16_t Autoreload) |
Sets the TIM2 Autoreload Register value. | |
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. | |
void | TIM2_SetCounter (uint16_t Counter) |
Sets the TIM2 Counter Register value. | |
void | TIM2_SetIC1Prescaler (TIM2_ICPSC_TypeDef TIM2_IC1Prescaler) |
Sets the TIM2 Input Capture 1 prescaler. | |
void | TIM2_SetIC2Prescaler (TIM2_ICPSC_TypeDef TIM2_IC2Prescaler) |
Sets the TIM2 Input Capture 2 prescaler. | |
void | TIM2_TimeBaseInit (TIM2_Prescaler_TypeDef TIM2_Prescaler, TIM2_CounterMode_TypeDef TIM2_CounterMode, uint16_t TIM2_Period) |
Initializes the TIM2 Time Base Unit according to the specified parameters. | |
void | TIM2_TIxExternalClockConfig (TIM2_TIxExternalCLK1Source_TypeDef TIM2_TIxExternalCLKSource, TIM2_ICPolarity_TypeDef TIM2_ICPolarity, uint8_t ICFilter) |
Configures the TIM2 Trigger as External Clock. | |
void | TIM2_UpdateDisableConfig (FunctionalState NewState) |
Enables or Disables the TIM2 Update event. | |
void | TIM2_UpdateRequestConfig (TIM2_UpdateSource_TypeDef TIM2_UpdateSource) |
Selects the TIM2 Update Request Interrupt source. |
Detailed Description
This file contains all the functions prototypes for the TIM2 firmware library.
- Attention:
THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
© COPYRIGHT 2011 STMicroelectronics
Definition in file stm8l15x_tim2.h.