Go Down

Topic: timer interrupts (Read 936 times) previous topic - next topic

whatever9

I want to use timer interrupts that are activated conditionally, and I'm trying to use the DueTimer library at https://github.com/ivanseidel/DueTimer. 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.  :smiley-mr-green:

MarkT

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.
[ I won't respond to messages, use the forum please ]

marmac2002uk

A generalised question - I have been looking for a Due Timer library;
I s   https://github.com/ivanseidel/DueTimer 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.


MarkT

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...
[ I won't respond to messages, use the forum please ]

ivanseidel

Hi, a GitHub user started some work on a fork of my DueTimer library: https://github.com/pklaus/DueTimer/tree/counter-implementation

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
Arduino DueTimer | https://github.com/ivanseidel/DueTimer
Arduino Thread | https://github.com/ivanseidel/ArduinoThread

Go Up