diff options
author | Martin Braun <martin.braun@ettus.com> | 2020-11-26 10:04:44 +0100 |
---|---|---|
committer | michael-west <michael.west@ettus.com> | 2020-12-01 13:01:11 -0800 |
commit | 2ea04bf544cf30220bff8b5bbaafa81a9db41183 (patch) | |
tree | 14b6ac36a58312a474d7a65a6206e2e018919ec5 /host | |
parent | 4da7d5a946df34ae3461c524600e80ea8ab15f41 (diff) | |
download | uhd-2ea04bf544cf30220bff8b5bbaafa81a9db41183.tar.gz uhd-2ea04bf544cf30220bff8b5bbaafa81a9db41183.tar.bz2 uhd-2ea04bf544cf30220bff8b5bbaafa81a9db41183.zip |
python: Make TuneRequest implicitly convertible from double
This allows to do the following:
>>> usrp = uhd.usrp.MultiUSRP(args)
>>> usrp.set_tx_frequency(1e9)
In the past, you would have to manually convert the frequency to
a uhd.types.TuneRequest before passing it to set_?x_frequency(). This
new behaviour makes Python match the C++ behaviour.
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/types/tune_python.hpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/host/lib/types/tune_python.hpp b/host/lib/types/tune_python.hpp index 75455e3d8..842e9b124 100644 --- a/host/lib/types/tune_python.hpp +++ b/host/lib/types/tune_python.hpp @@ -31,6 +31,7 @@ void export_tune(py::module& m) .def_readwrite("rf_freq", &tune_request_t::rf_freq) .def_readwrite("dsp_freq", &tune_request_t::dsp_freq) .def_readwrite("args", &tune_request_t::args); + py::implicitly_convertible<double, tune_request_t>(); py::class_<tune_result_t>(m, "tune_result") .def(py::init<>()) |