Struct rp2040_hal::xosc::CrystalOscillator
source · pub struct CrystalOscillator<S: State> { /* private fields */ }
Expand description
A Crystal Oscillator.
Implementations§
source§impl<S: State> CrystalOscillator<S>
impl<S: State> CrystalOscillator<S>
source§impl CrystalOscillator<Disabled>
impl CrystalOscillator<Disabled>
sourcepub fn initialize(
self,
frequency: HertzU32,
startup_delay_multiplier: u32
) -> Result<CrystalOscillator<Unstable>, Error>
pub fn initialize( self, frequency: HertzU32, startup_delay_multiplier: u32 ) -> Result<CrystalOscillator<Unstable>, Error>
Initializes the XOSC : frequency range is set, startup delay is calculated and set. Set startup_delay_multiplier to a value > 1 when using a slow-starting oscillator.
source§impl CrystalOscillator<Unstable>
impl CrystalOscillator<Unstable>
sourcepub fn await_stabilization(&self) -> Result<StableOscillatorToken, Infallible>
pub fn await_stabilization(&self) -> Result<StableOscillatorToken, Infallible>
One has to wait for the startup delay before using the oscillator, ie awaiting stabilization of the XOSC
sourcepub fn get_stable(
self,
_token: StableOscillatorToken
) -> CrystalOscillator<Stable>
pub fn get_stable( self, _token: StableOscillatorToken ) -> CrystalOscillator<Stable>
Returns the stabilized oscillator
source§impl CrystalOscillator<Stable>
impl CrystalOscillator<Stable>
sourcepub fn operating_frequency(&self) -> HertzU32
pub fn operating_frequency(&self) -> HertzU32
Operating frequency of the XOSC in hertz
sourcepub fn disable(self) -> CrystalOscillator<Disabled>
pub fn disable(self) -> CrystalOscillator<Disabled>
Disables the XOSC
sourcepub unsafe fn dormant(self) -> CrystalOscillator<Unstable>
pub unsafe fn dormant(self) -> CrystalOscillator<Unstable>
Put the XOSC in DORMANT state. The method returns after the processor awakens.
After waking up from the DORMANT state, XOSC needs to re-stabilise.
§Safety
This method is marked unsafe because prior to switch the XOSC into DORMANT state, PLLs must be stopped and IRQs have to be properly configured. This method does not do any of that, it merely switches the XOSC to DORMANT state. It should only be called if this oscillator is the clock source for the system clock. See Chapter 2, Section 16, §5) for details.