diff options
author | Philip Balister <philip@opensdr.com> | 2010-07-14 22:16:52 +0000 |
---|---|---|
committer | Philip Balister <philip@opensdr.com> | 2010-07-14 22:16:52 +0000 |
commit | d9b7d9f2f9c6ebe27b6cfd4085f4a5c524363a1f (patch) | |
tree | 2fb2de93a9d908082317226d901c4485b04b1557 /host | |
parent | 87428bf6e1c5fcf623595063921277f9827a919a (diff) | |
download | uhd-d9b7d9f2f9c6ebe27b6cfd4085f4a5c524363a1f.tar.gz uhd-d9b7d9f2f9c6ebe27b6cfd4085f4a5c524363a1f.tar.bz2 uhd-d9b7d9f2f9c6ebe27b6cfd4085f4a5c524363a1f.zip |
Convert basic test programs to use shorts in the GPP to avoid using
short to float code in uhd.
Diffstat (limited to 'host')
-rw-r--r-- | host/examples/rx_timed_samples.cpp | 6 | ||||
-rw-r--r-- | host/examples/tx_timed_samples.cpp | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp index 3b9acbb2c..a72e1ec81 100644 --- a/host/examples/rx_timed_samples.cpp +++ b/host/examples/rx_timed_samples.cpp @@ -84,12 +84,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_FLOAT32, + uhd::io_type_t::COMPLEX_INT16, uhd::device::RECV_MODE_ONE_PACKET ); diff --git a/host/examples/tx_timed_samples.cpp b/host/examples/tx_timed_samples.cpp index 5b72bd72f..ceae58a22 100644 --- a/host/examples/tx_timed_samples.cpp +++ b/host/examples/tx_timed_samples.cpp @@ -77,13 +77,13 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ sdev->set_time_now(uhd::time_spec_t(0.0)); //allocate data to send - std::vector<std::complex<float> > buff(samps_per_packet, std::complex<float>(ampl, ampl)); + std::vector<std::complex<short> > buff(samps_per_packet, std::complex<float>(ampl, ampl)); + uhd::tx_metadata_t md; //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 @@ -94,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_FLOAT32, + uhd::io_type_t::COMPLEX_INT16, uhd::device::SEND_MODE_FULL_BUFF ); if(verbose) std::cout << std::endl << boost::format("Sent %d samples") % num_tx_samps << std::endl; |