Testing out the wiringPi2 interrupts on python 2.7 / RaspberryPi and can't seem to get it to work.
With the following code, the interrupt generates a segmentation fault.
#!/usr/bin/env python2
import wiringpi2
import time
def my_int():
print('Interrupt')
wpi = wiringpi2.GPIO(wiringpi2.GPIO.WPI_MODE_PINS)
wpi.pullUpDnControl(4,wpi.PUD_UP)
wpi.wiringPiISR(4, wpi.INT_EDGE_BOTH, my_int())
while True:
time.sleep(1)
print('Waiting...')
Waiting...
Waiting...
Waiting...
Waiting...
Segmentation fault
If I callback without the "()" then I get another error:
wpi.wiringPiISR(4, wpi.INT_EDGE_BOTH, my_int)
> TypeError: in method 'wiringPiISR', argument 3 of type 'void (*)(void)'
What am I doing wrong ???