Skip to content

Instantly share code, notes, and snippets.

@kevinmehall
Created March 7, 2018 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinmehall/628353277cfaed9b7ab00f92565435cf to your computer and use it in GitHub Desktop.
Save kevinmehall/628353277cfaed9b7ab00f92565435cf to your computer and use it in GitHub Desktop.
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