interrupt_disable( intpin )

Use: interrupt_disable( intpin )
Description: Removes an interrupt
Parameters: intpin Interrupt pin or circuit, this is a Pinname that has been used as an interrupt. If Pinname is used it must be in the form Px_y. Where x is the port number, which can be 1 or 2, and y is the bit number which is between 0 and 7. (e.g. P2_3)
Returns: None
Related: eint(), dint(), interrupt_setup(), interrupt_reset()

Use the interrupt_reset command to clear an interrupt so that it can be used again.


# The interrupt function flash_led is defined in the same way as any other mpy function
def toggle_led():   
    # First operation is to reset the interrupt flag for P1_3, this allows new interrupts to occur 
    global x
    x = ~x       # x is the on/off value for the Led , toggle its value  
    out(P1_0,x)   # Turn the LED on or off

# Main code
x = 0             # variable holding the LED state, set it off to start with
dirout(P1_0)      # set the REDLED pin as an output
dirinpu(P1_3)     # set the switch as an input with a pullup resistor
interrupt_setup( P1_3, RISE, toggle_led)    # setup a Rising pin interupt on P1_3, which will run the flash_led function 
eint()            # Enable the global interrupt switch. No interrupts will happen until this has been set