STM8L15x Standard Peripherals Drivers: stm8l15x_clk.c File Reference

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

stm8l15x_clk.c File Reference

This file provides firmware functions to manage the following functionalities of the clock controler (CLK) peripheral:

  • Internal/external clocks, CSS and CCO configuration
  • System clocks configuration
  • Peripheral clocks configuration
  • CSS on LSE configuration
  • Low power clock configuration
  • Interrupts and flags management.
More...
#include "stm8l15x_clk.h"

Go to the source code of this file.

Functions

void CLK_AdjustHSICalibrationValue (uint8_t CLK_HSICalibrationValue)
 Adjusts the Internal High Speed oscillator (HSI) calibration value.
void CLK_BEEPClockConfig (CLK_BEEPCLKSource_TypeDef CLK_BEEPCLKSource)
 Configures the BEEP clock (BEEPCLK).
void CLK_CCOConfig (CLK_CCOSource_TypeDef CLK_CCOSource, CLK_CCODiv_TypeDef CLK_CCODiv)
 Selects the clock source to output on CCO pin(PC4).
void CLK_ClearFlag (void)
 Clears the CSS LSE Flag.
void CLK_ClearITPendingBit (CLK_IT_TypeDef CLK_IT)
 Clears the CLK's interrupt pending bits.
void CLK_ClockSecuritySystemEnable (void)
 Enables the Clock Security System.
void CLK_ClockSecuritySytemDeglitchCmd (FunctionalState NewState)
 Enables the Clock Security System deglitcher system.
void CLK_DeInit (void)
 Deinitializes the CLK peripheral registers to their default reset values.
uint32_t CLK_GetClockFreq (void)
 Returns the frequencies of different the SYSCLK.
FlagStatus CLK_GetFlagStatus (CLK_FLAG_TypeDef CLK_FLAG)
 Checks whether the specified CLK flag is set or not.
ITStatus CLK_GetITStatus (CLK_IT_TypeDef CLK_IT)
 Checks whether the specified CLK interrupt has occurred or not.
CLK_SYSCLKSource_TypeDef CLK_GetSYSCLKSource (void)
 Returns the clock source used as system clock.
void CLK_HaltConfig (CLK_Halt_TypeDef CLK_Halt, FunctionalState NewState)
 Configures clock during halt and active halt modes.
void CLK_HSEConfig (CLK_HSE_TypeDef CLK_HSE)
 Configures the External High Speed oscillator (HSE).
void CLK_HSICmd (FunctionalState NewState)
 Enables or disables the Internal High Speed oscillator (HSI).
void CLK_ITConfig (CLK_IT_TypeDef CLK_IT, FunctionalState NewState)
 Enables or disables the specified CLK interrupts.
void CLK_LSEClockSecuritySystemEnable (void)
 Enables the clock CSS on LSE.
void CLK_LSEConfig (CLK_LSE_TypeDef CLK_LSE)
 Configures the External Low Speed oscillator (LSE).
void CLK_LSICmd (FunctionalState NewState)
 Enables or disables the Internal Low Speed oscillator (LSI).
void CLK_MainRegulatorCmd (FunctionalState NewState)
 Configures the main voltage regulator.
void CLK_PeripheralClockConfig (CLK_Peripheral_TypeDef CLK_Peripheral, FunctionalState NewState)
 Enables or disables the specified peripheral clock.
void CLK_RTCCLKSwitchOnLSEFailureEnable (void)
 Enables RTC clock switch to LSI in case of LSE failure.
void CLK_RTCClockConfig (CLK_RTCCLKSource_TypeDef CLK_RTCCLKSource, CLK_RTCCLKDiv_TypeDef CLK_RTCCLKDiv)
 Configures the RTC clock (RTCCLK).
void CLK_SYSCLKDivConfig (CLK_SYSCLKDiv_TypeDef CLK_SYSCLKDiv)
 Configures the System clock (SYSCLK) dividers.
void CLK_SYSCLKSourceConfig (CLK_SYSCLKSource_TypeDef CLK_SYSCLKSource)
 Configures the system clock (SYSCLK).
void CLK_SYSCLKSourceSwitchCmd (FunctionalState NewState)
 Enables or disables the clock switch execution.

Variables

CONST uint8_t SYSDivFactor [5] = {1, 2, 4, 8, 16}

Detailed Description

This file provides firmware functions to manage the following functionalities of the clock controler (CLK) peripheral:

  • Internal/external clocks, CSS and CCO configuration
  • System clocks configuration
  • Peripheral clocks configuration
  • CSS on LSE configuration
  • Low power clock configuration
  • Interrupts and flags management.
Author:
MCD Application Team
Version:
V1.5.0
Date:
13-May-2011
  *               
  *          ===================================================================
  *                               CLK specific features
  *          ===================================================================
  *    
  *          After reset the device is running from Internal High Speed oscillator
  *          divided by 8 (HSI/8 = 2MHz) with all peripherals off.
  *           - The clock for all peripherals is switched off, except for the BootROM 
  *             clock used for bootloader, in which case, the software should be properly 
  *             written to switch off that clock after the bootloader execution.     
  *
  *          Once the device starts from reset, the user application has to:
  *           - Configure the clock source to be used to drive the System clock
  *             (if the application needs higher frequency/performance)
  *           - Configure the System clock frequency  
  *           - Enable the clock for the peripheral(s) to be used
  *           - Configure the clock source(s) for peripherals which clocks are not
  *             derived from the System clock (RTC/LCD, BEEP)
  *
  *  
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_clk.c.

STM8S Firmware Library: Overview

 

 

 

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