Revision 605483a2
| b/host/examples/tx_waveforms.cpp | ||
|---|---|---|
| 34 | 34 |
//variables to be set by po |
| 35 | 35 |
std::string args, wave_type; |
| 36 | 36 |
size_t total_duration, mspb; |
| 37 |
double rate, freq, wave_freq; |
|
| 37 |
double rate, freq, wave_freq, aepb;
|
|
| 38 | 38 |
float ampl, gain; |
| 39 | 39 |
|
| 40 | 40 |
//setup the program options |
| ... | ... | |
| 44 | 44 |
("args", po::value<std::string>(&args)->default_value(""), "simple uhd device address args")
|
| 45 | 45 |
("duration", po::value<size_t>(&total_duration)->default_value(3), "number of seconds to transmit")
|
| 46 | 46 |
("mspb", po::value<size_t>(&mspb)->default_value(10000), "mimimum samples per buffer")
|
| 47 |
("aepb", po::value<double>(&aepb)->default_value(1e-5), "allowed error per buffer")
|
|
| 47 | 48 |
("rate", po::value<double>(&rate)->default_value(100e6/16), "rate of outgoing samples")
|
| 48 | 49 |
("freq", po::value<double>(&freq)->default_value(0), "rf center frequency in Hz")
|
| 49 | 50 |
("ampl", po::value<float>(&l)->default_value(float(0.3)), "amplitude of the waveform")
|
| ... | ... | |
| 103 | 104 |
while (true){
|
| 104 | 105 |
double num_samps_per_buff = periods_per_buff*samps_per_period; |
| 105 | 106 |
double sample_error = num_samps_per_buff - boost::math::round(num_samps_per_buff); |
| 106 |
if (std::abs(sample_error/num_samps_per_buff) < 1e-5) break;
|
|
| 107 |
if (std::abs(sample_error) <= aepb) break;
|
|
| 107 | 108 |
periods_per_buff++; |
| 108 | 109 |
} |
| 109 | 110 |
|
Also available in: Unified diff