diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-01-04 07:21:00 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-01-08 15:03:48 -0800 |
commit | ab83e9259b6fc45ae8258bd0b4252e3b6d7260c5 (patch) | |
tree | 510b21acb15b3b62835f2cf8b492a9d0548c808f /host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp | |
parent | aeb18f50a0598395d3b0a6179414f6dbfcad2d44 (diff) | |
download | uhd-ab83e9259b6fc45ae8258bd0b4252e3b6d7260c5.tar.gz uhd-ab83e9259b6fc45ae8258bd0b4252e3b6d7260c5.tar.bz2 uhd-ab83e9259b6fc45ae8258bd0b4252e3b6d7260c5.zip |
mg: Use enums for all bands, move freq mapping to single location
This removes the need to re-implement the band checks (in particular,
the low band check) in multiple places, potentially causing confusion.
Signed-off-by: Trung Tran <trung.tran@ettus.com>
Reviewed-by: Trung Tran <trung.tran@ettus.com>
Diffstat (limited to 'host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp')
-rw-r--r-- | host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp index d7869a24a..449b772b3 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp @@ -26,9 +26,11 @@ double magnesium_radio_ctrl_impl::_set_all_gain( "chan=" << chan << ", " "dir=" << dir); const size_t ad9371_chan = _master ? 0 : 1; ;// FIXME: use chan when 2 radios - magnesium_cpld_ctrl::chan_sel_t chan_sel = + const magnesium_cpld_ctrl::chan_sel_t chan_sel = _master ? magnesium_cpld_ctrl::CHAN1 : magnesium_cpld_ctrl::CHAN2; - const auto gain_tuple = get_gain_tuple(gain, freq, dir); + const auto gain_tuple = (dir == RX_DIRECTION) ? + get_rx_gain_tuple(gain, _map_freq_to_rx_band(freq)) : + get_tx_gain_tuple(gain, _map_freq_to_tx_band(freq)); const double ad9371_gain = ((dir == RX_DIRECTION) ? AD9371_MAX_RX_GAIN : AD9371_MAX_TX_GAIN) - gain_tuple.ad9371_att; |