forked from pa-pa/AskSinPP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Alarm.h
68 lines (55 loc) · 1.35 KB
/
Alarm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//- -----------------------------------------------------------------------------------------------------------------------
// AskSin++
// 2016-10-31 papa Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
//- -----------------------------------------------------------------------------------------------------------------------
#ifndef __ALARM_H__
#define __ALARM_H__
#include "Link.h"
namespace as {
class AlarmClock;
class Alarm: public Link {
protected:
~Alarm() {}
bool m_Async : 4;
bool m_Active : 4;
public:
uint32_t tick : 24;
virtual void trigger(AlarmClock&) = 0;
Alarm () :
m_Async(false), m_Active(0), tick(0) {
}
Alarm(uint32_t t) :
m_Async(false), m_Active(0), tick(t) {
}
Alarm(uint32_t t,bool asynch) :
m_Async(asynch), m_Active(0), tick(t) {
}
void set(uint32_t t) {
tick = t;
}
void async(bool value) {
m_Async = value;
}
bool async() const {
return m_Async;
}
void active(bool value) {
m_Active = value;
}
bool active () const {
return m_Active;
}
};
class RTCAlarm : public Alarm {
public:
uint16_t millis;
protected:
~RTCAlarm() {}
bool delayMillis ();
public:
RTCAlarm() : Alarm(0), millis(0) {}
RTCAlarm(uint32_t t,uint16_t m) : Alarm(t), millis(m) {}
RTCAlarm(uint32_t t,uint16_t m,bool asynch) : Alarm(t,asynch), millis(m) {}
};
}
#endif