aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc
diff options
context:
space:
mode:
authorLane Kolbly <lane.kolbly@ni.com>2021-12-08 14:12:28 -0600
committerAaron Rossetto <aaron.rossetto@ni.com>2022-01-20 08:52:42 -0600
commit4e391500b54a22dbaae8692750ec25ae8a97ee6d (patch)
tree12907aaefb68f0d4825a8c9cb9ee2be9825d2542 /host/lib/rfnoc
parent72e9ba55d6b144d456a644cb47f40522022d4fb6 (diff)
downloaduhd-4e391500b54a22dbaae8692750ec25ae8a97ee6d.tar.gz
uhd-4e391500b54a22dbaae8692750ec25ae8a97ee6d.tar.bz2
uhd-4e391500b54a22dbaae8692750ec25ae8a97ee6d.zip
host: Implement nameless_gain_mixin
Diffstat (limited to 'host/lib/rfnoc')
-rw-r--r--host/lib/rfnoc/rf_control/CMakeLists.txt1
-rw-r--r--host/lib/rfnoc/rf_control/nameless_gain_mixin.cpp56
2 files changed, 57 insertions, 0 deletions
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 <uhd/property_tree.hpp>
+#include <uhdlib/rfnoc/rf_control/nameless_gain_mixin.hpp>
+#include <unordered_map>
+#include <functional>
+#include <memory>
+#include <string>
+#include <vector>
+
+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