STM8L15x Standard Peripherals Drivers
|
Output Compare management functions. More...
Functions | |
void | TIM1_BDTRConfig (TIM1_OSSIState_TypeDef TIM1_OSSIState, TIM1_LockLevel_TypeDef TIM1_LockLevel, uint8_t TIM1_DeadTime, TIM1_BreakState_TypeDef TIM1_Break, TIM1_BreakPolarity_TypeDef TIM1_BreakPolarity, TIM1_AutomaticOutput_TypeDef TIM1_AutomaticOutput) |
Configures the Break feature, dead time, Lock level, the OSSI, and the AOE(automatic output enable). | |
void | TIM1_CCPreloadControl (FunctionalState NewState) |
Sets or Resets the TIM1 peripheral Capture Compare Preload Control bit. | |
void | TIM1_CCxCmd (TIM1_Channel_TypeDef TIM1_Channel, FunctionalState NewState) |
Enables or disables the TIM1 Capture Compare Channel x (x=1,..,4). | |
void | TIM1_CCxNCmd (TIM1_Channel_TypeDef TIM1_Channel, FunctionalState NewState) |
Enables or disables the TIM1 Capture Compare Channel xN (xN=1,..,3). | |
void | TIM1_ClearOC1Ref (FunctionalState NewState) |
Clears or safeguards the OC1REF signal. | |
void | TIM1_ClearOC2Ref (FunctionalState NewState) |
Clears or safeguards the OC2REF signal. | |
void | TIM1_ClearOC3Ref (FunctionalState NewState) |
Clears or safeguards the OC3REF signal. | |
void | TIM1_ClearOC4Ref (FunctionalState NewState) |
Clears or safeguards the OC4REF signal. | |
void | TIM1_CtrlPWMOutputs (FunctionalState NewState) |
Enables or disables the TIM1 peripheral Main Outputs. | |
void | TIM1_ForcedOC1Config (TIM1_ForcedAction_TypeDef TIM1_ForcedAction) |
Forces the TIM1 Channel1 output waveform to active or inactive level. | |
void | TIM1_ForcedOC2Config (TIM1_ForcedAction_TypeDef TIM1_ForcedAction) |
Forces the TIM1 Channel2 output waveform to active or inactive level. | |
void | TIM1_ForcedOC3Config (TIM1_ForcedAction_TypeDef TIM1_ForcedAction) |
Forces the TIM1 Channel3 output waveform to active or inactive level. | |
void | TIM1_OC1FastConfig (FunctionalState NewState) |
Configures the TIM1 Capture Compare 1 Fast feature. | |
void | TIM1_OC1Init (TIM1_OCMode_TypeDef TIM1_OCMode, TIM1_OutputState_TypeDef TIM1_OutputState, TIM1_OutputNState_TypeDef TIM1_OutputNState, uint16_t TIM1_Pulse, TIM1_OCPolarity_TypeDef TIM1_OCPolarity, TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity, TIM1_OCIdleState_TypeDef TIM1_OCIdleState, TIM1_OCNIdleState_TypeDef TIM1_OCNIdleState) |
Initializes the TIM1 Channel1 according to the specified parameters. | |
void | TIM1_OC1NPolarityConfig (TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity) |
Configures the TIM1 Channel 1N polarity. | |
void | TIM1_OC1PolarityConfig (TIM1_OCPolarity_TypeDef TIM1_OCPolarity) |
Configures the TIM1 Channel 1 polarity. | |
void | TIM1_OC1PreloadConfig (FunctionalState NewState) |
Enables or disables the TIM1 peripheral Preload Register on CCR1. | |
void | TIM1_OC2FastConfig (FunctionalState NewState) |
Configures the TIM1 Capture Compare 2 Fast feature. | |
void | TIM1_OC2Init (TIM1_OCMode_TypeDef TIM1_OCMode, TIM1_OutputState_TypeDef TIM1_OutputState, TIM1_OutputNState_TypeDef TIM1_OutputNState, uint16_t TIM1_Pulse, TIM1_OCPolarity_TypeDef TIM1_OCPolarity, TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity, TIM1_OCIdleState_TypeDef TIM1_OCIdleState, TIM1_OCNIdleState_TypeDef TIM1_OCNIdleState) |
Initializes the TIM1 Channel2 according to the specified parameters. | |
void | TIM1_OC2NPolarityConfig (TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity) |
Configures the TIM1 Channel 2N polarity. | |
void | TIM1_OC2PolarityConfig (TIM1_OCPolarity_TypeDef TIM1_OCPolarity) |
Configures the TIM1 Channel 2 polarity. | |
void | TIM1_OC2PreloadConfig (FunctionalState NewState) |
Enables or disables the TIM1 peripheral Preload Register on CCR2. | |
void | TIM1_OC3FastConfig (FunctionalState NewState) |
Configures the TIM1 Capture Compare 3 Fast feature. | |
void | TIM1_OC3Init (TIM1_OCMode_TypeDef TIM1_OCMode, TIM1_OutputState_TypeDef TIM1_OutputState, TIM1_OutputNState_TypeDef TIM1_OutputNState, uint16_t TIM1_Pulse, TIM1_OCPolarity_TypeDef TIM1_OCPolarity, TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity, TIM1_OCIdleState_TypeDef TIM1_OCIdleState, TIM1_OCNIdleState_TypeDef TIM1_OCNIdleState) |
Initializes the TIM1 Channel3 according to the specified parameters. | |
void | TIM1_OC3NPolarityConfig (TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity) |
Configures the TIM1 Channel 3N polarity. | |
void | TIM1_OC3PolarityConfig (TIM1_OCPolarity_TypeDef TIM1_OCPolarity) |
Configures the TIM1 Channel 3 polarity. | |
void | TIM1_OC3PreloadConfig (FunctionalState NewState) |
Enables or disables the TIM1 peripheral Preload Register on CCR3. | |
void | TIM1_OC4PreloadConfig (FunctionalState NewState) |
Enables or disables the TIM1 peripheral Preload Register on CCR4. | |
void | TIM1_SelectCOM (FunctionalState NewState) |
Selects the TIM1 peripheral Commutation event. | |
void | TIM1_SelectOCREFClear (TIM1_OCReferenceClear_TypeDef TIM1_OCReferenceClear) |
Selects the OCReference Clear source. | |
void | TIM1_SelectOCxM (TIM1_Channel_TypeDef TIM1_Channel, TIM1_OCMode_TypeDef TIM1_OCMode) |
Selects the TIM1 Output Compare Mode. | |
void | TIM1_SetCompare1 (uint16_t Compare1) |
Sets the TIM1 Capture Compare1 Register value. | |
void | TIM1_SetCompare2 (uint16_t Compare2) |
Sets the TIM1 Capture Compare2 Register value. | |
void | TIM1_SetCompare3 (uint16_t Compare3) |
Sets the TIM1 Capture Compare3 Register value. | |
void | TIM1_SetCompare4 (uint16_t Compare4) |
Sets the TIM1 Capture Compare4 Register value. |
Detailed Description
Output Compare management functions.
=============================================================================== Output Compare management functions =============================================================================== =================================================================== TIM1 Driver: how to use it in Output Compare Mode =================================================================== To use the Timer in Output Compare mode, the following steps are mandatory: 1. Enable TIM1 clock using CLK_PeripheralClockConfig(CLK_Peripheral_TIM1, ENABLE) function. 2. Configure the TIM1 pins in output 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_OCxInit() to configure the channel x with the desired parameters including: - TIM1 Output Compare mode: TIM1_OCMode - TIM1 Output State: TIM1_OutputState - TIM1 Complementary Output State: TIM1_OutputNState - TIM1 Pulse value: TIM1_Pulse - TIM1 Output Compare Polarity : TIM1_OCPolarity - TIM1 Complementary Output Compare Polarity : TIM1_OCNPolarity - TIM1 Output Idle State: TIM1_OCIdleState - TIM1 Complementary Output Idle State: TIM1_OCNIdleState 5. Call the TIM1_Cmd(ENABLE) function to enable the TIM1 counter. Note1: All other functions can be used separately to modify, if needed, a specific feature of the Timer. Note2: If the corresponding interrupt or DMA request are needed, the user should: 1. Enable global interrupts (or the DMA) to use the TIM1 interrupts (or DMA requests). 2. Enable the corresponding interrupt (or DMA request) using the function TIM1_ITConfig(TIM1_IT_CCx) (or TIM1_DMACmd(TIM1_DMASource_CCx))
Function Documentation
void TIM1_BDTRConfig | ( | TIM1_OSSIState_TypeDef | TIM1_OSSIState, |
TIM1_LockLevel_TypeDef | TIM1_LockLevel, | ||
uint8_t | TIM1_DeadTime, | ||
TIM1_BreakState_TypeDef | TIM1_Break, | ||
TIM1_BreakPolarity_TypeDef | TIM1_BreakPolarity, | ||
TIM1_AutomaticOutput_TypeDef | TIM1_AutomaticOutput | ||
) |
Configures the Break feature, dead time, Lock level, the OSSI, and the AOE(automatic output enable).
Definition at line 797 of file stm8l15x_tim1.c.
References IS_TIM1_AUTOMATIC_OUTPUT_STATE, IS_TIM1_BREAK_POLARITY, IS_TIM1_BREAK_STATE, IS_TIM1_LOCK_LEVEL, IS_TIM1_OSSI_STATE, and TIM1.
void TIM1_CCPreloadControl | ( | FunctionalState | NewState | ) |
Sets or Resets the TIM1 peripheral Capture Compare Preload Control bit.
Definition at line 957 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CR2_CCPC.
void TIM1_CCxCmd | ( | TIM1_Channel_TypeDef | TIM1_Channel, |
FunctionalState | NewState | ||
) |
Enables or disables the TIM1 Capture Compare Channel x (x=1,..,4).
Definition at line 1462 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, IS_TIM1_CHANNEL, TIM1, TIM1_CCER1_CC1E, TIM1_CCER1_CC2E, TIM1_CCER2_CC3E, TIM1_CCER2_CC4E, TIM1_Channel_1, TIM1_Channel_2, and TIM1_Channel_3.
void TIM1_CCxNCmd | ( | TIM1_Channel_TypeDef | TIM1_Channel, |
FunctionalState | NewState | ||
) |
Enables or disables the TIM1 Capture Compare Channel xN (xN=1,..,3).
Definition at line 1529 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, IS_TIM1_COMPLEMENTARY_CHANNEL, TIM1, TIM1_CCER1_CC1NE, TIM1_CCER1_CC2NE, TIM1_CCER2_CC3NE, TIM1_Channel_1, and TIM1_Channel_2.
void TIM1_ClearOC1Ref | ( | FunctionalState | NewState | ) |
Clears or safeguards the OC1REF signal.
Definition at line 1184 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CCMR_OCxCE.
void TIM1_ClearOC2Ref | ( | FunctionalState | NewState | ) |
Clears or safeguards the OC2REF signal.
Definition at line 1206 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CCMR_OCxCE.
void TIM1_ClearOC3Ref | ( | FunctionalState | NewState | ) |
Clears or safeguards the OC3REF signal.
Definition at line 1228 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CCMR_OCxCE.
void TIM1_ClearOC4Ref | ( | FunctionalState | NewState | ) |
Clears or safeguards the OC4REF signal.
Definition at line 1250 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CCMR_OCxCE.
void TIM1_CtrlPWMOutputs | ( | FunctionalState | NewState | ) |
Enables or disables the TIM1 peripheral Main Outputs.
Definition at line 828 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_BKR_MOE.
void TIM1_ForcedOC1Config | ( | TIM1_ForcedAction_TypeDef | TIM1_ForcedAction | ) |
Forces the TIM1 Channel1 output waveform to active or inactive level.
Definition at line 981 of file stm8l15x_tim1.c.
References IS_TIM1_FORCED_ACTION, TIM1, and TIM1_CCMR_OCM.
void TIM1_ForcedOC2Config | ( | TIM1_ForcedAction_TypeDef | TIM1_ForcedAction | ) |
Forces the TIM1 Channel2 output waveform to active or inactive level.
Definition at line 998 of file stm8l15x_tim1.c.
References IS_TIM1_FORCED_ACTION, TIM1, and TIM1_CCMR_OCM.
void TIM1_ForcedOC3Config | ( | TIM1_ForcedAction_TypeDef | TIM1_ForcedAction | ) |
Forces the TIM1 Channel3 output waveform to active or inactive level.
Definition at line 1015 of file stm8l15x_tim1.c.
References IS_TIM1_FORCED_ACTION, TIM1, and TIM1_CCMR_OCM.
void TIM1_OC1FastConfig | ( | FunctionalState | NewState | ) |
Configures the TIM1 Capture Compare 1 Fast feature.
Definition at line 1118 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CCMR_OCxFE.
void TIM1_OC1Init | ( | TIM1_OCMode_TypeDef | TIM1_OCMode, |
TIM1_OutputState_TypeDef | TIM1_OutputState, | ||
TIM1_OutputNState_TypeDef | TIM1_OutputNState, | ||
uint16_t | TIM1_Pulse, | ||
TIM1_OCPolarity_TypeDef | TIM1_OCPolarity, | ||
TIM1_OCNPolarity_TypeDef | TIM1_OCNPolarity, | ||
TIM1_OCIdleState_TypeDef | TIM1_OCIdleState, | ||
TIM1_OCNIdleState_TypeDef | TIM1_OCNIdleState | ||
) |
Initializes the TIM1 Channel1 according to the specified parameters.
Definition at line 571 of file stm8l15x_tim1.c.
References IS_TIM1_OC_MODE, IS_TIM1_OC_POLARITY, IS_TIM1_OCIDLE_STATE, IS_TIM1_OCN_POLARITY, IS_TIM1_OCNIDLE_STATE, IS_TIM1_OUTPUT_STATE, IS_TIM1_OUTPUTN_STATE, TIM1, TIM1_CCER1_CC1E, TIM1_CCER1_CC1NE, TIM1_CCER1_CC1NP, TIM1_CCER1_CC1P, TIM1_CCMR_OCM, TIM1_OISR_OIS1, and TIM1_OISR_OIS1N.
void TIM1_OC1NPolarityConfig | ( | TIM1_OCNPolarity_TypeDef | TIM1_OCNPolarity | ) |
Configures the TIM1 Channel 1N polarity.
Definition at line 1298 of file stm8l15x_tim1.c.
References IS_TIM1_OCN_POLARITY, TIM1, TIM1_CCER1_CC1NP, and TIM1_OCNPolarity_High.
void TIM1_OC1PolarityConfig | ( | TIM1_OCPolarity_TypeDef | TIM1_OCPolarity | ) |
Configures the TIM1 Channel 1 polarity.
Definition at line 1274 of file stm8l15x_tim1.c.
References IS_TIM1_OC_POLARITY, TIM1, TIM1_CCER1_CC1P, and TIM1_OCPolarity_High.
void TIM1_OC1PreloadConfig | ( | FunctionalState | NewState | ) |
Enables or disables the TIM1 peripheral Preload Register on CCR1.
Definition at line 1030 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CCMR_OCxPE.
void TIM1_OC2FastConfig | ( | FunctionalState | NewState | ) |
Configures the TIM1 Capture Compare 2 Fast feature.
Definition at line 1140 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CCMR_OCxFE.
void TIM1_OC2Init | ( | TIM1_OCMode_TypeDef | TIM1_OCMode, |
TIM1_OutputState_TypeDef | TIM1_OutputState, | ||
TIM1_OutputNState_TypeDef | TIM1_OutputNState, | ||
uint16_t | TIM1_Pulse, | ||
TIM1_OCPolarity_TypeDef | TIM1_OCPolarity, | ||
TIM1_OCNPolarity_TypeDef | TIM1_OCNPolarity, | ||
TIM1_OCIdleState_TypeDef | TIM1_OCIdleState, | ||
TIM1_OCNIdleState_TypeDef | TIM1_OCNIdleState | ||
) |
Initializes the TIM1 Channel2 according to the specified parameters.
Definition at line 652 of file stm8l15x_tim1.c.
References IS_TIM1_OC_MODE, IS_TIM1_OC_POLARITY, IS_TIM1_OCIDLE_STATE, IS_TIM1_OCN_POLARITY, IS_TIM1_OCNIDLE_STATE, IS_TIM1_OUTPUT_STATE, IS_TIM1_OUTPUTN_STATE, TIM1, TIM1_CCER1_CC2E, TIM1_CCER1_CC2NE, TIM1_CCER1_CC2NP, TIM1_CCER1_CC2P, TIM1_CCMR_OCM, TIM1_OISR_OIS2, and TIM1_OISR_OIS2N.
void TIM1_OC2NPolarityConfig | ( | TIM1_OCNPolarity_TypeDef | TIM1_OCNPolarity | ) |
Configures the TIM1 Channel 2N polarity.
Definition at line 1346 of file stm8l15x_tim1.c.
References IS_TIM1_OCN_POLARITY, TIM1, TIM1_CCER1_CC2NP, and TIM1_OCNPolarity_High.
void TIM1_OC2PolarityConfig | ( | TIM1_OCPolarity_TypeDef | TIM1_OCPolarity | ) |
Configures the TIM1 Channel 2 polarity.
Definition at line 1322 of file stm8l15x_tim1.c.
References IS_TIM1_OC_POLARITY, TIM1, TIM1_CCER1_CC2P, and TIM1_OCPolarity_High.
void TIM1_OC2PreloadConfig | ( | FunctionalState | NewState | ) |
Enables or disables the TIM1 peripheral Preload Register on CCR2.
Definition at line 1052 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CCMR_OCxPE.
void TIM1_OC3FastConfig | ( | FunctionalState | NewState | ) |
Configures the TIM1 Capture Compare 3 Fast feature.
Definition at line 1162 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CCMR_OCxFE.
void TIM1_OC3Init | ( | TIM1_OCMode_TypeDef | TIM1_OCMode, |
TIM1_OutputState_TypeDef | TIM1_OutputState, | ||
TIM1_OutputNState_TypeDef | TIM1_OutputNState, | ||
uint16_t | TIM1_Pulse, | ||
TIM1_OCPolarity_TypeDef | TIM1_OCPolarity, | ||
TIM1_OCNPolarity_TypeDef | TIM1_OCNPolarity, | ||
TIM1_OCIdleState_TypeDef | TIM1_OCIdleState, | ||
TIM1_OCNIdleState_TypeDef | TIM1_OCNIdleState | ||
) |
Initializes the TIM1 Channel3 according to the specified parameters.
Definition at line 729 of file stm8l15x_tim1.c.
References IS_TIM1_OC_MODE, IS_TIM1_OC_POLARITY, IS_TIM1_OCIDLE_STATE, IS_TIM1_OCN_POLARITY, IS_TIM1_OCNIDLE_STATE, IS_TIM1_OUTPUT_STATE, IS_TIM1_OUTPUTN_STATE, TIM1, TIM1_CCER2_CC3E, TIM1_CCER2_CC3NE, TIM1_CCER2_CC3NP, TIM1_CCER2_CC3P, TIM1_CCMR_OCM, TIM1_OISR_OIS3, and TIM1_OISR_OIS3N.
void TIM1_OC3NPolarityConfig | ( | TIM1_OCNPolarity_TypeDef | TIM1_OCNPolarity | ) |
Configures the TIM1 Channel 3N polarity.
Definition at line 1394 of file stm8l15x_tim1.c.
References IS_TIM1_OCN_POLARITY, TIM1, TIM1_CCER2_CC3NP, and TIM1_OCNPolarity_High.
void TIM1_OC3PolarityConfig | ( | TIM1_OCPolarity_TypeDef | TIM1_OCPolarity | ) |
Configures the TIM1 Channel 3 polarity.
Definition at line 1370 of file stm8l15x_tim1.c.
References IS_TIM1_OC_POLARITY, TIM1, TIM1_CCER2_CC3P, and TIM1_OCPolarity_High.
void TIM1_OC3PreloadConfig | ( | FunctionalState | NewState | ) |
Enables or disables the TIM1 peripheral Preload Register on CCR3.
Definition at line 1074 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CCMR_OCxPE.
void TIM1_OC4PreloadConfig | ( | FunctionalState | NewState | ) |
Enables or disables the TIM1 peripheral Preload Register on CCR4.
Definition at line 1096 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CCMR_OCxPE.
void TIM1_SelectCOM | ( | FunctionalState | NewState | ) |
Selects the TIM1 peripheral Commutation event.
Definition at line 1434 of file stm8l15x_tim1.c.
References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CR2_CCUS.
void TIM1_SelectOCREFClear | ( | TIM1_OCReferenceClear_TypeDef | TIM1_OCReferenceClear | ) |
Selects the OCReference Clear source.
Definition at line 1418 of file stm8l15x_tim1.c.
References IS_TIM1_OCREFERENCECECLEAR_SOURCE, TIM1, and TIM1_SMCR_OCCS.
void TIM1_SelectOCxM | ( | TIM1_Channel_TypeDef | TIM1_Channel, |
TIM1_OCMode_TypeDef | TIM1_OCMode | ||
) |
Selects the TIM1 Output Compare Mode.
This function disables the selected channel before changing the Output Compare Mode.
- Note:
- User has to enable this channel using TIM1_CCxCmd and TIM1_CCxNCmd functions.
Definition at line 865 of file stm8l15x_tim1.c.
References IS_TIM1_CHANNEL, IS_TIM1_OCM, TIM1, TIM1_CCER1_CC1E, TIM1_CCER1_CC2E, TIM1_CCER2_CC3E, TIM1_CCMR_OCM, TIM1_Channel_1, and TIM1_Channel_2.
void TIM1_SetCompare1 | ( | uint16_t | Compare1 | ) |
Sets the TIM1 Capture Compare1 Register value.
Definition at line 904 of file stm8l15x_tim1.c.
References TIM1.
void TIM1_SetCompare2 | ( | uint16_t | Compare2 | ) |
Sets the TIM1 Capture Compare2 Register value.
Definition at line 918 of file stm8l15x_tim1.c.
References TIM1.
void TIM1_SetCompare3 | ( | uint16_t | Compare3 | ) |
Sets the TIM1 Capture Compare3 Register value.
Definition at line 931 of file stm8l15x_tim1.c.
References TIM1.
void TIM1_SetCompare4 | ( | uint16_t | Compare4 | ) |
Sets the TIM1 Capture Compare4 Register value.
Definition at line 944 of file stm8l15x_tim1.c.
References TIM1.