summaryrefslogtreecommitdiff
path: root/gr-uhd/python/uhd/bindings/usrp_block_python.cc
diff options
context:
space:
mode:
authorMartin Braun <martin@gnuradio.org>2020-04-27 21:53:51 -0700
committerMartin Braun <martin@gnuradio.org>2020-08-26 00:11:42 -0700
commit028b2167d7c1a6e7c4eb428b1c6cdd5225add264 (patch)
treec947b74c386ae1c53766f49478a90ea84cf21409 /gr-uhd/python/uhd/bindings/usrp_block_python.cc
parentf871040e8129ccf7b0392aee3744d9867ffa0a1a (diff)
uhd: Add power reference APIs
UHD 4.0 is introducing a power reference level API, which will now become available in GNU Radio. Its availability is conditionally compiled into GNU Radio based on whether or not the feature is available in the UHD version GNU Radio was compiled against. USRP source and sink blocks receive the following new APIs: - has_power_reference() - set_power_reference() - get_power_reference() The command interface now understands a new `power_dbm` dictionary key. The GRC bindings can now switch between absolute gain, normalized gain, and absolute power settings. If GNU Radio was compiled against an older version of UHD (prior to UHD 4.0) which doesn't have this API, an error or warning is printed, the has_power_reference() will return false, and the others will throw an exception.
Diffstat (limited to 'gr-uhd/python/uhd/bindings/usrp_block_python.cc')
-rw-r--r--gr-uhd/python/uhd/bindings/usrp_block_python.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/gr-uhd/python/uhd/bindings/usrp_block_python.cc b/gr-uhd/python/uhd/bindings/usrp_block_python.cc
index 876dfb52d0..67f0d4dab4 100644
--- a/gr-uhd/python/uhd/bindings/usrp_block_python.cc
+++ b/gr-uhd/python/uhd/bindings/usrp_block_python.cc
@@ -151,6 +151,31 @@ void bind_usrp_block(py::module& m)
D(usrp_block, get_gain_range, 1))
+ .def("has_power_reference",
+ &usrp_block::has_power_reference,
+ py::arg("chan") = 0,
+ D(usrp_block, has_power_reference))
+
+
+ .def("set_power_reference",
+ &usrp_block::set_power_reference,
+ py::arg("power_dbm"),
+ py::arg("chan") = 0,
+ D(usrp_block, set_power_reference))
+
+
+ .def("get_power_reference",
+ &usrp_block::get_power_reference,
+ py::arg("chan") = 0,
+ D(usrp_block, get_power_reference))
+
+
+ .def("get_power_range",
+ &usrp_block::get_power_range,
+ py::arg("chan") = 0,
+ D(usrp_block, get_power_range))
+
+
.def("set_antenna",
&usrp_block::set_antenna,
py::arg("ant"),