WB32L003 Standard Peripherals Firmware Library

模块 | 结构体 | 宏定义 | 函数
RCC
WB32L003_StdPeriph_Driver

RCC driver modules 更多...

## 模块
| RCC_Exported_Constants
| RCC_Private_Functions

## 结构体
struct | RCC_ClocksTypeDef

## 宏定义
#define | IS_HSI_VALUE(VALUE)
#define | IS_LSI_VALUE(VALUE)
#define | IS_RCC_LSI_STARTUP(TIME)
#define | IS_RCC_HSE(HSE)
#define | IS_RCC_LSE(LSE)
#define | IS_RCC_SYSCLK_SOURCE(SOURCE)
#define | IS_RCC_AHBCLKDiv(DIV) (((int32_t)(DIV) > 0) && ((DIV) <= 510))
#define | IS_RCC_APBCLKDiv(DIV) (((int32_t)(DIV) > 0) && ((DIV) <= 510))
#define | IS_RCC_MCO_HCLkDiv(DIV) (((int32_t)(DIV) > 0) && ((DIV) <= 510))
#define | IS_RCC_MCO_SOURCE(SOURCE)
#define | IS_RCC_AHB_PERIPH(PERIPH) ((((PERIPH) & RCC_AHBPeriph_ALL) != 0))
#define | IS_RCC_APB_PERIPH(PERIPH) ((((PERIPH) & RCC_APBPeriph_ALL) != 0))
#define | IS_RCC_RESET_FLAG(FLAG)
#define | RCC_REGWR_LOCK() (RCC->UNLOCK = (0x2AD5334C << RCC_UNLOCK_KEY_Pos) & RCC_UNLOCK_KEY)
#define | RCC_REGWR_UNLOCK() (RCC->UNLOCK = RCC_UNLOCK_UNLOCK | (0x2AD5334C << RCC_UNLOCK_KEY_Pos))
#define | RCC_SYSTEMCR_UNLOCK_KEY ((uint32_t)0x5A69)
#define | RCC_SYSTEMCR_UNLOCK_Pos ((uint32_t)16)
#define | RCC_SET_KEYBIT(REG, BIT) ((REG) |= (BIT | (RCC_SYSTEMCR_UNLOCK_KEY << RCC_SYSTEMCR_UNLOCK_Pos)))
#define | RCC_MODIFY_KEYREG(REG, CLEARMASK, SETVALUE) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETVALUE | (RCC_SYSTEMCR_UNLOCK_KEY << RCC_SYSTEMCR_UNLOCK_Pos))))
#define | RCC_WRITE_KEYREG(REG, VAL) ((REG) = (VAL | (RCC_SYSTEMCR_UNLOCK_KEY << RCC_SYSTEMCR_UNLOCK_Pos)))
#define | RCC_CLEAR_KEYBIT(REG, CLEARMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (RCC_SYSTEMCR_UNLOCK_KEY << RCC_SYSTEMCR_UNLOCK_Pos)))

## 函数
void | RCC_DeInit (void)
| Resets the RCC clock configuration to the default reset state. 更多...
void | RCC_HSIConfig (uint32_t HSI_Value, FunctionalState NewState)
| Configures the Internal High Speed oscillator (HSI). 更多...
void | RCC_LSIConfig (uint32_t LSI_Value, uint32_t LSI_StartUPTime, FunctionalState NewState)
| Configures the Internal low Speed oscillator (LSI). 更多...
void | RCC_HSEConfig (uint32_t RCC_HSE)
| Configures the External High Speed oscillator (HSE). 更多...
void | RCC_LSEConfig (uint32_t RCC_LSE)
| Configures the External Low Speed oscillator (LSE). 更多...
void | RCC_HSEDriveCurrentConfig (uint32_t Current)
| Configures the drive current of High Speed oscillator (HSE). 更多...
void | RCC_HSEStartTimeConfig (uint32_t Time)
| Configures the start time of High Speed oscillator (HSE). 更多...
void | RCC_LSEDriveCurrentConfig (uint32_t Current)
| Configures the drive current of Low Speed oscillator (LSE). 更多...
void | RCC_LSEStartTimeConfig (uint32_t Time)
| Configures the start time of Low Speed oscillator (LSE). 更多...
void | RCC_SYSCLKConfig (uint32_t RCC_SYSCLKSource)
| Configures the SYS Clock (SYSCLK). 更多...
void | RCC_AHBCLKConfig (uint32_t RCC_AHBCLKDiv)
| Configures the AHB clock (AHBCLK). 更多...
void | RCC_APBCLKConfig (uint32_t RCC_APBCLKDiv)
| Configures the APB clock (APBCLK). 更多...
void | RCC_MCOConfig (uint32_t RCC_MCOSource, uint32_t RCC_MCOHCLKDiv)
| Selects the clock source to output on MCO pin. 更多...
void | RCC_MCOCmd (FunctionalState NewState)
| Enable or Disable the MCO Clock output. 更多...
void | RCC_GetClocksFreq (RCC_ClocksTypeDef *RCC_Clocks)
| Returns the frequencies of different on chip clocks. 更多...
void | RCC_AHBPeriphClockCmd (uint32_t RCC_AHBPeriph, FunctionalState NewState)
| Enables or disables the AHB peripheral clock. 更多...
void | RCC_APBPeriphClockCmd (uint32_t RCC_APBPeriph, FunctionalState NewState)
| Enables or disables the APB peripheral clock. 更多...
void | RCC_AHBPeriphResetCmd (uint32_t RCC_AHBPeriph, FunctionalState NewState)
| Forces or releases AHB peripheral reset. 更多...
void | RCC_APBPeriphResetCmd (uint32_t RCC_APBPeriph, FunctionalState NewState)
| Forces or releases APB peripheral reset. 更多...
void | RCC_RTCPeriphResetCmd (FunctionalState NewState)
| Forces or releases RTC peripheral reset. 更多...
FlagStatus | RCC_GetResetFlagStatus (uint32_t RCC_RSTFLAG)
| Checks whether the specified RCC reset flag is set or not. 更多...
void | RCC_ClearResetFlags (uint32_t RCC_RSTFLAG)
| Clear the specified RCC reset flag. 更多...

## 详细描述

RCC driver modules

## 宏定义说明

## ◆ IS_HSI_VALUE

#define IS_HSI_VALUE | ( |  | VALUE | ) |

值:
(((VALUE) == HSI_VALUE_24M) || \
((VALUE) == HSI_VALUE_22M) || \
((VALUE) == HSI_VALUE_16M) || \
((VALUE) == HSI_VALUE_8M) || \
((VALUE) == HSI_VALUE_4M))
HSI_VALUE_16M
#define HSI_VALUE_16M
Definition: wb32l003_rcc.h:48
HSI_VALUE_4M
#define HSI_VALUE_4M
Definition: wb32l003_rcc.h:50
HSI_VALUE_22M
#define HSI_VALUE_22M
Definition: wb32l003_rcc.h:47
HSI_VALUE_8M
#define HSI_VALUE_8M
Definition: wb32l003_rcc.h:49
HSI_VALUE_24M
#define HSI_VALUE_24M
Definition: wb32l003_rcc.h:46

## ◆ IS_LSI_VALUE

#define IS_LSI_VALUE | ( |  | VALUE | ) |

值:
(((VALUE) == LSI_VALUE_38K) || \
((VALUE) == LSI_VALUE_32K))
LSI_VALUE_32K
#define LSI_VALUE_32K
Definition: wb32l003_rcc.h:60
LSI_VALUE_38K
#define LSI_VALUE_38K
Definition: wb32l003_rcc.h:59

## ◆ IS_RCC_HSE

#define IS_RCC_HSE | ( |  | HSE | ) |

值:
(((HSE) == RCC_HSE_OFF) || \
((HSE) == RCC_HSE_ON) || \
((HSE) == RCC_HSE_BYPASS) || \
((HSE) == RCC_HSE_DEFAULT))
RCC_HSE_BYPASS
#define RCC_HSE_BYPASS
Definition: wb32l003_rcc.h:82
RCC_HSE_OFF
#define RCC_HSE_OFF
Definition: wb32l003_rcc.h:80
RCC_HSE_ON
#define RCC_HSE_ON
Definition: wb32l003_rcc.h:81

## ◆ IS_RCC_LSE

#define IS_RCC_LSE | ( |  | LSE | ) |

值:
(((LSE) == RCC_LSE_OFF) || \
((LSE) == RCC_LSE_ON) || \
((LSE) == RCC_LSE_BYPASS) || \
((LSE) == RCC_LSE_DEFAULT))
RCC_LSE_OFF
#define RCC_LSE_OFF
Definition: wb32l003_rcc.h:92
RCC_LSE_ON
#define RCC_LSE_ON
Definition: wb32l003_rcc.h:93
RCC_LSE_BYPASS
#define RCC_LSE_BYPASS
Definition: wb32l003_rcc.h:94

## ◆ IS_RCC_LSI_STARTUP

#define IS_RCC_LSI_STARTUP | ( |  | TIME | ) |

值:
(((TIME) == RCC_LSI_STARTUP_4CYCLE) || \
((TIME) == RCC_LSI_STARTUP_16CYCLE) || \
((TIME) == RCC_LSI_STARTUP_64CYCLE) || \
((TIME) == RCC_LSI_STARTUP_256CYCLE))
RCC_LSI_STARTUP_16CYCLE
#define RCC_LSI_STARTUP_16CYCLE
Definition: wb32l003_rcc.h:70
RCC_LSI_STARTUP_4CYCLE
#define RCC_LSI_STARTUP_4CYCLE
Definition: wb32l003_rcc.h:69
RCC_LSI_STARTUP_256CYCLE
#define RCC_LSI_STARTUP_256CYCLE
Definition: wb32l003_rcc.h:72
RCC_LSI_STARTUP_64CYCLE
#define RCC_LSI_STARTUP_64CYCLE
Definition: wb32l003_rcc.h:71

## ◆ IS_RCC_MCO_SOURCE

#define IS_RCC_MCO_SOURCE | ( |  | SOURCE | ) |

值:
(((SOURCE) == RCC_MCOSOURCE_HSI) || \
((SOURCE) == RCC_MCOSOURCE_HSE) || \
((SOURCE) == RCC_MCOSOURCE_LSI) || \
((SOURCE) == RCC_MCOSOURCE_LSE) || \
((SOURCE) == RCC_MCOSOURCE_SYSCLK) || \
((SOURCE) == RCC_MCOSOURCE_HCLK))

## ◆ IS_RCC_RESET_FLAG

#define IS_RCC_RESET_FLAG | ( |  | FLAG | ) |

值:
(((FLAG) == RCC_RSTFLAG_MCURST) || \
((FLAG) == RCC_RSTFLAG_CPURST) || \
((FLAG) == RCC_RSTFLAG_WWDGRST) || \
((FLAG) == RCC_RSTFLAG_IWDGRST) || \
((FLAG) == RCC_RSTFLAG_LVDRST) || \
((FLAG) == RCC_RSTFLAG_PORRST) || \
((FLAG) == RCC_RSTFLAG_LOCKUPRST) || \
((FLAG) == RCC_RSTFLAG_PADRST) || \
((FLAG) == RCC_RSTFLAG_SFTRST))

## ◆ IS_RCC_SYSCLK_SOURCE

#define IS_RCC_SYSCLK_SOURCE | ( |  | SOURCE | ) |

值:
(((SOURCE) == RCC_SYSCLKSource_HSI) || \
((SOURCE) == RCC_SYSCLKSource_HSE) || \
((SOURCE) == RCC_SYSCLKSource_LSI) || \
((SOURCE) == RCC_SYSCLKSource_LSE))

## 函数说明

## ◆ RCC_AHBCLKConfig()

void RCC_AHBCLKConfig | ( | uint32_t | RCC_AHBCLKDiv | ) |

Configures the AHB clock (AHBCLK).

参数

  RCC_AHBCLKDiv | defines the AHB clock divider. This clock is derived from the system clock (SYSCLK). This parameter can be a value of 1-510, The allowed values are an even number from 2 to 510 and 1.

返回值

  None |

## ◆ RCC_AHBPeriphClockCmd()

void RCC_AHBPeriphClockCmd | ( | uint32_t | RCC_AHBPeriph,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the AHB peripheral clock.

参数

  RCC_AHBPeriph | specifies the AHB peripheral to gates its clock. This parameter can be any combination of the following values: RCC_AHBPeriph_GPIOA RCC_AHBPeriph_GPIOB RCC_AHBPeriph_GPIOC RCC_AHBPeriph_GPIOD RCC_AHBPeriph_CRC RCC_AHBPeriph_FLASH
  NewState | new state of the specified peripheral clock. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ RCC_AHBPeriphResetCmd()

void RCC_AHBPeriphResetCmd | ( | uint32_t | RCC_AHBPeriph,
|  | FunctionalState | NewState
| ) |  |

Forces or releases AHB peripheral reset.

参数

  RCC_AHBPeriph | specifies the AHB peripheral to reset. This parameter can be any combination of the following values: RCC_AHBPeriph_GPIOA RCC_AHBPeriph_GPIOB RCC_AHBPeriph_GPIOC RCC_AHBPeriph_GPIOD RCC_AHBPeriph_CRC
  NewState | new state of the specified peripheral reset. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ RCC_APBCLKConfig()

void RCC_APBCLKConfig | ( | uint32_t | RCC_APBCLKDiv | ) |

Configures the APB clock (APBCLK).

参数

  RCC_APBCLKDiv | defines the APB clock divider. This clock is derived from the AHB clock (HCLK). This parameter can be a value of 1-510, The allowed values are an even number from 2 to 510 and 1.

返回值

  None |

## ◆ RCC_APBPeriphClockCmd()

void RCC_APBPeriphClockCmd | ( | uint32_t | RCC_APBPeriph,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the APB peripheral clock.

参数

  RCC_APBPeriph | specifies the APB peripheral to gates its clock. This parameter can be any combination of the following values: RCC_APBPeriph_UART1 RCC_APBPeriph_UART2 RCC_APBPeriph_I2C RCC_APBPeriph_LPUART RCC_APBPeriph_SPI RCC_APBPeriph_LPTIM RCC_APBPeriph_BASETIM RCC_APBPeriph_SYSCON RCC_APBPeriph_PCA RCC_APBPeriph_OWIRE RCC_APBPeriph_TIM1 RCC_APBPeriph_TIM2 RCC_APBPeriph_WWDG RCC_APBPeriph_ADC RCC_APBPeriph_AWK RCC_APBPeriph_RTC RCC_APBPeriph_CLKTRIM RCC_APBPeriph_IWDG RCC_APBPeriph_LVDVC RCC_APBPeriph_BEEP RCC_APBPeriph_DBG
  NewState | new state of the specified peripheral clock. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ RCC_APBPeriphResetCmd()

void RCC_APBPeriphResetCmd | ( | uint32_t | RCC_APBPeriph,
|  | FunctionalState | NewState
| ) |  |

Forces or releases APB peripheral reset.

参数

  RCC_APBPeriph | specifies the APB peripheral to reset. This parameter can be any combination of the following values: RCC_APBPeriph_UART1 RCC_APBPeriph_UART2 RCC_APBPeriph_I2C RCC_APBPeriph_LPUART RCC_APBPeriph_SPI RCC_APBPeriph_LPTIM RCC_APBPeriph_BASETIM RCC_APBPeriph_SYSCON RCC_APBPeriph_PCA RCC_APBPeriph_OWIRE RCC_APBPeriph_TIM1 RCC_APBPeriph_TIM2 RCC_APBPeriph_WWDG RCC_APBPeriph_ADC RCC_APBPeriph_AWK RCC_APBPeriph_CLKTRIM RCC_APBPeriph_LVDVC RCC_APBPeriph_BEEP RCC_APBPeriph_DBG
  NewState | new state of the specified peripheral reset. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ RCC_ClearResetFlags()

void RCC_ClearResetFlags | ( | uint32_t | RCC_RSTFLAG | ) |

Clear the specified RCC reset flag.

参数

  RCC_RSTFLAG | specifies the flag to check. This parameter can be one of the following values: RCC_RSTFLAG_MCURST: MCU reset-option byte reload. RCC_RSTFLAG_CPURST: CPU reset-no option byte reload. RCC_RSTFLAG_WWDGRST: Window Watchdog reset. RCC_RSTFLAG_IWDGRST: Independent Watchdog reset. RCC_RSTFLAG_LVDRST: Low Voltage Detect reset. RCC_RSTFLAG_PORRST: PowerON reset. RCC_RSTFLAG_LOCKUPRST: CPU Lockup reset. RCC_RSTFLAG_PADRST: Pad reset. RCC_RSTFLAG_SFTRST: Software reset.

返回值

  None. |

## ◆ RCC_DeInit()

void RCC_DeInit | ( | void |  | ) |

Resets the RCC clock configuration to the default reset state.

注解
  The default reset state of the clock configuration is given below:
  - HSI ON and used as system clock source
  - HSE are OFF
  - AHB, APB prescaler set to 1.
  - MCO OFF
  This function does not modify the configuration of the
  - Peripheral clocks
  - LSI, LSE clocks

返回值

  None |

## ◆ RCC_GetClocksFreq()

void RCC_GetClocksFreq | ( | RCC_ClocksTypeDef * | RCC_Clocks | ) |

Returns the frequencies of different on chip clocks.

参数

  RCC_Clocks | pointer to a RCC_ClocksTypeDef structure which will hold the clocks frequencies.

返回值

  None |

## ◆ RCC_GetResetFlagStatus()

FlagStatus RCC_GetResetFlagStatus | ( | uint32_t | RCC_RSTFLAG | ) |

Checks whether the specified RCC reset flag is set or not.

参数

  RCC_RSTFLAG | specifies the flag to check. This parameter can be one of the following values: RCC_RSTFLAG_MCURST: MCU reset-option byte reload. RCC_RSTFLAG_CPURST: CPU reset-no option byte reload. RCC_RSTFLAG_WWDGRST: Window Watchdog reset. RCC_RSTFLAG_IWDGRST: Independent Watchdog reset. RCC_RSTFLAG_LVDRST: Low Voltage Detect reset. RCC_RSTFLAG_PORRST: PowerON reset. RCC_RSTFLAG_LOCKUPRST: CPU Lockup reset. RCC_RSTFLAG_PADRST: Pad reset. RCC_RSTFLAG_SFTRST: Software reset.

返回值

  The | new state of RCC_RSTFLAG (SET or RESET).

## ◆ RCC_HSEConfig()

void RCC_HSEConfig | ( | uint32_t | RCC_HSE | ) |

Configures the External High Speed oscillator (HSE).

参数

  RCC_HSE | Specifies the new state of the HSE. This parameter can be one of the following values: RCC_HSE_OFF RCC_HSE_ON RCC_HSE_BYPASS RCC_HSE_DEFAULT

注解
  The SYSTEM register write-protection function should be disabled before using this function.

返回值

  None |

## ◆ RCC_HSEDriveCurrentConfig()

void RCC_HSEDriveCurrentConfig | ( | uint32_t | Current | ) |

Configures the drive current of High Speed oscillator (HSE).

参数

  Current | specifies the drive current.

注解
  The SYSTEM register write-protection function should be disabled before using this function. This parameter can be a value of 0-7.

返回值

  None |

## ◆ RCC_HSEStartTimeConfig()

void RCC_HSEStartTimeConfig | ( | uint32_t | Time | ) |

Configures the start time of High Speed oscillator (HSE).

参数

  Time | specifies the start time.

注解
  The SYSTEM register write-protection function should be disabled before using this function. This parameter can be a value of 0-3.

返回值

  None |

## ◆ RCC_HSIConfig()

void RCC_HSIConfig | ( | const uint32_t | HSI_Value,
|  | FunctionalState | NewState
| ) |  |

Configures the Internal High Speed oscillator (HSI).

参数

  HSI_Value | The HSI frequency value. This parameter can be one of the following values: HSI_VALUE_24M HSI_VALUE_22M HSI_VALUE_16M HSI_VALUE_8M HSI_VALUE_4M
  NewState | new state of the HSI. This parameter can be: ENABLE or DISABLE.

注解
  The SYSTEM register write-protection function should be disabled before using this function.

返回值

  None |

## ◆ RCC_LSEConfig()

void RCC_LSEConfig | ( | uint32_t | RCC_LSE | ) |

Configures the External Low Speed oscillator (LSE).

参数

  RCC_LSE | Specifies the new state of the LSE. This parameter can be one of the following values: RCC_LSE_OFF RCC_LSE_ON RCC_LSE_BYPASS RCC_LSE_DEFAULT

注解
  The SYSTEM register write-protection function should be disabled before using this function.

返回值

  None |

## ◆ RCC_LSEDriveCurrentConfig()

void RCC_LSEDriveCurrentConfig | ( | uint32_t | Current | ) |

Configures the drive current of Low Speed oscillator (LSE).

参数

  Current | specifies the drive current.

注解
  The SYSTEM register write-protection function should be disabled before using this function. This parameter can be a value of 0-15.

返回值

  None |

## ◆ RCC_LSEStartTimeConfig()

void RCC_LSEStartTimeConfig | ( | uint32_t | Time | ) |

Configures the start time of Low Speed oscillator (LSE).

参数

  Time | specifies the start time.

注解
  The SYSTEM register write-protection function should be disabled before using this function. This parameter can be a value of 0-3.

返回值

  None |

## ◆ RCC_LSIConfig()

void RCC_LSIConfig | ( | uint32_t | LSI_Value,
|  | uint32_t | LSI_StartUPTime,
|  | FunctionalState | NewState
| ) |  |

Configures the Internal low Speed oscillator (LSI).

参数

  LSI_Value | The LSI frequency value. This parameter can be one of the following values: LSI_VALUE_38K LSI_VALUE_32K
  LSI_StartUPTime | The LSI startup time. This parameter can be one of the following values: RCC_LSI_STARTUP_4CYCLE RCC_LSI_STARTUP_16CYCLE RCC_LSI_STARTUP_64CYCLE RCC_LSI_STARTUP_256CYCLE
  NewState | new state of the LSI. This parameter can be: ENABLE or DISABLE.

注解
  The SYSTEM register write-protection function should be disabled before using this function.

返回值

  None |

## ◆ RCC_MCOCmd()

void RCC_MCOCmd | ( | FunctionalState | NewState | ) |

Enable or Disable the MCO Clock output.

参数

  NewState | new state of the MCO. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ RCC_MCOConfig()

void RCC_MCOConfig | ( | uint32_t | RCC_MCOSource,
|  | uint32_t | RCC_MCOHCLKDiv
| ) |  |

Selects the clock source to output on MCO pin.

参数

  RCC_MCOSource | specifies the clock source to output. This parameter can be one of the following values: RCC_MCOSOURCE_HSI: HSI selected as MCO clock RCC_MCOSOURCE_HSE: HSE selected as MCO clock RCC_MCOSOURCE_LSI: LSI selected as MCO clock RCC_MCOSOURCE_LSE: LSE selected as MCO clock RCC_MCOSOURCE_SYSCLK: SYSCLK selected as MCO clock RCC_MCOSOURCE_HCLK: HCLK selected as MCO clock
  RCC_MCOHCLKDiv | specifies the MCO DIV. This parameter can be a value of 1-510, The allowed values are an even number from 2 to 510 and 1.

注解
  MCO pin should be configured in alternate function mode.

返回值

  None |

## ◆ RCC_RTCPeriphResetCmd()

void RCC_RTCPeriphResetCmd | ( | FunctionalState | NewState | ) |

Forces or releases RTC peripheral reset.

参数

  NewState | new state of the RTC peripheral reset. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ RCC_SYSCLKConfig()

void RCC_SYSCLKConfig | ( | uint32_t | RCC_SYSCLKSource | ) |

Configures the SYS Clock (SYSCLK).

参数

  RCC_SYSCLKSource | specifies the clock source used as system clock. This parameter can be one of the following values: RCC_SYSCLKSource_HSI: HSI selected as system clock. RCC_SYSCLKSource_HSE: HSE selected as system clock. RCC_SYSCLKSource_LSI: LSI selected as system clock. RCC_SYSCLKSource_LSE: LSE selected as system clock.

返回值

  None |