diff options
author | Philip Balister <philip@opensdr.com> | 2010-09-09 19:30:02 -0400 |
---|---|---|
committer | Philip Balister <philip@opensdr.com> | 2010-09-09 19:30:02 -0400 |
commit | d1a327862292d52d659b117aef28e37d9f60fb4b (patch) | |
tree | 319f4c4d84cd9700fd1881ed9f9451728a7ae505 /host/examples | |
parent | 4a757e64cbb513e6461e547f4d095b0539ae0b09 (diff) | |
download | uhd-d1a327862292d52d659b117aef28e37d9f60fb4b.tar.gz uhd-d1a327862292d52d659b117aef28e37d9f60fb4b.tar.bz2 uhd-d1a327862292d52d659b117aef28e37d9f60fb4b.zip |
Restore tx and rx timed smaple programs to the versions in master. They use floating point.
Diffstat (limited to 'host/examples')
-rw-r--r-- | host/examples/rx_timed_samples.cpp | 6 | ||||
-rw-r--r-- | host/examples/tx_timed_samples.cpp | 9 |
2 files changed, 6 insertions, 9 deletions
diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp index 5fbf8b6c5..4856f6779 100644 --- a/host/examples/rx_timed_samples.cpp +++ b/host/examples/rx_timed_samples.cpp @@ -85,12 +85,12 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //loop until total number of samples reached size_t num_acc_samps = 0; //number of accumulated samples - uhd::rx_metadata_t md; - std::vector<std::complex<short> > buff(dev->get_max_recv_samps_per_packet()); while(num_acc_samps < total_num_samps){ + uhd::rx_metadata_t md; + std::vector<std::complex<float> > buff(dev->get_max_recv_samps_per_packet()); size_t num_rx_samps = dev->recv( &buff.front(), buff.size(), md, - uhd::io_type_t::COMPLEX_INT16, + uhd::io_type_t::COMPLEX_FLOAT32, uhd::device::RECV_MODE_ONE_PACKET ); diff --git a/host/examples/tx_timed_samples.cpp b/host/examples/tx_timed_samples.cpp index f7d7ea2ca..5b72bd72f 100644 --- a/host/examples/tx_timed_samples.cpp +++ b/host/examples/tx_timed_samples.cpp @@ -35,7 +35,6 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ size_t samps_per_packet; double tx_rate, freq; float ampl; - float tx_gain; //setup the program options po::options_description desc("Allowed options"); @@ -48,7 +47,6 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("txrate", po::value<double>(&tx_rate)->default_value(100e6/16), "rate of outgoing samples") ("freq", po::value<double>(&freq)->default_value(0), "rf center frequency in Hz") ("ampl", po::value<float>(&l)->default_value(float(0.3)), "amplitude of each sample") - ("gain", po::value<float>(&tx_gain)->default_value(float(0)), "TX Gain setting") ("dilv", "specify to disable inner-loop verbose") ; po::variables_map vm; @@ -77,16 +75,15 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ std::cout << boost::format("Setting device timestamp to 0...") << std::endl; sdev->set_tx_freq(freq); sdev->set_time_now(uhd::time_spec_t(0.0)); - sdev->set_tx_gain(tx_gain); //allocate data to send - std::vector<std::complex<short> > buff(samps_per_packet, std::complex<short>(ampl, ampl)); - uhd::tx_metadata_t md; + std::vector<std::complex<float> > buff(samps_per_packet, std::complex<float>(ampl, ampl)); //send the data in multiple packets size_t num_packets = (total_num_samps+samps_per_packet-1)/samps_per_packet; for (size_t i = 0; i < num_packets; i++){ //setup the metadata flags and time spec + uhd::tx_metadata_t md; md.start_of_burst = true; //always SOB (good for continuous streaming) md.end_of_burst = (i == num_packets-1); //only last packet has EOB md.has_time_spec = (i == 0); //only first packet has time @@ -97,7 +94,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //send the entire packet (driver fragments internally) size_t num_tx_samps = dev->send( &buff.front(), samps_to_send, md, - uhd::io_type_t::COMPLEX_INT16, + uhd::io_type_t::COMPLEX_FLOAT32, uhd::device::SEND_MODE_FULL_BUFF ); if(verbose) std::cout << std::endl << boost::format("Sent %d samples") % num_tx_samps << std::endl; |