This commit is contained in:
2026-06-11 15:35:34 +02:00
parent 3ca4998ae9
commit b947256af6

View File

@ -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 () {
}
}