timer interrupts

I want to use timer interrupts that are activated conditionally, and I'm trying to use the DueTimer library at GitHub - ivanseidel/DueTimer: ⏳ Timer Library fully implemented for Arduino DUE. I don't see examples about using detachInterrupt() and the Arduino command requires the pin number in the detachInterrupt() parentheses, so I don't understand how to stop the timer interrupt using detachInterrupt(). Thank you for any suggestions. :grin:

You just call timer.dettachInterrupt() to detach the handler from that
timer object. You can then re-attach later if you like, or whatever. Unlike
the Arduino attachInterrupt there is an object for each timer channel, not a
global object for all external interrupts, so no need to identify which channel.

A generalised question - I have been looking for a Due Timer library;
I s GitHub - ivanseidel/DueTimer: ⏳ Timer Library fully implemented for Arduino DUE the recommended or best timer library for due?
I didnt see any code or examples in it for driving or using pins, i.e timer attached pins.

Also, where do I find code for implementing counters on the Due? I.e for counting pulses on an input pin.

I think you might be the first wanting such a library - given that the Due
is a lot more flexible perhaps a Due-specific library is needed to make some of
the benefits of the timer/counter hardware easier to use.

A "libraries wanted" thread might be an idea, to complement the "libraries tested" one...

Hi, a GitHub user started some work on a fork of my DueTimer library: GitHub - pklaus/DueTimer: TimerCounter Library for Arduino DUE – Including code to use the TC in the Arduino Due as Counter, not Timer

I don't know if he completed it.

I'm currently working on a newer version of DueTimer, that will cal 'ArduinoTimer', and I (hope) to accomplish a Generic Timer class, that can work across multiple platforms. However, Arduino is going trough some changes on the Library patterns. I was waiting it to complete to start working on it.

The Idea is to have PWM, Counters (Virtuals and Physical), Timers and so on, all working with major Arduino Platforms.

Ivan