From 3e1c5285713c20e0f527109fb45655283134825a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20M=C3=BCllener?= Date: Fri, 5 Feb 2016 17:15:35 +0100 Subject: [PATCH] Spi: Constructor with chip select added in cpp header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Steven Müllener Signed-off-by: Brendan Le Foll --- api/mraa/spi.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/mraa/spi.hpp b/api/mraa/spi.hpp index 19316dc..e5ffb09 100644 --- a/api/mraa/spi.hpp +++ b/api/mraa/spi.hpp @@ -70,6 +70,15 @@ class Spi } } + Spi(int bus, int cs) + { + m_spi = mraa_spi_init_raw(bus, cs); + + if (m_spi == NULL) { + throw std::invalid_argument("Error initialising SPI bus"); + } + } + /** * Closes spi bus */