Skip to main content

Module rcc

Module rcc 

Source
Expand description

Reset and clock control (RCC).

§API shape (all chip families)

ItemRole
ConfigFamily-specific clock setup (presets + optional fields)
initApply Config to hardware and refresh the global cache
refreshRead RCC registers and refresh the cache (bootloader / dual-stage init)
clocksCached AHB/APB frequencies for drivers
HSI_FREQ / LSI_FREQNominal RC oscillator rates
HseExternal clock description when HSE is used

On CH32H4, clocks additionally reports the V3F/V5F core frequencies ([Clocks::v3f], [Clocks::v5f]); there is no separate core_clocks().

Pass the board HSE crystal frequency to refresh whenever SYSCLK can be sourced from HSE or PLL fed by HSE (same requirement as HSE_VALUE in the WCH C SDK).

Re-exports§

pub use mco::Mco;
pub use mco::McoPin;

Modules§

mco
Microcontroller clock output (MCO).

Structs§

Clocks
Config
HsPll
Hse
External high-speed clock (HSE).
LsConfig
LseConfig
Pll
Pllx

Enums§

AHBPrescaler
AHB prescaler.
APBPrescaler
APB Low speed prescaler (APB1).
HsPllPrescaler
HsPllRef
HsPllSource
HseMode
LseMode
McoSource
Microcontroller clock output.
PllMul
PLL Multiplication Factor.
PllPreDiv
PREDIV1 division factor.
PllSource
PllxMul
PLL2, PLL3 Multiplication Factor.
RtcClockSource
Sysclk
System clock Switch.
Usbpre
USB prescaler.

Constants§

HSI_FREQ
Nominal HSI frequency for the selected chip.
HSI_FREQUENCY
LSI_FREQ

Functions§

clocks
init⚠
refresh⚠
Re-measure RCC and update clocks (on H4 that includes v3f / v5f).