pub struct RingOscillator<S>where
S: State,{ /* private fields */ }Expand description
A Ring Oscillator.
Implementations§
Source§impl<S> RingOscillator<S>where
S: State,
impl<S> RingOscillator<S>where
S: State,
Source§impl RingOscillator<Disabled>
impl RingOscillator<Disabled>
Sourcepub fn new(dev: ROSC) -> RingOscillator<Disabled>
pub fn new(dev: ROSC) -> RingOscillator<Disabled>
Creates a new RingOscillator from the underlying device.
Sourcepub fn initialize(self) -> RingOscillator<Enabled>
pub fn initialize(self) -> RingOscillator<Enabled>
Initializes the ROSC : frequency range is set, startup delay is calculated and set.
Sourcepub fn initialize_with_freq(
self,
known_freq: Rate<u32, 1, 1>,
) -> RingOscillator<Enabled>
pub fn initialize_with_freq( self, known_freq: Rate<u32, 1, 1>, ) -> RingOscillator<Enabled>
Initializes the ROSC with a known frequency.
See Sections 8.3.4 “Modifying the frequency”, and 8.3.8 “Using the
frequency counter” in the RP2350 datasheet
for guidance on how to do this before initialising the ROSC. Also see
rosc_as_system_clock example for usage.
Source§impl RingOscillator<Enabled>
impl RingOscillator<Enabled>
Sourcepub fn operating_frequency(&self) -> Rate<u32, 1, 1>
pub fn operating_frequency(&self) -> Rate<u32, 1, 1>
Approx operating frequency of the ROSC in hertz
Sourcepub fn disable(self) -> RingOscillator<Disabled>
pub fn disable(self) -> RingOscillator<Disabled>
Disables the ROSC
Sourcepub fn get_random_bit(&self) -> bool
pub fn get_random_bit(&self) -> bool
Generate random bit based on the Ring oscillator This is not suited for security purposes
Sourcepub unsafe fn dormant(&self)
pub unsafe fn dormant(&self)
Put the ROSC in DORMANT state. The method returns after the processor awakens.
After waking up from the DORMANT state, ROSC restarts in approximately 1µs.
§Safety
This method is marked unsafe because prior to switch the ROSC 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 ROSC to DORMANT state. It should only be called if this oscillator is the clock source for the system clock.
See Section 6.5.3 of the RP2350 datasheet.
Trait Implementations§
Source§impl ClockSource for RingOscillator<Enabled>
impl ClockSource for RingOscillator<Enabled>
Source§impl RngCore for RingOscillator<Enabled>
impl RngCore for RingOscillator<Enabled>
Source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
dest with random data. Read moreSource§impl ValidSrc<GpioOutput0Clock> for RingOscillator<Enabled>
impl ValidSrc<GpioOutput0Clock> for RingOscillator<Enabled>
Source§impl ValidSrc<GpioOutput1Clock> for RingOscillator<Enabled>
impl ValidSrc<GpioOutput1Clock> for RingOscillator<Enabled>
Source§impl ValidSrc<GpioOutput2Clock> for RingOscillator<Enabled>
impl ValidSrc<GpioOutput2Clock> for RingOscillator<Enabled>
Source§impl ValidSrc<GpioOutput3Clock> for RingOscillator<Enabled>
impl ValidSrc<GpioOutput3Clock> for RingOscillator<Enabled>
Source§impl ValidSrc<PeripheralClock> for RingOscillator<Enabled>
impl ValidSrc<PeripheralClock> for RingOscillator<Enabled>
Source§impl ValidSrc<ReferenceClock> for RingOscillator<Enabled>
impl ValidSrc<ReferenceClock> for RingOscillator<Enabled>
Source§impl ValidSrc<SystemClock> for RingOscillator<Enabled>
impl ValidSrc<SystemClock> for RingOscillator<Enabled>
Auto Trait Implementations§
impl<S> Freeze for RingOscillator<S>where
S: Freeze,
impl<S> RefUnwindSafe for RingOscillator<S>where
S: RefUnwindSafe,
impl<S> Send for RingOscillator<S>where
S: Send,
impl<S> !Sync for RingOscillator<S>
impl<S> Unpin for RingOscillator<S>where
S: Unpin,
impl<S> UnwindSafe for RingOscillator<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more