aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrej Rode <andrej.rode@ettus.com>2017-03-21 19:43:22 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:03:44 -0800
commitb29246a9e2d7ed1e03e44cfc6804615fcfa5a5d8 (patch)
tree2a6ad8ad9d17531640b5ab26b4b9e84e0ce5875b
parent1b4af85e10121ba6c89aa2d2ea064dd554076dba (diff)
downloaduhd-b29246a9e2d7ed1e03e44cfc6804615fcfa5a5d8.tar.gz
uhd-b29246a9e2d7ed1e03e44cfc6804615fcfa5a5d8.tar.bz2
uhd-b29246a9e2d7ed1e03e44cfc6804615fcfa5a5d8.zip
mpm: add make factory to lmk04828 spi iface
-rw-r--r--mpm/include/lmk/lmk04828_spi_iface.hpp3
-rw-r--r--mpm/lib/lmk04828/lmk04828_spi_iface.cpp5
2 files changed, 8 insertions, 0 deletions
diff --git a/mpm/include/lmk/lmk04828_spi_iface.hpp b/mpm/include/lmk/lmk04828_spi_iface.hpp
index 3338bd6d1..013271af1 100644
--- a/mpm/include/lmk/lmk04828_spi_iface.hpp
+++ b/mpm/include/lmk/lmk04828_spi_iface.hpp
@@ -1,12 +1,15 @@
#include "lmk04828.hpp"
#include "uhd/types/serial.hpp"
+#include <boost/shared_ptr.hpp>
class lmk04828_spi_iface
{
public:
+ using sptr = boost::shared_ptr<lmk04828_spi_iface>;
lmk04828_spi_iface(uhd::spi_iface::sptr iface);
lmk04828_iface::write_fn_t get_write_fn();
lmk04828_iface::read_fn_t get_read_fn();
+ static sptr make(uhd::spi_iface::sptr iface);
private:
const int LMK_SPI_NUM_BITS = 24;
diff --git a/mpm/lib/lmk04828/lmk04828_spi_iface.cpp b/mpm/lib/lmk04828/lmk04828_spi_iface.cpp
index e281467e1..2e3b43a3c 100644
--- a/mpm/lib/lmk04828/lmk04828_spi_iface.cpp
+++ b/mpm/lib/lmk04828/lmk04828_spi_iface.cpp
@@ -1,6 +1,7 @@
#include "lmk/lmk04828_spi_iface.hpp"
#include "uhd/exception.hpp"
#include <boost/bind.hpp>
+#include <boost/make_shared.hpp>
lmk04828_spi_iface::lmk04828_spi_iface(uhd::spi_iface::sptr iface) : _spi_iface(iface)
{
@@ -41,3 +42,7 @@ uint8_t lmk04828_spi_iface::spi_read(uint32_t addr) {
return data & 0xFF;
}
+
+lmk04828_spi_iface::sptr lmk04828_spi_iface::make(uhd::spi_iface::sptr iface){
+ return boost::make_shared<lmk04828_spi_iface>(iface);
+}