diff options
Diffstat (limited to 'mpm/include/mpm/ad9361/ad9361_ctrl.hpp')
| -rw-r--r-- | mpm/include/mpm/ad9361/ad9361_ctrl.hpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/mpm/include/mpm/ad9361/ad9361_ctrl.hpp b/mpm/include/mpm/ad9361/ad9361_ctrl.hpp index 7673d7460..2405317fd 100644 --- a/mpm/include/mpm/ad9361/ad9361_ctrl.hpp +++ b/mpm/include/mpm/ad9361/ad9361_ctrl.hpp @@ -14,11 +14,16 @@ #include <functional> #include <string> #include <vector> +#include <future> namespace mpm { namespace chips { using uhd::usrp::ad9361_ctrl; }}; // namespace mpm::chips +//! Async calls +std::future<double> handle_tune; +std::future<double> handle_set_clock_rate; + // TODO: pull in filter_info_base #ifdef LIBMPM_PYTHON void export_catalina(py::module& top_module) @@ -58,6 +63,48 @@ void export_catalina(py::module& top_module) .def("_get_filter", &ad9361_ctrl::get_filter) .def("set_filter", &ad9361_ctrl::set_filter) .def("output_digital_test_tone", &ad9361_ctrl::output_digital_test_tone); + + m.def("async__tune", +[]( + ad9361_ctrl& catalina, + const std::string &which, + const double value + ){ + handle_tune = std::async(std::launch::async, + &ad9361_ctrl::tune, + &catalina, + which, + value + ); + }); + m.def("await__tune", +[]( + )->bool{ + if (handle_tune.wait_for(std::chrono::seconds(0)) + == std::future_status::ready){ + handle_tune.get(); + return true; + } + return false; + }); + m.def("async__set_clock_rate", +[]( + ad9361_ctrl& catalina, + const double value + ){ + handle_set_clock_rate = std::async(std::launch::async, + &ad9361_ctrl::set_clock_rate, + &catalina, + value + ); + }); + m.def("await__set_clock_rate", +[]( + )->bool{ + if (handle_set_clock_rate.wait_for(std::chrono::seconds(0)) + == std::future_status::ready){ + handle_set_clock_rate.get(); + return true; + } + return false; + }); + } #endif |
