Project

General

Profile

Revision 1547

Added by Brad Neuman over 14 years ago

found one bug and changed some debug prints

View differences:

branches/init_refactor/code/behaviors/BOM_test/beaconBot/main.c
2 2

  
3 3
int main(void)
4 4
{
5

  
6 5
  /* initialize components, set wireless channel */
7 6
  if (dragonfly_init(/* ANALOG|ORB|BOM */ ALL_ON) != 0) {
8 7
    orbs_set_color(YELLOW, YELLOW);
......
13 12
    orbs_set_color(RED, RED);
14 13
    while(1) { ; }
15 14
  }
16
  
17
	
15

  
16
  while(1);
17
  	
18 18
  while (1) {
19 19

  
20 20
    orbs_set_color(GREEN, BLUE);
branches/init_refactor/code/lib/include/libdragonfly/dragonfly_defs.h
90 90
#define RELEASE_LOCK(LOCK) do { LOCK=0; } while (0)
91 91

  
92 92

  
93
#define __TO_STR_(s) #s
94
#define __TO_STR(s) __TO_STR_(s)
95

  
93 96
#ifdef DRAGONFLY_DEBUG
94
#define DRAGONFLY_DEBUG_PRINT(s) usb_puts(s)
95
#define DRAGONFLY_DEBUG_PRINTLN(s) usb_puts(__FILE__ ":" __LINE__ ">>" s "\r\n")
97
#define DRAGONFLY_DEBUG_PRINT(s) usb_puts(__FILE__ ":" __TO_STR(__LINE__) ">" s )
98
#define DRAGONFLY_DEBUG_PRINT_STR(s) usb_puts(s)
96 99
#define DRAGONFLY_DEBUG_PRINT_INT(i) usb_puti(i)
97 100
#else
98 101
#define DRAGONFLY_DEBUG_PRINT(s)
99
#define DRAGONFLY_DEBUG_PRINTLN(s)
102
#define DRAGONFLY_DEBUG_PRINT_STR(s)
100 103
#define DRAGONFLY_DEBUG_PRINT_INT(i)
101 104
#endif
102 105

  
106
//TODO: write a STR_ERROR function which returns strings for the error codes
107

  
103 108
#endif
branches/init_refactor/code/projects/unit_tests/test_usb.c
10 10
 * 
11 11
 */
12 12

  
13
#ifdef DRAGONFLY_DEBUG
14
#error it worked?
15
#endif
16

  
13 17
int testusb(void) {
14 18
	
15 19
	usb_init();
......
50 54
  
51 55
  
52 56
	return 0;
53
}
57
}
branches/init_refactor/code/projects/libdragonfly/serial.c
68 68
  // - 9600 is U2X =1, UBRR = 107.
69 69

  
70 70
  if(usb_initd) {
71
    DRAGONFLY_DEBUG_PRINT("ERROR: usb already init'd\r\n");
71 72
    return ERROR_INIT_ALREADY_INITD;
72 73
  }
73 74

  
......
194 195
  char *t = s;
195 196

  
196 197
  if(!usb_initd) {
197
    DRAGONFLY_DEBUG_PRINT("ERROR: xbee not init'd\r\n"); 
198 198
    return ERROR_LIBRARY_NOT_INITD;
199 199
  }
200 200

  
......
216 216
    char buf;
217 217

  
218 218
    if(!usb_initd) {
219
      DRAGONFLY_DEBUG_PRINT("ERROR: xbee not init'd\r\n"); 
220 219
      return ERROR_LIBRARY_NOT_INITD;
221 220
    }
222 221
	
branches/init_refactor/code/projects/libdragonfly/bom.c
151 151
		analog_pin = MONKI;
152 152
        break;
153 153
    case BOM15:
154
        //Sets BOM1.5 to normal [BOM] mode
155
        digital_output(BOM_MODE, 0);
156
		select_pins[0] = BOM_S0; 
157
		select_pins[1] = BOM_S1;
158
		select_pins[2] = BOM_S2;
159
		select_pins[3] = BOM_S3;
160
		bom_set_leds(BOM_ALL);
161
		analog_pin = BOM_OUT;
162
        break;
154
      //Sets BOM1.5 to normal [BOM] mode
155
      digital_output(BOM_MODE, 0);
156
      select_pins[0] = BOM_S0; 
157
      select_pins[1] = BOM_S1;
158
      select_pins[2] = BOM_S2;
159
      select_pins[3] = BOM_S3;
160
      bom_set_leds(BOM_ALL);
161
      analog_pin = BOM_OUT;
162
      break;
163 163
    case RBOM:
164
      DRAGONFLY_DEBUG_PRINT("RBOM is not currently supported\r\n");
164 165
        break;
165 166
    default:
166 167
      DRAGONFLY_DEBUG_PRINT("ERROR: unknown BOM type ");
......
336 337
    int i;
337 338
    unsigned int mask = 1<<(NUM_BOM_LEDS-1);
338 339

  
339
    if(!bom_initd) {
340
      DRAGONFLY_DEBUG_PRINT("ERROR: BOM not init'd\r\n");
341
      return ERROR_LIBRARY_NOT_INITD;
342
    }
343

  
344 340
    switch(bom_type) {
345 341
    case BOM10:
346
        //TODO: put an assert here to alert the user that this should not be called
347
        break;
342
      DRAGONFLY_DEBUG_PRINT("ERROR: bom_set_leds called with a BOM 1.0. This doesn't make sense\r\n");
343
      break;
348 344
		
349 345
    case BOM15:
350
	    for(i=NUM_BOM_LEDS; i>0; i--)
351
	    {
352
		    //set the current bit, sending MSB first
353
		    digital_output(BOM_DATA, bit_field&mask);
354
		    //then pulse the clock
355
		    digital_output(BOM_CLOCK, 1);
356
		    digital_output(BOM_CLOCK, 0);
357
			mask = mask>>1;
358
	    }
359
        break;
346
      for(i=NUM_BOM_LEDS; i>0; i--)
347
      {
348
	//set the current bit, sending MSB first
349
	digital_output(BOM_DATA, bit_field&mask);
350
	//then pulse the clock
351
	digital_output(BOM_CLOCK, 1);
352
	digital_output(BOM_CLOCK, 0);
353
	mask = mask>>1;
354
      }
355
      break;
360 356
		
361 357
    case RBOM:
362
        //add rbom code here
363
        break;
358
      //add rbom code here
359
      break;
364 360
    }
365 361

  
366 362
    return 0;
......
406 402
	break;
407 403
  case BOM15:
408 404
	digital_output(BOM_STROBE, 1);
405
	DRAGONFLY_DEBUG_PRINT("BOM should be on?\r\n");
409 406
	break;
410 407
  case RBOM:
411 408
	break;
branches/init_refactor/code/projects/libdragonfly/dragonfly_defs.h
90 90
#define RELEASE_LOCK(LOCK) do { LOCK=0; } while (0)
91 91

  
92 92

  
93
#define __TO_STR_(s) #s
94
#define __TO_STR(s) __TO_STR_(s)
95

  
93 96
#ifdef DRAGONFLY_DEBUG
94
#define DRAGONFLY_DEBUG_PRINT(s) usb_puts(__FILE__ ":" __LINE__ ">>" s "\r\n")
97
#define DRAGONFLY_DEBUG_PRINT(s) usb_puts(__FILE__ ":" __TO_STR(__LINE__) ">" s )
95 98
#define DRAGONFLY_DEBUG_PRINT_STR(s) usb_puts(s)
96 99
#define DRAGONFLY_DEBUG_PRINT_INT(i) usb_puti(i)
97 100
#else

Also available in: Unified diff