.irq().flags() - what is this?
Posted: Tue Mar 08, 2022 1:03 pm
Im learning about micropython on the rpi pico. In the Pi Pico Python SDK doc it shows a nice example of setting interrupts.
from machine import Pin
p2 = Pin(2, Pin.IN, Pin.PULL_UP)
p2.irq(lambda pin: print("IRQ with flags:", pin.irq().flags()), Pin.IRQ_FALLING)
And it works, when I press a button attached to a pin (I used pin 22) it reports :
IRQ with flags: 4
Ok, but what does flags 4 mean. I've looked at the micropython docs, and googled and I cant find anything about .irq().flags() at all. I'm probably missing the obvious but can anyone explain what flags 4 means and perhaps point me in the direction of some documents on this.
Thanks
from machine import Pin
p2 = Pin(2, Pin.IN, Pin.PULL_UP)
p2.irq(lambda pin: print("IRQ with flags:", pin.irq().flags()), Pin.IRQ_FALLING)
And it works, when I press a button attached to a pin (I used pin 22) it reports :
IRQ with flags: 4
Ok, but what does flags 4 mean. I've looked at the micropython docs, and googled and I cant find anything about .irq().flags() at all. I'm probably missing the obvious but can anyone explain what flags 4 means and perhaps point me in the direction of some documents on this.
Thanks