Revision 98
Added new charging station code to charging station branch, it now compiles.
main.c | ||
---|---|---|
1 |
#include <firefly+_lib.h> |
|
1 | 2 |
|
2 |
#include "firefly+_lib.h" |
|
3 |
|
|
4 | 3 |
#include <wireless.h> |
5 | 4 |
#include <wl_token_ring.h> |
6 | 5 |
|
7 |
#include "bays.h"
|
|
6 |
#include "charging.h"
|
|
8 | 7 |
|
9 |
int main(void) { |
|
10 |
|
|
11 |
//lcd, orb, all that good stuff |
|
8 |
int main(void) |
|
9 |
{ |
|
10 |
analog_init(); |
|
11 |
led_init(); |
|
12 |
orb_init(); |
|
13 |
buzzer_init(); |
|
14 |
usb_init(BAUD115200); |
|
15 |
xbee_init(BAUD9600); |
|
12 | 16 |
|
13 |
analog_init(); |
|
14 |
led_init(); |
|
15 |
orb_init(); |
|
16 |
buzzer_init(); |
|
17 |
|
|
18 |
usb_init(BAUD115200); |
|
19 |
xbee_init(BAUD9600); |
|
20 |
|
|
21 |
usb_puts("Beginning.\n"); |
|
22 |
wl_init(); |
|
23 |
usb_puts("Done initializing.\n"); |
|
24 |
wl_token_ring_register(); |
|
25 |
wl_token_ring_join(); |
|
26 |
bays_init(); |
|
27 |
|
|
28 |
orb_set_color(GREEN); |
|
29 |
|
|
30 |
lbom_off(); |
|
31 |
|
|
32 |
while(1) |
|
33 |
{ |
|
34 |
//this needs to happen continuously -- it handles the packet |
|
17 |
//dragonfly_init(ALL_ON); |
|
18 |
|
|
19 |
wl_init(); |
|
20 |
wl_token_ring_register(); |
|
21 |
charging_init(); |
|
22 |
|
|
23 |
while (1) |
|
35 | 24 |
wl_do(); |
36 |
do_consistency_checks(); |
|
37 |
|
|
38 |
if(button1_click()) |
|
39 |
{ |
|
40 |
print_bays_debug(); |
|
41 |
} |
|
42 |
if(button2_click()) |
|
43 |
{ |
|
44 |
if(bayStates[1] == 255) |
|
45 |
{ |
|
46 |
bayStates[1] = 50; |
|
47 |
usb_puts("\n**filled bay 1 with bogus robot (50)**\n"); |
|
48 |
print_bays_debug(); |
|
49 |
orb_set_color(RED); |
|
50 |
} |
|
51 |
else if(bayStates[1] == 50) |
|
52 |
{ |
|
53 |
bayStates[1] = 255; |
|
54 |
usb_puts("\n**freed bogus robot (50) from bay 1 bay 1**\n"); |
|
55 |
print_bays_debug(); |
|
56 |
orb_set_color(BLUE); |
|
57 |
} |
|
58 |
else |
|
59 |
{ |
|
60 |
usb_puts("\n**bay 1 already in use by legitimate robot**\n"); |
|
61 |
print_bays_debug(); |
|
62 |
orb_set_color(GREEN); |
|
63 |
} |
|
64 |
} |
|
65 |
} |
|
66 |
return 0; |
|
25 |
|
|
26 |
return 0; |
|
67 | 27 |
} |
28 |
|
Also available in: Unified diff