summaryrefslogtreecommitdiff
path: root/gr-iio/python/iio/bindings/fmcomms2_source_python.cc
diff options
context:
space:
mode:
authorJosh Morman <jmorman@peratonlabs.com>2021-10-05 17:12:41 -0400
committermormj <34754695+mormj@users.noreply.github.com>2021-10-13 12:03:15 -0400
commit973a2da868e9a2fb71308e8e7dadc523ba73b49c (patch)
tree34955176f6b12121b975274896be1225d58465f3 /gr-iio/python/iio/bindings/fmcomms2_source_python.cc
parent139be21c350f28adc5f95597144026e3e7baf80e (diff)
iio: de-duplicate the pluto wrappers
The fmcomms2 source/sink were wrapped with hier blocks that were used as the basis for the pluto blocks This templatizes the fmcomms2 blocks so they can be directly used, and since the pluto block is so close to the fmcomms block, just use grc as the wrapper around it fmcomms2/pluto can also now be used as sc16 or fc32 Signed-off-by: Josh Morman <jmorman@peratonlabs.com>
Diffstat (limited to 'gr-iio/python/iio/bindings/fmcomms2_source_python.cc')
-rw-r--r--gr-iio/python/iio/bindings/fmcomms2_source_python.cc33
1 files changed, 28 insertions, 5 deletions
diff --git a/gr-iio/python/iio/bindings/fmcomms2_source_python.cc b/gr-iio/python/iio/bindings/fmcomms2_source_python.cc
index 636c4127d9..a69a1424e1 100644
--- a/gr-iio/python/iio/bindings/fmcomms2_source_python.cc
+++ b/gr-iio/python/iio/bindings/fmcomms2_source_python.cc
@@ -14,7 +14,7 @@
/* BINDTOOL_GEN_AUTOMATIC(0) */
/* BINDTOOL_USE_PYGCCXML(0) */
/* BINDTOOL_HEADER_FILE(fmcomms2_source.h) */
-/* BINDTOOL_HEADER_FILE_HASH(79999a9f1335aa4bc5043ddf033a0e38) */
+/* BINDTOOL_HEADER_FILE_HASH(c286f60f1afed36dfc335cf4ce1b949e) */
/***********************************************************************************/
#include <pybind11/complex.h>
@@ -27,23 +27,46 @@ namespace py = pybind11;
// pydoc.h is automatically generated in the build directory
#include <fmcomms2_source_pydoc.h>
-void bind_fmcomms2_source(py::module& m)
+template <typename T>
+void bind_fmcomms2_source_template(py::module& m, const char* classname)
{
- using fmcomms2_source = gr::iio::fmcomms2_source;
+ using fmcomms2_source = gr::iio::fmcomms2_source<T>;
py::class_<fmcomms2_source,
gr::sync_block,
gr::block,
gr::basic_block,
- std::shared_ptr<fmcomms2_source>>(m, "fmcomms2_source", D(fmcomms2_source))
+ std::shared_ptr<fmcomms2_source>>(m, classname, D(fmcomms2_source))
.def(py::init(&fmcomms2_source::make),
py::arg("uri"),
py::arg("ch_en"),
py::arg("buffer_size"),
D(fmcomms2_source, make))
+ .def("set_frequency", &fmcomms2_source::set_frequency, py::arg("longfrequency"))
+ .def("set_samplerate", &fmcomms2_source::set_samplerate, py::arg("samplerate"))
+ .def("set_gain_mode",
+ &fmcomms2_source::set_gain_mode,
+ py::arg("chan"),
+ py::arg("mode"))
+ .def("set_gain",
+ &fmcomms2_source::set_gain,
+ py::arg("chan"),
+ py::arg("gain_value"))
+ .def("set_quadrature", &fmcomms2_source::set_quadrature, py::arg("quadrature"))
+ .def("set_rfdc", &fmcomms2_source::set_rfdc, py::arg("rfdc"))
+ .def("set_bbdc", &fmcomms2_source::set_bbdc, py::arg("bbdc"))
+ .def("set_filter_params", &fmcomms2_source::set_filter_params)
+ .def(
+ "set_len_tag_key", &fmcomms2_source::set_len_tag_key, py::arg("len_tag_key"));
+ ;
+}
- ;
+void bind_fmcomms2_source(py::module& m)
+{
+ bind_fmcomms2_source_template<int16_t>(m, "fmcomms2_source_s");
+ bind_fmcomms2_source_template<std::complex<int16_t>>(m, "fmcomms2_source_sc16");
+ bind_fmcomms2_source_template<gr_complex>(m, "fmcomms2_source_fc32");
}