STM8L15x Standard Peripherals Drivers: stm8l15x_tim5.c File Reference

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

stm8l15x_tim5.c File Reference

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

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

Go to the source code of this file.

Functions

static void TI1_Config (TIM5_ICPolarity_TypeDef TIM5_ICPolarity, TIM5_ICSelection_TypeDef TIM5_ICSelection, uint8_t TIM5_ICFilter)
 Configure the TI1 as Input.
static void TI2_Config (TIM5_ICPolarity_TypeDef TIM5_ICPolarity, TIM5_ICSelection_TypeDef TIM5_ICSelection, uint8_t TIM5_ICFilter)
 Configure the TI2 as Input.
void TIM5_ARRPreloadConfig (FunctionalState NewState)
 Enables or disables TIM5 peripheral Preload register on ARR.
void TIM5_BKRConfig (TIM5_OSSIState_TypeDef TIM5_OSSIState, TIM5_LockLevel_TypeDef TIM5_LockLevel, TIM5_BreakState_TypeDef TIM5_BreakState, TIM5_BreakPolarity_TypeDef TIM5_BreakPolarity, TIM5_AutomaticOutput_TypeDef TIM5_AutomaticOutput)
 Configures the Break feature, dead time, Lock level, the OSSI, and the AOE(automatic output enable).
void TIM5_CCxCmd (TIM5_Channel_TypeDef TIM5_Channel, FunctionalState NewState)
 Enables or disables the TIM5 Capture Compare Channel x.
void TIM5_ClearFlag (TIM5_FLAG_TypeDef TIM5_FLAG)
 Clears the TIM�s pending flags.
void TIM5_ClearITPendingBit (TIM5_IT_TypeDef TIM5_IT)
 Clears the TIM's interrupt pending bits.
void TIM5_Cmd (FunctionalState NewState)
 Enables or disables the TIM5 peripheral.
void TIM5_CounterModeConfig (TIM5_CounterMode_TypeDef TIM5_CounterMode)
 Specifies the TIM5 Counter Mode to be used.
void TIM5_CtrlPWMOutputs (FunctionalState NewState)
 Enables or disables the TIM5 peripheral Main Outputs.
void TIM5_DeInit (void)
 Deinitialize the TIM5 peripheral registers to their default reset values.
void TIM5_DMACmd (TIM5_DMASource_TypeDef TIM5_DMASource, FunctionalState NewState)
 Enables or disables the TIM5 DMA Requests.
void TIM5_EncoderInterfaceConfig (TIM5_EncoderMode_TypeDef TIM5_EncoderMode, TIM5_ICPolarity_TypeDef TIM5_IC1Polarity, TIM5_ICPolarity_TypeDef TIM5_IC2Polarity)
 Configures the TIM5 Encoder Interface.
void TIM5_ETRClockMode1Config (TIM5_ExtTRGPSC_TypeDef TIM5_ExtTRGPrescaler, TIM5_ExtTRGPolarity_TypeDef TIM5_ExtTRGPolarity, uint8_t ExtTRGFilter)
 Configures the TIM5 External clock Mode1.
void TIM5_ETRClockMode2Config (TIM5_ExtTRGPSC_TypeDef TIM5_ExtTRGPrescaler, TIM5_ExtTRGPolarity_TypeDef TIM5_ExtTRGPolarity, uint8_t ExtTRGFilter)
 Configures the TIM5 External clock Mode2.
void TIM5_ETRConfig (TIM5_ExtTRGPSC_TypeDef TIM5_ExtTRGPrescaler, TIM5_ExtTRGPolarity_TypeDef TIM5_ExtTRGPolarity, uint8_t ExtTRGFilter)
 Configures the TIM5 External Trigger.
void TIM5_ForcedOC1Config (TIM5_ForcedAction_TypeDef TIM5_ForcedAction)
 Forces the TIM5 Channel1 output waveform to active or inactive level.
void TIM5_ForcedOC2Config (TIM5_ForcedAction_TypeDef TIM5_ForcedAction)
 Forces the TIM5 Channel2 output waveform to active or inactive level.
void TIM5_GenerateEvent (TIM5_EventSource_TypeDef TIM5_EventSource)
 Configures the TIM5 event to be generated by software.
uint16_t TIM5_GetCapture1 (void)
 Gets the TIM5 Input Capture 1 value.
uint16_t TIM5_GetCapture2 (void)
 Gets the TIM5 Input Capture 2 value.
uint16_t TIM5_GetCounter (void)
 Gets the TIM5 Counter value.
FlagStatus TIM5_GetFlagStatus (TIM5_FLAG_TypeDef TIM5_FLAG)
 Checks whether the specified TIM5 flag is set or not.
ITStatus TIM5_GetITStatus (TIM5_IT_TypeDef TIM5_IT)
 Checks whether the TIM5 interrupt has occurred or not.
TIM5_Prescaler_TypeDef TIM5_GetPrescaler (void)
 Gets the TIM5 Prescaler value.
void TIM5_ICInit (TIM5_Channel_TypeDef TIM5_Channel, TIM5_ICPolarity_TypeDef TIM5_ICPolarity, TIM5_ICSelection_TypeDef TIM5_ICSelection, TIM5_ICPSC_TypeDef TIM5_ICPrescaler, uint8_t TIM5_ICFilter)
 Initializes the TIM5 peripheral according to the specified parameters.
void TIM5_InternalClockConfig (void)
 Enables the TIM5 internal Clock.
void TIM5_ITConfig (TIM5_IT_TypeDef TIM5_IT, FunctionalState NewState)
 Enables or disables the specified TIM5 interrupts.
void TIM5_OC1FastConfig (FunctionalState NewState)
 Configures the TIM5 Capture Compare 1 Fast feature.
void TIM5_OC1Init (TIM5_OCMode_TypeDef TIM5_OCMode, TIM5_OutputState_TypeDef TIM5_OutputState, uint16_t TIM5_Pulse, TIM5_OCPolarity_TypeDef TIM5_OCPolarity, TIM5_OCIdleState_TypeDef TIM5_OCIdleState)
 Initializes the TIM5 Channel1 according to the specified parameters.
void TIM5_OC1PolarityConfig (TIM5_OCPolarity_TypeDef TIM5_OCPolarity)
 Configures the TIM5 Channel 1 polarity.
void TIM5_OC1PreloadConfig (FunctionalState NewState)
 Enables or disables the TIM5 peripheral Preload Register on CCR1.
void TIM5_OC2FastConfig (FunctionalState NewState)
 Configures the TIM5 Capture Compare 2 Fast feature.
void TIM5_OC2Init (TIM5_OCMode_TypeDef TIM5_OCMode, TIM5_OutputState_TypeDef TIM5_OutputState, uint16_t TIM5_Pulse, TIM5_OCPolarity_TypeDef TIM5_OCPolarity, TIM5_OCIdleState_TypeDef TIM5_OCIdleState)
 Initializes the TIM5 Channel2 according to the specified parameters.
void TIM5_OC2PolarityConfig (TIM5_OCPolarity_TypeDef TIM5_OCPolarity)
 Configures the TIM5 Channel 2 polarity.
void TIM5_OC2PreloadConfig (FunctionalState NewState)
 Enables or disables the TIM5 peripheral Preload Register on CCR2.
void TIM5_PrescalerConfig (TIM5_Prescaler_TypeDef Prescaler, TIM5_PSCReloadMode_TypeDef TIM5_PSCReloadMode)
 Configures the TIM5 Prescaler.
void TIM5_PWMIConfig (TIM5_Channel_TypeDef TIM5_Channel, TIM5_ICPolarity_TypeDef TIM5_ICPolarity, TIM5_ICSelection_TypeDef TIM5_ICSelection, TIM5_ICPSC_TypeDef TIM5_ICPrescaler, uint8_t TIM5_ICFilter)
 Configures the TIM5 peripheral in PWM Input Mode according to the specified parameters.
void TIM5_SelectCCDMA (FunctionalState NewState)
 Selects the TIM5 peripheral Capture Compare DMA source.
void TIM5_SelectHallSensor (FunctionalState NewState)
 Enables or Disables the TIM�s Hall sensor interface.
void TIM5_SelectInputTrigger (TIM5_TRGSelection_TypeDef TIM5_InputTriggerSource)
 Selects the TIM5 Input Trigger source.
void TIM5_SelectMasterSlaveMode (FunctionalState NewState)
 Sets or Resets the TIM5 Master/Slave Mode.
void TIM5_SelectOCxM (TIM5_Channel_TypeDef TIM5_Channel, TIM5_OCMode_TypeDef TIM5_OCMode)
 Selects the TIM5 Output Compare Mode.
void TIM5_SelectOnePulseMode (TIM5_OPMode_TypeDef TIM5_OPMode)
 Selects the TIM�s One Pulse Mode.
void TIM5_SelectOutputTrigger (TIM5_TRGOSource_TypeDef TIM5_TRGOSource)
 Selects the TIM5 Trigger Output Mode.
void TIM5_SelectSlaveMode (TIM5_SlaveMode_TypeDef TIM5_SlaveMode)
 Selects the TIM5 Slave Mode.
void TIM5_SetAutoreload (uint16_t Autoreload)
 Sets the TIM5 Autoreload Register value.
void TIM5_SetCompare1 (uint16_t Compare)
 Sets the TIM5 Capture Compare1 Register value.
void TIM5_SetCompare2 (uint16_t Compare)
 Sets the TIM5 Capture Compare2 Register value.
void TIM5_SetCounter (uint16_t Counter)
 Sets the TIM5 Counter Register value.
void TIM5_SetIC1Prescaler (TIM5_ICPSC_TypeDef TIM5_IC1Prescaler)
 Sets the TIM5 Input Capture 1 prescaler.
void TIM5_SetIC2Prescaler (TIM5_ICPSC_TypeDef TIM5_IC2Prescaler)
 Sets the TIM5 Input Capture 2 prescaler.
void TIM5_TimeBaseInit (TIM5_Prescaler_TypeDef TIM5_Prescaler, TIM5_CounterMode_TypeDef TIM5_CounterMode, uint16_t TIM5_Period)
 Initializes the TIM5 Time Base Unit according to the specified parameters.
void TIM5_TIxExternalClockConfig (TIM5_TIxExternalCLK1Source_TypeDef TIM5_TIxExternalCLKSource, TIM5_ICPolarity_TypeDef TIM5_ICPolarity, uint8_t ICFilter)
 Configures the TIM5 Trigger as External Clock.
void TIM5_UpdateDisableConfig (FunctionalState NewState)
 Enables or Disables the TIM5 Update event.
void TIM5_UpdateRequestConfig (TIM5_UpdateSource_TypeDef TIM5_UpdateSource)
 Selects the TIM5 Update Request Interrupt source.

Detailed Description

This file provides firmware functions to manage the following functionalities of the TIM5 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 TIM5
  *          peripheral
  *          These functions are split in 7 groups: 
  *   
  *          1. TIM5 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. TIM5 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. TIM5 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. TIM5 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. TIM5 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. TIM5 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. TIM5 specific interface management, this group includes all 
  *             needed functions to use the specific TIM5 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_tim5.c.

STM8S Firmware Library: Overview

 

 

 

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