fm mod init
This commit is contained in:
39
src/fm_demod.rs
Normal file
39
src/fm_demod.rs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
use std::{os::unix::process, slice::Chunks};
|
||||||
|
|
||||||
|
use crate::iq_reader::{IqChunk, IqSample};
|
||||||
|
|
||||||
|
pub struct FmDemod<I> {
|
||||||
|
pub inner: I,
|
||||||
|
pub prev_sample: IqSample,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<I> FmDemod<I> {
|
||||||
|
pub fn new(inner: I) -> Self {
|
||||||
|
Self {
|
||||||
|
inner,
|
||||||
|
prev_sample: IqSample::new(1.0, 0.0),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn process_chunk(&mut self, chunk: &mut IqChunk) {
|
||||||
|
// TODO: FM Demodulation
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<I, E> Iterator for FmDemod<I>
|
||||||
|
where
|
||||||
|
I: Iterator<Item = Result<IqChunk, E>>,
|
||||||
|
{
|
||||||
|
type Item = Result<IqChunk, E>;
|
||||||
|
|
||||||
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
match self.inner.next()? {
|
||||||
|
Ok(mut chunk) => {
|
||||||
|
self.process_chunk(&mut chunk);
|
||||||
|
Some(Ok(chunk))
|
||||||
|
}
|
||||||
|
Err(e) => Some(Err(e)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ use std::error::Error;
|
|||||||
|
|
||||||
mod agc;
|
mod agc;
|
||||||
mod fir;
|
mod fir;
|
||||||
|
mod fm_demod;
|
||||||
mod iq_reader;
|
mod iq_reader;
|
||||||
mod pipeline;
|
mod pipeline;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|||||||
Reference in New Issue
Block a user