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 TIM3_ARRPreloadConfig (FunctionalState NewState)
 Enables or disables TIM3 peripheral Preload register on ARR.
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_DeInit (void)
 Deinitialize the TIM3 peripheral registers to their default reset values.
uint16_t TIM3_GetCounter (void)
 Gets the TIM3 Counter value.
TIM3_Prescaler_TypeDef TIM3_GetPrescaler (void)
 Gets the TIM3 Prescaler value.
void TIM3_PrescalerConfig (TIM3_Prescaler_TypeDef Prescaler, TIM3_PSCReloadMode_TypeDef TIM3_PSCReloadMode)
 Configures the TIM3 Prescaler.
void TIM3_SelectOnePulseMode (TIM3_OPMode_TypeDef TIM3_OPMode)
 Selects the TIM�s One Pulse Mode.
void TIM3_SetAutoreload (uint16_t Autoreload)
 Sets the TIM3 Autoreload Register value.
void TIM3_SetCounter (uint16_t Counter)
 Sets the TIM3 Counter Register value.
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_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

TimeBase management functions.

 ===============================================================================
                       TimeBase management functions
 ===============================================================================  
  
       ===================================================================      
              TIM3 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 TIM3 clock using CLK_PeripheralClockConfig(CLK_Peripheral_TIM3, ENABLE) function.
        
       2. Call TIM3_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 TIM3_ITConfig(TIM3_IT_Update) 
          
       5. Call the TIM3_Cmd(ENABLE) function to enable the TIM3 counter.
       
       Note1: All other functions can be used separately to modify, if needed,
          a specific feature of the Timer. 


Function Documentation

void TIM3_ARRPreloadConfig ( FunctionalState  NewState)

Enables or disables TIM3 peripheral Preload register on ARR.

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

Definition at line 436 of file stm8l15x_tim3.c.

References DISABLE, IS_FUNCTIONAL_STATE, TIM3, and TIM_CR1_ARPE.

void TIM3_Cmd ( FunctionalState  NewState)

Enables or disables the TIM3 peripheral.

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

Definition at line 482 of file stm8l15x_tim3.c.

References DISABLE, IS_FUNCTIONAL_STATE, TIM3, and TIM_CR1_CEN.

void TIM3_CounterModeConfig ( TIM3_CounterMode_TypeDef  TIM3_CounterMode)

Specifies the TIM3 Counter Mode to be used.

Parameters:
TIM3_CounterMode,:Specifies the Counter Mode to be used This parameter can be one of the following values:
  • TIM3_CounterMode_Up: Counter Up Mode
  • TIM3_CounterMode_Down: Counter Down Mode
  • TIM3_CounterMode_CenterAligned1: Counter Central aligned Mode 1
  • TIM3_CounterMode_CenterAligned2: Counter Central aligned Mode 2
  • TIM3_CounterMode_CenterAligned3: Counter Central aligned Mode 3
Return values:
None

Definition at line 300 of file stm8l15x_tim3.c.

References IS_TIM3_COUNTER_MODE, TIM3, TIM_CR1_CMS, and TIM_CR1_DIR.

uint16_t TIM3_GetCounter ( void  )

Gets the TIM3 Counter value.

Parameters:
None
Return values:
CounterRegister value.

Definition at line 350 of file stm8l15x_tim3.c.

References TIM3.

TIM3_Prescaler_TypeDef TIM3_GetPrescaler ( void  )

Gets the TIM3 Prescaler value.

Parameters:
None
Return values:
TIM3Prescaler, it can be one of the following values:
  • TIM3_Prescaler_1: Time base Prescaler = 1 (No effect)
  • TIM3_Prescaler_2: Time base Prescaler = 2
  • TIM3_Prescaler_4: Time base Prescaler = 4
  • TIM3_Prescaler_8: Time base Prescaler = 8
  • TIM3_Prescaler_16: Time base Prescaler = 16
  • TIM3_Prescaler_32: Time base Prescaler = 32
  • TIM3_Prescaler_64: Time base Prescaler = 64
  • TIM3_Prescaler_128: Time base Prescaler = 128

Definition at line 377 of file stm8l15x_tim3.c.

References TIM3.

void TIM3_PrescalerConfig ( TIM3_Prescaler_TypeDef  Prescaler,
TIM3_PSCReloadMode_TypeDef  TIM3_PSCReloadMode 
)

Configures the TIM3 Prescaler.

Parameters:
Prescaler,:Specifies the Prescaler Register value This parameter can be one of the following values:
  • TIM3_Prescaler_1: Time base Prescaler = 1 (No effect)
  • TIM3_Prescaler_2: Time base Prescaler = 2
  • TIM3_Prescaler_4: Time base Prescaler = 4
  • TIM3_Prescaler_8: Time base Prescaler = 8
  • TIM3_Prescaler_16: Time base Prescaler = 16
  • TIM3_Prescaler_32: Time base Prescaler = 32
  • TIM3_Prescaler_64: Time base Prescaler = 64
  • TIM3_Prescaler_128: Time base Prescaler = 128
TIM3_PSCReloadMode,:Specifies the TIM3 Prescaler Reload mode. This parameter can be one of the following values:
  • TIM3_PSCReloadMode_Update: Prescaler value is reloaded at every update
  • TIM3_PSCReloadMode_Immediate: Prescaler value is reloaded at every update
Return values:
None

Definition at line 268 of file stm8l15x_tim3.c.

References IS_TIM3_PRESCALER, IS_TIM3_PRESCALER_RELOAD, TIM3, TIM3_PSCReloadMode_Immediate, and TIM_EGR_UG.

void TIM3_SelectOnePulseMode ( TIM3_OPMode_TypeDef  TIM3_OPMode)

Selects the TIM�s One Pulse Mode.

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

Definition at line 460 of file stm8l15x_tim3.c.

References IS_TIM3_OPM_MODE, TIM3, TIM3_OPMode_Single, and TIM_CR1_OPM.

void TIM3_SetAutoreload ( uint16_t  Autoreload)

Sets the TIM3 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_tim3.c.

References TIM3.

void TIM3_SetCounter ( uint16_t  Counter)

Sets the TIM3 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_tim3.c.

References TIM3.

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.

Parameters:
TIM3_Prescaler,:Prescaler This parameter can be one of the following values:
  • TIM3_Prescaler_1: Time base Prescaler = 1 (No effect)
  • TIM3_Prescaler_2: Time base Prescaler = 2
  • TIM3_Prescaler_4: Time base Prescaler = 4
  • TIM3_Prescaler_8: Time base Prescaler = 8
  • TIM3_Prescaler_16: Time base Prescaler = 16
  • TIM3_Prescaler_32: Time base Prescaler = 32
  • TIM3_Prescaler_64: Time base Prescaler = 64
  • TIM3_Prescaler_128: Time base Prescaler = 128
TIM3_CounterMode,:Counter mode This parameter can be one of the following values:
  • TIM3_CounterMode_Up: Counter Up Mode
  • TIM3_CounterMode_Down: Counter Down Mode
  • TIM3_CounterMode_CenterAligned1: Counter Central aligned Mode 1
  • TIM3_CounterMode_CenterAligned2: Counter Central aligned Mode 2
  • TIM3_CounterMode_CenterAligned3: Counter Central aligned Mode 3
TIM3_Period,:This parameter must be a value between 0x0000 and 0xFFFF.
Return values:
None

Definition at line 225 of file stm8l15x_tim3.c.

References IS_TIM3_COUNTER_MODE, IS_TIM3_PRESCALER, TIM3, TIM3_EventSource_Update, TIM_CR1_CMS, and TIM_CR1_DIR.

void TIM3_UpdateDisableConfig ( FunctionalState  NewState)

Enables or Disables the TIM3 Update event.

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

Definition at line 390 of file stm8l15x_tim3.c.

References DISABLE, IS_FUNCTIONAL_STATE, TIM3, and TIM_CR1_UDIS.

void TIM3_UpdateRequestConfig ( TIM3_UpdateSource_TypeDef  TIM3_UpdateSource)

Selects the TIM3 Update Request Interrupt source.

Parameters:
TIM3_UpdateSource,:Specifies the Update source. This parameter can be one of the following values:
  • TIM3_UpdateSource_Global: Global Update request source
  • TIM3_UpdateSource_Regular: Regular Update request source
Return values:
None

Definition at line 414 of file stm8l15x_tim3.c.

References IS_TIM3_UPDATE_SOURCE, TIM3, TIM3_UpdateSource_Regular, and TIM_CR1_URS.

STM8S Firmware Library: Overview

 

 

 

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