Files
cellula.rs/amps-handset-emu/src/main.rs
2025-03-25 21:49:51 -04:00

40 lines
1.1 KiB
Rust

use audio::play_audio;
use fsk::afsk_modulate;
use text_io::scan;
use std::io;
mod fsk;
mod audio;
fn main() -> Result<(), io::Error> {
println!("Press 1 to send test tone");
println!("Press 0 to exit");
let a: i32;
scan!("{}", a);
match a {
1 => {
println!("1 has been pressed! No test tone implemented yet");
let tone: Vec<f32>;
tone = afsk_modulate(&[
0b10101010, 0b01010101, 0b10101010, 0b01010101, 0b10101010, 0b01010101, 0b10101010, 0b01010101, 0b10101010, 0b01010101,
0b1000101,0b11111111,0b1000101,0b11111111,0b11111111,0b1000101,0b11111111,0b11111111,0b1000101,0b11111111,0b11111111,
], 1700.0);
let repeated_tone: Vec<f32> = tone.iter().cloned().cycle().take(tone.len() * 10).collect();
play_audio(&repeated_tone);
return main();
},
0 => {
return Ok(());
}
_ => {
eprintln!("Invalid command.");
return Ok(());
}
}
//Ok(())
}