STM8L15x Standard Peripherals Drivers: Output Compare management functions

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

Output Compare management functions

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).

Parameters:
TIM1_OSSIStatespecifies the OSSIS State This parameter can be one of the following values:
  • TIM1_OSSIState_Enable: OSSIS State enabled
  • TIM1_OSSIState_Disable: OSSIS State disabled
TIM1_LockLevelspecifies the lock level This parameter can be one of the following values:
  • TIM1_LockLevel_Off: No lock level
  • TIM1_LockLevel_1: Lock level 1
  • TIM1_LockLevel_2: Lock level 2
  • TIM1_LockLevel_3: Lock level 3
TIM1_DeadTimespecifies the dead time value.
TIM1_Breakspecifies the Break state This parameter can be one of the following values:
  • TIM1_BreakState_Enable: Break enabled
  • TIM1_BreakState_Disable: Break disabled
TIM1_BreakPolarityspecifies the Break polarity This parameter can be one of the following values:
  • TIM1_BreakPolarity_Low: Break polarity high
  • TIM1_BreakPolarity_High: Break polarity low
TIM1_AutomaticOutputspecifies the Automatic Output configuration This parameter can be one of the following values:
  • TIM1_AutomaticOutput_Enable: Automatic Output enabled
  • TIM1_AutomaticOutput_Disable: Automatic Output disabled
Return values:
None

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.

Parameters:
NewStatenew state of the Capture Compare Preload Control bit. This parameter can be ENABLE or DISABLE.
Return values:
None

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).

Parameters:
TIM1_Channelspecifies the TIM1 Channel. This parameter can be one of the following values:
  • TIM1_Channel_1: TIM1 Channel1
  • TIM1_Channel_2: TIM1 Channel2
  • TIM1_Channel_3: TIM1 Channel3
  • TIM1_CHANNEL_4: TIM1 Channel4
NewStatespecifies the TIM1 Channel CCxE bit new state. This parameter can be: ENABLE or DISABLE.
Return values:
None

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).

Parameters:
TIM1_Channelspecifies the TIM1 Channel. This parameter can be one of the following values:
  • TIM1_Channel_1: TIM1 Channel1
  • TIM1_Channel_2: TIM1 Channel2
  • TIM1_Channel_3: TIM1 Channel3
NewStatespecifies the TIM1 Channel CCxNE bit new state. This parameter can be: ENABLE or DISABLE.
Return values:
None

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.

Parameters:
NewStatenew state of the Output Compare 1 Clear Enable bit. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
NewStatenew state of the Output Compare 2 Clear Enable bit. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
NewStatenew state of the Output Compare 3 Clear Enable bit. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
NewStatenew state of the Output Compare 4 Clear Enable bit. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
NewStatenew state of the TIM1 peripheral. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
TIM1_ForcedActionspecifies the forced Action to be set to the output waveform. This parameter can be one of the following values:
  • TIM1_ForcedAction_Active: Force active level on OC1REF
  • TIM1_ForcedAction_Inactive: Force inactive level on OC1REF.
Return values:
None

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.

Parameters:
TIM1_ForcedActionspecifies the forced Action to be set to the output waveform. This parameter can be one of the following values:
  • TIM1_ForcedAction_Active: Force active level on OC2REF
  • TIM1_ForcedAction_Inactive: Force inactive level on OC2REF.
Return values:
None

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.

Parameters:
TIM1_ForcedActionspecifies the forced Action to be set to the output waveform. This parameter can be one of the following values:
  • TIM1_ForcedAction_Active: Force active level on OC3REF
  • TIM1_ForcedAction_Inactive: Force inactive level on OC3REF.
Return values:
None

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.

Parameters:
NewStatenew state of the Output Compare Fast Enable bit. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
TIM1_OCModespecifies the Output Compare mode This parameter can be one of the following values:
  • TIM1_OCMode_Timing: OC Mode Timing
  • TIM1_OCMode_Active: OC Mode Active
  • TIM1_OCMode_Inactive: OC Mode Inactive
  • TIM1_OCMode_Toggle: OC Mode Toggle
  • TIM1_OCMode_PWM1: OC Mode PWM1
  • TIM1_OCMode_PWM2: OC Mode PWM2
TIM1_OutputStatespecifies the Output State This parameter can be one of the following values:
  • TIM1_OutputState_Disable: Output state disable
  • TIM1_OutputState_Enable: Output state enable
TIM1_OutputNStatespecifies the Complementary Output State This parameter can be one of the following values:
  • TIM1_OutputNState_Disable: Output N state disable
  • TIM1_OutputNState_Enable: Output N state enable
TIM1_Pulsespecifies the Pulse width value.
TIM1_OCPolarityspecifies the Output Compare Polarity This parameter can be one of the following values:
  • TIM1_OCPolarity_High: Output Compare active low
  • TIM1_OCPolarity_Low: Output Compare active high
TIM1_OCNPolarityspecifies the Complementary Output Compare Polarity This parameter can be one of the following values:
  • TIM1_OCNPolarity_High: Complementary Output Compare active low
  • TIM1_OCNPolarity_Low: Complementary Output Compare active high
TIM1_OCIdleStatespecifies the Output Compare Idle State This parameter can be one of the following values:
  • TIM1_OCIdleState_Set: Output Compare Idle state set
  • TIM1_OCIdleState_Reset: Output Compare Idle state reset
TIM1_OCNIdleStatespecifies the Complementary Output Compare Idle State This parameter can be one of the following values:
  • TIM1_OCNIdleState_Set: Complementary Output Compare Idle state set
  • TIM1_OCNIdleState_Reset: Complementary Output Compare Idle state reset
Return values:
None

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.

Parameters:
TIM1_OCNPolarityspecifies the OC1N Polarity. This parameter can be one of the following values:
  • TIM1_OCNPolarity_High: Complementary Output Compare active low
  • TIM1_OCNPolarity_Low: Complementary Output Compare active high
Return values:
None

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.

Parameters:
TIM1_OCPolarityspecifies the OC1 Polarity. This parameter can be one of the following values:
  • TIM1_OCPolarity_High: Output Compare active low
  • TIM1_OCPolarity_Low: Output Compare active high
Return values:
None

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.

Parameters:
NewStatenew state of the Capture Compare Preload register. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
NewStatenew state of the Output Compare Fast Enable bit. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
TIM1_OCModespecifies the Output Compare mode This parameter can be one of the following values:
  • TIM1_OCMode_Timing: OC Mode Timing
  • TIM1_OCMode_Active: OC Mode Active
  • TIM1_OCMode_Inactive: OC Mode Inactive
  • TIM1_OCMode_Toggle: OC Mode Toggle
  • TIM1_OCMode_PWM1: OC Mode PWM1
  • TIM1_OCMode_PWM2: OC Mode PWM2
TIM1_OutputStatespecifies the Output State This parameter can be one of the following values:
  • TIM1_OutputState_Disable: Output state disable
  • TIM1_OutputState_Enable: Output state enable
TIM1_OutputNStatespecifies the Complementary Output State This parameter can be one of the following values:
  • TIM1_OutputNState_Disable: Output N state disable
  • TIM1_OutputNState_Enable: Output N state enable
TIM1_Pulsespecifies the Pulse width value.
TIM1_OCPolarityspecifies the Output Compare Polarity This parameter can be one of the following values:
  • TIM1_OCPolarity_High: Output Compare active low
  • TIM1_OCPolarity_Low: Output Compare active high
TIM1_OCNPolarityspecifies the Complementary Output Compare This parameter can be one of the following values:
  • TIM1_OCNPolarity_High: Complementary Output Compare active low
  • TIM1_OCNPolarity_Low: Complementary Output Compare active high
TIM1_OCIdleStatespecifies the Output Compare Idle State This parameter can be one of the following values:
  • TIM1_OCIdleState_Set: Output Compare Idle state set
  • TIM1_OCIdleState_Reset: Output Compare Idle state reset
TIM1_OCNIdleStatespecifies the Complementary Output Compare Idle State This parameter can be one of the following values:
  • TIM1_OCNIdleState_Set: Complementary Output Compare Idle state set
  • TIM1_OCNIdleState_Reset: Complementary Output Compare Idle state reset
Return values:
None

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.

Parameters:
TIM1_OCNPolarityspecifies the OC2N Polarity. This parameter can be one of the following values:
  • TIM1_OCNPolarity_High: Complementary Output Compare active low
  • TIM1_OCNPolarity_Low: Complementary Output Compare active high
Return values:
None

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.

Parameters:
TIM1_OCPolarityspecifies the OC2 Polarity. This parameter can be one of the following values:
  • TIM1_OCPolarity_High: Output Compare active low
  • TIM1_OCPolarity_Low: Output Compare active high
Return values:
None

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.

Parameters:
NewStatenew state of the Capture Compare Preload register. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
NewStatenew state of the Output Compare Fast Enable bit. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
TIM1_OCModespecifies the Output Compare mode This parameter can be one of the following values:
  • TIM1_OCMode_Timing: OC Mode Timing
  • TIM1_OCMode_Active: OC Mode Active
  • TIM1_OCMode_Inactive: OC Mode Inactive
  • TIM1_OCMode_Toggle: OC Mode Toggle
  • TIM1_OCMode_PWM1: OC Mode PWM1
  • TIM1_OCMode_PWM2: OC Mode PWM2
TIM1_OutputStatespecifies the Output State This parameter can be one of the following values:
  • TIM1_OutputState_Disable: Output state disable
  • TIM1_OutputState_Enable: Output state enable
TIM1_OutputNStatespecifies the Complementary Output State This parameter can be one of the following values:
  • TIM1_OutputNState_Disable: Output N state disable
  • TIM1_OutputNState_Enable: Output N state enable
TIM1_Pulsespecifies the Pulse width value.
TIM1_OCPolarityspecifies the Output Compare Polarity This parameter can be one of the following values:
  • TIM1_OCPolarity_High: Output Compare active low
  • TIM1_OCPolarity_Low: Output Compare active high
TIM1_OCNPolarityspecifies the Complementary Output Compare Polarity This parameter can be one of the following values:
  • TIM1_OCNPolarity_High: Complementary Output Compare active low
  • TIM1_OCNPolarity_Low: Complementary Output Compare active high
TIM1_OCIdleStatespecifies the Output Compare Idle State This parameter can be one of the following values:
  • TIM1_OCIdleState_Set: Output Compare Idle state set
  • TIM1_OCIdleState_Reset: Output Compare Idle state reset
TIM1_OCNIdleStatespecifies the Complementary Output Compare Idle State This parameter can be one of the following values:
  • TIM1_OCNIdleState_Set: Complementary Output Compare Idle state set
  • TIM1_OCNIdleState_Reset: Complementary Output Compare Idle state reset
Return values:
None

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.

Parameters:
TIM1_OCNPolarityspecifies the OC3N Polarity. This parameter can be one of the following values:
  • TIM1_OCNPolarity_High: Complementary Output Compare active low
  • TIM1_OCNPolarity_Low: Complementary Output Compare active high
Return values:
None

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.

Parameters:
TIM1_OCPolarityspecifies the OC3 Polarity. This parameter can be one of the following values:
  • TIM1_OCPolarity_High: Output Compare active low
  • TIM1_OCPolarity_Low: Output Compare active high
Return values:
None

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.

Parameters:
NewStatenew state of the Capture Compare Preload register. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
NewStatenew state of the Capture Compare Preload register. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
NewStatenew state of the Commutation event. This parameter can be ENABLE or DISABLE.
Return values:
None

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.

Parameters:
TIM1_OCReferenceClear,:specifies the OCReference Clear source. This parameter can be one of the following values:
  • TIM1_OCReferenceClear_ETRF: OCReference Clear source ETR
  • TIM1_OCReferenceClear_OCREFCLR: OCReference Clear source OCREF
Return values:
None

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.
Parameters:
TIM1_Channelspecifies the TIM1 Channel. This parameter can be one of the following values:
  • TIM1_Channel_1: TIM1 Channel1
  • TIM1_Channel_2: TIM1 Channel2
  • TIM1_Channel_3: TIM1 Channel3
  • TIM1_Channel_4: TIM1 Channel4
TIM1_OCModespecifies the TIM1 Output Compare Mode. This parameter can be one of the following values:
  • TIM1_OCMode_Timing: OC Mode Timing
  • TIM1_OCMode_Active: OC Mode Active
  • TIM1_OCMode_Inactive: OC Mode Inactive
  • TIM1_OCMode_Toggle: OC Mode Toggle
  • TIM1_OCMode_PWM1: OC Mode PWM1
  • TIM1_OCMode_PWM2: OC Mode PWM2
Return values:
None

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.

Parameters:
Compare1specifies the Capture Compare1 register new value. This parameter is between 0x0000 and 0xFFFF.
Return values:
None

Definition at line 904 of file stm8l15x_tim1.c.

References TIM1.

void TIM1_SetCompare2 ( uint16_t  Compare2)

Sets the TIM1 Capture Compare2 Register value.

Parameters:
Compare2specifies the Capture Compare2 register new value. This parameter is between 0x0000 and 0xFFFF.
Return values:
None

Definition at line 918 of file stm8l15x_tim1.c.

References TIM1.

void TIM1_SetCompare3 ( uint16_t  Compare3)

Sets the TIM1 Capture Compare3 Register value.

Parameters:
Compare3specifies the Capture Compare3 register new value. This parameter is between 0x0000 and 0xFFFF.
Return values:
None

Definition at line 931 of file stm8l15x_tim1.c.

References TIM1.

void TIM1_SetCompare4 ( uint16_t  Compare4)

Sets the TIM1 Capture Compare4 Register value.

Parameters:
Compare4specifies the Capture Compare4 register new value. This parameter is between 0x0000 and 0xFFFF.
Return values:
None

Definition at line 944 of file stm8l15x_tim1.c.

References TIM1.

STM8S Firmware Library: Overview

 

 

 

For complete documentation on STM8L15x 8-bit microcontrollers platform visit www.st.com