Created
March 7, 2018 04:35
-
-
Save kevinmehall/628353277cfaed9b7ab00f92565435cf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
extern crate soapysdr; | |
extern crate num_complex; | |
use num_complex::Complex; | |
use soapysdr::Direction::{Rx, Tx}; | |
fn main() { | |
let dev = soapysdr::Device::new("driver=lime").expect("Failed to open device"); | |
dev.set_sample_rate(Tx, 0, 5_000_000.).unwrap(); | |
dev.set_sample_rate(Rx, 0, 5_000_000.).unwrap(); | |
dev.set_frequency(Tx, 0, 915_000_000., ()).unwrap(); | |
dev.set_antenna(Tx, 0, "BAND1").unwrap(); | |
let mut rx_stream = dev.rx_stream::<Complex<f32>>(&[0]).unwrap(); | |
rx_stream.activate(None).unwrap(); | |
let mut tx_stream = dev.tx_stream::<Complex<f32>>(&[0]).unwrap(); | |
tx_stream.activate(None).unwrap(); | |
let buf = vec![Complex::new(1.0, 0.0); 500_000]; | |
let mut time = dev.get_hardware_time(None).unwrap(); | |
loop { | |
time += 1_000_000_000; | |
tx_stream.write_burst(&[&buf], Some(time), 100_000_000_000).expect("Failed to write burst"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment