From 4e391500b54a22dbaae8692750ec25ae8a97ee6d Mon Sep 17 00:00:00 2001 From: Lane Kolbly Date: Wed, 8 Dec 2021 14:12:28 -0600 Subject: host: Implement nameless_gain_mixin --- host/lib/rfnoc/rf_control/CMakeLists.txt | 1 + host/lib/rfnoc/rf_control/nameless_gain_mixin.cpp | 56 +++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 host/lib/rfnoc/rf_control/nameless_gain_mixin.cpp (limited to 'host/lib/rfnoc') diff --git a/host/lib/rfnoc/rf_control/CMakeLists.txt b/host/lib/rfnoc/rf_control/CMakeLists.txt index f55c9a8a1..fd3ad6539 100644 --- a/host/lib/rfnoc/rf_control/CMakeLists.txt +++ b/host/lib/rfnoc/rf_control/CMakeLists.txt @@ -11,4 +11,5 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/antenna.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gain_profile.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nameless_gain_mixin.cpp ) diff --git a/host/lib/rfnoc/rf_control/nameless_gain_mixin.cpp b/host/lib/rfnoc/rf_control/nameless_gain_mixin.cpp new file mode 100644 index 000000000..d10d01efb --- /dev/null +++ b/host/lib/rfnoc/rf_control/nameless_gain_mixin.cpp @@ -0,0 +1,56 @@ +// +// Copyright 2021 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#include +#include +#include +#include +#include +#include +#include + +namespace uhd { namespace rfnoc { namespace rf_control { + +nameless_gain_mixin::nameless_gain_mixin(name_selector name_selector) + : _name_selector(name_selector) +{ +} + +double nameless_gain_mixin::set_tx_gain(const double gain, const size_t chan) +{ + const auto name = _name_selector(TX_DIRECTION, chan); + return set_tx_gain(gain, name, chan); +} + +double nameless_gain_mixin::get_tx_gain(const size_t chan) +{ + const auto name = _name_selector(TX_DIRECTION, chan); + return get_tx_gain(name, chan); +} + +double nameless_gain_mixin::set_rx_gain(const double gain, const size_t chan) +{ + const auto name = _name_selector(RX_DIRECTION, chan); + return set_rx_gain(gain, name, chan); +} + +double nameless_gain_mixin::get_rx_gain(const size_t chan) +{ + const auto name = _name_selector(RX_DIRECTION, chan); + return get_rx_gain(name, chan); +} + +gain_range_t nameless_gain_mixin::get_tx_gain_range(const size_t chan) const +{ + return get_tx_gain_range("", chan); +} + +gain_range_t nameless_gain_mixin::get_rx_gain_range(const size_t chan) const +{ + return get_rx_gain_range("", chan); +} + +}}} // namespace uhd::rfnoc::rf_control -- cgit v1.2.3