summaryrefslogtreecommitdiffstats
path: root/host/examples
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-04-12 13:55:57 +0000
committerJosh Blum <josh@joshknows.com>2010-04-12 13:55:57 +0000
commit615f7081d8361643031437ac31bb4a44e41839e8 (patch)
treef092991d1f3ff97fa53d9373c90e358105c4ff79 /host/examples
parent50780640a1b9ed6abb2abebbc727ce19711fbcb4 (diff)
parent34854116a4fd287fe681222f2b7a881692e418d3 (diff)
downloaduhd-615f7081d8361643031437ac31bb4a44e41839e8.tar.gz
uhd-615f7081d8361643031437ac31bb4a44e41839e8.tar.bz2
uhd-615f7081d8361643031437ac31bb4a44e41839e8.zip
Merge branch 'master' into usrp_e
Diffstat (limited to 'host/examples')
-rw-r--r--host/examples/rx_timed_samples.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp
index 58b5af9da..e971e9f6a 100644
--- a/host/examples/rx_timed_samples.cpp
+++ b/host/examples/rx_timed_samples.cpp
@@ -29,6 +29,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::string transport_args;
int seconds_in_future;
size_t total_num_samps;
+ double rx_rate;
//setup the program options
po::options_description desc("Allowed options");
@@ -37,6 +38,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("args", po::value<std::string>(&transport_args)->default_value(""), "simple uhd transport args")
("secs", po::value<int>(&seconds_in_future)->default_value(3), "number of seconds in the future to receive")
("nsamps", po::value<size_t>(&total_num_samps)->default_value(1000), "total number of samples to receive")
+ ("rxrate", po::value<double>(&rx_rate)->default_value(100e6/16), "rate of incoming samples")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -57,9 +59,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << boost::format("Using Device: %s") % sdev->get_name() << std::endl;
//set properties on the device
- double rx_rate = sdev->get_rx_rates()[4]; //pick some rate
std::cout << boost::format("Setting RX Rate: %f Msps...") % (rx_rate/1e6) << std::endl;
sdev->set_rx_rate(rx_rate);
+ std::cout << boost::format("Actual RX Rate: %f Msps...") % (sdev->get_rx_rate()/1e6) << std::endl;
std::cout << boost::format("Setting device timestamp to 0...") << std::endl;
sdev->set_time_now(uhd::time_spec_t(0));
@@ -67,11 +69,10 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << std::endl;
std::cout << boost::format("Begin streaming %u samples, %d seconds in the future...")
% total_num_samps % seconds_in_future << std::endl;
- uhd::stream_cmd_t stream_cmd;
+ uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
+ stream_cmd.num_samps = total_num_samps;
stream_cmd.stream_now = false;
stream_cmd.time_spec = uhd::time_spec_t(seconds_in_future);
- stream_cmd.continuous = false;
- stream_cmd.num_samps = total_num_samps;
sdev->issue_stream_cmd(stream_cmd);
//loop until total number of samples reached