pub struct CicDecimationFilter<const M: usize, const N: usize> { /* private fields */ }Expand description
CIC decimation filter.
M- Decimation factorN- Number of stages
Implementations§
Source§impl<const M: usize, const N: usize> CicDecimationFilter<M, N>
impl<const M: usize, const N: usize> CicDecimationFilter<M, N>
pub const fn new() -> Self
Sourcepub fn process_sample(&mut self, input: &i32) -> Option<i32>
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.
Sourcepub const fn bit_growth(&self) -> u32
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§
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> 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
Mutably borrows from an owned value. Read more