root / branches / autonomous_recharging / code / projects / charging_bay / main.c @ 748
History | View | Annotate | Download (561 Bytes)
1 |
#include <bayboard_lib.h> |
---|---|
2 |
|
3 |
int main(void) |
4 |
{ |
5 |
//Any int code that runs before the default loop
|
6 |
|
7 |
//Default loop
|
8 |
while(1) |
9 |
{ |
10 |
//Check fro an XBee and if it exists become master
|
11 |
if(checkXBee);
|
12 |
{ |
13 |
become_master(); |
14 |
} |
15 |
else if(packetExists) //Check for packets via I2C and act accordingly |
16 |
{ |
17 |
doPacket |
18 |
} |
19 |
} |
20 |
return (0); |
21 |
} |
22 |
|
23 |
void become_master(void) |
24 |
{ |
25 |
wl_init(); |
26 |
//Register packet
|
27 |
//Join token ring
|
28 |
//Become I2C Master
|
29 |
|
30 |
//Main code loop
|
31 |
while(stillHaveXBee)
|
32 |
{ |
33 |
//Wait for charge request
|
34 |
//Allocate Bays
|
35 |
//Forward packets of necessary
|
36 |
} |
37 |
} |