aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Rossetto <aaron.rossetto@ni.com>2020-08-05 07:37:38 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2020-08-05 07:47:22 -0500
commitcf614ae5e053d06e55b50b45aa9fec65d1a2c481 (patch)
tree16338ee41c85c500d05f36a3a5453b5e8011c4b2
parentrfnoc: Add Keep One in N block support (diff)
downloaduhd-cf614ae5e053d06e55b50b45aa9fec65d1a2c481.tar.xz
uhd-cf614ae5e053d06e55b50b45aa9fec65d1a2c481.zip
python: Add Keep One in N block controller bindings
-rw-r--r--host/lib/rfnoc/keep_one_in_n_block_control_python.hpp31
-rw-r--r--host/python/pyuhd.cpp2
-rw-r--r--host/python/uhd/rfnoc.py1
3 files changed, 34 insertions, 0 deletions
diff --git a/host/lib/rfnoc/keep_one_in_n_block_control_python.hpp b/host/lib/rfnoc/keep_one_in_n_block_control_python.hpp
new file mode 100644
index 000000000..35b9df8f2
--- /dev/null
+++ b/host/lib/rfnoc/keep_one_in_n_block_control_python.hpp
@@ -0,0 +1,31 @@
+//
+// Copyright 2020 Ettus Research, a National Instruments Brand
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#pragma once
+
+#include "block_controller_factory_python.hpp"
+#include <uhd/rfnoc/keep_one_in_n_block_control.hpp>
+
+using namespace uhd::rfnoc;
+
+void export_keep_one_in_n_block_control(py::module& m)
+{
+ py::class_<keep_one_in_n_block_control,
+ noc_block_base,
+ keep_one_in_n_block_control::sptr>(m, "keep_one_in_n_block_control")
+ .def(py::init(&block_controller_factory<keep_one_in_n_block_control>::make_from))
+ .def("get_max_n", &keep_one_in_n_block_control::get_max_n)
+ .def("get_n", &keep_one_in_n_block_control::get_n,
+ py::arg("chan") = 0)
+ .def("set_n", &keep_one_in_n_block_control::set_n,
+ py::arg("n"),
+ py::arg("chan") = 0)
+ .def("get_mode", &keep_one_in_n_block_control::get_mode,
+ py::arg("chan") = 0)
+ .def("set_mode", &keep_one_in_n_block_control::set_mode,
+ py::arg("mode"),
+ py::arg("chan") = 0);
+}
diff --git a/host/python/pyuhd.cpp b/host/python/pyuhd.cpp
index 605f80b86..bb564c276 100644
--- a/host/python/pyuhd.cpp
+++ b/host/python/pyuhd.cpp
@@ -19,6 +19,7 @@ namespace py = pybind11;
#include "rfnoc/fft_block_control_python.hpp"
#include "rfnoc/fir_filter_block_control_python.hpp"
#include "rfnoc/fosphor_block_control_python.hpp"
+#include "rfnoc/keep_one_in_n_block_control_python.hpp"
#include "rfnoc/moving_average_block_control_python.hpp"
#include "rfnoc/null_block_control_python.hpp"
#include "rfnoc/radio_control_python.hpp"
@@ -93,6 +94,7 @@ PYBIND11_MODULE(libpyuhd, m)
export_fft_block_control(rfnoc_module);
export_fosphor_block_control(rfnoc_module);
export_fir_filter_block_control(rfnoc_module);
+ export_keep_one_in_n_block_control(rfnoc_module);
export_moving_average_block_control(rfnoc_module);
export_null_block_control(rfnoc_module);
export_radio_control(rfnoc_module);
diff --git a/host/python/uhd/rfnoc.py b/host/python/uhd/rfnoc.py
index 05b356e29..c355777b0 100644
--- a/host/python/uhd/rfnoc.py
+++ b/host/python/uhd/rfnoc.py
@@ -23,6 +23,7 @@ DucBlockControl = lib.rfnoc.duc_block_control
FftBlockControl = lib.rfnoc.fft_block_control
FosphorBlockControl = lib.rfnoc.fosphor_block_control
FirFilterBlockControl = lib.rfnoc.fir_filter_block_control
+KeepOneInNBlockControl = lib.rfnoc.keep_one_in_n_block_control
MovingAverageBlockControl = lib.rfnoc.moving_average_block_control
NullBlockControl = lib.rfnoc.null_block_control
RadioControl = lib.rfnoc.radio_control