-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignals.cpp
More file actions
57 lines (45 loc) · 804 Bytes
/
signals.cpp
File metadata and controls
57 lines (45 loc) · 804 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
52
53
54
55
56
57
#include "signals.h"
static bool commandAvailable = false;
static bool exitFlag = false;
static bool leftFlag = false;
static bool rightFlag = false;
void raiseLeftFlag(void){
leftFlag = true;
}
bool isLeftPressed(void){
if (leftFlag){
leftFlag = false;
return true;
}
return false;
}
void raiseRightFlag(void){
rightFlag = true;
}
bool isRightPressed(void){
if (rightFlag){
rightFlag = false;
return true;
}
return false;
}
void raiseCommandFlag(void){
commandAvailable = true;
}
bool isCommandAvailable(void){
if (commandAvailable){
commandAvailable = false;
return true;
}
return false;
}
void raiseExitFlag(void){
exitFlag = true;
}
bool checkExitSignal(void){
if (exitFlag){
exitFlag = false;
return true;
}
return false;
}