Revision 1966
Added test map data encoding to intersectData.c. Fixe a whole bunch of stuff so
that at least this traffic_navigation compiles without warnings. Symlinked to
needed files in linefollow. Changed function declaration style. Added
delclaration of read_line to analog.h. You're welcome. Fixed several #includes.
You're all welcome.
validTurns.c | ||
---|---|---|
10 | 10 |
|
11 | 11 |
/******************************Random Num Gen Version of validTurns*/ |
12 | 12 |
|
13 |
#include "intersectData.h" |
|
14 |
#include "../linefollowing/lineDrive.h" |
|
15 |
#include "validTurns.h" |
|
13 | 16 |
|
14 |
|
|
15 | 17 |
#define GET16(s)( ((s)&0x8000)>>16 ) /*gets the 16 bit*/ |
16 | 18 |
#define GET14(s)( ((s)&0x2000)>>14 ) /*gets the 14thbit*/ |
17 | 19 |
#define GET13(s)( ((s)&0x1000)>>13 ) /*you get the idea*/ |
... | ... | |
20 | 22 |
#define SHIFT(s)( (s)<<1) |
21 | 23 |
#define RESEED(s)( (s)=( ( ((GET16(s)^GET14(s))^GET13(s))^GET11(s) ) | SHIFT(s) ) )/*reseeding the first bit of the number with bits from the number*/ |
22 | 24 |
|
23 |
|
|
24 |
unsigned int seed = 0xC0FFEE; |
|
25 |
unsigned int seed = 0xC0DE; |
|
25 | 26 |
int randomNumGen(int max){ |
26 |
int a = 0;
|
|
27 |
int b = 0xBEEF; |
|
27 |
//int a = 0; // not currently in use
|
|
28 |
//int b = 0xBEEF;
|
|
28 | 29 |
seed++; |
29 | 30 |
return seed%4; |
30 | 31 |
} |
... | ... | |
33 | 34 |
int randomNumGen(int max){ |
34 | 35 |
return rtc_get() % max; |
35 | 36 |
} |
36 |
*/ |
|
37 | 37 |
int randomNumGen(int max){ |
38 | 38 |
int a = 1337; |
39 | 39 |
int b = 0xDEADBEEF; |
40 | 40 |
seed++; |
41 | 41 |
return seed%max; |
42 | 42 |
} |
43 |
*/ |
|
43 | 44 |
|
44 |
|
|
45 | 45 |
/* |
46 | 46 |
int getIntersectType(int barcode) |
47 | 47 |
{ |
... | ... | |
53 | 53 |
return randomNumGen(max); |
54 | 54 |
} |
55 | 55 |
*/ |
56 |
|
|
56 | 57 |
int getTurnType(int barcode) |
57 | 58 |
{ |
58 | 59 |
return randomNumGen(4); |
59 | 60 |
} |
60 | 61 |
|
61 |
|
|
62 |
#include "intersectData.h" |
|
63 |
#include "lineDrive.h" |
|
64 |
#include "validTurns.h" |
|
65 |
|
|
66 | 62 |
int validateTurn(int barcode, int turn_type) |
67 | 63 |
{ |
68 | 64 |
int intersect_type; |
... | ... | |
177 | 173 |
} |
178 | 174 |
break; |
179 | 175 |
} |
180 |
default: |
|
181 |
return -1; |
|
176 |
default: |
|
177 |
return -1; |
|
178 |
} |
|
179 |
|
|
180 |
return -1; |
|
182 | 181 |
} |
183 |
} |
Also available in: Unified diff