Revision 581
wireless library now times out instead of infinitely looping in waiting for ok
wireless.c | ||
---|---|---|
51 | 51 |
|
52 | 52 |
/*Function Prototypes*/ |
53 | 53 |
|
54 |
void wl_do_timeout(void); |
|
54 |
static void wl_do_timeout(void);
|
|
55 | 55 |
|
56 | 56 |
//Note: the actual frame sent has group as the first four bits and |
57 | 57 |
//frame as the last four. |
58 |
int wl_send_packet(char group, char type, char* data, int len, int dest, char options, char frame); |
|
58 |
static int wl_send_packet(char group, char type, char* data, int len, int dest, char options, char frame);
|
|
59 | 59 |
|
60 | 60 |
/*Data Members*/ |
61 | 61 |
|
62 | 62 |
//used to store incoming and outgoing packets |
63 |
unsigned char wl_buf[128]; |
|
63 |
static unsigned char wl_buf[128];
|
|
64 | 64 |
//1 if we have timed out since we last checked, 0 otherwise. |
65 |
int wl_timeout = 0; |
|
65 |
static int wl_timeout = 0;
|
|
66 | 66 |
|
67 |
PacketGroupHandler* wl_packet_groups[WL_MAX_PACKET_GROUPS]; |
|
67 |
static PacketGroupHandler* wl_packet_groups[WL_MAX_PACKET_GROUPS];
|
|
68 | 68 |
|
69 | 69 |
#ifndef ROBOT |
70 | 70 |
|
71 | 71 |
//called when we time out, or receive interrupt |
72 |
void sig_handler(int signo) |
|
72 |
static void sig_handler(int signo)
|
|
73 | 73 |
{ |
74 | 74 |
switch (signo) |
75 | 75 |
{ |
... | ... | |
86 | 86 |
#else |
87 | 87 |
|
88 | 88 |
//called when the timer ticks |
89 |
void timer_handler(void) |
|
89 |
static void timer_handler(void)
|
|
90 | 90 |
{ |
91 | 91 |
wl_timeout = 1; |
92 | 92 |
} |
... | ... | |
106 | 106 |
wl_packet_groups[i] = NULL; |
107 | 107 |
|
108 | 108 |
if (xbee_lib_init() == -1) { |
109 |
return -1;
|
|
109 |
return -1;
|
|
110 | 110 |
} |
111 | 111 |
|
112 | 112 |
//begin timeout timer |
Also available in: Unified diff