aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/include
diff options
context:
space:
mode:
Diffstat (limited to 'mpm/include')
-rw-r--r--mpm/include/mpm/spi/spi_python.hpp27
-rw-r--r--mpm/include/mpm/spi/spi_regs_iface.hpp11
2 files changed, 38 insertions, 0 deletions
diff --git a/mpm/include/mpm/spi/spi_python.hpp b/mpm/include/mpm/spi/spi_python.hpp
new file mode 100644
index 000000000..4386e1f1b
--- /dev/null
+++ b/mpm/include/mpm/spi/spi_python.hpp
@@ -0,0 +1,27 @@
+//
+// Copyright 2017 Ettus Research (National Instruments)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+
+#pragma once
+
+#include "spi_regs_iface.hpp"
+
+void export_spi() {
+ LIBMPM_BOOST_PREAMBLE("spi")
+
+ bp::def("make_spidev_regs_iface", &mpm::spi::make_spidev_regs_iface);
+}
+
diff --git a/mpm/include/mpm/spi/spi_regs_iface.hpp b/mpm/include/mpm/spi/spi_regs_iface.hpp
index 87f398db1..072e15dc4 100644
--- a/mpm/include/mpm/spi/spi_regs_iface.hpp
+++ b/mpm/include/mpm/spi/spi_regs_iface.hpp
@@ -30,5 +30,16 @@ namespace mpm { namespace spi {
uint32_t write_flags = 0
);
+ /*! Convenience factory for regs_iface based on SPI based on spidev
+ */
+ mpm::types::regs_iface::sptr make_spidev_regs_iface(
+ const std::string &device,
+ const int speed_hz,
+ uint32_t addr_shift,
+ uint32_t data_shift,
+ uint32_t read_flags,
+ uint32_t write_flags = 0
+ );
+
}}; /* namespace mpm::spi */