I've tried help(RPi.GPIO.add_event_detect) and checked its official wiki with no answer to that. The official example is like:
GPIO.add_event_detect(channel, GPIO.RISING, callback=my_callback, bouncetime=200)
Is there any way to pass args to my callback function (other than the pin channel) ?
Updates:
What I'm trying to do is to stop/resume a camera&servo task via a button. My code is like:
active = [False]
GPIO.add_event_detect(channel, GPIO.BOTH, callback=button_callback)
while True:
if active[0]:
# camera&servo doing something which lasts seconds per loop
I want to pass the arg active to function button_callback in order to set it True/False. If I directly put GPIO.input(channel) in the while loop, I might miss the button input.
So how to pass that arg to the callback or is there any better way to achieve that?
gpio-keysdriver and get a proper IRQ handler for that.