STM8L15x Standard Peripherals Drivers: stm8l15x_tim3.c File Reference

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

stm8l15x_tim3.c File Reference

This file provides firmware functions to manage the following functionalities of the TIM3 peripheral:

  • TimeBase management
  • Output Compare management
  • Input Capture management
  • Interrupts, DMA and flags management
  • Clocks management
  • Synchronization management
  • Specific interface management.
More...
#include "stm8l15x_TIM3.h"

Go to the source code of this file.

Functions

static void TI1_Config (TIM3_ICPolarity_TypeDef TIM3_ICPolarity, TIM3_ICSelection_TypeDef TIM3_ICSelection, uint8_t TIM3_ICFilter)
 Configure the TI1 as Input.
static void TI2_Config (TIM3_ICPolarity_TypeDef TIM3_ICPolarity, TIM3_ICSelection_TypeDef TIM3_ICSelection, uint8_t TIM3_ICFilter)
 Configure the TI2 as Input.
void TIM3_ARRPreloadConfig (FunctionalState NewState)
 Enables or disables TIM3 peripheral Preload register on ARR.
void TIM3_BKRConfig (TIM3_OSSIState_TypeDef TIM3_OSSIState, TIM3_LockLevel_TypeDef TIM3_LockLevel, TIM3_BreakState_TypeDef TIM3_BreakState, TIM3_BreakPolarity_TypeDef TIM3_BreakPolarity, TIM3_AutomaticOutput_TypeDef TIM3_AutomaticOutput)
 Configures the Break feature, dead time, Lock level, the OSSI, and the AOE(automatic output enable).
void TIM3_CCxCmd (TIM3_Channel_TypeDef TIM3_Channel, FunctionalState NewState)
 Enables or disables the TIM3 Capture Compare Channel x.
void TIM3_ClearFlag (TIM3_FLAG_TypeDef TIM3_FLAG)
 Clears the TIM�s pending flags.
void TIM3_ClearITPendingBit (TIM3_IT_TypeDef TIM3_IT)
 Clears the TIM's interrupt pending bits.
void TIM3_Cmd (FunctionalState NewState)
 Enables or disables the TIM3 peripheral.
void TIM3_CounterModeConfig (TIM3_CounterMode_TypeDef TIM3_CounterMode)
 Specifies the TIM3 Counter Mode to be used.
void TIM3_CtrlPWMOutputs (FunctionalState NewState)
 Enables or disables the TIM3 peripheral Main Outputs.
void TIM3_DeInit (void)
 Deinitialize the TIM3 peripheral registers to their default reset values.
void TIM3_DMACmd (TIM3_DMASource_TypeDef TIM3_DMASource, FunctionalState NewState)
 Enables or disables the TIM3 DMA Requests.
void TIM3_EncoderInterfaceConfig (TIM3_EncoderMode_TypeDef TIM3_EncoderMode, TIM3_ICPolarity_TypeDef TIM3_IC1Polarity, TIM3_ICPolarity_TypeDef TIM3_IC2Polarity)
 Configures the TIM3 Encoder Interface.
void TIM3_ETRClockMode1Config (TIM3_ExtTRGPSC_TypeDef TIM3_ExtTRGPrescaler, TIM3_ExtTRGPolarity_TypeDef TIM3_ExtTRGPolarity, uint8_t ExtTRGFilter)
 Configures the TIM3 External clock Mode1.
void TIM3_ETRClockMode2Config (TIM3_ExtTRGPSC_TypeDef TIM3_ExtTRGPrescaler, TIM3_ExtTRGPolarity_TypeDef TIM3_ExtTRGPolarity, uint8_t ExtTRGFilter)
 Configures the TIM3 External clock Mode2.
void TIM3_ETRConfig (TIM3_ExtTRGPSC_TypeDef TIM3_ExtTRGPrescaler, TIM3_ExtTRGPolarity_TypeDef TIM3_ExtTRGPolarity, uint8_t ExtTRGFilter)
 Configures the TIM3 External Trigger.
void TIM3_ForcedOC1Config (TIM3_ForcedAction_TypeDef TIM3_ForcedAction)
 Forces the TIM3 Channel1 output waveform to active or inactive level.
void TIM3_ForcedOC2Config (TIM3_ForcedAction_TypeDef TIM3_ForcedAction)
 Forces the TIM3 Channel2 output waveform to active or inactive level.
void TIM3_GenerateEvent (TIM3_EventSource_TypeDef TIM3_EventSource)
 Configures the TIM3 event to be generated by software.
uint16_t TIM3_GetCapture1 (void)
 Gets the TIM3 Input Capture 1 value.
uint16_t TIM3_GetCapture2 (void)
 Gets the TIM3 Input Capture 2 value.
uint16_t TIM3_GetCounter (void)
 Gets the TIM3 Counter value.
FlagStatus TIM3_GetFlagStatus (TIM3_FLAG_TypeDef TIM3_FLAG)
 Checks whether the specified TIM3 flag is set or not.
ITStatus TIM3_GetITStatus (TIM3_IT_TypeDef TIM3_IT)
 Checks whether the TIM3 interrupt has occurred or not.
TIM3_Prescaler_TypeDef TIM3_GetPrescaler (void)
 Gets the TIM3 Prescaler value.
void TIM3_ICInit (TIM3_Channel_TypeDef TIM3_Channel, TIM3_ICPolarity_TypeDef TIM3_ICPolarity, TIM3_ICSelection_TypeDef TIM3_ICSelection, TIM3_ICPSC_TypeDef TIM3_ICPrescaler, uint8_t TIM3_ICFilter)
 Initializes the TIM3 peripheral according to the specified parameters.
void TIM3_InternalClockConfig (void)
 Enables the TIM3 internal Clock.
void TIM3_ITConfig (TIM3_IT_TypeDef TIM3_IT, FunctionalState NewState)
 Enables or disables the specified TIM3 interrupts.
void TIM3_OC1FastConfig (FunctionalState NewState)
 Configures the TIM3 Capture Compare 1 Fast feature.
void TIM3_OC1Init (TIM3_OCMode_TypeDef TIM3_OCMode, TIM3_OutputState_TypeDef TIM3_OutputState, uint16_t TIM3_Pulse, TIM3_OCPolarity_TypeDef TIM3_OCPolarity, TIM3_OCIdleState_TypeDef TIM3_OCIdleState)
 Initializes the TIM3 Channel1 according to the specified parameters.
void TIM3_OC1PolarityConfig (TIM3_OCPolarity_TypeDef TIM3_OCPolarity)
 Configures the TIM3 Channel 1 polarity.
void TIM3_OC1PreloadConfig (FunctionalState NewState)
 Enables or disables the TIM3 peripheral Preload Register on CCR1.
void TIM3_OC2FastConfig (FunctionalState NewState)
 Configures the TIM3 Capture Compare 2 Fast feature.
void TIM3_OC2Init (TIM3_OCMode_TypeDef TIM3_OCMode, TIM3_OutputState_TypeDef TIM3_OutputState, uint16_t TIM3_Pulse, TIM3_OCPolarity_TypeDef TIM3_OCPolarity, TIM3_OCIdleState_TypeDef TIM3_OCIdleState)
 Initializes the TIM3 Channel2 according to the specified parameters.
void TIM3_OC2PolarityConfig (TIM3_OCPolarity_TypeDef TIM3_OCPolarity)
 Configures the TIM3 Channel 2 polarity.
void TIM3_OC2PreloadConfig (FunctionalState NewState)
 Enables or disables the TIM3 peripheral Preload Register on CCR2.
void TIM3_PrescalerConfig (TIM3_Prescaler_TypeDef Prescaler, TIM3_PSCReloadMode_TypeDef TIM3_PSCReloadMode)
 Configures the TIM3 Prescaler.
void TIM3_PWMIConfig (TIM3_Channel_TypeDef TIM3_Channel, TIM3_ICPolarity_TypeDef TIM3_ICPolarity, TIM3_ICSelection_TypeDef TIM3_ICSelection, TIM3_ICPSC_TypeDef TIM3_ICPrescaler, uint8_t TIM3_ICFilter)
 Configures the TIM3 peripheral in PWM Input Mode according to the specified parameters.
void TIM3_SelectCCDMA (FunctionalState NewState)
 Selects the TIM3 peripheral Capture Compare DMA source.
void TIM3_SelectHallSensor (FunctionalState NewState)
 Enables or Disables the TIM�s Hall sensor interface.
void TIM3_SelectInputTrigger (TIM3_TRGSelection_TypeDef TIM3_InputTriggerSource)
 Selects the TIM3 Input Trigger source.
void TIM3_SelectMasterSlaveMode (FunctionalState NewState)
 Sets or Resets the TIM3 Master/Slave Mode.
void TIM3_SelectOCxM (TIM3_Channel_TypeDef TIM3_Channel, TIM3_OCMode_TypeDef TIM3_OCMode)
 Selects the TIM3 Output Compare Mode.
void TIM3_SelectOnePulseMode (TIM3_OPMode_TypeDef TIM3_OPMode)
 Selects the TIM�s One Pulse Mode.
void TIM3_SelectOutputTrigger (TIM3_TRGOSource_TypeDef TIM3_TRGOSource)
 Selects the TIM3 Trigger Output Mode.
void TIM3_SelectSlaveMode (TIM3_SlaveMode_TypeDef TIM3_SlaveMode)
 Selects the TIM3 Slave Mode.
void TIM3_SetAutoreload (uint16_t Autoreload)
 Sets the TIM3 Autoreload Register value.
void TIM3_SetCompare1 (uint16_t Compare)
 Sets the TIM3 Capture Compare1 Register value.
void TIM3_SetCompare2 (uint16_t Compare)
 Sets the TIM3 Capture Compare2 Register value.
void TIM3_SetCounter (uint16_t Counter)
 Sets the TIM3 Counter Register value.
void TIM3_SetIC1Prescaler (TIM3_ICPSC_TypeDef TIM3_IC1Prescaler)
 Sets the TIM3 Input Capture 1 prescaler.
void TIM3_SetIC2Prescaler (TIM3_ICPSC_TypeDef TIM3_IC2Prescaler)
 Sets the TIM3 Input Capture 2 prescaler.
void TIM3_TimeBaseInit (TIM3_Prescaler_TypeDef TIM3_Prescaler, TIM3_CounterMode_TypeDef TIM3_CounterMode, uint16_t TIM3_Period)
 Initializes the TIM3 Time Base Unit according to the specified parameters.
void TIM3_TIxExternalClockConfig (TIM3_TIxExternalCLK1Source_TypeDef TIM3_TIxExternalCLKSource, TIM3_ICPolarity_TypeDef TIM3_ICPolarity, uint8_t ICFilter)
 Configures the TIM3 Trigger as External Clock.
void TIM3_UpdateDisableConfig (FunctionalState NewState)
 Enables or Disables the TIM3 Update event.
void TIM3_UpdateRequestConfig (TIM3_UpdateSource_TypeDef TIM3_UpdateSource)
 Selects the TIM3 Update Request Interrupt source.

Detailed Description

This file provides firmware functions to manage the following functionalities of the TIM3 peripheral:

  • TimeBase management
  • Output Compare management
  • Input Capture management
  • Interrupts, DMA and flags management
  • Clocks management
  • Synchronization management
  • Specific interface management.
Author:
MCD Application Team
Version:
V1.5.0
Date:
13-May-2011
  *  
  *          ===================================================================
  *                                 How to use this driver
  *          ===================================================================
  *          This driver provides functions to configure and initialise the TIM3
  *          peripheral
  *          These functions are split in 7 groups: 
  *   
  *          1. TIM3 TimeBase management: this group includes all needed functions 
  *             to configure the TIM Timebase unit:
  *                   - Set/Get Prescaler
  *                   - Set/Get Autoreload  
  *                   - Counter modes configuration
  *                   - Select the One Pulse mode
  *                   - Update Request Configuration
  *                   - Update Disable Configuration
  *                   - Auto-Preload Configuration 
  *                   - Enable/Disable the counter
  *                 
  *          2. TIM3 Output Compare management: this group includes all needed 
  *             functions to configure the Capture/Compare unit used in Output 
  *             compare mode: 
  *                   - Configure each channel, independently, in Output Compare mode
  *                   - Select the output compare modes
  *                   - Select the Polarities of each channel
  *                   - Set/Get the Capture/Compare register values
  *                   - Select the Output Compare Fast mode 
  *                   - Select the Output Compare Forced mode  
  *                   - Output Compare-Preload Configuration 
  *                   - Enable/Disable the Capture/Compare Channels    
  *                   
  *          3. TIM3 Input Capture management: this group includes all needed 
  *             functions to configure the Capture/Compare unit used in 
  *             Input Capture mode:
  *                   - Configure each channel in input capture mode
  *                   - Configure Channel1/2 in PWM Input mode
  *                   - Set the Input Capture Prescaler
  *                   - Get the Capture/Compare values      
  *        
  *          4. TIM3 interrupts, DMA and flags management
  *                   - Enable/Disable interrupt sources
  *                   - Get flags status
  *                   - Clear flags/ Pending bits
  *                   - Enable/Disable DMA requests 
  *                   - Select CaptureCompare DMA request  
  *              
  *          5. TIM3 clocks management: this group includes all needed functions 
  *             to configure the clock controller unit:
  *                   - Select internal/External clock
  *                   - Select the external clock mode: ETR(Mode1/Mode2) or TIx
  *         
  *          6. TIM3 synchronization management: this group includes all needed 
  *             functions to configure the Synchronization unit:
  *                   - Select Input Trigger  
  *                   - Select Output Trigger  
  *                   - Select Master Slave Mode 
  *                   - ETR Configuration when used as external trigger   
  *     
  *          7. TIM3 specific interface management, this group includes all 
  *             needed functions to use the specific TIM3 interface:
  *                   - Encoder Interface Configuration
  *                   - Select Hall Sensor        
  *   
  *  
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_tim3.c.

STM8S Firmware Library: Overview

 

 

 

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