diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-05-11 12:04:45 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:53 -0800 |
commit | b39dafa1eebf327a8bbd3959a3c54e85707b56aa (patch) | |
tree | 5b3b4688a5c24404cc7e4ec20442e9e742c8cbaa /mpm/lib/spi/spidev_iface.cpp | |
parent | e6858a61a81d0ff1762e4b8434fe781acf2fc1ab (diff) | |
download | uhd-b39dafa1eebf327a8bbd3959a3c54e85707b56aa.tar.gz uhd-b39dafa1eebf327a8bbd3959a3c54e85707b56aa.tar.bz2 uhd-b39dafa1eebf327a8bbd3959a3c54e85707b56aa.zip |
mpm: Enabled selection of SPI mode
Diffstat (limited to 'mpm/lib/spi/spidev_iface.cpp')
-rw-r--r-- | mpm/lib/spi/spidev_iface.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/mpm/lib/spi/spidev_iface.cpp b/mpm/lib/spi/spidev_iface.cpp index fe37f16d5..74cb6bc88 100644 --- a/mpm/lib/spi/spidev_iface.cpp +++ b/mpm/lib/spi/spidev_iface.cpp @@ -37,8 +37,10 @@ public: spidev_iface_impl( const std::string &device, - const int max_speed_hz - ) : _speed(max_speed_hz) + const int max_speed_hz, + const int spi_mode + ) : _speed(max_speed_hz), + _mode(spi_mode) { if (!init_spi( @@ -94,7 +96,7 @@ public: private: int _fd; - uint32_t _mode = SPI_CPHA | SPI_CPOL; + const uint32_t _mode; uint32_t _speed = 2000000; uint8_t _bits = 8; uint16_t _delay = 0; @@ -105,10 +107,11 @@ private: *****************************************************************************/ spi_iface::sptr spi_iface::make_spidev( const std::string &device, - const int speed_hz + const int speed_hz, + const int spi_mode ) { return std::make_shared<spidev_iface_impl>( - device, speed_hz + device, speed_hz, spi_mode ); } |