Revision 1608
wl updates: compile issues
wireless_send.c | ||
---|---|---|
35 | 35 |
|
36 | 36 |
#include "wl_defs.h" |
37 | 37 |
#include "wireless.h" |
38 |
#include "xbee.h" |
|
38 | 39 |
#include <string.h> |
39 | 40 |
|
40 | 41 |
|
... | ... | |
64 | 65 |
/* private function prototypes */ |
65 | 66 |
void setack(uint8_t num,uint8_t val); |
66 | 67 |
void ackhandle(uint8_t num,uint8_t val); |
67 |
int8_t send_buf_add(uint8_t *ptr, uint8_t byte) |
|
68 |
int8_t send_buf_add(uint8_t *ptr, uint8_t byte);
|
|
68 | 69 |
uint8_t send_buf_get(uint8_t *ptr); |
69 | 70 |
|
70 | 71 |
// the send functions |
... | ... | |
145 | 146 |
// save in ack system |
146 | 147 |
if (mode == FAST) { |
147 | 148 |
setack(nextframe,ACK_OK); // assume the send was successful |
149 |
nextframe = (nextframe == 0xFF)?1:nextframe+1; // increment frame number |
|
150 |
return WL_SUCCESS; // no frame number |
|
148 | 151 |
} else if (mode == RELIABLE) { |
149 | 152 |
setack(nextframe,SENDING); // set status to SENDING |
150 | 153 |
// save packet on sending buffer |
... | ... | |
171 | 174 |
} |
172 | 175 |
send_buf_last = scope; |
173 | 176 |
send_buf_num_packets++; |
177 |
|
|
178 |
nextframe = (nextframe == 0xFF)?1:nextframe+1; // increment frame number |
|
179 |
return packet[0]; // return frame number for ack tracking |
|
174 | 180 |
} |
175 |
|
|
176 |
// increment frame number |
|
177 |
nextframe = (nextframe == 0xFF)?1:nextframe+1; |
|
178 |
|
|
179 |
return ret_val; // return frame number for ack tracking |
|
180 | 181 |
} |
181 | 182 |
|
182 | 183 |
/** |
... | ... | |
189 | 190 |
* @return positive packet number for tracking acks, or error code (TBD) |
190 | 191 |
**/ |
191 | 192 |
int16_t wl_send_global(char *data, uint8_t length, uint8_t group) { |
192 |
return wl_send(*data, length, group, PAN, 0, RELIABLE);
|
|
193 |
return wl_send(data, length, group, GLOBAL, BROADCAST, RELIABLE);
|
|
193 | 194 |
} |
194 | 195 |
|
195 | 196 |
/** |
... | ... | |
202 | 203 |
* @return positive packet number for tracking acks, or error code (TBD) |
203 | 204 |
**/ |
204 | 205 |
int16_t wl_send_pan(char *data, uint8_t length, uint8_t group) { |
205 |
return wl_send(*data, length, group, PAN, 0, RELIABLE);
|
|
206 |
return wl_send(data, length, group, PAN, BROADCAST, RELIABLE);
|
|
206 | 207 |
} |
207 | 208 |
|
208 | 209 |
/** |
... | ... | |
217 | 218 |
* @return positive packet number for tracking acks, or error code (TBD) |
218 | 219 |
**/ |
219 | 220 |
int16_t wl_send_robot(char *data, uint8_t length, uint8_t group, uint16_t dest, uint8_t mode) { |
220 |
return wl_send(*data, length, group, GLOBAL, dest, mode);
|
|
221 |
return wl_send(data, length, group, GLOBAL, dest, mode); |
|
221 | 222 |
} |
222 | 223 |
|
223 | 224 |
/** |
... | ... | |
230 | 231 |
**/ |
231 | 232 |
int16_t wl_send_basic(char *data, uint8_t length) { |
232 | 233 |
/** Check if it needs to adjust according to data type. **/ |
233 |
return wl_send(*data, length, BASIC, GLOBAL, 0, RELIABLE);
|
|
234 |
return wl_send(*data, length, BASIC, GLOBAL, BROADCAST, RELIABLE);
|
|
234 | 235 |
} |
235 | 236 |
|
236 | 237 |
|
Also available in: Unified diff