root / branches / analog / code / projects / libwireless / jni / robot_test / main.c @ 1390
History | View | Annotate | Download (815 Bytes)
1 | 940 | rcahoon | #include <dragonfly_lib.h> |
---|---|---|---|
2 | #include <wireless.h> |
||
3 | #include <wl_token_ring.h> |
||
4 | #include <xbee.h> |
||
5 | |||
6 | #define TEST_PACKET_GROUP_ID 15 |
||
7 | |||
8 | void handle_receive(char type, int source, unsigned char* packet, int length) |
||
9 | { |
||
10 | wl_send_robot_to_robot_global_packet(TEST_PACKET_GROUP_ID, type, (char *)packet, length, source, 0); |
||
11 | } |
||
12 | |||
13 | int main(void) |
||
14 | { |
||
15 | //usb_puts("Turned on.\n");
|
||
16 | dragonfly_init(ALL_ON); |
||
17 | usb_puts("Dragonfly initialized.\n");
|
||
18 | |||
19 | wl_init(); |
||
20 | usb_puts("Wireless initialized.\n");
|
||
21 | |||
22 | PacketGroupHandler pgh = { TEST_PACKET_GROUP_ID, NULL, NULL, handle_receive, NULL }; |
||
23 | wl_register_packet_group(&pgh); |
||
24 | |||
25 | wl_set_channel(0xF);
|
||
26 | usb_puts("Wireless channel set.\n");
|
||
27 | wl_token_ring_register(); |
||
28 | usb_puts("Token ring initialized.\n");
|
||
29 | wl_token_ring_join(); |
||
30 | usb_puts("Token ring joined.\n");
|
||
31 | |||
32 | while (1) |
||
33 | { |
||
34 | wl_do(); |
||
35 | } |
||
36 | } |