root / branches / colonetmk2 / code / projects / swarm / robot / main.c @ 1456
History | View | Annotate | Download (1.4 KB)
| 1 | #include <dragonfly_lib.h> |
|---|---|
| 2 | #include <wireless.h> |
| 3 | #include <wl_token_ring.h> |
| 4 | //#include <xbee.h>
|
| 5 | |
| 6 | //#define SWARM_PACKET_GROUP_ID 0x8
|
| 7 | |
| 8 | //static PacketGroupHandler swarm_pgh;
|
| 9 | //static void swarm_handle_receive(char type, int wl_source, unsigned char* packet, int length);
|
| 10 | |
| 11 | int main(void) |
| 12 | {
|
| 13 | dragonfly_init(ALL_ON); |
| 14 | |
| 15 | wl_init(); |
| 16 | wl_set_channel(0xF);
|
| 17 | |
| 18 | /*swarm_pgh.groupCode = SWARM_PACKET_GROUP_ID;
|
| 19 | swarm_pgh.timeout_handler = NULL; |
| 20 | swarm_pgh.handle_response = NULL; |
| 21 | swarm_pgh.handle_receive = swarm_handle_receive; |
| 22 | swarm_pgh.unregister = NULL; |
| 23 | wl_register_packet_group(&swarm_pgh);*/ |
| 24 | |
| 25 | wl_token_ring_register(); |
| 26 | wl_token_ring_join(); |
| 27 | |
| 28 | usb_puts("initialized\r\n");
|
| 29 | |
| 30 | /*char packet[] = { 0x0, 0x1, 0x0, 0x3, 0x4, 0x0, 0x6, 0x7, 0x8, 0x0, 0xa, 0xb, 0xc, 0xd, 0x0, 0xf, 0x0 };
|
| 31 | int length = 17; |
| 32 | |
| 33 | int num = 0;*/ |
| 34 | |
| 35 | while (1) |
| 36 | {
|
| 37 | wl_do(); |
| 38 | /*packet[16] = num;
|
| 39 | wl_send_global_packet(SWARM_PACKET_GROUP_ID, 0, packet, length, 0); |
| 40 | usb_puts("sent ");
|
| 41 | usb_puti(num); |
| 42 | usb_puts("\r\n");
|
| 43 | num++; |
| 44 | delay_ms(50);*/ |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | /*static void swarm_handle_receive(char type, int wl_source, unsigned char* packet, int length)
|
| 49 | {
|
| 50 | //wl_send_robot_to_robot_packet(SWARM_PACKET_GROUP_ID, type, packet, length, wl_source, 0); |
| 51 | |
| 52 | char buf[40]; |
| 53 | int i; |
| 54 | for (i = 0; i < length; i++) {
|
| 55 | sprintf(buf, "%d: %d ", i, packet[i]); |
| 56 | usb_puts(buf); |
| 57 | } |
| 58 | usb_puts("\r\n");
|
| 59 | }*/ |
| 60 |