How to modify an external interrupt?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
hansel
Posts: 13
Joined: Wed Feb 11, 2015 7:34 pm
Location: Rotterdam, NL
Contact:

How to modify an external interrupt?

Post by hansel » Sat Feb 21, 2015 11:11 am

Is there a way to modify an external interrupt (say map to a different callback)?
ExtInt has no deinit(), and when calling the constructor again for the same pin one gets an exception: ExtInt vector 1 is already in use

Code: Select all

def callback1(line):
    print ("cb 1")
def callback2(line):
    print ("cb 2")

pin = pyb.Pin.board.X1
irInt = pyb.ExtInt(pin, pyb.ExtInt.IRQ_RISING_FALLING, pyb.Pin.PULL_UP, callback1)
irInt = pyb.ExtInt(pin, pyb.ExtInt.IRQ_RISING_FALLING, pyb.Pin.PULL_UP, callback2)

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: How to modify an external interrupt?

Post by dhylands » Sat Feb 21, 2015 6:04 pm

The deinit is to set the callback to None.

Post Reply