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 TIM1_ARRPreloadConfig (FunctionalState NewState)
 Enables or disables TIM1 peripheral Preload register on ARR.
void TIM1_Cmd (FunctionalState NewState)
 Enables or disables the TIM1 peripheral.
void TIM1_CounterModeConfig (TIM1_CounterMode_TypeDef TIM1_CounterMode)
 Specifies the TIM1 Counter Mode to be used.
void TIM1_DeInit (void)
 Deinitializes the TIM1 peripheral registers to their default reset values.
uint16_t TIM1_GetCounter (void)
 Gets the TIM1 Counter value.
uint16_t TIM1_GetPrescaler (void)
 Gets the TIM1 Prescaler value.
void TIM1_PrescalerConfig (uint16_t Prescaler, TIM1_PSCReloadMode_TypeDef TIM1_PSCReloadMode)
 Configures the TIM1 Prescaler.
void TIM1_SelectOnePulseMode (TIM1_OPMode_TypeDef TIM1_OPMode)
 Selects the TIM1�s One Pulse Mode.
void TIM1_SetAutoreload (uint16_t Autoreload)
 Sets the TIM1 Autoreload Register value.
void TIM1_SetCounter (uint16_t Counter)
 Sets the TIM1 Counter Register value.
void TIM1_TimeBaseInit (uint16_t TIM1_Prescaler, TIM1_CounterMode_TypeDef TIM1_CounterMode, uint16_t TIM1_Period, uint8_t TIM1_RepetitionCounter)
 Initializes the TIM1 Time Base Unit according to the specified parameters.
void TIM1_UpdateDisableConfig (FunctionalState NewState)
 Enables or Disables the TIM1 Update event.
void TIM1_UpdateRequestConfig (TIM1_UpdateSource_TypeDef TIM1_UpdateSource)
 Selects the TIM1 Update Request Interrupt source.

Detailed Description

TimeBase management functions.

 ===============================================================================
                       TimeBase management functions
 ===============================================================================  
  
       ===================================================================      
              TIM1 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 TIM1 clock using CLK_PeripheralClockConfig(CLK_Peripheral_TIM1, ENABLE) function.
        
       2. Call TIM1_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 TIM1_ITConfig(TIM1_IT_Update) 
          
       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. 


Function Documentation

void TIM1_ARRPreloadConfig ( FunctionalState  NewState)

Enables or disables TIM1 peripheral Preload register on ARR.

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

Definition at line 420 of file stm8l15x_tim1.c.

References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CR1_ARPE.

void TIM1_Cmd ( FunctionalState  NewState)

Enables or disables the TIM1 peripheral.

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

Definition at line 466 of file stm8l15x_tim1.c.

References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CR1_CEN.

void TIM1_CounterModeConfig ( TIM1_CounterMode_TypeDef  TIM1_CounterMode)

Specifies the TIM1 Counter Mode to be used.

Parameters:
TIM1_CounterModespecifies the Counter Mode to be used This parameter can be one of the following values:
  • TIM1_CounterMode_Up: TIM1 Up Counting Mode
  • TIM1_CounterMode_Down: TIM1 Down Counting Mode
  • TIM1_CounterMode_CenterAligned1: TIM1 Center Aligned Mode1
  • TIM1_CounterMode_CenterAligned2: TIM1 Center Aligned Mode2
  • IM1_CounterMode_CenterAligned3: TIM1 Center Aligned Mode3
Return values:
None

Definition at line 297 of file stm8l15x_tim1.c.

References IS_TIM1_COUNTER_MODE, TIM1, TIM1_CR1_CMS, and TIM1_CR1_DIR.

uint16_t TIM1_GetCounter ( void  )

Gets the TIM1 Counter value.

Parameters:
None
Return values:
CounterRegister value.

Definition at line 339 of file stm8l15x_tim1.c.

References TIM1.

uint16_t TIM1_GetPrescaler ( void  )

Gets the TIM1 Prescaler value.

Parameters:
None
Return values:
PrescalerRegister value.

Definition at line 360 of file stm8l15x_tim1.c.

References TIM1.

void TIM1_PrescalerConfig ( uint16_t  Prescaler,
TIM1_PSCReloadMode_TypeDef  TIM1_PSCReloadMode 
)

Configures the TIM1 Prescaler.

Parameters:
Prescalerspecifies the Prescaler Register value This parameter must be a value between 0x0000 and 0xFFFF
TIM1_PSCReloadModespecifies the TIM1 Prescaler Reload mode. This parameter can be one of the following values
  • TIM1_PSCReloadMode_Immediate: The Prescaler is loaded immediately.
  • TIM1_PSCReloadMode_Update: The Prescaler is loaded at the update event.
Return values:
None

Definition at line 273 of file stm8l15x_tim1.c.

References IS_TIM1_PRESCALER_RELOAD, and TIM1.

void TIM1_SelectOnePulseMode ( TIM1_OPMode_TypeDef  TIM1_OPMode)

Selects the TIM1�s One Pulse Mode.

Parameters:
TIM1_OPModespecifies the OPM Mode to be used. This parameter can be one of the following values
  • TIM1_OPMode_Single
  • TIM1_OPMode_Repetitive
Return values:
None

Definition at line 444 of file stm8l15x_tim1.c.

References IS_TIM1_OPM_MODE, TIM1, TIM1_CR1_OPM, and TIM1_OPMode_Repetitive.

void TIM1_SetAutoreload ( uint16_t  Autoreload)

Sets the TIM1 Autoreload Register value.

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

Definition at line 327 of file stm8l15x_tim1.c.

References TIM1.

void TIM1_SetCounter ( uint16_t  Counter)

Sets the TIM1 Counter Register value.

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

Definition at line 314 of file stm8l15x_tim1.c.

References TIM1.

void TIM1_TimeBaseInit ( uint16_t  TIM1_Prescaler,
TIM1_CounterMode_TypeDef  TIM1_CounterMode,
uint16_t  TIM1_Period,
uint8_t  TIM1_RepetitionCounter 
)

Initializes the TIM1 Time Base Unit according to the specified parameters.

Parameters:
TIM1_Prescalerspecifies the Prescaler value.
TIM1_CounterModespecifies the counter mode from This parameter can be one of the following values:
  • TIM1_CounterMode_Up: Counter mode Up
  • TIM1_CounterMode_Down: Counter mode Down
  • TIM1_CounterMode_CenterAligned1: Counter mode center aligned
  • TIM1_CounterMode_CenterAligned2: Counter mode center aligned
  • TIM1_CounterMode_CenterAligned3: Counter mode center aligned
TIM1_Periodspecifies the Period value.
TIM1_RepetitionCounterspecifies the Repetition counter value
Return values:
None

Definition at line 235 of file stm8l15x_tim1.c.

References IS_TIM1_COUNTER_MODE, TIM1, TIM1_CR1_CMS, and TIM1_CR1_DIR.

void TIM1_UpdateDisableConfig ( FunctionalState  NewState)

Enables or Disables the TIM1 Update event.

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

Definition at line 374 of file stm8l15x_tim1.c.

References DISABLE, IS_FUNCTIONAL_STATE, TIM1, and TIM1_CR1_UDIS.

void TIM1_UpdateRequestConfig ( TIM1_UpdateSource_TypeDef  TIM1_UpdateSource)

Selects the TIM1 Update Request Interrupt source.

Parameters:
TIM1_UpdateSourcespecifies the Update source. This parameter can be one of the following values
  • TIM1_UpdateSource_Regular
  • TIM1_UpdateSource_Global
Return values:
None

Definition at line 398 of file stm8l15x_tim1.c.

References IS_TIM1_UPDATE_SOURCE, TIM1, TIM1_CR1_URS, and TIM1_UpdateSource_Global.

STM8S Firmware Library: Overview

 

 

 

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