pub fn cpu_systick_hz(rcc: &RCC, src: SystClkSource) -> u32
Expand description

Calculate the current CPU systick frequency in hertz.

This will automatically select the correct CPU based on the feature flag passed to the HAL.

Example

Created a systick based delay structure.

use stm32wlxx_hal::{
    cortex_m::{delay::Delay, peripheral::syst::SystClkSource},
    pac,
    rcc::cpu_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
let mut delay: Delay = Delay::new(cp.SYST, cpu_systick_hz(&dp.RCC, SystClkSource::Core));
delay.delay_ms(100);