drivers/spi: fix compilation errors
authorIvan <ivan.galkin@samsung.com>
Tue, 4 Apr 2017 04:33:30 +0000 (13:33 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Tue, 18 Apr 2017 03:02:07 +0000 (12:02 +0900)
This commit fixes a compilation error when CONFIG_SPI_BITBANG_VARWIDTH
is set to '=y'.

Change-Id: I8c5eb89cddb588571744d0f7d87670b037c3547c
Signed-off-by: Ivan <ivan.galkin@samsung.com>
os/include/tinyara/spi/spi_bitbang.c

index 71ff3ac..4102e68 100644 (file)
@@ -612,14 +612,15 @@ static uint16_t spi_exchange(FAR struct spi_bitbang_s *priv, uint16_t dataout)
         * rate.
         */
 
-       shift = priv->nbits - 1 for (bit = 1 << shift; bit != 0; bit >>= 1) {
+       shift = priv->nbits - 1;
+       for (bit = 1 << shift; bit != 0; bit >>= 1) {
                /* Shift to make space for the next, less significant bit.
                 * Then exchange bits with the slave an OR in the new, returned
                 * bit.
                 */
 
                datain <<= 1;
-               datain |= exchange(dataout & bit, holdtime);
+               datain |= exchange(!!(dataout & bit), holdtime);
        }
 
        return datain;