MG32L003 Standard Peripherals Firmware Library
Functions
RCC_Private_Functions

Functions

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

Detailed Description

Function Documentation

◆ RCC_AHBCLKConfig()

void RCC_AHBCLKConfig ( uint32_t  RCC_AHBCLKDiv)

Configures the AHB clock (AHBCLK).

Parameters
RCC_AHBCLKDivdefines 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.
Return values
None

◆ RCC_AHBPeriphClockCmd()

void RCC_AHBPeriphClockCmd ( uint32_t  RCC_AHBPeriph,
FunctionalState  NewState 
)

Enables or disables the AHB peripheral clock.

Parameters
RCC_AHBPeriphspecifies 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
NewStatenew state of the specified peripheral clock. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ RCC_AHBPeriphResetCmd()

void RCC_AHBPeriphResetCmd ( uint32_t  RCC_AHBPeriph,
FunctionalState  NewState 
)

Forces or releases AHB peripheral reset.

Parameters
RCC_AHBPeriphspecifies 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
NewStatenew state of the specified peripheral reset. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ RCC_APBCLKConfig()

void RCC_APBCLKConfig ( uint32_t  RCC_APBCLKDiv)

Configures the APB clock (APBCLK).

Parameters
RCC_APBCLKDivdefines 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.
Return values
None

◆ RCC_APBPeriphClockCmd()

void RCC_APBPeriphClockCmd ( uint32_t  RCC_APBPeriph,
FunctionalState  NewState 
)

Enables or disables the APB peripheral clock.

Parameters
RCC_APBPeriphspecifies 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
NewStatenew state of the specified peripheral clock. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ RCC_APBPeriphResetCmd()

void RCC_APBPeriphResetCmd ( uint32_t  RCC_APBPeriph,
FunctionalState  NewState 
)

Forces or releases APB peripheral reset.

Parameters
RCC_APBPeriphspecifies 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
NewStatenew state of the specified peripheral reset. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ RCC_ClearResetFlags()

void RCC_ClearResetFlags ( uint32_t  RCC_RSTFLAG)

Clear the specified RCC reset flag.

Parameters
RCC_RSTFLAGspecifies 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.
Return values
None.

◆ RCC_DeInit()

void RCC_DeInit ( void  )

Resets the RCC clock configuration to the default reset state.

Note
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
Return values
None

◆ RCC_GetClocksFreq()

void RCC_GetClocksFreq ( RCC_ClocksTypeDef RCC_Clocks)

Returns the frequencies of different on chip clocks.

Parameters
RCC_Clockspointer to a RCC_ClocksTypeDef structure which will hold the clocks frequencies.
Return values
None

◆ RCC_GetResetFlagStatus()

FlagStatus RCC_GetResetFlagStatus ( uint32_t  RCC_RSTFLAG)

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

Parameters
RCC_RSTFLAGspecifies 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.
Return values
Thenew state of RCC_RSTFLAG (SET or RESET).

◆ RCC_HSEConfig()

void RCC_HSEConfig ( uint32_t  RCC_HSE)

Configures the External High Speed oscillator (HSE).

Parameters
RCC_HSESpecifies the new state of the HSE. This parameter can be one of the following values:
Note
The SYSTEM register write-protection function should be disabled before using this function.
Return values
None

◆ RCC_HSEDriveCurrentConfig()

void RCC_HSEDriveCurrentConfig ( uint32_t  Current)

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

Parameters
Currentspecifies the drive current.
Note
The SYSTEM register write-protection function should be disabled before using this function. This parameter can be a value of 0-7.
Return values
None

◆ RCC_HSEStartTimeConfig()

void RCC_HSEStartTimeConfig ( uint32_t  Time)

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

Parameters
Timespecifies the start time.
Note
The SYSTEM register write-protection function should be disabled before using this function. This parameter can be a value of 0-3.
Return values
None

◆ RCC_HSIConfig()

void RCC_HSIConfig ( const uint32_t  HSI_Value,
FunctionalState  NewState 
)

Configures the Internal High Speed oscillator (HSI).

Parameters
HSI_ValueThe HSI frequency value. This parameter can be one of the following values:
NewStatenew state of the HSI. This parameter can be: ENABLE or DISABLE.
Note
The SYSTEM register write-protection function should be disabled before using this function.
Return values
None

◆ RCC_LSEConfig()

void RCC_LSEConfig ( uint32_t  RCC_LSE)

Configures the External Low Speed oscillator (LSE).

Parameters
RCC_LSESpecifies the new state of the LSE. This parameter can be one of the following values:
Note
The SYSTEM register write-protection function should be disabled before using this function.
Return values
None

◆ RCC_LSEDriveCurrentConfig()

void RCC_LSEDriveCurrentConfig ( uint32_t  Current)

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

Parameters
Currentspecifies the drive current.
Note
The SYSTEM register write-protection function should be disabled before using this function. This parameter can be a value of 0-15.
Return values
None

◆ RCC_LSEStartTimeConfig()

void RCC_LSEStartTimeConfig ( uint32_t  Time)

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

Parameters
Timespecifies the start time.
Note
The SYSTEM register write-protection function should be disabled before using this function. This parameter can be a value of 0-3.
Return values
None

◆ RCC_LSIConfig()

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

Configures the Internal low Speed oscillator (LSI).

Parameters
LSI_ValueThe LSI frequency value. This parameter can be one of the following values:
LSI_StartUPTimeThe LSI startup time. This parameter can be one of the following values:
NewStatenew state of the LSI. This parameter can be: ENABLE or DISABLE.
Note
The SYSTEM register write-protection function should be disabled before using this function.
Return values
None

◆ RCC_MCOCmd()

void RCC_MCOCmd ( FunctionalState  NewState)

Enable or Disable the MCO Clock output.

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

◆ RCC_MCOConfig()

void RCC_MCOConfig ( uint32_t  RCC_MCOSource,
uint32_t  RCC_MCOHCLKDiv 
)

Selects the clock source to output on MCO pin.

Parameters
RCC_MCOSourcespecifies 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_MCOHCLKDivspecifies 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.
Note
MCO pin should be configured in alternate function mode.
Return values
None

◆ RCC_RTCPeriphResetCmd()

void RCC_RTCPeriphResetCmd ( FunctionalState  NewState)

Forces or releases RTC peripheral reset.

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

◆ RCC_SYSCLKConfig()

void RCC_SYSCLKConfig ( uint32_t  RCC_SYSCLKSource)

Configures the SYS Clock (SYSCLK).

Parameters
RCC_SYSCLKSourcespecifies 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.
Return values
None