Function stm32wlxx_hal::rcc::cpu2_systick_hz
source · pub fn cpu2_systick_hz(rcc: &RCC, src: SystClkSource) -> u32
Available on crate features
stm32wl5x_cm4
or stm32wl5x_cm0p
only.Expand description
Calculate the current CPU2 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::cpu2_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 CPU2
// cpu_systick_hz is better for this use-case
let mut delay: Delay = Delay::new(cp.SYST, cpu2_systick_hz(&dp.RCC, SystClkSource::Core));
delay.delay_ms(100);