Page 1 of 1

Basic IRQ question

Posted: Sun Mar 05, 2017 7:54 am
by SureshVakati
I see there are two methods to handle Interrupts. ExtInt and irq. Which one should I choose?

Code: Select all

Modem_Status_LED=ExtInt(Pin('G1'), ExtInt.IRQ_RISING_FALLING, Pin.PULL_DOWN,callback)
Power_Status_LED=ExtInt(Pin('G0'), ExtInt.IRQ_RISING_FALLING, Pin.PULL_DOWN,callback)

Code: Select all

>>> p0.irq(trigger=Pin.IRQ_FALLING, handler=callback)
>>> p2.irq(trigger=Pin.IRQ_RISING | Pin.IRQ_FALLING, handler=callback)

Re: Basic IRQ question

Posted: Sun Mar 05, 2017 1:35 pm
by pythoncoder
This boils down to which library to use, pyb (with ExtInit) or machine (with Pin.irq()). In my view there is no satisfactory answer. The intention is that machine will become the standard across all ports, replacing the Pyboard specific pyb. However in its current state of development machine only supports a subset of the functionality of pyb. The choice is yours. You can, of course, mix and match

Re: Basic IRQ question

Posted: Sun Mar 05, 2017 7:33 pm
by SureshVakati
Thank you!