当前位置: 首页>>代码示例>>C++>>正文


C++ sptr::set_tx_rate方法代码示例

本文整理汇总了C++中uhd::usrp::multi_usrp::sptr::set_tx_rate方法的典型用法代码示例。如果您正苦于以下问题:C++ sptr::set_tx_rate方法的具体用法?C++ sptr::set_tx_rate怎么用?C++ sptr::set_tx_rate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在uhd::usrp::multi_usrp::sptr的用法示例。


在下文中一共展示了sptr::set_tx_rate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

/***********************************************************************
 * Set standard defaults for devices
 **********************************************************************/
static inline void set_optimum_defaults(uhd::usrp::multi_usrp::sptr usrp){
    uhd::property_tree::sptr tree = usrp->get_device()->get_tree();
    // Will work on 1st subdev, top-level must make sure it's the right one
    uhd::usrp::subdev_spec_t subdev_spec = usrp->get_rx_subdev_spec();

    const uhd::fs_path mb_path = "/mboards/0";
    const std::string mb_name = tree->access<std::string>(mb_path / "name").get();
    if (mb_name.find("USRP2") != std::string::npos or mb_name.find("N200") != std::string::npos or mb_name.find("N210") != std::string::npos  or mb_name.find("X300") != std::string::npos  or mb_name.find("X310") != std::string::npos){
        usrp->set_tx_rate(12.5e6);
        usrp->set_rx_rate(12.5e6);
    }
    else if (mb_name.find("B100") != std::string::npos){
        usrp->set_tx_rate(4e6);
        usrp->set_rx_rate(4e6);
    }
    else if (mb_name.find("E100") != std::string::npos or mb_name.find("E110") != std::string::npos){
        usrp->set_tx_rate(4e6);
        usrp->set_rx_rate(8e6);
    }
    else{
        throw std::runtime_error("self-calibration is not supported for this hardware");
    }

    const uhd::fs_path tx_fe_path = "/mboards/0/dboards/" + subdev_spec[0].db_name + "/tx_frontends/0";
    const std::string tx_name = tree->access<std::string>(tx_fe_path / "name").get();
    if (tx_name.find("WBX") != std::string::npos){
        usrp->set_tx_gain(0);
    }
    else if (tx_name.find("SBX") != std::string::npos){
        usrp->set_tx_gain(0);
    }
    else if (tx_name.find("CBX") != std::string::npos){
        usrp->set_tx_gain(0);
    }
    else if (tx_name.find("RFX") != std::string::npos){
        usrp->set_tx_gain(0);
    }
    else{
        throw std::runtime_error("self-calibration is not supported for this hardware");
    }

    const uhd::fs_path rx_fe_path = "/mboards/0/dboards/" + subdev_spec[0].db_name + "/rx_frontends/0";
    const std::string rx_name = tree->access<std::string>(rx_fe_path / "name").get();
    if (rx_name.find("WBX") != std::string::npos){
        usrp->set_rx_gain(25);
    }
    else if (rx_name.find("SBX") != std::string::npos){
        usrp->set_rx_gain(25);
    }
    else if (rx_name.find("CBX") != std::string::npos){
        usrp->set_rx_gain(25);
    }
    else if (rx_name.find("RFX") != std::string::npos){
        usrp->set_rx_gain(25);
    }
    else{
        throw std::runtime_error("self-calibration is not supported for this hardware");
    }

}
开发者ID:Bobakka,项目名称:uhd,代码行数:63,代码来源:usrp_cal_utils.hpp

示例2: set_rates

int uhd_device::set_rates(double tx_rate, double rx_rate)
{
	double offset_limit = 1.0;
	double tx_offset, rx_offset;

	// B2XX is the only device where we set FPGA clocking
	if (dev_type == B2XX) {
		if (set_master_clk(B2XX_CLK_RT) < 0)
			return -1;
	}

	// Set sample rates
	try {
		usrp_dev->set_tx_rate(tx_rate);
		usrp_dev->set_rx_rate(rx_rate);
	} catch (const std::exception &ex) {
		LOG(ALERT) << "UHD rate setting failed";
		LOG(ALERT) << ex.what();
		return -1;
	}
	this->tx_rate = usrp_dev->get_tx_rate();
	this->rx_rate = usrp_dev->get_rx_rate();

	tx_offset = fabs(this->tx_rate - tx_rate);
	rx_offset = fabs(this->rx_rate - rx_rate);
	if ((tx_offset > offset_limit) || (rx_offset > offset_limit)) {
		LOG(ALERT) << "Actual sample rate differs from desired rate";
		LOG(ALERT) << "Tx/Rx (" << this->tx_rate << "/"
			   << this->rx_rate << ")";
		return -1;
	}

	return 0;
}
开发者ID:Djimmer,项目名称:obts,代码行数:34,代码来源:UHDDevice.cpp

示例3: setup_device

int setup_device(uhd::usrp::multi_usrp::sptr usrp, double rx_gain, double tx_gain, double freq, double rate){

    //create a usrp device
    std::cout << boost::format("Using Device: %s") % usrp->get_pp_string() << std::endl;

    usrp->set_rx_rate(rate);
    usrp->set_rx_freq(freq);
    usrp->set_rx_gain(rx_gain);
	usrp->set_tx_rate(rate);
	usrp->set_tx_freq(freq);
	usrp->set_tx_gain(tx_gain);

}
开发者ID:KevinHCChen,项目名称:wireless-aoa,代码行数:13,代码来源:aoa_tx.cpp

示例4: init_usrp

void init_usrp() {
	cout << "Initial USRP" << endl;
	
	usrp = uhd::usrp::multi_usrp::make(usrp_ip);
	usrp->set_rx_rate(rate);
	usrp->set_tx_rate(rate);

	usrp->set_rx_freq(freq);
	usrp->set_tx_freq(freq);

	usrp->set_rx_gain(gain);
	uhd::meta_range_t rx_range = usrp->get_rx_gain_range();
}
开发者ID:xtype0x,项目名称:wn_hw,代码行数:13,代码来源:single_rx.cpp

示例5: Uhd

    Uhd(const std::vector<size_t> channels, const double tx_rate, const double tx_center_freq, const double tx_gain)
    {
        uhd::set_thread_priority_safe();

        for(const auto ch : channels)
        {
            usrp = uhd::usrp::multi_usrp::make(std::string(""));
            usrp->set_clock_source("internal");
            usrp->set_tx_rate(tx_rate, ch);
            usrp->set_tx_freq(uhd::tune_request_t(tx_center_freq), ch);
            usrp->set_tx_gain(tx_gain, ch);
        }
        usrp->set_time_now(uhd::time_spec_t(0.0));
    }
开发者ID:pervices,项目名称:uhd,代码行数:14,代码来源:test_tx_trigger.cpp

示例6: set_rates

double uhd_device::set_rates(double rate)
{
	double actual_rt, actual_clk_rt;

#if !defined(MULTICHAN) & !defined(RESAMPLE)
	// Make sure we can set the master clock rate on this device
	actual_clk_rt = usrp_dev->get_master_clock_rate();
	if (actual_clk_rt > U1_DEFAULT_CLK_RT) {
		LOG(ALERT) << "Cannot set clock rate on this device";
		LOG(ALERT) << "Please compile with host resampling support";
		return -1.0;
	}

	// Set master clock rate
	usrp_dev->set_master_clock_rate(master_clk_rt);
	actual_clk_rt = usrp_dev->get_master_clock_rate();

	if (actual_clk_rt != master_clk_rt) {
		LOG(ALERT) << "Failed to set master clock rate";
		LOG(ALERT) << "Actual clock rate " << actual_clk_rt;
		return -1.0;
	}
#endif

	// Set sample rates
	usrp_dev->set_tx_rate(rate);
	usrp_dev->set_rx_rate(rate);
	actual_rt = usrp_dev->get_tx_rate();

	if (actual_rt != rate) {
		LOG(ALERT) << "Actual sample rate differs from desired rate";
		LOG(ALERT) << actual_rt << "Hz";
		return -1.0;
	}
	if (usrp_dev->get_rx_rate() != actual_rt) {
		LOG(ALERT) << "Transmit and receive sample rates do not match";
		return -1.0;
	}

	return actual_rt;
}
开发者ID:5728136cs,项目名称:openbts-multi-arfcn,代码行数:41,代码来源:UHDDevice.cpp


注:本文中的uhd::usrp::multi_usrp::sptr::set_tx_rate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。