CicDecimationFilter

Struct CicDecimationFilter 

Source
pub struct CicDecimationFilter<const M: usize, const N: usize> { /* private fields */ }
Expand description

CIC decimation filter.

  • M - Decimation factor
  • N - Number of stages

Implementations§

Source§

impl<const M: usize, const N: usize> CicDecimationFilter<M, N>

Source

pub const fn new() -> Self

Source

pub fn process_sample(&mut self, input: &i32) -> Option<i32>

Process the input and return the output when the decimator is ready to output a value.

§Arguments
  • input - The input to filter.
§Returns

The output of the filter.
The output range is Input range * (M^N). For example, if Input range is +/-1, M is 4, and N is 2, the output range is +/-16.
When the decimator is ready to output a value, it will return some(input). Otherwise, it will return None.

Source

pub const fn bit_growth(&self) -> u32

Returns the number of bits increased by passing through the CIC decimation filter.
The bit increase by the CIC decimation filter can be expressed by the following equation.
log2(M)*N
M is the decimation factor and N is the number of stages.

Trait Implementations§

Source§

impl<const M: usize, const N: usize> Default for CicDecimationFilter<M, N>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<const M: usize, const N: usize> Freeze for CicDecimationFilter<M, N>

§

impl<const M: usize, const N: usize> RefUnwindSafe for CicDecimationFilter<M, N>

§

impl<const M: usize, const N: usize> Send for CicDecimationFilter<M, N>

§

impl<const M: usize, const N: usize> Sync for CicDecimationFilter<M, N>

§

impl<const M: usize, const N: usize> Unpin for CicDecimationFilter<M, N>

§

impl<const M: usize, const N: usize> UnwindSafe for CicDecimationFilter<M, N>

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> 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.