-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestcase0.ini
46 lines (38 loc) · 902 Bytes
/
testcase0.ini
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
SIGNAL void testCase0() {
int pos;
int i;
int lastPulsePinValue;
int ok;
ok = 1;
pos = 0;
// close the doors
PORTC |= 1 << 8;
// let's go to floor 2
printf("going to floor 2\n");
PORTC |= 1 << 1;
// count the pulses to know what our position is
lastPulsePinValue = PORTC & (1 << 9);
for (i = 0; i < 6000; ++i) {
if (lastPulsePinValue < (PORTC & (1 << 9)))
++pos;
lastPulsePinValue = PORTC & (1 << 9);
swatch(0.0025);
}
// now it's 15s later, we should be at floor 2 and
// the motor should be stopped
PORTC ^= 1 << 1;
ok = ok & (pos >= 399 && pos <= 401 &&
(PORTC & (1 << 7)) &&
!TIM3_CCR1 && !TIM3_CCR2);
if (!ok) {
while (1) {
printf("Test-case failed: did not get to floor 2!\n");
swatch(0.1);
}
}
while (1) {
if (ok)
printf("Test-case succeeded\n");
swatch(0.1);
}
}