diff options
author | Brent Stapleton <brent.stapleton@ettus.com> | 2018-11-20 12:02:43 -0800 |
---|---|---|
committer | Brent Stapleton <bstapleton@g.hmc.edu> | 2018-11-29 09:50:02 -0800 |
commit | 32457928dd056198900b90215a0690a4226a2b60 (patch) | |
tree | 4a8ee0d5e2cb6cf3f227fc40976c0b98544fe83b /host | |
parent | 6cadc49938761597024cd30235a3e2a92a201638 (diff) | |
download | uhd-32457928dd056198900b90215a0690a4226a2b60.tar.gz uhd-32457928dd056198900b90215a0690a4226a2b60.tar.bz2 uhd-32457928dd056198900b90215a0690a4226a2b60.zip |
python: Add sync source to Python API
Exposing getters, setters, and options for multi_usrp sync source.
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/multi_usrp_python.hpp | 32 | ||||
-rw-r--r-- | host/python/pyuhd.cpp | 9 |
2 files changed, 41 insertions, 0 deletions
diff --git a/host/lib/usrp/multi_usrp_python.hpp b/host/lib/usrp/multi_usrp_python.hpp index 39b0fa065..75a64ceeb 100644 --- a/host/lib/usrp/multi_usrp_python.hpp +++ b/host/lib/usrp/multi_usrp_python.hpp @@ -7,6 +7,7 @@ #ifndef INCLUDED_UHD_USRP_MULTI_USRP_PYTHON_HPP #define INCLUDED_UHD_USRP_MULTI_USRP_PYTHON_HPP +#include <uhd/types/device_addr.hpp> #include <uhd/usrp/multi_usrp.hpp> // @@ -170,6 +171,31 @@ static void set_gpio_attr_1(uhd::usrp::multi_usrp *multi_usrp, BOOST_PYTHON_FUNCTION_OVERLOADS(overload_set_gpio_attr_0, set_gpio_attr_0, 4, 6); BOOST_PYTHON_FUNCTION_OVERLOADS(overload_set_gpio_attr_1, set_gpio_attr_1, 4, 6); +static void set_sync_source_0(uhd::usrp::multi_usrp *multi_usrp, + const std::string &clock_source, + const std::string &time_source) +{ + multi_usrp->set_sync_source(clock_source, time_source); +} +static void set_sync_source_1(uhd::usrp::multi_usrp *multi_usrp, + const std::string &clock_source, + const std::string &time_source, + const size_t mboard) +{ + multi_usrp->set_sync_source(clock_source, time_source, mboard); +} +static void set_sync_source_2(uhd::usrp::multi_usrp *multi_usrp, + const uhd::device_addr_t& sync_source) +{ + multi_usrp->set_sync_source(sync_source); +} +static void set_sync_source_3(uhd::usrp::multi_usrp *multi_usrp, + const uhd::device_addr_t& sync_source, + const size_t mboard) +{ + multi_usrp->set_sync_source(sync_source, mboard); +} + // // Boost.Python needs to know about default argument overloads // @@ -368,6 +394,12 @@ void export_multi_usrp() .def("set_clock_source" , &multi_usrp::set_clock_source, overload_set_clock_source()) .def("get_clock_source" , &multi_usrp::get_clock_source) .def("get_clock_sources" , &multi_usrp::get_clock_sources) + .def("set_sync_source" , &set_sync_source_0) + .def("set_sync_source" , &set_sync_source_1) + .def("set_sync_source" , &set_sync_source_2) + .def("set_sync_source" , &set_sync_source_3) + .def("get_sync_source" , &multi_usrp::get_sync_source) + .def("get_sync_sources" , &multi_usrp::get_sync_sources) .def("set_clock_source_out" , &multi_usrp::set_clock_source_out, overload_set_clock_source_out()) .def("set_time_source_out" , &multi_usrp::set_time_source_out, overload_set_time_source_out()) .def("get_num_mboards" , &multi_usrp::get_num_mboards) diff --git a/host/python/pyuhd.cpp b/host/python/pyuhd.cpp index 27b154c90..e0f35d929 100644 --- a/host/python/pyuhd.cpp +++ b/host/python/pyuhd.cpp @@ -171,6 +171,15 @@ BOOST_PYTHON_MODULE(libpyuhd) export_metadata(); export_sensors(); export_tune(); + + // Declare some more converters + iterable_converter() + .from_python<std::vector<uhd::device_addr_t>>() + ; + + bp::to_python_converter< + std::vector<uhd::device_addr_t>, + iterable_to_python_list<std::vector<uhd::device_addr_t>>, false >(); } // Register usrp submodule |