-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDigitalInputEvent.h
48 lines (32 loc) · 903 Bytes
/
DigitalInputEvent.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
/*
* DigitalInputEvent.h
*
* Created on: 24 áîøñ 2013
* Author: Miro
*/
#ifndef DIGITALINPUTEVENT_H_
#define DIGITALINPUTEVENT_H_
#include "Event.h"
class DigitalInputEvent;
const extern uint8_t EVENT_TYPE_DIGITAL_INPUT;
class DigitalInputListener : public EventListener {
protected:
virtual void onRising(DigitalInputEvent* o) = 0;
virtual void onFalling(DigitalInputEvent* o) = 0;
friend class DigitalInputEvent;
// We don't use original event callback
//void onEvent(Event* o) {}
};
class DigitalInputEvent: public Event , public EventListener {
public:
DigitalInputEvent();
virtual ~DigitalInputEvent();
void init(uint8_t pin);
uint8_t type() {return EVENT_TYPE_DIGITAL_INPUT;}
protected:
void onEvent(Event* o, uint16_t eventType = 0, uint32_t param1 = 0, uint32_t param2 = 0);
private:
uint8_t _pin;
uint8_t _lastValue;
};
#endif /* DIGITALINPUTEVENT_H_ */