STM8L15x Standard Peripherals Drivers: Peripheral clocks configuration functions

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

Peripheral clocks configuration functions

Peripheral clocks configuration functions. More...

Functions

void CLK_BEEPClockConfig (CLK_BEEPCLKSource_TypeDef CLK_BEEPCLKSource)
 Configures the BEEP clock (BEEPCLK).
void CLK_PeripheralClockConfig (CLK_Peripheral_TypeDef CLK_Peripheral, FunctionalState NewState)
 Enables or disables the specified peripheral clock.
void CLK_RTCClockConfig (CLK_RTCCLKSource_TypeDef CLK_RTCCLKSource, CLK_RTCCLKDiv_TypeDef CLK_RTCCLKDiv)
 Configures the RTC clock (RTCCLK).

Detailed Description

Peripheral clocks configuration functions.

 ===============================================================================
                   Peripheral clocks configuration functions
 ===============================================================================  

  This section provides functions allowing to configure the Peripheral clocks. 
  
  1. The RTC clock which is derived from the LSI, LSE, HSI or HSE clock divided by 1 to 64.
     
  2. The BEEP clock which is derived from the LSI or LSE clocks.

  3. After restart from Reset or wakeup from HALT, all peripherals are off
     Before to start using a peripheral you have to enable its interface clock. 
     You can do this using CLK_AHBPeriphClockCmd()
     , CLK_APB2PeriphClockCmd() and CLK_APB1PeriphClockCmd() functions.
     
  4. To reset the peripherals configuration (to the default state after device reset)
     you can use CLK_PeripheralClockConfig() function.  


Function Documentation

void CLK_BEEPClockConfig ( CLK_BEEPCLKSource_TypeDef  CLK_BEEPCLKSource)

Configures the BEEP clock (BEEPCLK).

Parameters:
CLK_BEEPCLKSource,:specifies the BEEP clock source. This parameter can be one of the following values:
  • CLK_BEEPCLKSource_Off: BEEP clock Off
  • CLK_BEEPCLKSource_LSE: LSE selected as BEEP clock
  • CLK_BEEPCLKSource_LSI: LSI selected as BEEP clock
Return values:
None

Definition at line 629 of file stm8l15x_clk.c.

References CLK, and IS_CLK_CLOCK_BEEP.

void CLK_PeripheralClockConfig ( CLK_Peripheral_TypeDef  CLK_Peripheral,
FunctionalState  NewState 
)

Enables or disables the specified peripheral clock.

Note:
After reset, the peripheral clock (used for registers read/write access) is disabled and the application software has to enable this clock before using it.
Parameters:
CLK_Peripheral,:specifies the peripheral to gate its clock. This parameter can be any combination of the following values:
  • CLK_Peripheral_TIM2: TIM2 clock
  • CLK_Peripheral_TIM3: TIM3 clock
  • CLK_Peripheral_TIM4: TIM4 clock
  • CLK_Peripheral_I2C1: I2C1 clock
  • CLK_Peripheral_SPI1: SPI1 clock
  • CLK_Peripheral_USART1: USART1 clock
  • CLK_Peripheral_BEEP: BEEP clock
  • CLK_Peripheral_DAC: DAC clock
  • CLK_Peripheral_ADC1: ADC1 clock
  • CLK_Peripheral_TIM1: TIM1 clock
  • CLK_Peripheral_RTC: RTC clock
  • CLK_Peripheral_LCD: LCD clock
  • CLK_Peripheral_DMA1: DMA1 clock
  • CLK_Peripheral_COMP: COMP clock
  • CLK_Peripheral_BOOTROM: BOOTROM clock
  • CLK_Peripheral_AES: AES clock
  • CLK_Peripheral_TIM5: TIM5 clock
  • CLK_Peripheral_SPI2: SPI2 clock
  • CLK_Peripheral_USART2: USART2 clock
  • CLK_Peripheral_USART3: USART3 clock
  • CLK_Peripheral_CSSLSE: CSS on LSE clock
NewState,:new state of the specified peripheral clock. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 671 of file stm8l15x_clk.c.

References CLK, DISABLE, IS_CLK_PERIPHERAL, and IS_FUNCTIONAL_STATE.

void CLK_RTCClockConfig ( CLK_RTCCLKSource_TypeDef  CLK_RTCCLKSource,
CLK_RTCCLKDiv_TypeDef  CLK_RTCCLKDiv 
)

Configures the RTC clock (RTCCLK).

Parameters:
CLK_RTCCLKSource,:specifies the RTC clock source. This parameter can be one of the following values:
  • CLK_RTCCLKSource_Off: RTC clock Off
  • CLK_RTCCLKSource_LSE: LSE selected as RTC clock
  • CLK_RTCCLKSource_LSI: LSI selected as RTC clock
  • CLK_RTCCLKSource_HSE: HSE selected as RTC clock
  • CLK_RTCCLKSource_HSI: HSI selected as RTC clock
CLK_RTCCLKDiv,:specifies the RTC clock source divider. This parameter can be one of the following values:
  • CLK_RTCCLKDiv_1: Clock RTC Div 1
  • CLK_RTCCLKDiv_2: Clock RTC Div 2
  • CLK_RTCCLKDiv_4: Clock RTC Div 4
  • CLK_RTCCLKDiv_8: Clock RTC Div 8
  • CLK_RTCCLKDiv_16: Clock RTC Div 16
  • CLK_RTCCLKDiv_32: Clock RTC Div 32
  • CLK_RTCCLKDiv_64: Clock RTC Div 64
Note:
If the LSE or LSI is used as RTC clock source, the RTC continues to work in HALT and Active HALT modes, and can be used as wakeup source. However, when the HSE clock is used as RTC clock source.
The maximum input clock frequency for RTC is 1MHz (when using HSE/HSI as RTC clock source).
Return values:
None

Definition at line 610 of file stm8l15x_clk.c.

References CLK, IS_CLK_CLOCK_RTC, and IS_CLK_CLOCK_RTC_DIV.

STM8S Firmware Library: Overview

 

 

 

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