From a67d71ed90ebcbea5e45d680451554b5267372e0 Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Wed, 22 Oct 2014 20:52:11 +0100 Subject: [PATCH] spi: fix mraa_spi_bit_per_word call to use correct ioctl This should fix #14 Signed-off-by: Brendan Le Foll --- src/spi/spi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/spi/spi.c b/src/spi/spi.c index 7350261..45a187e 100644 --- a/src/spi/spi.c +++ b/src/spi/spi.c @@ -146,6 +146,10 @@ mraa_spi_lsbmode(mraa_spi_context dev, mraa_boolean_t lsb) mraa_result_t mraa_spi_bit_per_word(mraa_spi_context dev, unsigned int bits) { + if (ioctl(dev->devfd, SPI_IOC_WR_BITS_PER_WORD, &bits) < 0) { + syslog(LOG_ERR, "spi: Failed to set bit per word"); + return MRAA_ERROR_INVALID_RESOURCE; + } dev->bpw = bits; return MRAA_SUCCESS; }