Function stm32wlxx_hal::rcc::cpu1_systick_hz
source · pub fn cpu1_systick_hz(rcc: &RCC, src: SystClkSource) -> u32
Expand description
Calculate the current CPU1 systick frequency in hertz
Fractional frequencies will be rounded down.
Example
Created a systick based delay structure.
use stm32wlxx_hal::{
cortex_m::{delay::Delay, peripheral::syst::SystClkSource},
pac,
rcc::cpu1_systick_hz,
};
let mut dp: pac::Peripherals = pac::Peripherals::take().unwrap();
let cp: pac::CorePeripherals = pac::CorePeripherals::take().unwrap();
// Delay constructor will set the clock source to core
// note: this code is only valid if running on CPU1
// cpu_systick_hz is better for this use-case
let mut delay: Delay = Delay::new(cp.SYST, cpu1_systick_hz(&dp.RCC, SystClkSource::Core));
delay.delay_ms(100);