STM8L15x Standard Peripherals Drivers: TimeBase management functions

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

TimeBase management functions

TimeBase management functions. More...

Functions

void TIM5_ARRPreloadConfig (FunctionalState NewState)
 Enables or disables TIM5 peripheral Preload register on ARR.
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_DeInit (void)
 Deinitialize the TIM5 peripheral registers to their default reset values.
uint16_t TIM5_GetCounter (void)
 Gets the TIM5 Counter value.
TIM5_Prescaler_TypeDef TIM5_GetPrescaler (void)
 Gets the TIM5 Prescaler value.
void TIM5_PrescalerConfig (TIM5_Prescaler_TypeDef Prescaler, TIM5_PSCReloadMode_TypeDef TIM5_PSCReloadMode)
 Configures the TIM5 Prescaler.
void TIM5_SelectOnePulseMode (TIM5_OPMode_TypeDef TIM5_OPMode)
 Selects the TIM�s One Pulse Mode.
void TIM5_SetAutoreload (uint16_t Autoreload)
 Sets the TIM5 Autoreload Register value.
void TIM5_SetCounter (uint16_t Counter)
 Sets the TIM5 Counter Register value.
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_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

TimeBase management functions.

 ===============================================================================
                       TimeBase management functions
 ===============================================================================  
  
       ===================================================================      
              TIM5 Driver: how to use it in Timing(Time base) Mode
       =================================================================== 
       To use the Timer in Timing(Time base) mode, the following steps are mandatory:
       
       1. Enable TIM5 clock using CLK_PeripheralClockConfig(CLK_Peripheral_TIM5, ENABLE) function.
        
       2. Call TIM5_TimeBaseInit() to configure the Time Base unit with the
          corresponding configuration.
          
       3. Enable global interrupts if you need to generate the update interrupt.
          
       4. Enable the corresponding interrupt using the function TIM5_ITConfig(TIM5_IT_Update) 
          
       5. Call the TIM5_Cmd(ENABLE) function to enable the TIM5 counter.
       
       Note1: All other functions can be used separately to modify, if needed,
          a specific feature of the Timer. 


Function Documentation

void TIM5_ARRPreloadConfig ( FunctionalState  NewState)

Enables or disables TIM5 peripheral Preload register on ARR.

Parameters:
NewState,:The new state of the TIM5 peripheral Preload register. This parameter can be ENABLE or DISABLE
Return values:
None

Definition at line 436 of file stm8l15x_tim5.c.

References DISABLE, IS_FUNCTIONAL_STATE, TIM5, and TIM_CR1_ARPE.

void TIM5_Cmd ( FunctionalState  NewState)

Enables or disables the TIM5 peripheral.

Parameters:
NewState,:The new state of the TIM5 peripheral. This parameter can be ENABLE or DISABLE
Return values:
None

Definition at line 482 of file stm8l15x_tim5.c.

References DISABLE, IS_FUNCTIONAL_STATE, TIM5, and TIM_CR1_CEN.

void TIM5_CounterModeConfig ( TIM5_CounterMode_TypeDef  TIM5_CounterMode)

Specifies the TIM5 Counter Mode to be used.

Parameters:
TIM5_CounterMode,:Specifies the Counter Mode to be used This parameter can be one of the following values:
  • TIM5_CounterMode_Up: Counter Up Mode
  • TIM5_CounterMode_Down: Counter Down Mode
  • TIM5_CounterMode_CenterAligned1: Counter Central aligned Mode 1
  • TIM5_CounterMode_CenterAligned2: Counter Central aligned Mode 2
  • TIM5_CounterMode_CenterAligned3: Counter Central aligned Mode 3
Return values:
None

Definition at line 300 of file stm8l15x_tim5.c.

References IS_TIM5_COUNTER_MODE, TIM5, TIM_CR1_CMS, and TIM_CR1_DIR.

uint16_t TIM5_GetCounter ( void  )

Gets the TIM5 Counter value.

Parameters:
None
Return values:
CounterRegister value.

Definition at line 350 of file stm8l15x_tim5.c.

References TIM5.

TIM5_Prescaler_TypeDef TIM5_GetPrescaler ( void  )

Gets the TIM5 Prescaler value.

Parameters:
None
Return values:
TIM5Prescaler, it can be one of the following values:
  • TIM5_Prescaler_1: Time base Prescaler = 1 (No effect)
  • TIM5_Prescaler_2: Time base Prescaler = 2
  • TIM5_Prescaler_4: Time base Prescaler = 4
  • TIM5_Prescaler_8: Time base Prescaler = 8
  • TIM5_Prescaler_16: Time base Prescaler = 16
  • TIM5_Prescaler_32: Time base Prescaler = 32
  • TIM5_Prescaler_64: Time base Prescaler = 64
  • TIM5_Prescaler_128: Time base Prescaler = 128

Definition at line 377 of file stm8l15x_tim5.c.

References TIM5.

void TIM5_PrescalerConfig ( TIM5_Prescaler_TypeDef  Prescaler,
TIM5_PSCReloadMode_TypeDef  TIM5_PSCReloadMode 
)

Configures the TIM5 Prescaler.

Parameters:
Prescaler,:Specifies the Prescaler Register value This parameter can be one of the following values:
  • TIM5_Prescaler_1: Time base Prescaler = 1 (No effect)
  • TIM5_Prescaler_2: Time base Prescaler = 2
  • TIM5_Prescaler_4: Time base Prescaler = 4
  • TIM5_Prescaler_8: Time base Prescaler = 8
  • TIM5_Prescaler_16: Time base Prescaler = 16
  • TIM5_Prescaler_32: Time base Prescaler = 32
  • TIM5_Prescaler_64: Time base Prescaler = 64
  • TIM5_Prescaler_128: Time base Prescaler = 128
TIM5_PSCReloadMode,:Specifies the TIM5 Prescaler Reload mode. This parameter can be one of the following values:
  • TIM5_PSCReloadMode_Update: Prescaler value is reloaded at every update
  • TIM5_PSCReloadMode_Immediate: Prescaler value is reloaded at every update
Return values:
None

Definition at line 268 of file stm8l15x_tim5.c.

References IS_TIM5_PRESCALER, IS_TIM5_PRESCALER_RELOAD, TIM5, TIM5_PSCReloadMode_Immediate, and TIM_EGR_UG.

void TIM5_SelectOnePulseMode ( TIM5_OPMode_TypeDef  TIM5_OPMode)

Selects the TIM�s One Pulse Mode.

Parameters:
TIM5_OPMode,:Specifies the OPM Mode to be used. This parameter can be one of the following values:
  • TIM5_OPMode_Single: Single one Pulse mode (OPM Active)
  • TIM5_OPMode_Repetitive: Single one Pulse mode (OPM Active)
Return values:
None

Definition at line 460 of file stm8l15x_tim5.c.

References IS_TIM5_OPM_MODE, TIM5, TIM5_OPMode_Single, and TIM_CR1_OPM.

void TIM5_SetAutoreload ( uint16_t  Autoreload)

Sets the TIM5 Autoreload Register value.

Parameters:
Autoreload,:Specifies the Autoreload register new value. This parameter is between 0x0000 and 0xFFFF.
Return values:
None

Definition at line 338 of file stm8l15x_tim5.c.

References TIM5.

void TIM5_SetCounter ( uint16_t  Counter)

Sets the TIM5 Counter Register value.

Parameters:
Counter,:Specifies the Counter register new value. This parameter is between 0x0000 and 0xFFFF.
Return values:
None

Definition at line 324 of file stm8l15x_tim5.c.

References TIM5.

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.

Parameters:
TIM5_Prescaler,:Prescaler This parameter can be one of the following values:
  • TIM5_Prescaler_1: Time base Prescaler = 1 (No effect)
  • TIM5_Prescaler_2: Time base Prescaler = 2
  • TIM5_Prescaler_4: Time base Prescaler = 4
  • TIM5_Prescaler_8: Time base Prescaler = 8
  • TIM5_Prescaler_16: Time base Prescaler = 16
  • TIM5_Prescaler_32: Time base Prescaler = 32
  • TIM5_Prescaler_64: Time base Prescaler = 64
  • TIM5_Prescaler_128: Time base Prescaler = 128
TIM5_CounterMode,:Counter mode This parameter can be one of the following values:
  • TIM5_CounterMode_Up: Counter Up Mode
  • TIM5_CounterMode_Down: Counter Down Mode
  • TIM5_CounterMode_CenterAligned1: Counter Central aligned Mode 1
  • TIM5_CounterMode_CenterAligned2: Counter Central aligned Mode 2
  • TIM5_CounterMode_CenterAligned3: Counter Central aligned Mode 3
TIM5_Period,:This parameter must be a value between 0x0000 and 0xFFFF.
Return values:
None

Definition at line 225 of file stm8l15x_tim5.c.

References IS_TIM5_COUNTER_MODE, IS_TIM5_PRESCALER, TIM5, TIM5_EventSource_Update, TIM_CR1_CMS, and TIM_CR1_DIR.

void TIM5_UpdateDisableConfig ( FunctionalState  NewState)

Enables or Disables the TIM5 Update event.

Parameters:
NewState,:The new state of the TIM5 peripheral Preload register. This parameter can be ENABLE or DISABLE
Return values:
None

Definition at line 390 of file stm8l15x_tim5.c.

References DISABLE, IS_FUNCTIONAL_STATE, TIM5, and TIM_CR1_UDIS.

void TIM5_UpdateRequestConfig ( TIM5_UpdateSource_TypeDef  TIM5_UpdateSource)

Selects the TIM5 Update Request Interrupt source.

Parameters:
TIM5_UpdateSource,:Specifies the Update source. This parameter can be one of the following values:
  • TIM5_UpdateSource_Global: Global Update request source
  • TIM5_UpdateSource_Regular: Regular Update request source
Return values:
None

Definition at line 414 of file stm8l15x_tim5.c.

References IS_TIM5_UPDATE_SOURCE, TIM5, TIM5_UpdateSource_Regular, and TIM_CR1_URS.

STM8S Firmware Library: Overview

 

 

 

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