Browse Source

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
pull/78/head
virtuosonic 4 years ago
committed by GitHub
parent
commit
5f69495de6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      wiringPi/mcp3002.c

+ 1
- 1
wiringPi/mcp3002.c View File

@@ -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 ;
}




Loading…
Cancel
Save