idsp

Struct RPLL

source
pub struct RPLL { /* private fields */ }
Expand description

Reciprocal PLL.

Consumes noisy, quantized timestamps of a reference signal and reconstructs the phase and frequency of the update() invocations with respect to (and in units of 1 << 32 of) that reference. In other words, update() rate ralative to reference frequency, u32::MAX corresponding to both being equal.

Implementations§

source§

impl RPLL

source

pub fn new(dt2: u32) -> Self

Create a new RPLL instance.

Args:

  • dt2: inverse update() rate. 1 << dt2 is the counter rate to update() rate ratio.

Returns: Initialized RPLL instance.

source

pub fn update( &mut self, input: Option<i32>, shift_frequency: u32, shift_phase: u32, ) -> (i32, u32)

Advance the RPLL and optionally supply a new timestamp.

Args:

  • input: Optional new timestamp (wrapping around at the i32 boundary). There can be at most one timestamp per update() cycle (1 << dt2 counter cycles).
  • shift_frequency: Frequency lock settling time. 1 << shift_frequency is frequency lock settling time in counter periods. The settling time must be larger than the signal period to lock to.
  • shift_phase: Phase lock settling time. Usually one less than shift_frequency (see there).

Returns: A tuple containing the current phase (wrapping at the i32 boundary, pi) and frequency.

source

pub fn phase(&self) -> i32

Return the current phase estimate

source

pub fn frequency(&self) -> u32

Return the current frequency estimate

Trait Implementations§

source§

impl Clone for RPLL

source§

fn clone(&self) -> RPLL

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for RPLL

source§

fn default() -> RPLL

Returns the “default value” for a type. Read more
source§

impl Copy for RPLL

Auto Trait Implementations§

§

impl Freeze for RPLL

§

impl RefUnwindSafe for RPLL

§

impl Send for RPLL

§

impl Sync for RPLL

§

impl Unpin for RPLL

§

impl UnwindSafe for RPLL

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<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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, 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.