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§

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

Sets the desired frequency for the HCLK clock

Sets the desired frequency for the PCKL1 clock

Sets the desired frequency for the PCLK2 clock

Sets the desired frequency for the SYSCLK clock

Sets the desired frequency for the ADCCLK clock

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);

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.