Basic IRQ question

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

Basic IRQ question

Postby 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: 1564
Joined: Fri Jul 18, 2014 8:01 am

Re: Basic IRQ question

Postby 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

SureshVakati
Posts: 30
Joined: Fri Feb 24, 2017 3:52 pm

Re: Basic IRQ question

Postby SureshVakati » Sun Mar 05, 2017 7:33 pm

Thank you!


Return to “General Discussion and Questions”

Who is online

Users browsing this forum: No registered users and 1 guest