Topic: TimerOne updates
(Read 393 times)
Oct 07, 2011, 09:22 pm
I'm new to this and not sure of the etiquette for modifying existing libraries, so would appreciate some pointers.
I started development of a timer using Timer1, but then came across the TimerOne library. Rather than create something new, I'd like to propose some amendments to the existing library, but I'm not sure how I go about it.
To give you a feel, my suggested amendments are as follows:
* - Add (long) assignments and casts to TimerOne::read() to ensure calculations involving tmp, ICR1 and TCNT1 aren't truncated
* - Ensure 16 bit registers accesses are atomic - run with interrupts disabled when accessing
* - Remove global enable of interrupts (sei())- could be running within an interrupt routine)
* - Counter reset to 1 rather than zero. Datasheet vague on this, but experiment shows that overflow interrupt
* - flag gets set whilst TCNT1 == BOTTOM, resulting in a phantom interrupt. Could code around, but unnecessary complexity
* - Start() amended to start counter and handle all interrupt enabling.
* - Point restart() at start(). Can't see any real difference