diff options
author | Josh Blum <josh@joshknows.com> | 2010-11-01 18:56:38 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-11-10 19:29:06 -0800 |
commit | 08dfff379865656e94b31fd565a4b13b4609ea63 (patch) | |
tree | 271b37573198e2d0abcf7573c17a5953c3a2eb95 /host/lib/usrp/dboard/db_xcvr2450.cpp | |
parent | b7b3e8288dcd64e47c242edbc5b009b9300615a2 (diff) | |
download | uhd-08dfff379865656e94b31fd565a4b13b4609ea63.tar.gz uhd-08dfff379865656e94b31fd565a4b13b4609ea63.tar.bz2 uhd-08dfff379865656e94b31fd565a4b13b4609ea63.zip |
uhd: created a meta range that is a range of ranges for gains and freqs
created a templated range that that holds a start, stop, and step
created a meta-range template that is a vector of ranges
meta-range can calculate the overall start, stop, step
or be indexed to get at components
replaced instances of range.min, max, step with the functions
start() stop() and step()
the xcvr frequency range is now expressed in as two ranges
(have to fix its clip function though)
Diffstat (limited to 'host/lib/usrp/dboard/db_xcvr2450.cpp')
-rw-r--r-- | host/lib/usrp/dboard/db_xcvr2450.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp index be0e42b92..d3084b0a0 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -72,8 +72,10 @@ using namespace boost::assign; **********************************************************************/ static const bool xcvr2450_debug = false; -static const freq_range_t xcvr_freq_range(2.4e9, 6.0e9); -static const freq_range_t xcvr_freq_band_seperation(2.5e9, 4.9e9); +static const freq_range_t xcvr_freq_range = list_of + (range_t<double>(2.4e9, 2.5e9)) + (range_t<double>(4.9e9, 6.0e9)) +; static const prop_names_t xcvr_antennas = list_of("J1")("J2"); @@ -212,10 +214,10 @@ xcvr2450::xcvr2450(ctor_args_t args) : xcvr_dboard_base(args){ set_rx_ant(xcvr_antennas.at(0)); set_tx_ant(xcvr_antennas.at(1)); BOOST_FOREACH(const std::string &name, xcvr_tx_gain_ranges.keys()){ - set_tx_gain(xcvr_tx_gain_ranges[name].min, name); + set_tx_gain(xcvr_tx_gain_ranges[name].start(), name); } BOOST_FOREACH(const std::string &name, xcvr_rx_gain_ranges.keys()){ - set_rx_gain(xcvr_rx_gain_ranges[name].min, name); + set_rx_gain(xcvr_rx_gain_ranges[name].start(), name); } } @@ -259,17 +261,9 @@ void xcvr2450::update_atr(void){ * Tuning **********************************************************************/ void xcvr2450::set_lo_freq(double target_freq){ - //clip for highband and lowband - if((target_freq > xcvr_freq_band_seperation.min) and (target_freq < xcvr_freq_band_seperation.max)){ - if(target_freq - xcvr_freq_band_seperation.min < xcvr_freq_band_seperation.max - target_freq){ - target_freq = xcvr_freq_band_seperation.min; - }else{ - target_freq = xcvr_freq_band_seperation.max; - } - } - //clip for max and min - target_freq = std::clip(target_freq, xcvr_freq_range.min, xcvr_freq_range.max); + //clip the input to the range (TODO FIXME not right) + target_freq = std::clip(target_freq, xcvr_freq_range.start(), xcvr_freq_range.stop()); //variables used in the calculation below double scaler = xcvr2450::is_highband(target_freq)? (4.0/5.0) : (4.0/3.0); |