fir init
This commit is contained in:
19
src/fir.rs
19
src/fir.rs
@ -1,10 +1,10 @@
|
|||||||
// Finite Impulse response + Decimation
|
// Finite Impulse response + Decimation
|
||||||
use num_complex::Complex32;
|
|
||||||
use crate::utils::ring_buffer::RingBuffer;
|
use crate::utils::ring_buffer::RingBuffer;
|
||||||
|
use num_complex::Complex32;
|
||||||
|
|
||||||
pub struct Fir {
|
pub struct Fir<const N: usize> {
|
||||||
// Filter coefs
|
// Filter coefs
|
||||||
pub taps: Vec<f32>,
|
pub taps: [f32; N],
|
||||||
|
|
||||||
// Ring Buffer of samples
|
// Ring Buffer of samples
|
||||||
pub history: RingBuffer<Complex32>,
|
pub history: RingBuffer<Complex32>,
|
||||||
@ -15,18 +15,13 @@ pub struct Fir {
|
|||||||
decimator_counter: usize,
|
decimator_counter: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Fir {
|
impl<const N: usize> Fir<N> {
|
||||||
fn new(decimation_factor: usize) -> Self {
|
fn new(taps: [f32; N], decimation_factor: usize) -> Self {
|
||||||
Self {
|
Self {
|
||||||
// TODO: precalulate filter coefs + ring buffer
|
taps,
|
||||||
taps: vec![],
|
history: RingBuffer::new(N),
|
||||||
history:
|
|
||||||
decimation_factor,
|
decimation_factor,
|
||||||
decimator_counter: 0,
|
decimator_counter: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn () {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user