Changed pin.function so that it's always read-write, which in turn
permits InputDevice to force pin.function to "input" rather than
checking that it's not "input" first. This ensures internal state in
RPi.GPIO and RPIO reflects the reality of each pin's function (see
discussion under the ticket for more detail).
This commit is contained in:
Dave Jones
2016-04-03 15:41:52 +01:00
parent 00373b608c
commit 7826e60c3d
4 changed files with 7 additions and 11 deletions

View File

@@ -39,8 +39,7 @@ class InputDevice(GPIODevice):
def __init__(self, pin=None, pull_up=False):
super(InputDevice, self).__init__(pin)
try:
if self.pin.function != 'input':
self.pin.function = 'input'
self.pin.function = 'input'
pull = 'up' if pull_up else 'down'
if self.pin.pull != pull:
self.pin.pull = pull