mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Fix #193
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user