Compare commits
2 Commits
00a93527de
...
d8012551cd
| Author | SHA1 | Date | |
|---|---|---|---|
| d8012551cd | |||
| c676e8e650 |
@ -59,11 +59,7 @@ where
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
match self.inner.next()? {
|
||||
Ok(chunk) => {
|
||||
// self.process_chunk(&mut chunk);
|
||||
// Some(Ok(chunk))
|
||||
Some(Ok(self.process_chunk(&chunk)))
|
||||
}
|
||||
Ok(chunk) => Some(Ok(self.process_chunk(&chunk))),
|
||||
Err(e) => Some(Err(e)),
|
||||
}
|
||||
}
|
||||
|
||||
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 fir;
|
||||
mod fm_demod;
|
||||
mod iq_reader;
|
||||
mod pipeline;
|
||||
mod utils;
|
||||
|
||||
Reference in New Issue
Block a user