I need a method to enable/disable single interrupts. cli() and sei() are disabling/enabling all interrupts which is not appropriate for my program. Looking around in the forum there are many examples where NVIC_ENABLE_IRQ(xx) and NVIC_DISABLE_IRQ(xx) are used, but I cannot find an explanation what parameter xx shall be used.
Is it the name of the interrupt service routine or what else?

Which processors are you using?

The sketch runs on a Teensy 3.2.

Open the file "...\teensy\avr\cores\teensy3\kinetis.h" found in your Teensy core installation. There you'll find all the macro names assigned to the various interrupt numbers.

My understanding is that the parameter should be an interrupt number.

But now comes the problem where I can get the number from.

My sketch uses two interrupts, one from comparator1 and one from a timer. For the timer I use the class IntervalTimer. This class, I guess, decides internally what timer to use. How can I get the corresponding interrupt number?

Have you looked in the file I referenced? You can tell the interrupt source from the macro names that get assigned the appropriate interrupt number. Use the names. If you insist on using the raw numbers, then look in the MK20DX256 Manual where the interrupt vector assignments are listed.

Comparator one should be IRQ_CMP1 ad per: cores/kinetis.h at master · PaulStoffregen/cores · GitHub

For interval timers, it looks like you should be able to do:


Because “magic C++ overloading of type conversions” and cores/IntervalTimer.h at master · PaulStoffregen/cores · GitHub