summaryrefslogtreecommitdiffstats
path: root/host/examples
diff options
context:
space:
mode:
Diffstat (limited to 'host/examples')
-rw-r--r--host/examples/rx_timed_samples.cpp6
-rw-r--r--host/examples/tx_timed_samples.cpp9
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>(&ampl)->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;