mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-19 14:14:00 +00:00
mcp3008: fix bitshift bug
This commit is contained in:
+1
-1
@@ -83,7 +83,7 @@ func (p ADCPin) Get() uint16 {
|
|||||||
p.d.bus.Tx(p.d.tx, p.d.rx)
|
p.d.bus.Tx(p.d.tx, p.d.rx)
|
||||||
|
|
||||||
// scale result to 16bit value like other ADCs
|
// scale result to 16bit value like other ADCs
|
||||||
result := uint16((p.d.rx[1]&0x3))<<8 + uint16(p.d.rx[2])<<6
|
result := uint16((p.d.rx[1]&0x3))<<(8+6) + uint16(p.d.rx[2])<<6
|
||||||
p.d.cs.High()
|
p.d.cs.High()
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user