From 5f69495de65e6991fec0857ed22cdfdee5c74362 Mon Sep 17 00:00:00 2001 From: virtuosonic Date: Wed, 24 Jun 2020 15:49:16 -0700 Subject: [PATCH] Update mcp3002.c fixed: wrong value for bitwise left shift tested using a MCP3002-I/SN with raspberry pi 3 b+ running Raspbian GNU/Linux 9.11 measured devices: 5k slide potentiometer & dwyer 628 --- wiringPi/mcp3002.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiringPi/mcp3002.c b/wiringPi/mcp3002.c index 9ebf3e4..8e191b6 100644 --- a/wiringPi/mcp3002.c +++ b/wiringPi/mcp3002.c @@ -49,7 +49,7 @@ static int myAnalogRead (struct wiringPiNodeStruct *node, int pin) wiringPiSPIDataRW (node->fd, spiData, 2) ; - return ((spiData [0] << 8) | (spiData [1] >> 1)) & 0x3FF ; + return ((spiData [0] << 7) | (spiData [1] >> 1)) & 0x3FF ; }