aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/include
diff options
context:
space:
mode:
authorAndrej Rode <andrej.rode@ettus.com>2017-03-21 19:46:50 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:03:44 -0800
commitef6326a174e6880be5e2eaeac26a2c5de0768807 (patch)
treec949545e02390745c3a373e657bcf2404e62e191 /mpm/include
parentb29246a9e2d7ed1e03e44cfc6804615fcfa5a5d8 (diff)
downloaduhd-ef6326a174e6880be5e2eaeac26a2c5de0768807.tar.gz
uhd-ef6326a174e6880be5e2eaeac26a2c5de0768807.tar.bz2
uhd-ef6326a174e6880be5e2eaeac26a2c5de0768807.zip
mpm: python refactoring
Diffstat (limited to 'mpm/include')
-rw-r--r--mpm/include/lmk/lmk04828_spi_iface.hpp13
-rw-r--r--mpm/include/mpm/spi/spidev_iface.hpp33
2 files changed, 46 insertions, 0 deletions
diff --git a/mpm/include/lmk/lmk04828_spi_iface.hpp b/mpm/include/lmk/lmk04828_spi_iface.hpp
index 013271af1..fa11029a8 100644
--- a/mpm/include/lmk/lmk04828_spi_iface.hpp
+++ b/mpm/include/lmk/lmk04828_spi_iface.hpp
@@ -25,3 +25,16 @@ private:
void spi_write(std::vector<uint32_t> writes);
uint8_t spi_read(uint32_t addr);
};
+
+#ifdef LIBMPM_PYTHON
+void export_lmk(){
+ LIBMPM_BOOST_PREAMBLE("lmk04828")
+ bp::class_<lmk04828_iface, boost::shared_ptr<lmk04828_iface>, boost::noncopyable >("lmk04828_iface", bp::no_init)
+ .def("make", &lmk04828_iface::make)
+ .def("verify_chip_id", &lmk04828_iface::verify_chip_id)
+ .def("get_chip_id", &lmk04828_iface::get_chip_id)
+ .def("init", &lmk04828_iface::init)
+ .def("send_sysref_pulse", &lmk04828_iface::send_sysref_pulse)
+ ;
+}
+#endif
diff --git a/mpm/include/mpm/spi/spidev_iface.hpp b/mpm/include/mpm/spi/spidev_iface.hpp
index fb82ffade..ef5303f7b 100644
--- a/mpm/include/mpm/spi/spidev_iface.hpp
+++ b/mpm/include/mpm/spi/spidev_iface.hpp
@@ -57,3 +57,36 @@ namespace mpm { namespace spi {
}}; /* namespace mpm */
+//void export_spi(){
+ //// Register submodule spi
+ //bp::object spi_module(bp::handle<>(bp::borrowed(PyImport_AddModule("libpyusrp_periphs.spi"))));
+ //bp::scope().attr("spi") = spi_module;
+ //bp::scope io_scope = spi_module;
+
+ //bp::class_<spi_lock, boost::noncopyable, boost::shared_ptr<spi_lock> >("spi_lock", bp::no_init)
+ //.def("make", &spi_lock::make)
+ //.def("get_spidev", &spi_lock::get_spidev)
+ //;
+
+ //bp::class_<mpm::spi_iface, boost::noncopyable>("spi_iface", bp::no_init)
+ //.def("write_byte", &mpm::spi_iface::write_byte)
+ //.def("write_bytes", &mpm::spi_iface::write_bytes)
+ //.def("read_byte", &mpm::spi_iface::read_byte)
+ //.def("write_field", &mpm::spi_iface::write_field)
+ //.def("read_field", &mpm::spi_iface::read_field)
+ //.def("get_wire_mode", &mpm::spi_iface::get_wire_mode)
+ //.def("get_endianness", &mpm::spi_iface::get_endianness)
+ //.def("get_chip_select", &mpm::spi_iface::get_chip_select)
+ //;
+
+ //bp::enum_<mpm::spi_iface::spi_endianness_t>("spi_endianness")
+ //.value("lsb_first", mpm::spi_iface::spi_endianness_t::LSB_FIRST)
+ //.value("msb_first", mpm::spi_iface::spi_endianness_t::MSB_FIRST)
+ //;
+
+ //bp::enum_<mpm::spi_iface::spi_wire_mode_t>("spi_wire_mode")
+ //.value("three_wire_mode", mpm::spi_iface::spi_wire_mode_t::THREE_WIRE_MODE)
+ //.value("four_wire_mode", mpm::spi_iface::spi_wire_mode_t::FOUR_WIRE_MODE)
+ //;
+//}
+