aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/multi_usrp_python.hpp
diff options
context:
space:
mode:
authoreklai <eric@skysafe.io>2020-01-23 18:47:28 -0800
committeratrnati <54334261+atrnati@users.noreply.github.com>2020-02-18 07:21:24 -0600
commitd7304cc724de43b0d61d5b9d61a528d58898f004 (patch)
tree05304ad4d65c507c6d43fcbc407c566c351053c3 /host/lib/usrp/multi_usrp_python.hpp
parentc0a6bb1720a3db8ac9a40bdd5ca19de8be40d500 (diff)
downloaduhd-d7304cc724de43b0d61d5b9d61a528d58898f004.tar.gz
uhd-d7304cc724de43b0d61d5b9d61a528d58898f004.tar.bz2
uhd-d7304cc724de43b0d61d5b9d61a528d58898f004.zip
x300: add front-panel GPIO source control
Adds a ZPU register to control the FP GPIO source. These are 2bits per GPIO pin, totalling 24 bits. 0 corresponds to RF-A, 1 corresponds to RF-B. The following Python code will control the upper 6 bits of the front-panel GPIO from the B-side radio on an X300: >>> import uhd >>> U = uhd.usrp.MultiUSRP("type=x300") >>> U.get_gpio_src_banks() ['FP0'] >>> U.get_gpio_src("FP0") ['RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA'] >>> U.set_gpio_src("FP0", ['RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFB', 'RFB', 'RFB', 'RFB', 'RFB', 'RFB']) >>> U.get_gpio_src("FP0") ['RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFB', 'RFB', 'RFB', 'RFB', 'RFB', 'RFB'] >>> # Make all GPIOs outputs: >>> U.set_gpio_attr("FP0A", "DDR", 0xFFF) >>> U.set_gpio_attr("FP0B", "DDR", 0xFFF) >>> # Control all GPIOs from software (not ATR): >>> U.set_gpio_attr("FP0A", "CTRL", 0x000) >>> U.set_gpio_attr("FP0B", "CTRL", 0x000) >>> # Bottom 3 pins go high from radio A >>> U.set_gpio_attr("FP0A", "OUT", 0x007) >>> # Top 3 pins go high from radio B >>> U.set_gpio_attr("FP0B", "OUT", 0xE00) Amends the gpio.cpp example to allow switching the source. Co-authored-by: Brent Stapleton <brent.stapleton@ettus.com>
Diffstat (limited to 'host/lib/usrp/multi_usrp_python.hpp')
-rw-r--r--host/lib/usrp/multi_usrp_python.hpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/host/lib/usrp/multi_usrp_python.hpp b/host/lib/usrp/multi_usrp_python.hpp
index c9d89888b..8d25e26d4 100644
--- a/host/lib/usrp/multi_usrp_python.hpp
+++ b/host/lib/usrp/multi_usrp_python.hpp
@@ -24,6 +24,7 @@ void export_multi_usrp(py::module& m)
// Factory
.def(py::init(&multi_usrp::make))
+ // clang-format off
// General USRP methods
.def("get_rx_freq" , &multi_usrp::get_rx_freq, py::arg("chan") = 0)
.def("get_rx_num_channels" , &multi_usrp::get_rx_num_channels)
@@ -170,6 +171,7 @@ void export_multi_usrp(py::module& m)
.def("get_gpio_srcs" , &multi_usrp::get_gpio_srcs, py::arg("bank"), py::arg("mboard") = 0)
.def("get_gpio_src" , &multi_usrp::get_gpio_src, py::arg("bank"), py::arg("mboard") = 0)
.def("set_gpio_src" , &multi_usrp::set_gpio_src, py::arg("bank"), py::arg("src"), py::arg("mboard") = 0)
+ .def("get_gpio_src_banks" , &multi_usrp::get_gpio_src_banks, py::arg("mboard") = 0)
// Filter API methods
.def("get_rx_filter_names" , &multi_usrp::get_rx_filter_names)
@@ -178,6 +180,7 @@ void export_multi_usrp(py::module& m)
.def("get_tx_filter_names" , &multi_usrp::get_tx_filter_names)
.def("get_tx_filter" , &multi_usrp::get_tx_filter)
.def("set_tx_filter" , &multi_usrp::set_tx_filter)
+ // clang-format off
;
}