77#ifndef __Timer_h_
88#define __Timer_h_
99
10- #include " Arduino.h"
10+ #include < Arduino.h>
1111#include " List.h"
1212
1313typedef void (*TimerEventHandler)();
1414
1515class Alarm
1616{
1717public:
18- Alarm (TimerEventHandler handler, uint16_t interval, bool repeat);
18+ Alarm (TimerEventHandler handler, uint32_t interval, bool repeat);
1919 ~Alarm ();
2020
2121 void reset ();
@@ -26,12 +26,12 @@ class Alarm
2626 void execute () const ;
2727
2828private:
29- Alarm (const Alarm & rhs);
30- Alarm & operator =(const Alarm & rhs);
29+ Alarm (const Alarm &rhs);
30+ Alarm &operator =(const Alarm &rhs);
3131
3232 TimerEventHandler m_handler;
3333 bool m_repeat;
34- uint16_t m_interval;
34+ uint32_t m_interval;
3535 uint32_t m_timeout;
3636};
3737
@@ -41,20 +41,16 @@ class TimerClass
4141 TimerClass ();
4242 ~TimerClass ();
4343
44- // creates a Timer that executes at the given interval
45- Alarm * repeat (TimerEventHandler handler, uint16_t interval);
46-
47- // creates a Timer that executes once after the given timeout
48- Alarm * delay (TimerEventHandler handler, uint16_t timeout);
44+ Alarm *repeat (TimerEventHandler handler, uint32_t interval);
45+ Alarm *delay (TimerEventHandler handler, uint32_t timeout);
4946
50- // should be placed in the loop() function to check of a timer has elapsed.
5147 void run ();
5248
5349private:
54- TimerClass (const TimerClass & rhs);
55- TimerClass & operator =(const TimerClass & rhs);
50+ TimerClass (const TimerClass &rhs);
51+ TimerClass &operator =(const TimerClass &rhs);
5652
57- List<Alarm*> m_alarms;
53+ List<Alarm *> m_alarms;
5854};
5955
6056extern TimerClass Timer;
0 commit comments