-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPushbuttonScanner.h
More file actions
51 lines (39 loc) · 915 Bytes
/
PushbuttonScanner.h
File metadata and controls
51 lines (39 loc) · 915 Bytes
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
/*
* PushbuttonScanner.h
*
* Created on: Feb 3, 2013
* Author: jpm8766
*/
#ifndef PUSHBUTTONSCANNER_H_
#define PUSHBUTTONSCANNER_H_
#include <unistd.h>
#include <stdint.h> /* for uintptr_t */
#include <hw/inout.h> /* for in*() and out*() functions */
#include <stdio.h>
#include "Thread.h"
#include "Common.h"
#include "EventCenter.h"
#define POLL_PERIOD (5000)
#define DEBOUNCE_PERIOD (200000)
#define LOW_MASK (0b00001111)
#define MASK_ARRAY_SIZE (3)
static const char MASK_ARRAY[] = {
//SET button
(0b00000001),
//START/STOP button
(0b00000010),
//MODE button
(0b00000100),
};
class PushbuttonScanner: public Thread {
public:
PushbuttonScanner(uintptr_t input_port);
virtual ~PushbuttonScanner();
/**
* Continuously scans the push buttons for depresses and releases.
*/
void* run();
private:
uintptr_t input_port_handle;
};
#endif /* PUSHBUTTONSCANNER_H_ */