Struct stm32f1xx_hal::rcc::CFGR
source · pub struct CFGR { /* private fields */ }
Expand description
Clock configuration register (CFGR)
Used to configure the frequencies of the clocks present in the processor.
After setting all frequencies, call the freeze function to apply the configuration.
NOTE: Currently, it is not guaranteed that the exact frequencies selected will be used, only frequencies close to it.
Implementations§
source§impl CFGR
impl CFGR
sourcepub fn use_hse(self, freq: Hertz) -> Self
pub fn use_hse(self, freq: Hertz) -> Self
Uses HSE (external oscillator) instead of HSI (internal RC oscillator) as the clock source. Will result in a hang if an external oscillator is not connected or it fails to start. The frequency specified must be the frequency of the external oscillator
sourcepub fn freeze(self, acr: &mut ACR) -> Clocks
pub fn freeze(self, acr: &mut ACR) -> Clocks
Applies the clock configuration and returns a Clocks
struct that signifies that the
clocks are frozen, and contains the frequencies used. After this function is called,
the clocks can not change
Usage:
let dp = pac::Peripherals::take().unwrap();
let mut flash = dp.FLASH.constrain();
let mut rcc = dp.RCC.constrain();
let clocks = rcc.cfgr.freeze(&mut flash.acr);