Revision 1192
added infrastructure for robot to send data to station
main.c | ||
---|---|---|
55 | 55 |
|
56 | 56 |
} |
57 | 57 |
|
58 |
|
|
59 |
int main_evan (void) |
|
60 |
{ |
|
61 |
#include <dragonfly_lib.h> |
|
62 |
#include <wireless.h> |
|
63 |
|
|
64 |
dragonfly_init(0); |
|
65 |
|
|
66 |
usb_init (); |
|
67 |
|
|
68 |
usb_puts(NL NL NL); |
|
69 |
usb_puts("# Diagnostic station version " version_string " starting" NL); |
|
70 |
|
|
71 |
orb_init_pwm (); |
|
72 |
hardware_init (); |
|
73 |
comm_server_init (); |
|
74 |
|
|
75 |
orb1_set (255, 0, 0); usb_puts("# Initializing wireless" NL); |
|
76 |
xbee_init (); |
|
77 |
wl_init(); |
|
78 |
orb2_set (255, 0, 0); usb_puts("# Done" NL); |
|
79 |
|
|
80 |
PacketGroupHandler receive_handler = {robot_station_group, NULL, NULL, &robot_station_receive, NULL}; |
|
81 |
wl_register_packet_group(&receive_handler); |
|
82 |
|
|
83 |
// If button 1 is pressed after initialization of the wireless (which takes about 1s), run all tests. |
|
84 |
if (button1_read ()) |
|
85 |
test_all (); |
|
86 |
|
|
87 |
// If button 2 is pressed, go to interactive mode (green/green). If not, go to server mode (green/yellow). |
|
88 |
if (button2_read ()) |
|
89 |
interactive_main (); |
|
90 |
else |
|
91 |
{ |
|
92 |
// Set the orbs to green/yellow |
|
93 |
orbs_set (0,255,0, 255,127,0); |
|
94 |
|
|
95 |
server_main (); |
|
96 |
} |
|
97 |
|
|
98 |
while (1); |
|
99 |
} |
|
100 |
|
|
58 | 101 |
int main_default (void) |
59 | 102 |
{ |
60 | 103 |
#include <dragonfly_lib.h> |
... | ... | |
92 | 135 |
} |
93 | 136 |
|
94 | 137 |
while (1); |
95 |
} |
|
138 |
} |
Also available in: Unified diff