diff options
author | Lane Kolbly <lane.kolbly@ni.com> | 2021-12-07 16:47:26 -0600 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-01-05 10:28:39 -0600 |
commit | 1880c6915d47aee1e8d6a6713da126767c9af9cf (patch) | |
tree | ed52e29f122a9d73080f79af02494e576bdab884 /host/lib/usrp | |
parent | 7deb56e2123785141e44969937f0ae902ea19c00 (diff) | |
download | uhd-1880c6915d47aee1e8d6a6713da126767c9af9cf.tar.gz uhd-1880c6915d47aee1e8d6a6713da126767c9af9cf.tar.bz2 uhd-1880c6915d47aee1e8d6a6713da126767c9af9cf.zip |
host: rf_control: Add internal antenna API abstraction.
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/dboard/zbx/zbx_dboard.cpp | 46 |
1 files changed, 11 insertions, 35 deletions
diff --git a/host/lib/usrp/dboard/zbx/zbx_dboard.cpp b/host/lib/usrp/dboard/zbx/zbx_dboard.cpp index d41302c8f..2a01425b6 100644 --- a/host/lib/usrp/dboard/zbx/zbx_dboard.cpp +++ b/host/lib/usrp/dboard/zbx/zbx_dboard.cpp @@ -48,6 +48,17 @@ zbx_dboard_impl::zbx_dboard_impl(register_iface& reg_iface, RFNOC_LOG_TRACE("Entering zbx_dboard_impl ctor..."); RFNOC_LOG_TRACE("Radio slot: " << _radio_slot); + _rx_antenna = std::make_shared<uhd::rfnoc::rf_control::enumerated_antenna>(tree, + [this](size_t chan) { + return this->_get_frontend_path(RX_DIRECTION, chan) / "antenna" / "value"; + }, + RX_ANTENNAS, RX_ANTENNA_NAME_COMPAT_MAP); + _tx_antenna = std::make_shared<uhd::rfnoc::rf_control::enumerated_antenna>(tree, + [this](size_t chan) { + return this->_get_frontend_path(TX_DIRECTION, chan) / "antenna" / "value"; + }, + TX_ANTENNAS, TX_ANTENNA_NAME_COMPAT_MAP); + _tx_gain_profile_api = std::make_shared<rf_control::enumerated_gain_profile>( ZBX_GAIN_PROFILES, ZBX_GAIN_PROFILE_DEFAULT, ZBX_NUM_CHANS); _rx_gain_profile_api = std::make_shared<rf_control::enumerated_gain_profile>( @@ -89,29 +100,6 @@ std::string zbx_dboard_impl::get_unique_id() const /****************************************************************************** * API Calls *****************************************************************************/ -void zbx_dboard_impl::set_tx_antenna(const std::string& ant, const size_t chan) -{ - RFNOC_LOG_TRACE("Setting TX antenna to " << ant << " for chan " << chan); - if (!TX_ANTENNA_NAME_COMPAT_MAP.count(ant)) { - assert_has(TX_ANTENNAS, ant, "tx antenna"); - } - const fs_path fe_path = _get_frontend_path(TX_DIRECTION, chan); - - _tree->access<std::string>(fe_path / "antenna" / "value").set(ant); -} - -void zbx_dboard_impl::set_rx_antenna(const std::string& ant, const size_t chan) -{ - RFNOC_LOG_TRACE("Setting RX antenna to " << ant << " for chan " << chan); - if (!RX_ANTENNA_NAME_COMPAT_MAP.count(ant)) { - assert_has(RX_ANTENNAS, ant, "rx antenna"); - } - - const fs_path fe_path = _get_frontend_path(RX_DIRECTION, chan); - - _tree->access<std::string>(fe_path / "antenna" / "value").set(ant); -} - double zbx_dboard_impl::set_tx_frequency(const double req_freq, const size_t chan) { const fs_path fe_path = _get_frontend_path(TX_DIRECTION, chan); @@ -592,18 +580,6 @@ double zbx_dboard_impl::get_rx_lo_freq(const std::string& name, size_t chan) return _tree->access<double>(fe_path / "los" / name / "freq" / "value").get(); } -std::string zbx_dboard_impl::get_tx_antenna(size_t chan) const -{ - const fs_path fe_path = _get_frontend_path(TX_DIRECTION, chan); - return _tree->access<std::string>(fe_path / "antenna" / "value").get(); -} - -std::string zbx_dboard_impl::get_rx_antenna(size_t chan) const -{ - const fs_path fe_path = _get_frontend_path(RX_DIRECTION, chan); - return _tree->access<std::string>(fe_path / "antenna" / "value").get(); -} - double zbx_dboard_impl::get_tx_frequency(size_t chan) { const fs_path fe_path = _get_frontend_path(TX_DIRECTION, chan); |