-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
752392e
commit 63f1c76
Showing
12 changed files
with
317 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
// use superdsp::gui::time_chart_complex::TimeChartComplex; | ||
// //use superdsp::gui::waterfall::Waterfall; | ||
// use superdsp::objects::object::DSPObject; | ||
// use superdsp::radios; | ||
// | ||
// | ||
// | ||
// fn main() { | ||
// let mut src = radios::bladerf::src::BladeRfSrc::new(915000000, 1_000_000, 1_000_000, 1_000_000, 1024); | ||
// let mut chart = TimeChartComplex::new(); | ||
// //let mut waterfall = Waterfall::new(1024); | ||
// | ||
// let s = src.get_bus(); | ||
// | ||
// waterfall.set_bus(s); | ||
// chart.set_bus(s); | ||
// | ||
// superdsp::objects::GUIExecutor::run(vec![Box::new(waterfall), Box::new(chart)], Box::new(src)); | ||
// } | ||
use superdsp::gui::time_chart_complex::TimeChartComplex; | ||
use superdsp::gui::waterfall::Waterfall; | ||
use superdsp::objects::object::DSPObject; | ||
use superdsp::radios; | ||
|
||
fn main() { | ||
let mut src = radios::bladerf::src::BladeRfSrc::new(915000000, 1_000_000, 1_000_000, 1_000_000, 1024); | ||
let mut chart = TimeChartComplex::new(); | ||
let mut waterfall = Waterfall::new(); | ||
|
||
let s = src.get_bus(); | ||
|
||
waterfall.set_bus(s); | ||
chart.set_bus(s); | ||
|
||
superdsp::objects::GUIExecutor::run(vec![Box::new(waterfall), Box::new(chart)], Box::new(src)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
// This function is based on the triangle filter function from wikipedia found here: https://en.wikipedia.org/wiki/Window_function | ||
|
||
use core::f32::consts::PI; | ||
|
||
/// Creates a triangle filter of size N | ||
/// Formula: f(x) = 1 - |((n - o) - (N / 2)) / (L / 2)| for n in 0..N | ||
/// | ||
/// | ||
/// Where: | ||
/// L can be N, N+1, or N+2 | ||
/// o is the bin offset | ||
/// | ||
/// | ||
/// # Arguments | ||
/// N: usize - Size of the filter | ||
/// l: usize - Filter setting (N, N+1, or N+2) | ||
/// offset: usize - Bin offset | ||
/// | ||
/// | ||
/// # Returns | ||
/// [f32; N] - Triangle window | ||
pub fn triangle_window<const N: usize>(l: usize, offset: usize) -> [f32; N] { | ||
let mut filter = [0.0; N]; | ||
|
||
for n in 0..N { | ||
filter[n] = 1.0 - (((n - offset) as f32 - (N as f32 / 2.0)) / (l as f32 / 2.0)).abs(); | ||
} | ||
|
||
filter | ||
} |
Oops, something went wrong.