RingOscillator

Struct RingOscillator 

Source
pub struct RingOscillator<S>
where S: State,
{ /* private fields */ }
Expand description

A Ring Oscillator.

Implementations§

Source§

impl<S> RingOscillator<S>
where S: State,

Source

pub fn free(self) -> ROSC

Releases the underlying device.

Source§

impl RingOscillator<Disabled>

Source

pub fn new(dev: ROSC) -> RingOscillator<Disabled>

Creates a new RingOscillator from the underlying device.

Source

pub fn initialize(self) -> RingOscillator<Enabled>

Initializes the ROSC : frequency range is set, startup delay is calculated and set.

Source

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>

Source

pub fn operating_frequency(&self) -> Rate<u32, 1, 1>

Approx operating frequency of the ROSC in hertz

Source

pub fn disable(self) -> RingOscillator<Disabled>

Disables the ROSC

Source

pub fn get_random_bit(&self) -> bool

Generate random bit based on the Ring oscillator This is not suited for security purposes

Source

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>

Source§

fn get_freq(&self) -> Rate<u32, 1, 1>

Get the operating frequency for this source Read more
Source§

impl RngCore for RingOscillator<Enabled>

Source§

fn next_u32(&mut self) -> u32

Return the next random u32. Read more
Source§

fn next_u64(&mut self) -> u64

Return the next random u64. Read more
Source§

fn fill_bytes(&mut self, dest: &mut [u8])

Fill dest with random data. Read more
Source§

fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>

Fill dest entirely with random data. Read more
Source§

impl ValidSrc<AdcClock> for RingOscillator<Enabled>

Source§

fn is_aux(&self) -> bool

Is this a ClockSource for src or aux?
Source§

fn variant(&self) -> ClkAdcSrcType

Get register value for this ClockSource
Source§

impl ValidSrc<GpioOutput0Clock> for RingOscillator<Enabled>

Source§

fn is_aux(&self) -> bool

Is this a ClockSource for src or aux?
Source§

fn variant(&self) -> ClkGpout0SrcType

Get register value for this ClockSource
Source§

impl ValidSrc<GpioOutput1Clock> for RingOscillator<Enabled>

Source§

fn is_aux(&self) -> bool

Is this a ClockSource for src or aux?
Source§

fn variant(&self) -> ClkGpout1SrcType

Get register value for this ClockSource
Source§

impl ValidSrc<GpioOutput2Clock> for RingOscillator<Enabled>

Source§

fn is_aux(&self) -> bool

Is this a ClockSource for src or aux?
Source§

fn variant(&self) -> ClkGpout2SrcType

Get register value for this ClockSource
Source§

impl ValidSrc<GpioOutput3Clock> for RingOscillator<Enabled>

Source§

fn is_aux(&self) -> bool

Is this a ClockSource for src or aux?
Source§

fn variant(&self) -> ClkGpout3SrcType

Get register value for this ClockSource
Source§

impl ValidSrc<PeripheralClock> for RingOscillator<Enabled>

Source§

fn is_aux(&self) -> bool

Is this a ClockSource for src or aux?
Source§

fn variant(&self) -> ClkPeriSrcType

Get register value for this ClockSource
Source§

impl ValidSrc<ReferenceClock> for RingOscillator<Enabled>

Source§

fn is_aux(&self) -> bool

Is this a ClockSource for src or aux?
Source§

fn variant(&self) -> ClkRefSrcType

Get register value for this ClockSource
Source§

impl ValidSrc<SystemClock> for RingOscillator<Enabled>

Source§

fn is_aux(&self) -> bool

Is this a ClockSource for src or aux?
Source§

fn variant(&self) -> ClkSysSrcType

Get register value for this ClockSource
Source§

impl ValidSrc<UsbClock> for RingOscillator<Enabled>

Source§

fn is_aux(&self) -> bool

Is this a ClockSource for src or aux?
Source§

fn variant(&self) -> ClkUsbSrcType

Get register value for this ClockSource

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices

Source§

type Remainder = Choices

Source§

fn subset( self, ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Is for T
where T: Sealed + Borrow<T> + BorrowMut<T>,

Source§

type Type = T

Source§

impl<T, U, I> LiftInto<U, I> for T
where U: LiftFrom<T, I>,

Source§

fn lift_into(self) -> U

Performs the indexed conversion.
Source§

impl<Source> Sculptor<HNil, HNil> for Source

Source§

type Remainder = Source

Source§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.