Revision 1605 branches/colonetmk2/code/projects/swarm/robot/main.c

View differences:

main.c
1 1
#include <dragonfly_lib.h>
2 2
#include <wireless.h>
3 3
#include <wl_token_ring.h>
4
//#include <xbee.h>
5 4

  
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 5
int main(void)
12 6
{
13 7
    dragonfly_init(ALL_ON);
......
15 9
    wl_init();
16 10
    wl_set_channel(0xF);
17 11

  
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 12
    wl_token_ring_register();
26 13
    wl_token_ring_join();
27 14

  
28 15
    usb_puts("initialized\r\n");
29 16

  
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 17
    while (1)
36 18
    {
37 19
	    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 20
    }
46 21
}
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

  

Also available in: Unified diff