Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2cea579

Browse files
authored
Explicitly set internal MCP23017 GPIO state on input_pins read, fix adafruit#70.
1 parent f300bdd commit 2cea579

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Adafruit_GPIO/MCP230xx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ def input_pins(self, pins):
100100
"""
101101
[self._validate_pin(pin) for pin in pins]
102102
# Get GPIO state.
103-
gpio = self._device.readList(self.GPIO, self.gpio_bytes)
103+
self.gpio = self._device.readList(self.GPIO, self.gpio_bytes)
104104
# Return True if pin's bit is set.
105-
return [(gpio[int(pin/8)] & 1 << (int(pin%8))) > 0 for pin in pins]
105+
return [(self.gpio[int(pin/8)] & 1 << (int(pin%8))) > 0 for pin in pins]
106106

107107

108108
def pullup(self, pin, enabled):

0 commit comments

Comments
 (0)