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