Skip to content

Commit 520234e

Browse files
soypatdeadprogram
authored andcommitted
mcp3008: fix bitshift bug
1 parent 334ed57 commit 520234e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mcp3008/mcp3008.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (p ADCPin) Get() uint16 {
8383
p.d.bus.Tx(p.d.tx, p.d.rx)
8484

8585
// scale result to 16bit value like other ADCs
86-
result := uint16((p.d.rx[1]&0x3))<<8 + uint16(p.d.rx[2])<<6
86+
result := uint16((p.d.rx[1]&0x3))<<(8+6) + uint16(p.d.rx[2])<<6
8787
p.d.cs.High()
8888

8989
return result

0 commit comments

Comments
 (0)