mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-07-26 10:38:41 +00:00
Reset data pins to output mode after reading
This commit is contained in:
committed by
Ron Evans
parent
b6c750ccd1
commit
80913d5fe7
+3
-1
@@ -105,7 +105,8 @@ func (g *GPIO) Read(data []byte) (n int, err error) {
|
|||||||
data[i] = g.read()
|
data[i] = g.read()
|
||||||
n++
|
n++
|
||||||
}
|
}
|
||||||
g.reconfigureGPIOMode(machine.PinInput)
|
g.rw.Low()
|
||||||
|
g.reconfigureGPIOMode(machine.PinOutput)
|
||||||
return n, nil
|
return n, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,6 +114,7 @@ func (g *GPIO) read4BitMode() byte {
|
|||||||
g.en.High()
|
g.en.High()
|
||||||
data := (g.pins() << 4 & 0xF0)
|
data := (g.pins() << 4 & 0xF0)
|
||||||
g.en.Low()
|
g.en.Low()
|
||||||
|
|
||||||
g.en.High()
|
g.en.High()
|
||||||
data |= (g.pins() & 0x0F)
|
data |= (g.pins() & 0x0F)
|
||||||
g.en.Low()
|
g.en.Low()
|
||||||
|
|||||||
Reference in New Issue
Block a user