using Teensy IntervalTimer library with Arduino

looking around in the forum I found a postage about IntervalTimer in a Teensy comment.
There is a description of the methods of the IntervalTimer object which seemed to be suitable for my project. I tested it with a Board setting for a Teensy 3.2 and it worked without including a library.

Now I'd like to use this object for an Arduino Board. But here I need to know the include file neccessary to use the IntervalTimer methods.

Does anybody know where to get the library for use with Arduino Mega2560?


I don’t know of a library like that for Arduino - that library looks like it relies in part on the richer interrupt configuration options available on the Teensy. For example, there’s no prioritization of interrupts like the teensy has.

The Arduino can do the same thing (using one of the 16-bit timers in CTC mode to generate interrupts); I haven’t seen a library that puts a wrapper around that. Personally, I’d do it by hand, and interact with the registers directly instead of trying to find a library that tries to put a one-size-fits-all wrapper on it. It’s only a few lines to configure the timer for the right mode - and then just write a function to change the timing (if you need such functionality) and to enable and disable it - then write the same interrupt that you otherwise would.

There is a lot written (tutorials, guides, available code) for Timer1 on the '328p - the '2560 has the same timer, plus several more that have identical behavior.