本文整理汇总了C++中uhd::usrp::multi_usrp::sptr::get_fe_tx_freq_range方法的典型用法代码示例。如果您正苦于以下问题:C++ sptr::get_fe_tx_freq_range方法的具体用法?C++ sptr::get_fe_tx_freq_range怎么用?C++ sptr::get_fe_tx_freq_range使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uhd::usrp::multi_usrp::sptr
的用法示例。
在下文中一共展示了sptr::get_fe_tx_freq_range方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tune_rx_and_tx
/***********************************************************************
* Tune RX and TX routine
**********************************************************************/
static double tune_rx_and_tx(uhd::usrp::multi_usrp::sptr usrp, const double rx_lo_freq, const double tx_offset)
{
//tune the receiver with no cordic
uhd::tune_request_t rx_tune_req(rx_lo_freq);
rx_tune_req.dsp_freq_policy = uhd::tune_request_t::POLICY_MANUAL;
rx_tune_req.dsp_freq = 0;
usrp->set_rx_freq(rx_tune_req);
//tune the transmitter
double tx_freq = usrp->get_rx_freq() + tx_offset;
double min_fe_tx_freq = usrp->get_fe_tx_freq_range().start();
double max_fe_tx_freq = usrp->get_fe_tx_freq_range().stop();
uhd::tune_request_t tx_tune_req(tx_freq);
tx_tune_req.dsp_freq_policy = uhd::tune_request_t::POLICY_MANUAL;
tx_tune_req.dsp_freq = 0;
if (tx_freq < min_fe_tx_freq)
tx_tune_req.dsp_freq = tx_freq - min_fe_tx_freq;
else if (tx_freq > max_fe_tx_freq)
tx_tune_req.dsp_freq = tx_freq - max_fe_tx_freq;
usrp->set_tx_freq(tx_tune_req);
//wait for the LOs to become locked
boost::this_thread::sleep(boost::posix_time::milliseconds(50));
boost::system_time start = boost::get_system_time();
while (not usrp->get_tx_sensor("lo_locked").to_bool() or not usrp->get_rx_sensor("lo_locked").to_bool())
{
if (boost::get_system_time() > start + boost::posix_time::milliseconds(100))
throw std::runtime_error("timed out waiting for TX and/or RX LO to lock");
}
return usrp->get_rx_freq();
}
示例2: coercion_test
std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, int chan,
bool test_gain, double freq_step, double gain_step, bool verbose){
//Getting USRP info
uhd::dict<std::string, std::string> usrp_info = (type == "TX") ? usrp->get_usrp_tx_info(chan)
: usrp->get_usrp_rx_info(chan);
std::string subdev_name = (type == "TX") ? usrp_info.get("tx_subdev_name")
: usrp_info.get("rx_subdev_name");
std::string subdev_spec = (type == "TX") ? usrp_info.get("tx_subdev_spec")
: usrp_info.get("rx_subdev_spec");
//Establish frequency range
std::vector<double> freqs;
std::vector<double> xcvr_freqs; //XCVR2450 has two ranges
uhd::freq_range_t freq_ranges = (type == "TX") ? usrp->get_fe_tx_freq_range(chan)
: usrp->get_fe_rx_freq_range(chan);
std::cout << boost::format("\nTesting %s coercion...") % type << std::endl;
BOOST_FOREACH(const uhd::range_t &range, freq_ranges){
double freq_begin = range.start();
double freq_end = range.stop();
if(subdev_name.find("XCVR2450") == 0){
xcvr_freqs.push_back(freq_begin);
xcvr_freqs.push_back(freq_end);
}
double current_freq = freq_begin;
while(current_freq < freq_end){
freqs.push_back(current_freq);
current_freq += freq_step;
}
if(freq_end != *freqs.end()) freqs.push_back(freq_end);
}
示例3: get_tx_parameters
//.........这里部分代码省略.........
// Current TX frequency
os << std::endl << "-----> Get TX Center Frequency" << std::endl;
try
{
os << "TX Freq: ";
double tx_freq = usrp->get_tx_freq(nchan);
os << tx_freq << endl;
}
catch (uhd::runtime_error &e)
{
os << " Exception occurred : " << e.code() << endl;
}
// TX Frequency Range
os << std::endl << "-----> Get TX Center Frequency Range" << std::endl;
try
{
os << "TX Frequency Range: ";
uhd::freq_range_t tx_freq_range = usrp->get_tx_freq_range(nchan);
os << "Start: " << tx_freq_range.start() << " Stop: " << tx_freq_range.stop() << " Step: " << tx_freq_range.step() << endl;
os << tx_freq_range.to_pp_string() << endl;
}
catch (uhd::runtime_error &e)
{
os << " Exception occurred : " << e.code() << endl;
}
// Front end TX frequency range
os << std::endl << "-----> Get TX RF Front End Center Frequency Range" << std::endl;
try
{
os << "TX Front End Frequency Range: ";
uhd::freq_range_t tx_fe_freq_range = usrp->get_fe_tx_freq_range(nchan);
os << "Start: " << tx_fe_freq_range.start() << " Stop: " << tx_fe_freq_range.stop() << " Step: " << tx_fe_freq_range.step() << endl;
os << tx_fe_freq_range.to_pp_string() << endl;
}
catch (uhd::runtime_error &e)
{
os << " Exception occurred : " << e.code() << endl;
}
// TX GAIN
os << std::endl << "********** TX Gain ***********" << std::endl;
// Total combined gain
os << endl << "-----> Get TX Total Gain" << endl;
os << "TX Total Gain: " ;
try
{
double tx_total_gain = usrp->get_tx_gain(nchan);
os << tx_total_gain << endl;
}
catch(uhd::runtime_error &e)
{
os << "Exception code: " << e.code() << endl;
}
// List of all gain elements
os << std::endl << "-----> Get TX gain names" << std::endl;
std::vector<std::string> tx_gain_names = usrp->get_tx_gain_names(nchan);
os << "Tx Gain Names: " << std::endl;
for (int index =0; index < tx_gain_names.size(); index++)
{
// Name