Project

General

Profile

Revision 1773

Wireless: updated library and test code for the new library.

View differences:

branches/wireless/code/projects/unit_tests/test_wireless2.c
330 330
		sendBuffer[1] = (data& 0x00FF);
331 331
		wl_send((uint8_t*)sendBuffer, 2, 0, GLOBAL, BROADCAST, FAST);
332 332
		delay_ms(1000);
333
		len = wl_get_basic(buffer, 10);
333
		len = wl_get(buffer, 10);
334 334
		if(len != 0){
335 335
      address = (buffer[0] << 8) + buffer[1];
336 336
			orb2_set_color(GREEN);
......
340 340
			usb_puth16(address);
341 341
			friendAddress = address;
342 342
		}
343
/*		if(button1_read()){
343
		if(button1_read()){
344 344
			test_sending();
345 345
			break;
346 346
		}
347 347
		if(button2_read()){
348 348
			test_receiving();
349 349
			break;
350
		}*/
350
		}
351 351
	}
352 352
	
353 353

  
......
388 388
	for(count = 0; count < 5; count++){
389 389
		usb_puti(count);
390 390
		usb_puti(wl_send_basic(&count, 1));
391
		delay_ms(500);
391
		delay_ms(300);
392 392
	}
393 393
	for(count = 5; count < 10; count++){
394 394
		usb_puti(count);
395 395
		usb_puti(wl_send_global(&count, 1, 0));
396
		delay_ms(1000);
396
		delay_ms(300);
397 397
	}	
398 398
	for(count = 10; count < 15; count++){
399 399
		usb_puti(count);
400 400
		usb_puti(wl_send_pan(&count, 1, xbee_get_pan()));
401
		delay_ms(1000);
401
		delay_ms(300);
402 402
	}
403
/*	for(count = 15; count < 20; count++){
403
	for(count = 15; count < 20; count++){
404 404
		usb_puti(count);
405 405
		usb_puti(wl_send_robot(&count, 1, 0, friendAddress, FAST));
406
		delay_ms(1000);
406
		delay_ms(300);
407 407
	}
408
*/	for(count = 20; count < 25; count++){
408
	for(count = 20; count < 25; count++){
409 409
		usb_puti(count);
410 410
		usb_puti(wl_send_global(&count, 1, 1));
411
		delay_ms(1000);
411
		delay_ms(300);
412 412
	}
413 413
	for(count = 25; count < 30; count++){
414 414
		usb_puti(count);
415 415
		usb_puti(wl_send_global(&count, 1, 2));
416
		delay_ms(1000);
416
		delay_ms(300);
417 417
	}
418 418
	for(count = 30; count < 35; count++){
419 419
		usb_puti(count);
420 420
		usb_puti(wl_send_global(&count, 1, 3));
421
		delay_ms(1000);
421
		delay_ms(300);
422 422
	}
423 423
	for(count = 35; count < 40; count++){
424 424
		usb_puti(count);
425 425
		usb_puti(wl_send_global(&count, 1, 4));
426
		delay_ms(1000);
426
		delay_ms(300);
427 427
	}
428 428
	//FAST mode tests completed. Now testing ACK system
429 429
/*	for(count = 40; count < 45; count++){
......
465 465
*/}
466 466

  
467 467
void test_receiving(){
468
	int8_t result, length;
468
	int8_t result, length = 8;
469 469
	char* data[8];
470 470
	while(1){
471 471
		result = wl_get_basic(data, length);
......
489 489
	return 0;
490 490
}
491 491
void group_3_function(uint8_t* data,uint8_t length,uint8_t source){
492
	WL_DEBUG_PRINT_P("\r\nFunction 3 called");
492
	WL_DEBUG_PRINT_P("\r\nFunction 3 called. Length: ");
493
	WL_DEBUG_PRINT_INT(length);
494
	WL_DEBUG_PRINT_P(" Soucre: ");
495
	WL_DEBUG_PRINT_HEX(source);
493 496
	return 0;
494 497
}
495 498
void group_4_function(uint8_t* data,uint8_t length,uint8_t source){
branches/wireless/code/projects/libwireless/wireless_send.c
367 367
      WL_DEBUG_PRINT_P("|send_buf:");
368 368
      for(int i=send_buf_first;i<send_buf_last;i++)
369 369
        WL_DEBUG_PRINT_HEX(send_buf[i]);
370
      while(1) { delay_ms(1000); }
370 371
      if (send_buf_get(&val) != num) {
371 372
        // not the correct packet, so continue
372 373
        WL_DEBUG_PRINT_P("|not correct packet");

Also available in: Unified diff