//! tune the given frontend, return the exact value double tune(const std::string &which, const double freq) { boost::lock_guard<boost::mutex> lock(_mutex); //clip to known bounds const meta_range_t freq_range = ad9361_ctrl::get_rf_freq_range(); const double clipped_freq = freq_range.clip(freq); const double value = ad9361_ctrl::get_rf_freq_range().clip(clipped_freq); ad9361_device_t::direction_t direction = _get_direction_from_antenna(which); double return_val = _device.tune(direction, value); return return_val; }
//! tune the given frontend, return the exact value double tune(const std::string &which, const double freq) { //clip to known bounds const meta_range_t freq_range = ad9361_ctrl::get_rf_freq_range(); const double clipped_freq = freq_range.clip(freq); ad9361_transaction_t request; if (which[0] == 'R') request.action = AD9361_ACTION_SET_RX_FREQ; if (which[0] == 'T') request.action = AD9361_ACTION_SET_TX_FREQ; const double value = ad9361_ctrl::get_rf_freq_range().clip(clipped_freq); ad9361_double_pack(value, request.value.freq); const ad9361_transaction_t reply = this->do_transaction(request); return ad9361_double_unpack(reply.value.freq); }
//! set a new clock rate, return the exact value double set_clock_rate(const double rate) { //warning for known trouble rates if (rate > 56e6) UHD_MSG(warning) << boost::format( "The requested clock rate %f MHz may cause slow configuration.\n" "The driver recommends a master clock rate less than %f MHz.\n" ) % (rate/1e6) % 56.0 << std::endl; //clip to known bounds const meta_range_t clock_rate_range = ad9361_ctrl::get_clock_rate_range(); const double clipped_rate = clock_rate_range.clip(rate); ad9361_transaction_t request; request.action = AD9361_ACTION_SET_CLOCK_RATE; ad9361_double_pack(clipped_rate, request.value.rate); const ad9361_transaction_t reply = this->do_transaction(request); return ad9361_double_unpack(reply.value.rate); }
//! set a new clock rate, return the exact value double set_clock_rate(const double rate) { boost::lock_guard<boost::mutex> lock(_mutex); // Changing clock rate will disrupt AD9361's sample clock _use_safe_spi(); //clip to known bounds const meta_range_t clock_rate_range = ad9361_ctrl::get_clock_rate_range(); const double clipped_rate = clock_rate_range.clip(rate); if (clipped_rate != rate) { UHD_MSG(warning) << boost::format( "The requested master_clock_rate %f MHz exceeds bounds imposed by UHD.\n" "The master_clock_rate has been forced to %f MHz.\n" ) % (rate/1e6) % (clipped_rate/1e6) << std::endl; } double return_rate = _device.set_clock_rate(clipped_rate); _use_timed_spi(); return return_rate; }