Compare commits

..

2 Commits

Author SHA1 Message Date
d8012551cd fm mod init 2026-06-12 15:50:50 +02:00
c676e8e650 supr com 2026-06-12 15:48:03 +02:00
3 changed files with 41 additions and 5 deletions

View File

@ -59,11 +59,7 @@ where
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
match self.inner.next()? { match self.inner.next()? {
Ok(chunk) => { Ok(chunk) => Some(Ok(self.process_chunk(&chunk))),
// self.process_chunk(&mut chunk);
// Some(Ok(chunk))
Some(Ok(self.process_chunk(&chunk)))
}
Err(e) => Some(Err(e)), Err(e) => Some(Err(e)),
} }
} }

39
src/fm_demod.rs Normal file
View 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)),
}
}
}

View File

@ -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;