STM8S/A Standard Peripherals Drivers
|
This file contains all functions prototype and macros for the CLK peripheral. More...
#include "stm8s.h"
Go to the source code of this file.
Defines | |
#define | CLK_TIMEOUT ((uint16_t)0xFFFF) |
#define | IS_CLK_CSSCONFIG_OK(CSSVALUE) |
Macros used by the assert function in order to check the CSS configuration. | |
#define | IS_CLK_CURRENTCLOCKSTATE_OK(STATE) |
Macros used by the assert function in order to check the current clock state. | |
#define | IS_CLK_FLAG_OK(FLAG) |
Macros used by the assert function in order to check the different clock flags. | |
#define | IS_CLK_HSIPRESCALER_OK(PRESCALER) |
Macros used by the assert function in order to check the different HSI prescaler values. | |
#define | IS_CLK_HSITRIMVALUE_OK(TRIMVALUE) |
Macros used by the assert function in order to check the different HSI trimming values. | |
#define | IS_CLK_IT_OK(IT) (((IT) == CLK_IT_CSSD) || ((IT) == CLK_IT_SWIF)) |
Macros used by the assert function in order to check the different clock IT pending bits. | |
#define | IS_CLK_OUTPUT_OK(OUTPUT) |
Macros used by the assert function in order to check the different clocks to output. | |
#define | IS_CLK_PERIPHERAL_OK(PERIPHERAL) |
Macros used by the assert function in order to check the different peripheral's clock. | |
#define | IS_CLK_PRESCALER_OK(PRESCALER) |
Macros used by the assert function in order to check the different clock prescaler values. | |
#define | IS_CLK_SOURCE_OK(SOURCE) |
Macros used by the assert function in order to check the different clock sources. | |
#define | IS_CLK_SWIMDIVIDER_OK(SWIMDIVIDER) (((SWIMDIVIDER) == CLK_SWIMDIVIDER_2) || ((SWIMDIVIDER) == CLK_SWIMDIVIDER_OTHER)) |
Macros used by the assert function in order to check the different SWIM dividers values. | |
#define | IS_CLK_SWITCHMODE_OK(MODE) (((MODE) == CLK_SWITCHMODE_MANUAL) || ((MODE) == CLK_SWITCHMODE_AUTO)) |
Macros used by the assert function in order to check the different functions parameters. | |
Enumerations | |
enum | CLK_CSSConfig_TypeDef { CLK_CSSCONFIG_ENABLEWITHIT = (uint8_t)0x05, CLK_CSSCONFIG_ENABLE = (uint8_t)0x01, CLK_CSSCONFIG_DISABLE = (uint8_t)0x00 } |
Clock security system configuration. More... | |
enum | CLK_CurrentClockState_TypeDef { CLK_CURRENTCLOCKSTATE_DISABLE = (uint8_t)0x00, CLK_CURRENTCLOCKSTATE_ENABLE = (uint8_t)0x01 } |
Current Clock State. More... | |
enum | CLK_Flag_TypeDef { CLK_FLAG_LSIRDY = (uint16_t)0x0110, CLK_FLAG_HSIRDY = (uint16_t)0x0102, CLK_FLAG_HSERDY = (uint16_t)0x0202, CLK_FLAG_SWIF = (uint16_t)0x0308, CLK_FLAG_SWBSY = (uint16_t)0x0301, CLK_FLAG_CSSD = (uint16_t)0x0408, CLK_FLAG_AUX = (uint16_t)0x0402, CLK_FLAG_CCOBSY = (uint16_t)0x0504, CLK_FLAG_CCORDY = (uint16_t)0x0502 } |
CLK Flags. More... | |
enum | CLK_HSITrimValue_TypeDef { CLK_HSITRIMVALUE_0 = (uint8_t)0x00, CLK_HSITRIMVALUE_1 = (uint8_t)0x01, CLK_HSITRIMVALUE_2 = (uint8_t)0x02, CLK_HSITRIMVALUE_3 = (uint8_t)0x03, CLK_HSITRIMVALUE_4 = (uint8_t)0x04, CLK_HSITRIMVALUE_5 = (uint8_t)0x05, CLK_HSITRIMVALUE_6 = (uint8_t)0x06, CLK_HSITRIMVALUE_7 = (uint8_t)0x07 } |
CLK HSI Calibration Value. More... | |
enum | CLK_IT_TypeDef { CLK_IT_CSSD = (uint8_t)0x0C, CLK_IT_SWIF = (uint8_t)0x1C } |
CLK interrupt configuration and Flags cleared by software. More... | |
enum | CLK_Output_TypeDef { CLK_OUTPUT_HSI = (uint8_t)0x00, CLK_OUTPUT_LSI = (uint8_t)0x02, CLK_OUTPUT_HSE = (uint8_t)0x04, CLK_OUTPUT_CPU = (uint8_t)0x08, CLK_OUTPUT_CPUDIV2 = (uint8_t)0x0A, CLK_OUTPUT_CPUDIV4 = (uint8_t)0x0C, CLK_OUTPUT_CPUDIV8 = (uint8_t)0x0E, CLK_OUTPUT_CPUDIV16 = (uint8_t)0x10, CLK_OUTPUT_CPUDIV32 = (uint8_t)0x12, CLK_OUTPUT_CPUDIV64 = (uint8_t)0x14, CLK_OUTPUT_HSIRC = (uint8_t)0x16, CLK_OUTPUT_MASTER = (uint8_t)0x18, CLK_OUTPUT_OTHERS = (uint8_t)0x1A } |
CLK Clock Output. More... | |
enum | CLK_Peripheral_TypeDef { CLK_PERIPHERAL_I2C = (uint8_t)0x00, CLK_PERIPHERAL_SPI = (uint8_t)0x01, CLK_PERIPHERAL_UART1 = (uint8_t)0x03, CLK_PERIPHERAL_UART2 = (uint8_t)0x03, CLK_PERIPHERAL_UART3 = (uint8_t)0x03, CLK_PERIPHERAL_TIMER6 = (uint8_t)0x04, CLK_PERIPHERAL_TIMER4 = (uint8_t)0x04, CLK_PERIPHERAL_TIMER5 = (uint8_t)0x05, CLK_PERIPHERAL_TIMER2 = (uint8_t)0x05, CLK_PERIPHERAL_TIMER3 = (uint8_t)0x06, CLK_PERIPHERAL_TIMER1 = (uint8_t)0x07, CLK_PERIPHERAL_AWU = (uint8_t)0x12, CLK_PERIPHERAL_ADC = (uint8_t)0x13, CLK_PERIPHERAL_CAN = (uint8_t)0x17 } |
CLK Enable peripheral. More... | |
enum | CLK_Prescaler_TypeDef { CLK_PRESCALER_HSIDIV1 = (uint8_t)0x00, CLK_PRESCALER_HSIDIV2 = (uint8_t)0x08, CLK_PRESCALER_HSIDIV4 = (uint8_t)0x10, CLK_PRESCALER_HSIDIV8 = (uint8_t)0x18, CLK_PRESCALER_CPUDIV1 = (uint8_t)0x80, CLK_PRESCALER_CPUDIV2 = (uint8_t)0x81, CLK_PRESCALER_CPUDIV4 = (uint8_t)0x82, CLK_PRESCALER_CPUDIV8 = (uint8_t)0x83, CLK_PRESCALER_CPUDIV16 = (uint8_t)0x84, CLK_PRESCALER_CPUDIV32 = (uint8_t)0x85, CLK_PRESCALER_CPUDIV64 = (uint8_t)0x86, CLK_PRESCALER_CPUDIV128 = (uint8_t)0x87 } |
CLK Clock Divisor. More... | |
enum | CLK_Source_TypeDef { CLK_SOURCE_HSI = (uint8_t)0xE1, CLK_SOURCE_LSI = (uint8_t)0xD2, CLK_SOURCE_HSE = (uint8_t)0xB4 } |
CLK Clock Source. More... | |
enum | CLK_SWIMDivider_TypeDef { CLK_SWIMDIVIDER_2 = (uint8_t)0x00, CLK_SWIMDIVIDER_OTHER = (uint8_t)0x01 } |
SWIM Clock divider. More... | |
enum | CLK_SwitchMode_TypeDef { CLK_SWITCHMODE_MANUAL = (uint8_t)0x00, CLK_SWITCHMODE_AUTO = (uint8_t)0x01 } |
Switch Mode Auto, Manual. More... | |
Functions | |
void | CLK_AdjustHSICalibrationValue (CLK_HSITrimValue_TypeDef CLK_HSICalibrationValue) |
Adjusts the Internal High Speed oscillator (HSI) calibration value. | |
void | CLK_CCOCmd (FunctionalState NewState) |
Enables or disablle the Configurable Clock Output (CCO). | |
void | CLK_CCOConfig (CLK_Output_TypeDef CLK_CCO) |
Output the selected clock on a dedicated I/O pin. | |
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_ClockSwitchCmd (FunctionalState NewState) |
Starts or Stops manually the clock switch execution. | |
ErrorStatus | CLK_ClockSwitchConfig (CLK_SwitchMode_TypeDef CLK_SwitchMode, CLK_Source_TypeDef CLK_NewClock, FunctionalState ITState, CLK_CurrentClockState_TypeDef CLK_CurrentClockState) |
configures the Switch from one clock to another | |
void | CLK_DeInit (void) |
Deinitializes the CLK peripheral registers to their default reset values. | |
void | CLK_FastHaltWakeUpCmd (FunctionalState NewState) |
Configures the High Speed Internal oscillator (HSI). | |
uint32_t | CLK_GetClockFreq (void) |
This function returns the frequencies of different on chip clocks. | |
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 is enabled or not. | |
CLK_Source_TypeDef | CLK_GetSYSCLKSource (void) |
Returns the clock source used as system clock. | |
void | CLK_HSECmd (FunctionalState NewState) |
Enable or Disable the External High Speed oscillator (HSE). | |
void | CLK_HSICmd (FunctionalState NewState) |
Enables or disables the Internal High Speed oscillator (HSI). | |
void | CLK_HSIPrescalerConfig (CLK_Prescaler_TypeDef HSIPrescaler) |
Configures the HSI clock dividers. | |
void | CLK_ITConfig (CLK_IT_TypeDef CLK_IT, FunctionalState NewState) |
Enables or disables the specified CLK interrupts. | |
void | CLK_LSICmd (FunctionalState NewState) |
Enables or disables the Internal Low Speed oscillator (LSI). | |
void | CLK_PeripheralClockConfig (CLK_Peripheral_TypeDef CLK_Peripheral, FunctionalState NewState) |
Enables or disables the specified peripheral CLK. | |
void | CLK_SlowActiveHaltWakeUpCmd (FunctionalState NewState) |
Configures the slow active halt wake up. | |
void | CLK_SWIMConfig (CLK_SWIMDivider_TypeDef CLK_SWIMDivider) |
Configures the SWIM clock frequency on the fly. | |
void | CLK_SYSCLKConfig (CLK_Prescaler_TypeDef CLK_Prescaler) |
Configures the HSI and CPU clock dividers. | |
void | CLK_SYSCLKEmergencyClear (void) |
Reset the SWBSY flag (SWICR Register) |
Detailed Description
This file contains all functions prototype and macros for the CLK peripheral.
- Attention:
© COPYRIGHT 2014 STMicroelectronics
Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:
http://www.st.com/software_license_agreement_liberty_v2
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file stm8s_clk.h.