]> code.octet-stream.net Git - m17rt/blob - tools/m17rt-mod/src/main.rs
Fix timing bugs and add documentation
[m17rt] / tools / m17rt-mod / src / main.rs
1 use m17app::app::M17App;
2 use m17app::link_setup::M17Address;
3 use m17app::serial::{PttPin, SerialPtt};
4 use m17app::soundcard::Soundcard;
5 use m17app::soundmodem::Soundmodem;
6 use m17codec2::WavePlayer;
7 use std::path::PathBuf;
8
9 pub fn mod_test() {
10 let soundcard = Soundcard::new("plughw:CARD=Device,DEV=0").unwrap();
11 soundcard.set_tx_inverted(true);
12 let ptt = SerialPtt::new("/dev/ttyUSB0", PttPin::Rts);
13 let soundmodem = Soundmodem::new(soundcard.input(), soundcard.output(), ptt);
14 let app = M17App::new(soundmodem);
15 app.start();
16 std::thread::sleep(std::time::Duration::from_secs(1));
17 println!("Beginning playback...");
18 WavePlayer::play(
19 PathBuf::from("../../../Data/test_vk7xt_8k.wav"),
20 app.tx(),
21 &M17Address::from_callsign("VK7XT-1").unwrap(),
22 &M17Address::new_broadcast(),
23 0,
24 );
25 println!("Playback complete.");
26 std::thread::sleep(std::time::Duration::from_secs(1));
27 app.close();
28 }
29
30 fn main() {
31 env_logger::builder()
32 .format_timestamp(Some(env_logger::TimestampPrecision::Millis))
33 .init();
34 mod_test();
35 }