STM8S/A Standard Peripherals Drivers
|
This file contains all functions prototype and macros for the TIM2 peripheral. More...
#include "stm8s.h"
Go to the source code of this file.
Defines | |
#define | IS_TIM2_CHANNEL_OK(CHANNEL) |
#define | IS_TIM2_CLEAR_FLAG_OK(FLAG) ((((uint16_t)(FLAG) & 0xF1F0) == 0x0000) && ((uint16_t)(FLAG) != 0x0000)) |
#define | IS_TIM2_EVENT_SOURCE_OK(SOURCE) (((SOURCE) != 0x00)) |
#define | IS_TIM2_FORCED_ACTION_OK(ACTION) |
#define | IS_TIM2_GET_FLAG_OK(FLAG) |
#define | IS_TIM2_GET_IT_OK(IT) |
#define | IS_TIM2_IC_FILTER_OK(ICFILTER) ((ICFILTER) <= 0x0F) |
TIM2 Input Capture Filer Value. | |
#define | IS_TIM2_IC_POLARITY_OK(POLARITY) |
#define | IS_TIM2_IC_PRESCALER_OK(PRESCALER) |
#define | IS_TIM2_IC_SELECTION1_OK(SELECTION) |
#define | IS_TIM2_IC_SELECTION_OK(SELECTION) |
#define | IS_TIM2_IT_OK(IT) (((IT) != 0x00) && ((IT) <= 0x0F)) |
#define | IS_TIM2_OC_MODE_OK(MODE) |
#define | IS_TIM2_OC_POLARITY_OK(POLARITY) |
#define | IS_TIM2_OCM_OK(MODE) |
#define | IS_TIM2_OPM_MODE_OK(MODE) |
#define | IS_TIM2_OUTPUT_STATE_OK(STATE) |
#define | IS_TIM2_PRESCALER_OK(PRESCALER) |
#define | IS_TIM2_PRESCALER_RELOAD_OK(RELOAD) |
#define | IS_TIM2_PWMI_CHANNEL_OK(CHANNEL) |
#define | IS_TIM2_UPDATE_SOURCE_OK(SOURCE) |
Enumerations | |
enum | TIM2_Channel_TypeDef { TIM2_CHANNEL_1 = ((uint8_t)0x00), TIM2_CHANNEL_2 = ((uint8_t)0x01), TIM2_CHANNEL_3 = ((uint8_t)0x02) } |
TIM2 Channel. More... | |
enum | TIM2_EventSource_TypeDef { TIM2_EVENTSOURCE_UPDATE = ((uint8_t)0x01), TIM2_EVENTSOURCE_CC1 = ((uint8_t)0x02), TIM2_EVENTSOURCE_CC2 = ((uint8_t)0x04), TIM2_EVENTSOURCE_CC3 = ((uint8_t)0x08) } |
TIM2 Event Source. More... | |
enum | TIM2_FLAG_TypeDef { TIM2_FLAG_UPDATE = ((uint16_t)0x0001), TIM2_FLAG_CC1 = ((uint16_t)0x0002), TIM2_FLAG_CC2 = ((uint16_t)0x0004), TIM2_FLAG_CC3 = ((uint16_t)0x0008), TIM2_FLAG_CC1OF = ((uint16_t)0x0200), TIM2_FLAG_CC2OF = ((uint16_t)0x0400), TIM2_FLAG_CC3OF = ((uint16_t)0x0800) } |
TIM2 Flags. More... | |
enum | TIM2_ForcedAction_TypeDef { TIM2_FORCEDACTION_ACTIVE = ((uint8_t)0x50), TIM2_FORCEDACTION_INACTIVE = ((uint8_t)0x40) } |
TIM2 Forced Action. More... | |
enum | TIM2_ICPolarity_TypeDef { TIM2_ICPOLARITY_RISING = ((uint8_t)0x00), TIM2_ICPOLARITY_FALLING = ((uint8_t)0x44) } |
TIM2 Input Capture Polarity. More... | |
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) } |
TIM2 Input Capture Prescaler. More... | |
enum | TIM2_ICSelection_TypeDef { TIM2_ICSELECTION_DIRECTTI = ((uint8_t)0x01), TIM2_ICSELECTION_INDIRECTTI = ((uint8_t)0x02), TIM2_ICSELECTION_TRGI = ((uint8_t)0x03) } |
TIM2 Input Capture Selection. More... | |
enum | TIM2_IT_TypeDef { TIM2_IT_UPDATE = ((uint8_t)0x01), TIM2_IT_CC1 = ((uint8_t)0x02), TIM2_IT_CC2 = ((uint8_t)0x04), TIM2_IT_CC3 = ((uint8_t)0x08) } |
TIM2 interrupt sources. More... | |
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) } |
TIM2 Output Compare and PWM modes. More... | |
enum | TIM2_OCPolarity_TypeDef { TIM2_OCPOLARITY_HIGH = ((uint8_t)0x00), TIM2_OCPOLARITY_LOW = ((uint8_t)0x22) } |
TIM2 Output Compare Polarity. More... | |
enum | TIM2_OPMode_TypeDef { TIM2_OPMODE_SINGLE = ((uint8_t)0x01), TIM2_OPMODE_REPETITIVE = ((uint8_t)0x00) } |
TIM2 One Pulse Mode. More... | |
enum | TIM2_OutputState_TypeDef { TIM2_OUTPUTSTATE_DISABLE = ((uint8_t)0x00), TIM2_OUTPUTSTATE_ENABLE = ((uint8_t)0x11) } |
TIM2 Output Compare states. More... | |
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), TIM2_PRESCALER_256 = ((uint8_t)0x08), TIM2_PRESCALER_512 = ((uint8_t)0x09), TIM2_PRESCALER_1024 = ((uint8_t)0x0A), TIM2_PRESCALER_2048 = ((uint8_t)0x0B), TIM2_PRESCALER_4096 = ((uint8_t)0x0C), TIM2_PRESCALER_8192 = ((uint8_t)0x0D), TIM2_PRESCALER_16384 = ((uint8_t)0x0E), TIM2_PRESCALER_32768 = ((uint8_t)0x0F) } |
TIM2 Prescaler. More... | |
enum | TIM2_PSCReloadMode_TypeDef { TIM2_PSCRELOADMODE_UPDATE = ((uint8_t)0x00), TIM2_PSCRELOADMODE_IMMEDIATE = ((uint8_t)0x01) } |
TIM2 Prescaler Reload Mode. More... | |
enum | TIM2_UpdateSource_TypeDef { TIM2_UPDATESOURCE_GLOBAL = ((uint8_t)0x00), TIM2_UPDATESOURCE_REGULAR = ((uint8_t)0x01) } |
TIM2 Update Source. More... | |
Functions | |
void | TIM2_ARRPreloadConfig (FunctionalState NewState) |
Enables or disables TIM2 peripheral Preload register on ARR. | |
void | TIM2_CCPreloadControl (FunctionalState NewState) |
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 TIM2�s pending flags. | |
void | TIM2_ClearITPendingBit (TIM2_IT_TypeDef TIM2_IT) |
Clears the TIM2's interrupt pending bits. | |
void | TIM2_Cmd (FunctionalState NewState) |
Enables or disables the TIM2 peripheral. | |
void | TIM2_DeInit (void) |
Deinitializes the TIM2 peripheral registers to their default reset values. | |
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_ForcedOC3Config (TIM2_ForcedAction_TypeDef TIM2_ForcedAction) |
Forces the TIM2 Channel3 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_GetCapture3 (void) |
Gets the TIM2 Input Capture 3 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) |
void | TIM2_ITConfig (TIM2_IT_TypeDef TIM2_IT, FunctionalState NewState) |
Enables or disables the specified TIM2 interrupts. | |
void | TIM2_OC1Init (TIM2_OCMode_TypeDef TIM2_OCMode, TIM2_OutputState_TypeDef TIM2_OutputState, uint16_t TIM2_Pulse, TIM2_OCPolarity_TypeDef TIM2_OCPolarity) |
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_OC2Init (TIM2_OCMode_TypeDef TIM2_OCMode, TIM2_OutputState_TypeDef TIM2_OutputState, uint16_t TIM2_Pulse, TIM2_OCPolarity_TypeDef TIM2_OCPolarity) |
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_OC3Init (TIM2_OCMode_TypeDef TIM2_OCMode, TIM2_OutputState_TypeDef TIM2_OutputState, uint16_t TIM2_Pulse, TIM2_OCPolarity_TypeDef TIM2_OCPolarity) |
Initializes the TIM2 Channel3 according to the specified parameters. | |
void | TIM2_OC3PolarityConfig (TIM2_OCPolarity_TypeDef TIM2_OCPolarity) |
Configures the TIM2 Channel 3 polarity. | |
void | TIM2_OC3PreloadConfig (FunctionalState NewState) |
Enables or disables the TIM2 peripheral Preload Register on CCR3. | |
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_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 TIM2�s One Pulse Mode. | |
void | TIM2_SetAutoreload (uint16_t Autoreload) |
Sets the TIM2 Autoreload Register value. | |
void | TIM2_SetCompare1 (uint16_t Compare1) |
Sets the TIM2 Capture Compare1 Register value. | |
void | TIM2_SetCompare2 (uint16_t Compare2) |
Sets the TIM2 Capture Compare2 Register value. | |
void | TIM2_SetCompare3 (uint16_t Compare3) |
Sets the TIM2 Capture Compare3 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_SetIC3Prescaler (TIM2_ICPSC_TypeDef TIM2_IC3Prescaler) |
Sets the TIM2 Input Capture 3 prescaler. | |
void | TIM2_TimeBaseInit (TIM2_Prescaler_TypeDef TIM2_Prescaler, uint16_t TIM2_Period) |
Initializes the TIM2 Time Base Unit according to the specified parameters. | |
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 functions prototype and macros for the TIM2 peripheral.
- Attention:
© COPYRIGHT 2014 STMicroelectronics
Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:
http://www.st.com/software_license_agreement_liberty_v2
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file stm8s_tim2.h.