Remove callback before adding a new one

This commit is contained in:
Ben Nuttall
2015-09-21 11:19:21 +01:00
parent 9219b01081
commit 6c98086bff

View File

@@ -34,6 +34,7 @@ class InputDevice(GPIODevice):
def add_callback(self, callback=None, bouncetime=1000):
if callback is None:
raise InputDeviceError('No callback function given')
self.remove_callback()
GPIO.add_event_detect(self.pin, self._edge, callback, bouncetime)
def remove_callback(self):