Provide acces to Timer2 hadware timer of arduino.
Public declarations:
class TimerOwner{ public: virtual void onTimerEvent(){} }; class Timer2{ public: Timer2(); Timer2(TimerOwner* owner); Timer2(voidFunction externFunction); ~Timer2(); void startMicros(ulong microseconds); void startMillis(ulong milliseconds); void stop(); ulong overlaps(); virtual void onTimerEvent(){} };
Call startMillis() or startMicros() to start the timer.
Call stop() to stop the timer.
Derive Timer2 class and rewrite onTimerEvent().
Optionally you can indicate an external function to be called. In this case, use the constructor with extern function to create Timer2 instance.
TimerOwner
Is a abstract class to receive timer events. This is usefull when the class that respond the events, can not be descending of Timer2 class. To use this way, derive TimerOwner class, rewrite the event onTimerEvent() and use the constructor with owner to create Timer2 instance.