Skip to content

Commit f3df1f9

Browse files
updated timer class
1 parent bf72183 commit f3df1f9

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Timer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "Timer.h"
22

3-
Alarm::Alarm(TimerEventHandler handler, uint16_t interval, bool repeat) :
3+
Alarm::Alarm(TimerEventHandler handler, uint32_t interval, bool repeat) :
44
m_handler(handler),
55
m_repeat(repeat),
66
m_interval(interval),
@@ -58,15 +58,15 @@ TimerClass::~TimerClass()
5858
}
5959
}
6060

61-
Alarm * TimerClass::repeat(TimerEventHandler handler, uint16_t interval)
61+
Alarm * TimerClass::repeat(TimerEventHandler handler, uint32_t interval)
6262
{
6363
Alarm * alarm = new Alarm(handler, interval, true);
6464
alarm->reset();
6565
m_alarms.push(alarm);
6666
return alarm;
6767
}
6868

69-
Alarm * TimerClass::delay(TimerEventHandler handler, uint16_t timeout)
69+
Alarm * TimerClass::delay(TimerEventHandler handler, uint32_t timeout)
7070
{
7171
Alarm * alarm = new Alarm(handler, timeout, false);
7272
alarm->reset();

Timer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ typedef void (*TimerEventHandler)();
99
class Alarm
1010
{
1111
public:
12-
Alarm(TimerEventHandler handler, uint16_t interval, bool repeat);
12+
Alarm(TimerEventHandler handler, uint32_t interval, bool repeat);
1313
~Alarm();
1414

1515
void reset();
@@ -25,7 +25,7 @@ class Alarm
2525

2626
TimerEventHandler m_handler;
2727
bool m_repeat;
28-
uint16_t m_interval;
28+
uint32_t m_interval;
2929
uint32_t m_timeout;
3030
};
3131

@@ -35,8 +35,8 @@ class TimerClass
3535
TimerClass();
3636
~TimerClass();
3737

38-
Alarm * repeat(TimerEventHandler handler, uint16_t interval);
39-
Alarm * delay(TimerEventHandler handler, uint16_t timeout);
38+
Alarm * repeat(TimerEventHandler handler, uint32_t interval);
39+
Alarm * delay(TimerEventHandler handler, uint32_t timeout);
4040

4141
void run();
4242

examples/Timer/Timer.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "Timer.h"

0 commit comments

Comments
 (0)