Function stm32wlxx_hal::rcc::set_sysclk_hse
source · pub unsafe fn set_sysclk_hse(
flash: &mut FLASH,
pwr: &mut PWR,
rcc: &mut RCC,
vos: Vos,
cs: &CriticalSection
)
Expand description
Set the sysclk to use the HSE 32MHz clock.
The VOS argument selects the voltage range which determines the clock prescaler:
- 1.2V: 32MHz (div 1)
- 1.0V: 16MHz (div 2)
Safety
- Peripherals must not be in-use before calling this function.
- Peripherals may need their prescalers adjusted for the new sysclk frequency.
Example
use stm32wlxx_hal::{
pac,
rcc::{set_sysclk_hse, Vos},
};
let mut dp: pac::Peripherals = pac::Peripherals::take().unwrap();
cortex_m::interrupt::free(|cs| unsafe {
set_sysclk_hse(&mut dp.FLASH, &mut dp.PWR, &mut dp.RCC, Vos::V1_2, cs)
});