Basic IRQ question

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
SureshVakati
Posts: 42
Joined: Fri Feb 24, 2017 3:52 pm

Basic IRQ question

Post by SureshVakati » Sun Mar 05, 2017 7:54 am

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)

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Basic IRQ question

Post by pythoncoder » Sun Mar 05, 2017 1:35 pm

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
Peter Hinch
Index to my micropython libraries.

User avatar
SureshVakati
Posts: 42
Joined: Fri Feb 24, 2017 3:52 pm

Re: Basic IRQ question

Post by SureshVakati » Sun Mar 05, 2017 7:33 pm

Thank you!

Post Reply