From b39dafa1eebf327a8bbd3959a3c54e85707b56aa Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 11 May 2017 12:04:45 -0700 Subject: mpm: Enabled selection of SPI mode --- mpm/lib/spi/spidev_iface.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'mpm/lib/spi/spidev_iface.cpp') 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( - device, speed_hz + device, speed_hz, spi_mode ); } -- cgit v1.2.3