-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_rc.ino
56 lines (43 loc) · 1014 Bytes
/
get_rc.ino
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
void get_rc()
{
//int rc_commandmean[4][4];
//Serial.print("inside get rc");
rcLastChange1 = micros();
rcLastChange2 = micros();
rcLastChange3 = micros();
rcLastChange4 = micros();
rcLastChange5 = micros();
rcLastChange6 = micros();
attachinterrupt();
}
void acquireLock(){
interruptLock = false;
}
void releaseLock(){
interruptLock = false;
}
void rcInterrupt1(){
if(!interruptLock) ch1 = micros() - rcLastChange1;
rcLastChange1 = micros();
}
void rcInterrupt2(){
if(!interruptLock) ch2 = micros() - rcLastChange2;
rcLastChange2 = micros();
}
void rcInterrupt3(){
if(!interruptLock) ch3 = micros() - rcLastChange3;
rcLastChange3 = micros();
}
void rcInterrupt4(){
if(!interruptLock) ch4 = micros() - rcLastChange4;
rcLastChange4 = micros();
//Serial.println(ch4);
}
void rcInterrupt5(){
if(!interruptLock) ch5 = micros() - rcLastChange5;
rcLastChange5 = micros();
}
void rcInterrupt6(){
if(!interruptLock) ch6 = micros() - rcLastChange6;
rcLastChange6 = micros();
}