diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-04-29 18:56:22 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:52 -0800 |
commit | fcf8715eab6d3d06526e1ef1398e0e684711daad (patch) | |
tree | d2e762044506fbd456f8bd039fc1c99ff78ce90a /mpm/include | |
parent | 0920bf97eace21fca3a88d5b7749849925c3ee29 (diff) | |
download | uhd-fcf8715eab6d3d06526e1ef1398e0e684711daad.tar.gz uhd-fcf8715eab6d3d06526e1ef1398e0e684711daad.tar.bz2 uhd-fcf8715eab6d3d06526e1ef1398e0e684711daad.zip |
mpm: Exposed spi regs iface factory to Python
Diffstat (limited to 'mpm/include')
-rw-r--r-- | mpm/include/mpm/spi/spi_python.hpp | 27 | ||||
-rw-r--r-- | mpm/include/mpm/spi/spi_regs_iface.hpp | 11 |
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 */ |