Revision 336
Updated wireless to use a circular buffer instead of a queue using malloc. Tested on both the computer and robots with a token ring, and was successful.
test.c | ||
---|---|---|
10 | 10 |
|
11 | 11 |
int main() |
12 | 12 |
{ |
13 |
/*unsigned char buffer[128]; |
|
14 |
xbee_lib_init(0x3331); |
|
15 |
printf("%i\n", xbee_get_address()); |
|
16 |
struct timespec delay; |
|
17 |
delay.tv_sec = 0; |
|
18 |
delay.tv_nsec = 100000000; |
|
19 |
while (1) |
|
20 |
{ |
|
21 |
int len = xbee_get_packet(buffer); |
|
22 |
if (len != -1) |
|
23 |
{ |
|
24 |
int i; |
|
25 |
for (i = 0; i < len; i++) |
|
26 |
printf("%c", buffer[i]); |
|
27 |
printf("\n\r"); |
|
28 |
} |
|
29 |
nanosleep(&delay, 0); |
|
30 |
wl_send_global_packet(1, 1, "CHECK", 3, |
|
31 |
0); |
|
32 |
} |
|
33 |
xbee_terminate();*/ |
|
34 | 13 |
printf("Beginning.\n"); |
14 |
wl_set_com_port("/dev/ttyUSB0"); |
|
35 | 15 |
wl_init(); |
16 |
wl_set_channel(0xF); |
|
36 | 17 |
printf("Wireless initialized.\n"); |
37 | 18 |
wl_error_register(); |
38 | 19 |
wl_token_ring_register(); |
Also available in: Unified diff