How do I undo attachInterrupt() ?

RichardL

Member
Hi,
I'm using attachInterrupt() to monitor state changes on a T4.1 pin... and it works a treat.

However, I cannot find a function to disable the interrupt function on a pin when I have finished.

detachInterrupt() ??

The pin usually receives signals in the 0 to 10KHz range but at other times can receive signals
to beyond 50MHz and the interrupt code would consume too much processor overhead.

Can someone please help?

Thanks.
 
In C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4\interrupt.c, line 124, detachInterrupt is defined:
Code:
void detachInterrupt(uint8_t pin)
{
	if (pin >= CORE_NUM_DIGITAL) return;
	volatile uint32_t *gpio = portOutputRegister(pin);
	uint32_t mask = digitalPinToBitMask(pin);
	gpio[IMR_INDEX] &= ~mask;
}

So that should suit your purpose.

Paul
 
Back
Top