Revision 1609
wl updates: compile issues
wireless_send.c | ||
---|---|---|
178 | 178 |
nextframe = (nextframe == 0xFF)?1:nextframe+1; // increment frame number |
179 | 179 |
return packet[0]; // return frame number for ack tracking |
180 | 180 |
} |
181 |
return WL_ERROR_SEND; |
|
181 | 182 |
} |
182 | 183 |
|
183 | 184 |
/** |
... | ... | |
189 | 190 |
* |
190 | 191 |
* @return positive packet number for tracking acks, or error code (TBD) |
191 | 192 |
**/ |
192 |
int16_t wl_send_global(char *data, uint8_t length, uint8_t group) {
|
|
193 |
int16_t wl_send_global(uint8_t *data, uint8_t length, uint8_t group) {
|
|
193 | 194 |
return wl_send(data, length, group, GLOBAL, BROADCAST, RELIABLE); |
194 | 195 |
} |
195 | 196 |
|
... | ... | |
202 | 203 |
* |
203 | 204 |
* @return positive packet number for tracking acks, or error code (TBD) |
204 | 205 |
**/ |
205 |
int16_t wl_send_pan(char *data, uint8_t length, uint8_t group) {
|
|
206 |
int16_t wl_send_pan(uint8_t *data, uint8_t length, uint8_t group) {
|
|
206 | 207 |
return wl_send(data, length, group, PAN, BROADCAST, RELIABLE); |
207 | 208 |
} |
208 | 209 |
|
... | ... | |
217 | 218 |
* |
218 | 219 |
* @return positive packet number for tracking acks, or error code (TBD) |
219 | 220 |
**/ |
220 |
int16_t wl_send_robot(char *data, uint8_t length, uint8_t group, uint16_t dest, uint8_t mode) {
|
|
221 |
int16_t wl_send_robot(uint8_t *data, uint8_t length, uint8_t group, uint16_t dest, uint8_t mode) {
|
|
221 | 222 |
return wl_send(data, length, group, GLOBAL, dest, mode); |
222 | 223 |
} |
223 | 224 |
|
... | ... | |
229 | 230 |
* |
230 | 231 |
* @return positive packet number for tracking acks, or error code (TBD) |
231 | 232 |
**/ |
232 |
int16_t wl_send_basic(char *data, uint8_t length) {
|
|
233 |
int16_t wl_send_basic(uint8_t *data, uint8_t length) {
|
|
233 | 234 |
/** Check if it needs to adjust according to data type. **/ |
234 |
return wl_send(*data, length, BASIC, GLOBAL, BROADCAST, RELIABLE);
|
|
235 |
return wl_send(data, length, BASIC, GLOBAL, BROADCAST, RELIABLE); |
|
235 | 236 |
} |
236 | 237 |
|
237 | 238 |
|
... | ... | |
245 | 246 |
* @return the # of packets lost (up to 255) |
246 | 247 |
**/ |
247 | 248 |
uint8_t wl_ack_error(void) { |
248 |
uint_8 val=0,i=1;
|
|
249 |
uint8_t val=0,i=1;
|
|
249 | 250 |
|
250 | 251 |
while(1) { |
251 |
if (ack_buf[i/4]&(0x2<<(i%4)) != 0) // if the ack is in an error state
|
|
252 |
if (((ack_buf[i/4])&(0x2<<(i%4))) != 0) // if the ack is in an error state
|
|
252 | 253 |
val++; |
253 | 254 |
if (i==255) |
254 | 255 |
break; |
... | ... | |
270 | 271 |
int8_t wl_ack_check(uint8_t packet) { |
271 | 272 |
if (packet == 0) { |
272 | 273 |
// no ack information here |
273 |
WL_DEBIG_PRINT("packet number cannot be 0\r\n");
|
|
274 |
WL_DEBUG_PRINT("packet number cannot be 0\r\n");
|
|
274 | 275 |
return WL_ERROR_ARGUMENT; |
275 | 276 |
} |
276 | 277 |
|
... | ... | |
487 | 488 |
WL_DEBUG_PRINT("send buffer full\r\n"); |
488 | 489 |
return WL_ERROR_SENDING_BUFFER_FULL; |
489 | 490 |
} |
490 |
send_buf[(*ptr)++] = byte);
|
|
491 |
send_buf[(*ptr)++] = byte; |
|
491 | 492 |
if (*ptr == PACKET_BUFFER_SIZE) |
492 | 493 |
*ptr = 0; |
493 | 494 |
return WL_SUCCESS; |
494 | 495 |
} |
495 | 496 |
/* gets a byte from the send buffer */ |
496 | 497 |
uint8_t send_buf_get(uint8_t *ptr) { |
497 |
uint8_t byte = xbee_basic_buf[(*ptr)++];
|
|
498 |
uint8_t byte = send_buf[(*ptr)++];
|
|
498 | 499 |
if (*ptr == PACKET_BUFFER_SIZE) |
499 | 500 |
*ptr = 0; |
500 | 501 |
return byte; |
Also available in: Unified diff