Index: demos/hunter_prey_john/projects/libwireless/lib/xbee.lst
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/xbee.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/xbee.lst	(revision 1694)
@@ -0,0 +1,1003 @@
+   1               		.file	"xbee.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  10               		.text
+  11               	.global	__vector_30
+  13               	__vector_30:
+  14               	/* prologue: frame size=0 */
+  15 0000 1F92      		push __zero_reg__
+  16 0002 0F92      		push __tmp_reg__
+  17 0004 0FB6      		in __tmp_reg__,__SREG__
+  18 0006 0F92      		push __tmp_reg__
+  19 0008 1124      		clr __zero_reg__
+  20 000a 2F93      		push r18
+  21 000c 3F93      		push r19
+  22 000e 8F93      		push r24
+  23 0010 9F93      		push r25
+  24 0012 EF93      		push r30
+  25 0014 FF93      		push r31
+  26               	/* prologue end (size=11) */
+  27 0016 8091 9C00 		lds r24,156
+  28 001a E091 0000 		lds r30,buffer_last
+  29 001e F091 0000 		lds r31,(buffer_last)+1
+  30 0022 E050      		subi r30,lo8(-(arrival_buf))
+  31 0024 F040      		sbci r31,hi8(-(arrival_buf))
+  32 0026 8083      		st Z,r24
+  33 0028 2091 0000 		lds r18,buffer_last
+  34 002c 3091 0000 		lds r19,(buffer_last)+1
+  35 0030 2F5F      		subi r18,lo8(-(1))
+  36 0032 3F4F      		sbci r19,hi8(-(1))
+  37 0034 2038      		cpi r18,128
+  38 0036 3105      		cpc r19,__zero_reg__
+  39 0038 01F4      		brne .L2
+  40 003a 20E0      		ldi r18,lo8(0)
+  41 003c 30E0      		ldi r19,hi8(0)
+  42               	.L2:
+  43 003e 8091 0000 		lds r24,buffer_first
+  44 0042 9091 0000 		lds r25,(buffer_first)+1
+  45 0046 3093 0000 		sts (buffer_last)+1,r19
+  46 004a 2093 0000 		sts buffer_last,r18
+  47               	/* epilogue: frame size=0 */
+  48 004e FF91      		pop r31
+  49 0050 EF91      		pop r30
+  50 0052 9F91      		pop r25
+  51 0054 8F91      		pop r24
+  52 0056 3F91      		pop r19
+  53 0058 2F91      		pop r18
+  54 005a 0F90      		pop __tmp_reg__
+  55 005c 0FBE      		out __SREG__,__tmp_reg__
+  56 005e 0F90      		pop __tmp_reg__
+  57 0060 1F90      		pop __zero_reg__
+  58 0062 1895      		reti
+  59               	/* epilogue end (size=11) */
+  60               	/* function __vector_30 size 50 (28) */
+  62               		.data
+  63               	.LC0:
+  64 0000 4F4B 0D00 		.string	"OK\r"
+  65               		.text
+  67               	xbee_wait_for_ok:
+  68               	/* prologue: frame size=0 */
+  69               	/* prologue end (size=0) */
+  70 0064 00C0      		rjmp .L20
+  71               	.L7:
+  72 0066 2091 0000 		lds r18,buffer_last
+  73 006a 3091 0000 		lds r19,(buffer_last)+1
+  74 006e 8091 0000 		lds r24,buffer_first
+  75 0072 9091 0000 		lds r25,(buffer_first)+1
+  76 0076 2817      		cp r18,r24
+  77 0078 3907      		cpc r19,r25
+  78 007a 01F0      		breq .L21
+  79 007c 8091 0000 		lds r24,buffer_first
+  80 0080 9091 0000 		lds r25,(buffer_first)+1
+  81 0084 FC01      		movw r30,r24
+  82 0086 E050      		subi r30,lo8(-(arrival_buf))
+  83 0088 F040      		sbci r31,hi8(-(arrival_buf))
+  84 008a E081      		ld r30,Z
+  85 008c 0196      		adiw r24,1
+  86 008e 9093 0000 		sts (buffer_first)+1,r25
+  87 0092 8093 0000 		sts buffer_first,r24
+  88 0096 8091 0000 		lds r24,buffer_first
+  89 009a 9091 0000 		lds r25,(buffer_first)+1
+  90 009e 8038      		cpi r24,128
+  91 00a0 9105      		cpc r25,__zero_reg__
+  92 00a2 01F4      		brne .L9
+  93 00a4 1092 0000 		sts (buffer_first)+1,__zero_reg__
+  94 00a8 1092 0000 		sts buffer_first,__zero_reg__
+  95               	.L9:
+  96 00ac 8C91      		ld r24,X
+  97 00ae E817      		cp r30,r24
+  98 00b0 01F0      		breq .L11
+  99               	.L20:
+ 100 00b2 A0E0      		ldi r26,lo8(.LC0)
+ 101 00b4 B0E0      		ldi r27,hi8(.LC0)
+ 102 00b6 00C0      		rjmp .L21
+ 103               	.L11:
+ 104 00b8 1196      		adiw r26,1
+ 105               	.L21:
+ 106 00ba CD01      		movw r24,r26
+ 107 00bc 8050      		subi r24,lo8(.LC0)
+ 108 00be 9040      		sbci r25,hi8(.LC0)
+ 109 00c0 0397      		sbiw r24,3
+ 110 00c2 04F0      		brlt .L7
+ 111 00c4 80E0      		ldi r24,lo8(0)
+ 112 00c6 90E0      		ldi r25,hi8(0)
+ 113               	/* epilogue: frame size=0 */
+ 114 00c8 0895      		ret
+ 115               	/* epilogue end (size=1) */
+ 116               	/* function xbee_wait_for_ok size 52 (51) */
+ 118               	.global	xbee_get_packet
+ 120               	xbee_get_packet:
+ 121               	/* prologue: frame size=0 */
+ 122 00ca CF93      		push r28
+ 123 00cc DF93      		push r29
+ 124               	/* prologue end (size=2) */
+ 125 00ce EC01      		movw r28,r24
+ 126 00d0 8091 0000 		lds r24,currentBufPos
+ 127 00d4 9091 0000 		lds r25,(currentBufPos)+1
+ 128 00d8 0097      		sbiw r24,0
+ 129 00da 01F4      		brne .L23
+ 130               	.L73:
+ 131 00dc 8091 0000 		lds r24,buffer_first
+ 132 00e0 9091 0000 		lds r25,(buffer_first)+1
+ 133 00e4 8038      		cpi r24,128
+ 134 00e6 9105      		cpc r25,__zero_reg__
+ 135 00e8 01F4      		brne .L25
+ 136 00ea 1092 0000 		sts (buffer_first)+1,__zero_reg__
+ 137 00ee 1092 0000 		sts buffer_first,__zero_reg__
+ 138               	.L25:
+ 139 00f2 2091 0000 		lds r18,buffer_first
+ 140 00f6 3091 0000 		lds r19,(buffer_first)+1
+ 141 00fa 8091 0000 		lds r24,buffer_last
+ 142 00fe 9091 0000 		lds r25,(buffer_last)+1
+ 143 0102 2817      		cp r18,r24
+ 144 0104 3907      		cpc r19,r25
+ 145 0106 01F4      		brne .+2
+ 146 0108 00C0      		rjmp .L77
+ 147 010a 8091 0000 		lds r24,buffer_first
+ 148 010e 9091 0000 		lds r25,(buffer_first)+1
+ 149 0112 FC01      		movw r30,r24
+ 150 0114 E050      		subi r30,lo8(-(arrival_buf))
+ 151 0116 F040      		sbci r31,hi8(-(arrival_buf))
+ 152 0118 E081      		ld r30,Z
+ 153 011a 0196      		adiw r24,1
+ 154 011c 9093 0000 		sts (buffer_first)+1,r25
+ 155 0120 8093 0000 		sts buffer_first,r24
+ 156 0124 EE37      		cpi r30,lo8(126)
+ 157 0126 01F4      		brne .L73
+ 158 0128 8091 0000 		lds r24,buffer_first
+ 159 012c 9091 0000 		lds r25,(buffer_first)+1
+ 160 0130 8038      		cpi r24,128
+ 161 0132 9105      		cpc r25,__zero_reg__
+ 162 0134 01F4      		brne .L30
+ 163 0136 1092 0000 		sts (buffer_first)+1,__zero_reg__
+ 164 013a 1092 0000 		sts buffer_first,__zero_reg__
+ 165               	.L30:
+ 166 013e E093 0000 		sts xbee_buf,r30
+ 167 0142 81E0      		ldi r24,lo8(1)
+ 168 0144 90E0      		ldi r25,hi8(1)
+ 169 0146 9093 0000 		sts (currentBufPos)+1,r25
+ 170 014a 8093 0000 		sts currentBufPos,r24
+ 171 014e 00C0      		rjmp .L76
+ 172               	.L23:
+ 173 0150 0397      		sbiw r24,3
+ 174 0152 04F4      		brge .L33
+ 175               	.L76:
+ 176 0154 6FEF      		ldi r22,lo8(-1)
+ 177 0156 7FEF      		ldi r23,hi8(-1)
+ 178 0158 00C0      		rjmp .L32
+ 179               	.L33:
+ 180 015a 2091 0000 		lds r18,xbee_buf+2
+ 181 015e 8091 0000 		lds r24,xbee_buf+1
+ 182 0162 9927      		clr r25
+ 183 0164 782F      		mov r23,r24
+ 184 0166 6627      		clr r22
+ 185 0168 620F      		add r22,r18
+ 186 016a 711D      		adc r23,__zero_reg__
+ 187               	.L32:
+ 188 016c 4091 0000 		lds r20,currentBufPos
+ 189 0170 5091 0000 		lds r21,(currentBufPos)+1
+ 190 0174 DA01      		movw r26,r20
+ 191 0176 A050      		subi r26,lo8(-(xbee_buf))
+ 192 0178 B040      		sbci r27,hi8(-(xbee_buf))
+ 193 017a 00C0      		rjmp .L35
+ 194               	.L36:
+ 195 017c 4330      		cpi r20,3
+ 196 017e 5105      		cpc r21,__zero_reg__
+ 197 0180 01F4      		brne .L37
+ 198 0182 2091 0000 		lds r18,xbee_buf+2
+ 199 0186 8091 0000 		lds r24,xbee_buf+1
+ 200 018a 9927      		clr r25
+ 201 018c 782F      		mov r23,r24
+ 202 018e 6627      		clr r22
+ 203 0190 620F      		add r22,r18
+ 204 0192 711D      		adc r23,__zero_reg__
+ 205 0194 6937      		cpi r22,121
+ 206 0196 7105      		cpc r23,__zero_reg__
+ 207 0198 04F0      		brlt .+2
+ 208 019a 00C0      		rjmp .L71
+ 209               	.L37:
+ 210 019c 2091 0000 		lds r18,buffer_first
+ 211 01a0 3091 0000 		lds r19,(buffer_first)+1
+ 212 01a4 8091 0000 		lds r24,buffer_last
+ 213 01a8 9091 0000 		lds r25,(buffer_last)+1
+ 214 01ac 2817      		cp r18,r24
+ 215 01ae 3907      		cpc r19,r25
+ 216 01b0 01F4      		brne .+2
+ 217 01b2 00C0      		rjmp .L72
+ 218 01b4 8091 0000 		lds r24,buffer_first
+ 219 01b8 9091 0000 		lds r25,(buffer_first)+1
+ 220 01bc FC01      		movw r30,r24
+ 221 01be E050      		subi r30,lo8(-(arrival_buf))
+ 222 01c0 F040      		sbci r31,hi8(-(arrival_buf))
+ 223 01c2 2081      		ld r18,Z
+ 224 01c4 2C93      		st X,r18
+ 225 01c6 4F5F      		subi r20,lo8(-(1))
+ 226 01c8 5F4F      		sbci r21,hi8(-(1))
+ 227 01ca 0196      		adiw r24,1
+ 228 01cc 9093 0000 		sts (buffer_first)+1,r25
+ 229 01d0 8093 0000 		sts buffer_first,r24
+ 230 01d4 8091 0000 		lds r24,buffer_first
+ 231 01d8 9091 0000 		lds r25,(buffer_first)+1
+ 232 01dc 8038      		cpi r24,128
+ 233 01de 9105      		cpc r25,__zero_reg__
+ 234 01e0 01F4      		brne .L43
+ 235 01e2 1092 0000 		sts (buffer_first)+1,__zero_reg__
+ 236 01e6 1092 0000 		sts buffer_first,__zero_reg__
+ 237               	.L43:
+ 238 01ea 1196      		adiw r26,1
+ 239               	.L35:
+ 240 01ec 8FEF      		ldi r24,hi8(-1)
+ 241 01ee 6F3F      		cpi r22,lo8(-1)
+ 242 01f0 7807      		cpc r23,r24
+ 243 01f2 01F0      		breq .L36
+ 244 01f4 FB01      		movw r30,r22
+ 245 01f6 3496      		adiw r30,4
+ 246 01f8 4E17      		cp r20,r30
+ 247 01fa 5F07      		cpc r21,r31
+ 248 01fc 04F4      		brge .+2
+ 249 01fe 00C0      		rjmp .L36
+ 250 0200 1092 0000 		sts (currentBufPos)+1,__zero_reg__
+ 251 0204 1092 0000 		sts currentBufPos,__zero_reg__
+ 252 0208 A0E0      		ldi r26,lo8(xbee_buf+3)
+ 253 020a B0E0      		ldi r27,hi8(xbee_buf+3)
+ 254 020c 90E0      		ldi r25,lo8(0)
+ 255 020e 23E0      		ldi r18,lo8(3)
+ 256 0210 30E0      		ldi r19,hi8(3)
+ 257 0212 00C0      		rjmp .L47
+ 258               	.L48:
+ 259 0214 8D91      		ld r24,X+
+ 260 0216 980F      		add r25,r24
+ 261 0218 2F5F      		subi r18,lo8(-(1))
+ 262 021a 3F4F      		sbci r19,hi8(-(1))
+ 263               	.L47:
+ 264 021c 2E17      		cp r18,r30
+ 265 021e 3F07      		cpc r19,r31
+ 266 0220 04F0      		brlt .L48
+ 267 0222 9F3F      		cpi r25,lo8(-1)
+ 268 0224 01F0      		breq .+2
+ 269 0226 00C0      		rjmp .L77
+ 270 0228 1616      		cp __zero_reg__,r22
+ 271 022a 1706      		cpc __zero_reg__,r23
+ 272 022c 04F0      		brlt .+2
+ 273 022e 00C0      		rjmp .L51
+ 274 0230 8091 0000 		lds r24,xbee_buf+3
+ 275 0234 8838      		cpi r24,lo8(-120)
+ 276 0236 01F0      		breq .L53
+ 277 0238 8A38      		cpi r24,lo8(-118)
+ 278 023a 01F0      		breq .+2
+ 279 023c 00C0      		rjmp .L51
+ 280 023e 00C0      		rjmp .L54
+ 281               	.L53:
+ 282 0240 8091 0000 		lds r24,xbee_buf+5
+ 283 0244 9091 0000 		lds r25,xbee_buf+6
+ 284 0248 8934      		cpi r24,lo8(73)
+ 285 024a 01F4      		brne .L55
+ 286 024c 9434      		cpi r25,lo8(68)
+ 287 024e 01F0      		breq .+2
+ 288 0250 00C0      		rjmp .L54
+ 289 0252 8091 0000 		lds r24,xbee_pending_panID
+ 290 0256 9091 0000 		lds r25,(xbee_pending_panID)+1
+ 291 025a 9093 0000 		sts (xbee_panID)+1,r25
+ 292 025e 8093 0000 		sts xbee_panID,r24
+ 293 0262 00C0      		rjmp .L54
+ 294               	.L55:
+ 295 0264 8334      		cpi r24,lo8(67)
+ 296 0266 01F4      		brne .L58
+ 297 0268 9834      		cpi r25,lo8(72)
+ 298 026a 01F0      		breq .+2
+ 299 026c 00C0      		rjmp .L54
+ 300 026e 8091 0000 		lds r24,xbee_pending_channel
+ 301 0272 9091 0000 		lds r25,(xbee_pending_channel)+1
+ 302 0276 9093 0000 		sts (xbee_channel)+1,r25
+ 303 027a 8093 0000 		sts xbee_channel,r24
+ 304 027e 00C0      		rjmp .L54
+ 305               	.L58:
+ 306 0280 8D34      		cpi r24,lo8(77)
+ 307 0282 01F0      		breq .+2
+ 308 0284 00C0      		rjmp .L54
+ 309 0286 9935      		cpi r25,lo8(89)
+ 310 0288 01F0      		breq .+2
+ 311 028a 00C0      		rjmp .L54
+ 312 028c 6550      		subi r22,lo8(-(-5))
+ 313 028e 7040      		sbci r23,hi8(-(-5))
+ 314 0290 01F4      		brne .+2
+ 315 0292 00C0      		rjmp .L54
+ 316 0294 1092 0000 		sts (xbee_address)+1,__zero_reg__
+ 317 0298 1092 0000 		sts xbee_address,__zero_reg__
+ 318 029c 40E0      		ldi r20,lo8(0)
+ 319 029e 50E0      		ldi r21,hi8(0)
+ 320 02a0 E0E0      		ldi r30,lo8(xbee_buf+8)
+ 321 02a2 F0E0      		ldi r31,hi8(xbee_buf+8)
+ 322 02a4 00C0      		rjmp .L64
+ 323               	.L65:
+ 324 02a6 8091 0000 		lds r24,xbee_address
+ 325 02aa 9091 0000 		lds r25,(xbee_address)+1
+ 326 02ae 982F      		mov r25,r24
+ 327 02b0 8827      		clr r24
+ 328 02b2 2191      		ld r18,Z+
+ 329 02b4 820F      		add r24,r18
+ 330 02b6 911D      		adc r25,__zero_reg__
+ 331 02b8 9093 0000 		sts (xbee_address)+1,r25
+ 332 02bc 8093 0000 		sts xbee_address,r24
+ 333 02c0 4F5F      		subi r20,lo8(-(1))
+ 334 02c2 5F4F      		sbci r21,hi8(-(1))
+ 335               	.L64:
+ 336 02c4 4617      		cp r20,r22
+ 337 02c6 5707      		cpc r21,r23
+ 338 02c8 04F0      		brlt .L65
+ 339 02ca 8091 0000 		lds r24,xbee_address
+ 340 02ce 9091 0000 		lds r25,(xbee_address)+1
+ 341 02d2 00C0      		rjmp .L54
+ 342               	.L51:
+ 343 02d4 2097      		sbiw r28,0
+ 344 02d6 01F0      		breq .L77
+ 345 02d8 FE01      		movw r30,r28
+ 346 02da 23E0      		ldi r18,lo8(3)
+ 347 02dc 30E0      		ldi r19,hi8(3)
+ 348 02de A0E0      		ldi r26,lo8(xbee_buf+3)
+ 349 02e0 B0E0      		ldi r27,hi8(xbee_buf+3)
+ 350 02e2 AB01      		movw r20,r22
+ 351 02e4 4D5F      		subi r20,lo8(-(3))
+ 352 02e6 5F4F      		sbci r21,hi8(-(3))
+ 353 02e8 00C0      		rjmp .L68
+ 354               	.L69:
+ 355 02ea 8D91      		ld r24,X+
+ 356 02ec 8193      		st Z+,r24
+ 357 02ee 2F5F      		subi r18,lo8(-(1))
+ 358 02f0 3F4F      		sbci r19,hi8(-(1))
+ 359               	.L68:
+ 360 02f2 2417      		cp r18,r20
+ 361 02f4 3507      		cpc r19,r21
+ 362 02f6 04F0      		brlt .L69
+ 363 02f8 00C0      		rjmp .L40
+ 364               	.L71:
+ 365 02fa 1092 0000 		sts (currentBufPos)+1,__zero_reg__
+ 366 02fe 1092 0000 		sts currentBufPos,__zero_reg__
+ 367 0302 00C0      		rjmp .L77
+ 368               	.L72:
+ 369 0304 5093 0000 		sts (currentBufPos)+1,r21
+ 370 0308 4093 0000 		sts currentBufPos,r20
+ 371               	.L77:
+ 372 030c 6FEF      		ldi r22,lo8(-1)
+ 373 030e 7FEF      		ldi r23,hi8(-1)
+ 374 0310 00C0      		rjmp .L40
+ 375               	.L54:
+ 376 0312 63E0      		ldi r22,lo8(3)
+ 377 0314 70E0      		ldi r23,hi8(3)
+ 378               	.L40:
+ 379 0316 CB01      		movw r24,r22
+ 380               	/* epilogue: frame size=0 */
+ 381 0318 DF91      		pop r29
+ 382 031a CF91      		pop r28
+ 383 031c 0895      		ret
+ 384               	/* epilogue end (size=3) */
+ 385               	/* function xbee_get_packet size 300 (295) */
+ 387               	.global	xbee_get_pan_id
+ 389               	xbee_get_pan_id:
+ 390               	/* prologue: frame size=0 */
+ 391               	/* prologue end (size=0) */
+ 392 031e 8091 0000 		lds r24,xbee_panID
+ 393 0322 9091 0000 		lds r25,(xbee_panID)+1
+ 394               	/* epilogue: frame size=0 */
+ 395 0326 0895      		ret
+ 396               	/* epilogue end (size=1) */
+ 397               	/* function xbee_get_pan_id size 5 (4) */
+ 399               	.global	xbee_get_channel
+ 401               	xbee_get_channel:
+ 402               	/* prologue: frame size=0 */
+ 403               	/* prologue end (size=0) */
+ 404 0328 8091 0000 		lds r24,xbee_channel
+ 405 032c 9091 0000 		lds r25,(xbee_channel)+1
+ 406               	/* epilogue: frame size=0 */
+ 407 0330 0895      		ret
+ 408               	/* epilogue end (size=1) */
+ 409               	/* function xbee_get_channel size 5 (4) */
+ 411               	.global	xbee_get_address
+ 413               	xbee_get_address:
+ 414               	/* prologue: frame size=0 */
+ 415               	/* prologue end (size=0) */
+ 416 0332 8091 0000 		lds r24,xbee_address
+ 417 0336 9091 0000 		lds r25,(xbee_address)+1
+ 418               	/* epilogue: frame size=0 */
+ 419 033a 0895      		ret
+ 420               	/* epilogue end (size=1) */
+ 421               	/* function xbee_get_address size 5 (4) */
+ 424               	xbee_send:
+ 425               	/* prologue: frame size=0 */
+ 426 033c EF92      		push r14
+ 427 033e FF92      		push r15
+ 428 0340 0F93      		push r16
+ 429 0342 1F93      		push r17
+ 430 0344 CF93      		push r28
+ 431 0346 DF93      		push r29
+ 432               	/* prologue end (size=6) */
+ 433 0348 7B01      		movw r14,r22
+ 434 034a C0E0      		ldi r28,lo8(0)
+ 435 034c D0E0      		ldi r29,hi8(0)
+ 436 034e 8C01      		movw r16,r24
+ 437 0350 00C0      		rjmp .L85
+ 438               	.L86:
+ 439 0352 F801      		movw r30,r16
+ 440 0354 8191      		ld r24,Z+
+ 441 0356 8F01      		movw r16,r30
+ 442 0358 0E94 0000 		call xbee_putc
+ 443 035c 2196      		adiw r28,1
+ 444               	.L85:
+ 445 035e CE15      		cp r28,r14
+ 446 0360 DF05      		cpc r29,r15
+ 447 0362 04F0      		brlt .L86
+ 448 0364 80E0      		ldi r24,lo8(0)
+ 449 0366 90E0      		ldi r25,hi8(0)
+ 450               	/* epilogue: frame size=0 */
+ 451 0368 DF91      		pop r29
+ 452 036a CF91      		pop r28
+ 453 036c 1F91      		pop r17
+ 454 036e 0F91      		pop r16
+ 455 0370 FF90      		pop r15
+ 456 0372 EF90      		pop r14
+ 457 0374 0895      		ret
+ 458               	/* epilogue end (size=7) */
+ 459               	/* function xbee_send size 29 (16) */
+ 461               	.global	xbee_send_packet
+ 463               	xbee_send_packet:
+ 464               	/* prologue: frame size=9 */
+ 465 0376 CF92      		push r12
+ 466 0378 DF92      		push r13
+ 467 037a EF92      		push r14
+ 468 037c FF92      		push r15
+ 469 037e 0F93      		push r16
+ 470 0380 CF93      		push r28
+ 471 0382 DF93      		push r29
+ 472 0384 CDB7      		in r28,__SP_L__
+ 473 0386 DEB7      		in r29,__SP_H__
+ 474 0388 2997      		sbiw r28,9
+ 475 038a 0FB6      		in __tmp_reg__,__SREG__
+ 476 038c F894      		cli
+ 477 038e DEBF      		out __SP_H__,r29
+ 478 0390 0FBE      		out __SREG__,__tmp_reg__
+ 479 0392 CDBF      		out __SP_L__,r28
+ 480               	/* prologue end (size=15) */
+ 481 0394 6C01      		movw r12,r24
+ 482 0396 7B01      		movw r14,r22
+ 483 0398 622F      		mov r22,r18
+ 484 039a 85E6      		ldi r24,lo8(101)
+ 485 039c E816      		cp r14,r24
+ 486 039e F104      		cpc r15,__zero_reg__
+ 487 03a0 04F0      		brlt .+2
+ 488 03a2 00C0      		rjmp .L90
+ 489 03a4 81E0      		ldi r24,lo8(1)
+ 490 03a6 8D83      		std Y+5,r24
+ 491 03a8 0E83      		std Y+6,r16
+ 492 03aa 252F      		mov r18,r21
+ 493 03ac 3327      		clr r19
+ 494 03ae 27FD      		sbrc r18,7
+ 495 03b0 3A95      		dec r19
+ 496 03b2 2F83      		std Y+7,r18
+ 497 03b4 4887      		std Y+8,r20
+ 498 03b6 6987      		std Y+9,r22
+ 499 03b8 8EE7      		ldi r24,lo8(126)
+ 500 03ba 8A83      		std Y+2,r24
+ 501 03bc E5E0      		ldi r30,lo8(5)
+ 502 03be F0E0      		ldi r31,hi8(5)
+ 503 03c0 EE0E      		add r14,r30
+ 504 03c2 FF1E      		adc r15,r31
+ 505 03c4 8F2D      		mov r24,r15
+ 506 03c6 9927      		clr r25
+ 507 03c8 EBEF      		ldi r30,lo8(-5)
+ 508 03ca FFEF      		ldi r31,hi8(-5)
+ 509 03cc EE0E      		add r14,r30
+ 510 03ce FF1E      		adc r15,r31
+ 511 03d0 8B83      		std Y+3,r24
+ 512 03d2 8E2D      		mov r24,r14
+ 513 03d4 8B5F      		subi r24,lo8(-(5))
+ 514 03d6 8C83      		std Y+4,r24
+ 515 03d8 802F      		mov r24,r16
+ 516 03da 8F5F      		subi r24,lo8(-(1))
+ 517 03dc 820F      		add r24,r18
+ 518 03de 840F      		add r24,r20
+ 519 03e0 860F      		add r24,r22
+ 520 03e2 8983      		std Y+1,r24
+ 521 03e4 20E0      		ldi r18,lo8(0)
+ 522 03e6 30E0      		ldi r19,hi8(0)
+ 523 03e8 082F      		mov r16,r24
+ 524 03ea F601      		movw r30,r12
+ 525 03ec 00C0      		rjmp .L92
+ 526               	.L93:
+ 527 03ee 8191      		ld r24,Z+
+ 528 03f0 080F      		add r16,r24
+ 529 03f2 2F5F      		subi r18,lo8(-(1))
+ 530 03f4 3F4F      		sbci r19,hi8(-(1))
+ 531               	.L92:
+ 532 03f6 2E15      		cp r18,r14
+ 533 03f8 3F05      		cpc r19,r15
+ 534 03fa 04F0      		brlt .L93
+ 535 03fc 0095      		com r16
+ 536 03fe 0983      		std Y+1,r16
+ 537 0400 63E0      		ldi r22,lo8(3)
+ 538 0402 70E0      		ldi r23,hi8(3)
+ 539 0404 CE01      		movw r24,r28
+ 540 0406 0296      		adiw r24,2
+ 541 0408 0E94 0000 		call xbee_send
+ 542 040c 892B      		or r24,r25
+ 543 040e 01F4      		brne .L90
+ 544 0410 65E0      		ldi r22,lo8(5)
+ 545 0412 70E0      		ldi r23,hi8(5)
+ 546 0414 CE01      		movw r24,r28
+ 547 0416 0596      		adiw r24,5
+ 548 0418 0E94 0000 		call xbee_send
+ 549 041c 892B      		or r24,r25
+ 550 041e 01F4      		brne .L90
+ 551 0420 B701      		movw r22,r14
+ 552 0422 C601      		movw r24,r12
+ 553 0424 0E94 0000 		call xbee_send
+ 554 0428 892B      		or r24,r25
+ 555 042a 01F4      		brne .L90
+ 556 042c 61E0      		ldi r22,lo8(1)
+ 557 042e 70E0      		ldi r23,hi8(1)
+ 558 0430 CE01      		movw r24,r28
+ 559 0432 0196      		adiw r24,1
+ 560 0434 0E94 0000 		call xbee_send
+ 561 0438 892B      		or r24,r25
+ 562 043a 01F4      		brne .L90
+ 563 043c 80E0      		ldi r24,lo8(0)
+ 564 043e 90E0      		ldi r25,hi8(0)
+ 565 0440 00C0      		rjmp .L99
+ 566               	.L90:
+ 567 0442 8FEF      		ldi r24,lo8(-1)
+ 568 0444 9FEF      		ldi r25,hi8(-1)
+ 569               	.L99:
+ 570               	/* epilogue: frame size=9 */
+ 571 0446 2996      		adiw r28,9
+ 572 0448 0FB6      		in __tmp_reg__,__SREG__
+ 573 044a F894      		cli
+ 574 044c DEBF      		out __SP_H__,r29
+ 575 044e 0FBE      		out __SREG__,__tmp_reg__
+ 576 0450 CDBF      		out __SP_L__,r28
+ 577 0452 DF91      		pop r29
+ 578 0454 CF91      		pop r28
+ 579 0456 0F91      		pop r16
+ 580 0458 FF90      		pop r15
+ 581 045a EF90      		pop r14
+ 582 045c DF90      		pop r13
+ 583 045e CF90      		pop r12
+ 584 0460 0895      		ret
+ 585               	/* epilogue end (size=14) */
+ 586               	/* function xbee_send_packet size 118 (89) */
+ 589               	xbee_send_modify_at_command:
+ 590               	/* prologue: frame size=20 */
+ 591 0462 0F93      		push r16
+ 592 0464 1F93      		push r17
+ 593 0466 CF93      		push r28
+ 594 0468 DF93      		push r29
+ 595 046a CDB7      		in r28,__SP_L__
+ 596 046c DEB7      		in r29,__SP_H__
+ 597 046e 6497      		sbiw r28,20
+ 598 0470 0FB6      		in __tmp_reg__,__SREG__
+ 599 0472 F894      		cli
+ 600 0474 DEBF      		out __SP_H__,r29
+ 601 0476 0FBE      		out __SREG__,__tmp_reg__
+ 602 0478 CDBF      		out __SP_L__,r28
+ 603               	/* prologue end (size=12) */
+ 604 047a FC01      		movw r30,r24
+ 605 047c 88E0      		ldi r24,lo8(8)
+ 606 047e 8D83      		std Y+5,r24
+ 607 0480 81E0      		ldi r24,lo8(1)
+ 608 0482 8E83      		std Y+6,r24
+ 609 0484 8081      		ld r24,Z
+ 610 0486 8F83      		std Y+7,r24
+ 611 0488 8181      		ldd r24,Z+1
+ 612 048a 8887      		std Y+8,r24
+ 613 048c 6115      		cp r22,__zero_reg__
+ 614 048e 7105      		cpc r23,__zero_reg__
+ 615 0490 01F4      		brne .L103
+ 616 0492 E0E0      		ldi r30,lo8(0)
+ 617 0494 F0E0      		ldi r31,hi8(0)
+ 618 0496 00C0      		rjmp .L105
+ 619               	.L103:
+ 620 0498 FB01      		movw r30,r22
+ 621 049a 0190      		ld __tmp_reg__,Z+
+ 622 049c 0020      		tst __tmp_reg__
+ 623 049e 01F4      		brne .-6
+ 624 04a0 3197      		sbiw r30,1
+ 625 04a2 E61B      		sub r30,r22
+ 626 04a4 F70B      		sbc r31,r23
+ 627 04a6 E930      		cpi r30,9
+ 628 04a8 F105      		cpc r31,__zero_reg__
+ 629 04aa 04F0      		brlt .+2
+ 630 04ac 00C0      		rjmp .L106
+ 631 04ae 20E0      		ldi r18,lo8(0)
+ 632 04b0 30E0      		ldi r19,hi8(0)
+ 633 04b2 AE01      		movw r20,r28
+ 634 04b4 475F      		subi r20,lo8(-(9))
+ 635 04b6 5F4F      		sbci r21,hi8(-(9))
+ 636 04b8 00C0      		rjmp .L108
+ 637               	.L109:
+ 638 04ba DB01      		movw r26,r22
+ 639 04bc 8D91      		ld r24,X+
+ 640 04be BD01      		movw r22,r26
+ 641 04c0 DA01      		movw r26,r20
+ 642 04c2 8D93      		st X+,r24
+ 643 04c4 AD01      		movw r20,r26
+ 644 04c6 2F5F      		subi r18,lo8(-(1))
+ 645 04c8 3F4F      		sbci r19,hi8(-(1))
+ 646               	.L108:
+ 647 04ca 2E17      		cp r18,r30
+ 648 04cc 3F07      		cpc r19,r31
+ 649 04ce 04F0      		brlt .L109
+ 650               	.L105:
+ 651 04d0 8F01      		movw r16,r30
+ 652 04d2 0C5F      		subi r16,lo8(-(4))
+ 653 04d4 1F4F      		sbci r17,hi8(-(4))
+ 654 04d6 8EE7      		ldi r24,lo8(126)
+ 655 04d8 8A83      		std Y+2,r24
+ 656 04da 812F      		mov r24,r17
+ 657 04dc 9927      		clr r25
+ 658 04de 8B83      		std Y+3,r24
+ 659 04e0 402F      		mov r20,r16
+ 660 04e2 20E0      		ldi r18,lo8(0)
+ 661 04e4 30E0      		ldi r19,hi8(0)
+ 662 04e6 90E0      		ldi r25,lo8(0)
+ 663 04e8 FE01      		movw r30,r28
+ 664 04ea 3596      		adiw r30,5
+ 665 04ec 00C0      		rjmp .L110
+ 666               	.L111:
+ 667 04ee 8191      		ld r24,Z+
+ 668 04f0 980F      		add r25,r24
+ 669 04f2 2F5F      		subi r18,lo8(-(1))
+ 670 04f4 3F4F      		sbci r19,hi8(-(1))
+ 671               	.L110:
+ 672 04f6 2017      		cp r18,r16
+ 673 04f8 3107      		cpc r19,r17
+ 674 04fa 04F0      		brlt .L111
+ 675 04fc 9095      		com r25
+ 676 04fe 9983      		std Y+1,r25
+ 677 0500 4C83      		std Y+4,r20
+ 678 0502 63E0      		ldi r22,lo8(3)
+ 679 0504 70E0      		ldi r23,hi8(3)
+ 680 0506 CE01      		movw r24,r28
+ 681 0508 0296      		adiw r24,2
+ 682 050a 0E94 0000 		call xbee_send
+ 683 050e 892B      		or r24,r25
+ 684 0510 01F4      		brne .L106
+ 685 0512 B801      		movw r22,r16
+ 686 0514 CE01      		movw r24,r28
+ 687 0516 0596      		adiw r24,5
+ 688 0518 0E94 0000 		call xbee_send
+ 689 051c 892B      		or r24,r25
+ 690 051e 01F4      		brne .L106
+ 691 0520 61E0      		ldi r22,lo8(1)
+ 692 0522 70E0      		ldi r23,hi8(1)
+ 693 0524 CE01      		movw r24,r28
+ 694 0526 0196      		adiw r24,1
+ 695 0528 0E94 0000 		call xbee_send
+ 696 052c 892B      		or r24,r25
+ 697 052e 01F4      		brne .L106
+ 698 0530 80E0      		ldi r24,lo8(0)
+ 699 0532 90E0      		ldi r25,hi8(0)
+ 700 0534 00C0      		rjmp .L116
+ 701               	.L106:
+ 702 0536 8FEF      		ldi r24,lo8(-1)
+ 703 0538 9FEF      		ldi r25,hi8(-1)
+ 704               	.L116:
+ 705               	/* epilogue: frame size=20 */
+ 706 053a 6496      		adiw r28,20
+ 707 053c 0FB6      		in __tmp_reg__,__SREG__
+ 708 053e F894      		cli
+ 709 0540 DEBF      		out __SP_H__,r29
+ 710 0542 0FBE      		out __SREG__,__tmp_reg__
+ 711 0544 CDBF      		out __SP_L__,r28
+ 712 0546 DF91      		pop r29
+ 713 0548 CF91      		pop r28
+ 714 054a 1F91      		pop r17
+ 715 054c 0F91      		pop r16
+ 716 054e 0895      		ret
+ 717               	/* epilogue end (size=11) */
+ 718               	/* function xbee_send_modify_at_command size 119 (96) */
+ 720               		.data
+ 721               	.LC1:
+ 722 0004 4348 00   		.string	"CH"
+ 723               		.text
+ 724               	.global	xbee_set_channel
+ 726               	xbee_set_channel:
+ 727               	/* prologue: frame size=3 */
+ 728 0550 CF93      		push r28
+ 729 0552 DF93      		push r29
+ 730 0554 CDB7      		in r28,__SP_L__
+ 731 0556 DEB7      		in r29,__SP_H__
+ 732 0558 2397      		sbiw r28,3
+ 733 055a 0FB6      		in __tmp_reg__,__SREG__
+ 734 055c F894      		cli
+ 735 055e DEBF      		out __SP_H__,r29
+ 736 0560 0FBE      		out __SREG__,__tmp_reg__
+ 737 0562 CDBF      		out __SP_L__,r28
+ 738               	/* prologue end (size=10) */
+ 739 0564 9C01      		movw r18,r24
+ 740 0566 0B97      		sbiw r24,11
+ 741 0568 4097      		sbiw r24,16
+ 742 056a 00F0      		brlo .L119
+ 743 056c 8FEF      		ldi r24,lo8(-1)
+ 744 056e 9FEF      		ldi r25,hi8(-1)
+ 745 0570 00C0      		rjmp .L121
+ 746               	.L119:
+ 747 0572 2983      		std Y+1,r18
+ 748 0574 1A82      		std Y+2,__zero_reg__
+ 749 0576 3093 0000 		sts (xbee_pending_channel)+1,r19
+ 750 057a 2093 0000 		sts xbee_pending_channel,r18
+ 751 057e BE01      		movw r22,r28
+ 752 0580 6F5F      		subi r22,lo8(-(1))
+ 753 0582 7F4F      		sbci r23,hi8(-(1))
+ 754 0584 80E0      		ldi r24,lo8(.LC1)
+ 755 0586 90E0      		ldi r25,hi8(.LC1)
+ 756 0588 0E94 0000 		call xbee_send_modify_at_command
+ 757               	.L121:
+ 758               	/* epilogue: frame size=3 */
+ 759 058c 2396      		adiw r28,3
+ 760 058e 0FB6      		in __tmp_reg__,__SREG__
+ 761 0590 F894      		cli
+ 762 0592 DEBF      		out __SP_H__,r29
+ 763 0594 0FBE      		out __SREG__,__tmp_reg__
+ 764 0596 CDBF      		out __SP_L__,r28
+ 765 0598 DF91      		pop r29
+ 766 059a CF91      		pop r28
+ 767 059c 0895      		ret
+ 768               	/* epilogue end (size=9) */
+ 769               	/* function xbee_set_channel size 40 (21) */
+ 771               		.data
+ 772               	.LC2:
+ 773 0007 4944 00   		.string	"ID"
+ 774               		.text
+ 775               	.global	xbee_set_pan_id
+ 777               	xbee_set_pan_id:
+ 778               	/* prologue: frame size=3 */
+ 779 059e CF93      		push r28
+ 780 05a0 DF93      		push r29
+ 781 05a2 CDB7      		in r28,__SP_L__
+ 782 05a4 DEB7      		in r29,__SP_H__
+ 783 05a6 2397      		sbiw r28,3
+ 784 05a8 0FB6      		in __tmp_reg__,__SREG__
+ 785 05aa F894      		cli
+ 786 05ac DEBF      		out __SP_H__,r29
+ 787 05ae 0FBE      		out __SREG__,__tmp_reg__
+ 788 05b0 CDBF      		out __SP_L__,r28
+ 789               	/* prologue end (size=10) */
+ 790 05b2 292F      		mov r18,r25
+ 791 05b4 3327      		clr r19
+ 792 05b6 27FD      		sbrc r18,7
+ 793 05b8 3A95      		dec r19
+ 794 05ba 2983      		std Y+1,r18
+ 795 05bc 8A83      		std Y+2,r24
+ 796 05be 1B82      		std Y+3,__zero_reg__
+ 797 05c0 9093 0000 		sts (xbee_pending_panID)+1,r25
+ 798 05c4 8093 0000 		sts xbee_pending_panID,r24
+ 799 05c8 BE01      		movw r22,r28
+ 800 05ca 6F5F      		subi r22,lo8(-(1))
+ 801 05cc 7F4F      		sbci r23,hi8(-(1))
+ 802 05ce 80E0      		ldi r24,lo8(.LC2)
+ 803 05d0 90E0      		ldi r25,hi8(.LC2)
+ 804 05d2 0E94 0000 		call xbee_send_modify_at_command
+ 805               	/* epilogue: frame size=3 */
+ 806 05d6 2396      		adiw r28,3
+ 807 05d8 0FB6      		in __tmp_reg__,__SREG__
+ 808 05da F894      		cli
+ 809 05dc DEBF      		out __SP_H__,r29
+ 810 05de 0FBE      		out __SREG__,__tmp_reg__
+ 811 05e0 CDBF      		out __SP_L__,r28
+ 812 05e2 DF91      		pop r29
+ 813 05e4 CF91      		pop r28
+ 814 05e6 0895      		ret
+ 815               	/* epilogue end (size=9) */
+ 816               	/* function xbee_set_pan_id size 37 (18) */
+ 819               	xbee_send_read_at_command:
+ 820               	/* prologue: frame size=0 */
+ 821               	/* prologue end (size=0) */
+ 822 05e8 60E0      		ldi r22,lo8(0)
+ 823 05ea 70E0      		ldi r23,hi8(0)
+ 824 05ec 0E94 0000 		call xbee_send_modify_at_command
+ 825               	/* epilogue: frame size=0 */
+ 826 05f0 0895      		ret
+ 827               	/* epilogue end (size=1) */
+ 828               	/* function xbee_send_read_at_command size 5 (4) */
+ 830               		.data
+ 831               	.LC3:
+ 832 000a 3300      		.string	"3"
+ 833               	.LC4:
+ 834 000c 4244 00   		.string	"BD"
+ 835               	.LC5:
+ 836 000f 4652 00   		.string	"FR"
+ 837               		.text
+ 838               	.global	xbee_reset
+ 840               	xbee_reset:
+ 841               	/* prologue: frame size=0 */
+ 842               	/* prologue end (size=0) */
+ 843 05f2 60E0      		ldi r22,lo8(.LC3)
+ 844 05f4 70E0      		ldi r23,hi8(.LC3)
+ 845 05f6 80E0      		ldi r24,lo8(.LC4)
+ 846 05f8 90E0      		ldi r25,hi8(.LC4)
+ 847 05fa 0E94 0000 		call xbee_send_modify_at_command
+ 848 05fe 80E0      		ldi r24,lo8(.LC5)
+ 849 0600 90E0      		ldi r25,hi8(.LC5)
+ 850 0602 0E94 0000 		call xbee_send_read_at_command
+ 851 0606 80E0      		ldi r24,lo8(0)
+ 852 0608 90E0      		ldi r25,hi8(0)
+ 853               	/* #APP */
+ 854 060a 0197      		1: sbiw r24,1
+ 855 060c 01F4      		brne 1b
+ 856               	/* #NOAPP */
+ 857 060e 80E0      		ldi r24,lo8(0)
+ 858 0610 90E0      		ldi r25,hi8(0)
+ 859               	/* epilogue: frame size=0 */
+ 860 0612 0895      		ret
+ 861               	/* epilogue end (size=1) */
+ 862               	/* function xbee_reset size 19 (18) */
+ 864               		.data
+ 865               	.LC6:
+ 866 0012 3000      		.string	"0"
+ 867               	.LC7:
+ 868 0014 4150 00   		.string	"AP"
+ 869               		.text
+ 870               	.global	xbee_terminate
+ 872               	xbee_terminate:
+ 873               	/* prologue: frame size=0 */
+ 874               	/* prologue end (size=0) */
+ 875 0614 60E0      		ldi r22,lo8(.LC6)
+ 876 0616 70E0      		ldi r23,hi8(.LC6)
+ 877 0618 80E0      		ldi r24,lo8(.LC7)
+ 878 061a 90E0      		ldi r25,hi8(.LC7)
+ 879 061c 0E94 0000 		call xbee_send_modify_at_command
+ 880               	/* epilogue: frame size=0 */
+ 881 0620 0895      		ret
+ 882               	/* epilogue end (size=1) */
+ 883               	/* function xbee_terminate size 7 (6) */
+ 886               	xbee_send_string:
+ 887               	/* prologue: frame size=0 */
+ 888               	/* prologue end (size=0) */
+ 889 0622 FC01      		movw r30,r24
+ 890 0624 0190      		ld __tmp_reg__,Z+
+ 891 0626 0020      		tst __tmp_reg__
+ 892 0628 01F4      		brne .-6
+ 893 062a 3197      		sbiw r30,1
+ 894 062c E81B      		sub r30,r24
+ 895 062e F90B      		sbc r31,r25
+ 896 0630 BF01      		movw r22,r30
+ 897 0632 0E94 0000 		call xbee_send
+ 898               	/* epilogue: frame size=0 */
+ 899 0636 0895      		ret
+ 900               	/* epilogue end (size=1) */
+ 901               	/* function xbee_send_string size 11 (10) */
+ 903               		.data
+ 904               	.LC8:
+ 905 0017 2B2B 2B00 		.string	"+++"
+ 906               	.LC9:
+ 907 001b 4154 434E 		.string	"ATCN\r"
+ 907      0D00 
+ 908               	.LC10:
+ 909 0021 4D59 00   		.string	"MY"
+ 910               	.LC11:
+ 911 0024 4154 4150 		.string	"ATAP 1\r"
+ 911      2031 0D00 
+ 912               		.text
+ 913               	.global	xbee_lib_init
+ 915               	xbee_lib_init:
+ 916               	/* prologue: frame size=0 */
+ 917               	/* prologue end (size=0) */
+ 918 0638 8091 9A00 		lds r24,154
+ 919 063c 8068      		ori r24,lo8(-128)
+ 920 063e 8093 9A00 		sts 154,r24
+ 921               	/* #APP */
+ 922 0642 7894      		sei
+ 923               	/* #NOAPP */
+ 924 0644 80E0      		ldi r24,lo8(.LC8)
+ 925 0646 90E0      		ldi r25,hi8(.LC8)
+ 926 0648 0E94 0000 		call xbee_send_string
+ 927 064c 892B      		or r24,r25
+ 928 064e 01F4      		brne .L134
+ 929 0650 0E94 0000 		call xbee_wait_for_ok
+ 930 0654 892B      		or r24,r25
+ 931 0656 01F4      		brne .L134
+ 932 0658 00C0      		rjmp .L144
+ 933               	.L146:
+ 934 065a 0E94 0000 		call xbee_wait_for_ok
+ 935 065e 80E0      		ldi r24,lo8(.LC9)
+ 936 0660 90E0      		ldi r25,hi8(.LC9)
+ 937 0662 0E94 0000 		call xbee_send_string
+ 938 0666 892B      		or r24,r25
+ 939 0668 01F4      		brne .L134
+ 940 066a 0E94 0000 		call xbee_wait_for_ok
+ 941 066e 80E0      		ldi r24,lo8(.LC10)
+ 942 0670 90E0      		ldi r25,hi8(.LC10)
+ 943 0672 0E94 0000 		call xbee_send_read_at_command
+ 944 0676 892B      		or r24,r25
+ 945 0678 01F0      		breq .L145
+ 946 067a 00C0      		rjmp .L134
+ 947               	.L140:
+ 948 067c 80E0      		ldi r24,lo8(0)
+ 949 067e 90E0      		ldi r25,hi8(0)
+ 950 0680 0E94 0000 		call xbee_get_packet
+ 951               	.L145:
+ 952 0684 8091 0000 		lds r24,xbee_address
+ 953 0688 9091 0000 		lds r25,(xbee_address)+1
+ 954 068c 892B      		or r24,r25
+ 955 068e 01F0      		breq .L140
+ 956 0690 80E0      		ldi r24,lo8(0)
+ 957 0692 90E0      		ldi r25,hi8(0)
+ 958 0694 0895      		ret
+ 959               	.L134:
+ 960 0696 8FEF      		ldi r24,lo8(-1)
+ 961 0698 9FEF      		ldi r25,hi8(-1)
+ 962 069a 0895      		ret
+ 963               	.L144:
+ 964 069c 80E0      		ldi r24,lo8(.LC11)
+ 965 069e 90E0      		ldi r25,hi8(.LC11)
+ 966 06a0 0E94 0000 		call xbee_send_string
+ 967 06a4 892B      		or r24,r25
+ 968 06a6 01F0      		breq .L146
+ 969 06a8 00C0      		rjmp .L134
+ 970               	/* epilogue: frame size=0 */
+ 971               	/* epilogue: noreturn */
+ 972               	/* epilogue end (size=0) */
+ 973               	/* function xbee_lib_init size 58 (58) */
+ 975               	.global	buffer_last
+ 976               	.global	buffer_last
+ 977               		.section .bss
+ 980               	buffer_last:
+ 981 0000 0000      		.skip 2,0
+ 982               	.global	buffer_first
+ 983               	.global	buffer_first
+ 986               	buffer_first:
+ 987 0002 0000      		.skip 2,0
+ 988               		.lcomm xbee_address,2
+ 989               		.lcomm xbee_channel,2
+ 990               		.lcomm xbee_pending_channel,2
+ 991               		.data
+ 994               	xbee_panID:
+ 995 002c FFFF      		.word	-1
+ 998               	xbee_pending_panID:
+ 999 002e FFFF      		.word	-1
+ 1000               		.lcomm currentBufPos,2
+ 1001               		.lcomm xbee_buf,108
+ 1002               		.comm arrival_buf,128,1
+ 1003               	/* File "xbee.c": code  860 = 0x035c ( 722), prologues  66, epilogues  72 */
+DEFINED SYMBOLS
+                            *ABS*:00000000 xbee.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:13     .text:00000000 __vector_30
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:980    .bss:00000000 buffer_last
+                            *COM*:00000080 arrival_buf
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:986    .bss:00000002 buffer_first
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:67     .text:00000064 xbee_wait_for_ok
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:120    .text:000000ca xbee_get_packet
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:990    .bss:0000000a currentBufPos
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:1000   .bss:0000000c xbee_buf
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:998    .data:0000002e xbee_pending_panID
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:994    .data:0000002c xbee_panID
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:989    .bss:00000008 xbee_pending_channel
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:988    .bss:00000006 xbee_channel
+                             .bss:00000004 xbee_address
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:389    .text:0000031e xbee_get_pan_id
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:401    .text:00000328 xbee_get_channel
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:413    .text:00000332 xbee_get_address
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:424    .text:0000033c xbee_send
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:463    .text:00000376 xbee_send_packet
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:589    .text:00000462 xbee_send_modify_at_command
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:726    .text:00000550 xbee_set_channel
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:777    .text:0000059e xbee_set_pan_id
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:819    .text:000005e8 xbee_send_read_at_command
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:840    .text:000005f2 xbee_reset
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:872    .text:00000614 xbee_terminate
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:886    .text:00000622 xbee_send_string
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccMrpJ1L.s:915    .text:00000638 xbee_lib_init
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+xbee_putc
Index: demos/hunter_prey_john/projects/libwireless/lib/.dep/wl_token_ring.o.d
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/.dep/wl_token_ring.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/.dep/wl_token_ring.o.d	(revision 1694)
@@ -0,0 +1,21 @@
+wl_token_ring.o: wl_token_ring.c wl_token_ring.h \
+  f:/winavr-20070525/bin/../avr/include/stdlib.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h wl_defs.h \
+  wireless.h sensor_matrix.h ../../../lib/include/libdragonfly/bom.h \
+  ../../../lib/include/libdragonfly/time.h
+
+wl_token_ring.h:
+
+f:/winavr-20070525/bin/../avr/include/stdlib.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h:
+
+wl_defs.h:
+
+wireless.h:
+
+sensor_matrix.h:
+
+../../../lib/include/libdragonfly/bom.h:
+
+../../../lib/include/libdragonfly/time.h:
Index: demos/hunter_prey_john/projects/libwireless/lib/.dep/xbee.o.d
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/.dep/xbee.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/.dep/xbee.o.d	(revision 1694)
@@ -0,0 +1,47 @@
+xbee.o: xbee.c xbee.h wl_defs.h \
+  ../../../lib/include/libdragonfly/serial.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h \
+  f:/winavr-20070525/bin/../avr/include/avr/interrupt.h \
+  f:/winavr-20070525/bin/../avr/include/util/delay.h \
+  f:/winavr-20070525/bin/../avr/include/util/delay_basic.h \
+  f:/winavr-20070525/bin/../avr/include/string.h
+
+xbee.h:
+
+wl_defs.h:
+
+../../../lib/include/libdragonfly/serial.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/interrupt.h:
+
+f:/winavr-20070525/bin/../avr/include/util/delay.h:
+
+f:/winavr-20070525/bin/../avr/include/util/delay_basic.h:
+
+f:/winavr-20070525/bin/../avr/include/string.h:
Index: demos/hunter_prey_john/projects/libwireless/lib/.dep/wireless.o.d
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/.dep/wireless.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/.dep/wireless.o.d	(revision 1694)
@@ -0,0 +1,16 @@
+wireless.o: wireless.c wireless.h xbee.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h wl_defs.h \
+  ../../../lib/include/libdragonfly/time.h \
+  ../../../lib/include/libdragonfly/bom.h
+
+wireless.h:
+
+xbee.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h:
+
+wl_defs.h:
+
+../../../lib/include/libdragonfly/time.h:
+
+../../../lib/include/libdragonfly/bom.h:
Index: demos/hunter_prey_john/projects/libwireless/lib/.dep/wl_basic.o.d
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/.dep/wl_basic.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/.dep/wl_basic.o.d	(revision 1694)
@@ -0,0 +1,5 @@
+wl_basic.o: wl_basic.c wl_basic.h wireless.h
+
+wl_basic.h:
+
+wireless.h:
Index: demos/hunter_prey_john/projects/libwireless/lib/.dep/wl_error_group.o.d
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/.dep/wl_error_group.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/.dep/wl_error_group.o.d	(revision 1694)
@@ -0,0 +1,13 @@
+wl_error_group.o: wl_error_group.c wl_error_group.h wireless.h wl_defs.h \
+  f:/winavr-20070525/bin/../avr/include/string.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h
+
+wl_error_group.h:
+
+wireless.h:
+
+wl_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/string.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h:
Index: demos/hunter_prey_john/projects/libwireless/lib/.dep/sensor_matrix.o.d
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/.dep/sensor_matrix.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/.dep/sensor_matrix.o.d	(revision 1694)
@@ -0,0 +1,5 @@
+sensor_matrix.o: sensor_matrix.c wl_defs.h sensor_matrix.h
+
+wl_defs.h:
+
+sensor_matrix.h:
Index: demos/hunter_prey_john/projects/libwireless/lib/sensor_matrix.lst
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/sensor_matrix.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/sensor_matrix.lst	(revision 1694)
@@ -0,0 +1,213 @@
+   1               		.file	"sensor_matrix.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  10               		.text
+  11               	.global	sensor_matrix_create
+  13               	sensor_matrix_create:
+  14               	/* prologue: frame size=0 */
+  15               	/* prologue end (size=0) */
+  16 0000 1092 0000 		sts (m)+1,__zero_reg__
+  17 0004 1092 0000 		sts m,__zero_reg__
+  18 0008 40E0      		ldi r20,lo8(0)
+  19 000a 50E0      		ldi r21,hi8(0)
+  20 000c A0E0      		ldi r26,lo8(m+2)
+  21 000e B0E0      		ldi r27,hi8(m+2)
+  22 0010 6FEF      		ldi r22,lo8(-1)
+  23 0012 22E1      		ldi r18,lo8(18)
+  24 0014 30E0      		ldi r19,hi8(18)
+  25               	.L2:
+  26 0016 1C92      		st X,__zero_reg__
+  27 0018 F901      		movw r30,r18
+  28 001a E050      		subi r30,lo8(-(m))
+  29 001c F040      		sbci r31,hi8(-(m))
+  30 001e 80E0      		ldi r24,lo8(0)
+  31 0020 90E0      		ldi r25,hi8(0)
+  32               	.L3:
+  33 0022 6193      		st Z+,r22
+  34 0024 0196      		adiw r24,1
+  35 0026 8031      		cpi r24,16
+  36 0028 9105      		cpc r25,__zero_reg__
+  37 002a 01F4      		brne .L3
+  38 002c 4F5F      		subi r20,lo8(-(1))
+  39 002e 5F4F      		sbci r21,hi8(-(1))
+  40 0030 205F      		subi r18,lo8(-(16))
+  41 0032 3F4F      		sbci r19,hi8(-(16))
+  42 0034 1196      		adiw r26,1
+  43 0036 4031      		cpi r20,16
+  44 0038 5105      		cpc r21,__zero_reg__
+  45 003a 01F4      		brne .L2
+  46               	/* epilogue: frame size=0 */
+  47 003c 0895      		ret
+  48               	/* epilogue end (size=1) */
+  49               	/* function sensor_matrix_create size 31 (30) */
+  51               	.global	sensor_matrix_set_reading
+  53               	sensor_matrix_set_reading:
+  54               	/* prologue: frame size=0 */
+  55               	/* prologue end (size=0) */
+  56 003e FC01      		movw r30,r24
+  57 0040 6031      		cpi r22,16
+  58 0042 7105      		cpc r23,__zero_reg__
+  59 0044 04F4      		brge .L15
+  60 0046 4097      		sbiw r24,16
+  61 0048 04F4      		brge .L15
+  62 004a 84E0      		ldi r24,4
+  63 004c EE0F      	1:	lsl r30
+  64 004e FF1F      		rol r31
+  65 0050 8A95      		dec r24
+  66 0052 01F4      		brne 1b
+  67 0054 E050      		subi r30,lo8(-(m))
+  68 0056 F040      		sbci r31,hi8(-(m))
+  69 0058 E60F      		add r30,r22
+  70 005a F71F      		adc r31,r23
+  71 005c 428B      		std Z+18,r20
+  72               	.L15:
+  73 005e 0895      		ret
+  74               	/* epilogue: frame size=0 */
+  75               	/* epilogue: noreturn */
+  76               	/* epilogue end (size=0) */
+  77               	/* function sensor_matrix_set_reading size 18 (18) */
+  79               	.global	sensor_matrix_get_reading
+  81               	sensor_matrix_get_reading:
+  82               	/* prologue: frame size=0 */
+  83               	/* prologue end (size=0) */
+  84 0060 FC01      		movw r30,r24
+  85 0062 4097      		sbiw r24,16
+  86 0064 04F4      		brge .L17
+  87 0066 6031      		cpi r22,16
+  88 0068 7105      		cpc r23,__zero_reg__
+  89 006a 04F4      		brge .L17
+  90 006c 94E0      		ldi r25,4
+  91 006e EE0F      	1:	lsl r30
+  92 0070 FF1F      		rol r31
+  93 0072 9A95      		dec r25
+  94 0074 01F4      		brne 1b
+  95 0076 E050      		subi r30,lo8(-(m))
+  96 0078 F040      		sbci r31,hi8(-(m))
+  97 007a E60F      		add r30,r22
+  98 007c F71F      		adc r31,r23
+  99 007e 8289      		ldd r24,Z+18
+ 100 0080 9927      		clr r25
+ 101 0082 0895      		ret
+ 102               	.L17:
+ 103 0084 8FEF      		ldi r24,lo8(-1)
+ 104 0086 9FEF      		ldi r25,hi8(-1)
+ 105 0088 0895      		ret
+ 106               	/* epilogue: frame size=0 */
+ 107               	/* epilogue: noreturn */
+ 108               	/* epilogue end (size=0) */
+ 109               	/* function sensor_matrix_get_reading size 22 (22) */
+ 111               	.global	sensor_matrix_set_in_ring
+ 113               	sensor_matrix_set_in_ring:
+ 114               	/* prologue: frame size=0 */
+ 115               	/* prologue end (size=0) */
+ 116 008a DC01      		movw r26,r24
+ 117 008c 8031      		cpi r24,16
+ 118 008e 9105      		cpc r25,__zero_reg__
+ 119 0090 04F4      		brge .L31
+ 120 0092 6130      		cpi r22,1
+ 121 0094 7105      		cpc r23,__zero_reg__
+ 122 0096 01F4      		brne .L25
+ 123 0098 FC01      		movw r30,r24
+ 124 009a E050      		subi r30,lo8(-(m))
+ 125 009c F040      		sbci r31,hi8(-(m))
+ 126 009e 8281      		ldd r24,Z+2
+ 127 00a0 8823      		tst r24
+ 128 00a2 01F4      		brne .L27
+ 129 00a4 8091 0000 		lds r24,m
+ 130 00a8 9091 0000 		lds r25,(m)+1
+ 131 00ac 0196      		adiw r24,1
+ 132 00ae 00C0      		rjmp .L32
+ 133               	.L25:
+ 134 00b0 6115      		cp r22,__zero_reg__
+ 135 00b2 7105      		cpc r23,__zero_reg__
+ 136 00b4 01F4      		brne .L27
+ 137 00b6 FC01      		movw r30,r24
+ 138 00b8 E050      		subi r30,lo8(-(m))
+ 139 00ba F040      		sbci r31,hi8(-(m))
+ 140 00bc 8281      		ldd r24,Z+2
+ 141 00be 8823      		tst r24
+ 142 00c0 01F0      		breq .L27
+ 143 00c2 8091 0000 		lds r24,m
+ 144 00c6 9091 0000 		lds r25,(m)+1
+ 145 00ca 0197      		sbiw r24,1
+ 146               	.L32:
+ 147 00cc 9093 0000 		sts (m)+1,r25
+ 148 00d0 8093 0000 		sts m,r24
+ 149               	.L27:
+ 150 00d4 A050      		subi r26,lo8(-(m))
+ 151 00d6 B040      		sbci r27,hi8(-(m))
+ 152 00d8 FD01      		movw r30,r26
+ 153 00da 6283      		std Z+2,r22
+ 154               	.L31:
+ 155 00dc 0895      		ret
+ 156               	/* epilogue: frame size=0 */
+ 157               	/* epilogue: noreturn */
+ 158               	/* epilogue end (size=0) */
+ 159               	/* function sensor_matrix_set_in_ring size 42 (42) */
+ 161               	.global	sensor_matrix_get_in_ring
+ 163               	sensor_matrix_get_in_ring:
+ 164               	/* prologue: frame size=0 */
+ 165               	/* prologue end (size=0) */
+ 166 00de FC01      		movw r30,r24
+ 167 00e0 4097      		sbiw r24,16
+ 168 00e2 04F0      		brlt .L34
+ 169 00e4 8FEF      		ldi r24,lo8(-1)
+ 170 00e6 9FEF      		ldi r25,hi8(-1)
+ 171 00e8 0895      		ret
+ 172               	.L34:
+ 173 00ea E050      		subi r30,lo8(-(m))
+ 174 00ec F040      		sbci r31,hi8(-(m))
+ 175 00ee 8281      		ldd r24,Z+2
+ 176 00f0 9927      		clr r25
+ 177 00f2 0895      		ret
+ 178               	/* epilogue: frame size=0 */
+ 179               	/* epilogue: noreturn */
+ 180               	/* epilogue end (size=0) */
+ 181               	/* function sensor_matrix_get_in_ring size 12 (12) */
+ 183               	.global	sensor_matrix_get_joined
+ 185               	sensor_matrix_get_joined:
+ 186               	/* prologue: frame size=0 */
+ 187               	/* prologue end (size=0) */
+ 188 00f4 8091 0000 		lds r24,m
+ 189 00f8 9091 0000 		lds r25,(m)+1
+ 190               	/* epilogue: frame size=0 */
+ 191 00fc 0895      		ret
+ 192               	/* epilogue end (size=1) */
+ 193               	/* function sensor_matrix_get_joined size 5 (4) */
+ 195               	.global	sensor_matrix_get_size
+ 197               	sensor_matrix_get_size:
+ 198               	/* prologue: frame size=0 */
+ 199               	/* prologue end (size=0) */
+ 200 00fe 80E1      		ldi r24,lo8(16)
+ 201 0100 90E0      		ldi r25,hi8(16)
+ 202               	/* epilogue: frame size=0 */
+ 203 0102 0895      		ret
+ 204               	/* epilogue end (size=1) */
+ 205               	/* function sensor_matrix_get_size size 3 (2) */
+ 207               		.comm m,274,1
+ 208               	/* File "sensor_matrix.c": code  133 = 0x0085 ( 130), prologues   0, epilogues   3 */
+DEFINED SYMBOLS
+                            *ABS*:00000000 sensor_matrix.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccvHQquy.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccvHQquy.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccvHQquy.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccvHQquy.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccvHQquy.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccvHQquy.s:13     .text:00000000 sensor_matrix_create
+                            *COM*:00000112 m
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccvHQquy.s:53     .text:0000003e sensor_matrix_set_reading
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccvHQquy.s:81     .text:00000060 sensor_matrix_get_reading
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccvHQquy.s:113    .text:0000008a sensor_matrix_set_in_ring
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccvHQquy.s:163    .text:000000de sensor_matrix_get_in_ring
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccvHQquy.s:185    .text:000000f4 sensor_matrix_get_joined
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccvHQquy.s:197    .text:000000fe sensor_matrix_get_size
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
Index: demos/hunter_prey_john/projects/libwireless/lib/wireless.lst
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wireless.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wireless.lst	(revision 1694)
@@ -0,0 +1,522 @@
+   1               		.file	"wireless.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  10               		.text
+  12               	timer_handler:
+  13               	/* prologue: frame size=0 */
+  14               	/* prologue end (size=0) */
+  15 0000 81E0      		ldi r24,lo8(1)
+  16 0002 90E0      		ldi r25,hi8(1)
+  17 0004 9093 0000 		sts (wl_timeout)+1,r25
+  18 0008 8093 0000 		sts wl_timeout,r24
+  19               	/* epilogue: frame size=0 */
+  20 000c 0895      		ret
+  21               	/* epilogue end (size=1) */
+  22               	/* function timer_handler size 7 (6) */
+  24               	.global	wl_register_packet_group
+  26               	wl_register_packet_group:
+  27               	/* prologue: frame size=0 */
+  28               	/* prologue end (size=0) */
+  29 000e DC01      		movw r26,r24
+  30 0010 8D91      		ld r24,X+
+  31 0012 9C91      		ld r25,X
+  32 0014 1197      		sbiw r26,1
+  33 0016 8031      		cpi r24,16
+  34 0018 9105      		cpc r25,__zero_reg__
+  35 001a 00F4      		brsh .L7
+  36 001c FC01      		movw r30,r24
+  37 001e EE0F      		lsl r30
+  38 0020 FF1F      		rol r31
+  39 0022 E050      		subi r30,lo8(-(wl_packet_groups))
+  40 0024 F040      		sbci r31,hi8(-(wl_packet_groups))
+  41 0026 8081      		ld r24,Z
+  42 0028 9181      		ldd r25,Z+1
+  43 002a 892B      		or r24,r25
+  44 002c 01F4      		brne .L7
+  45 002e B183      		std Z+1,r27
+  46 0030 A083      		st Z,r26
+  47               	.L7:
+  48 0032 0895      		ret
+  49               	/* epilogue: frame size=0 */
+  50               	/* epilogue: noreturn */
+  51               	/* epilogue end (size=0) */
+  52               	/* function wl_register_packet_group size 19 (19) */
+  54               	.global	wl_unregister_packet_group
+  56               	wl_unregister_packet_group:
+  57               	/* prologue: frame size=0 */
+  58 0034 CF93      		push r28
+  59 0036 DF93      		push r29
+  60               	/* prologue end (size=2) */
+  61 0038 FC01      		movw r30,r24
+  62 003a C081      		ld r28,Z
+  63 003c D181      		ldd r29,Z+1
+  64 003e FE01      		movw r30,r28
+  65 0040 EE0F      		lsl r30
+  66 0042 FF1F      		rol r31
+  67 0044 E050      		subi r30,lo8(-(wl_packet_groups))
+  68 0046 F040      		sbci r31,hi8(-(wl_packet_groups))
+  69 0048 0190      		ld __tmp_reg__,Z+
+  70 004a F081      		ld r31,Z
+  71 004c E02D      		mov r30,__tmp_reg__
+  72 004e 3097      		sbiw r30,0
+  73 0050 01F0      		breq .L9
+  74 0052 0084      		ldd __tmp_reg__,Z+8
+  75 0054 F185      		ldd r31,Z+9
+  76 0056 E02D      		mov r30,__tmp_reg__
+  77 0058 3097      		sbiw r30,0
+  78 005a 01F0      		breq .L9
+  79 005c 0995      		icall
+  80               	.L9:
+  81 005e CC0F      		lsl r28
+  82 0060 DD1F      		rol r29
+  83 0062 C050      		subi r28,lo8(-(wl_packet_groups))
+  84 0064 D040      		sbci r29,hi8(-(wl_packet_groups))
+  85 0066 1982      		std Y+1,__zero_reg__
+  86 0068 1882      		st Y,__zero_reg__
+  87               	/* epilogue: frame size=0 */
+  88 006a DF91      		pop r29
+  89 006c CF91      		pop r28
+  90 006e 0895      		ret
+  91               	/* epilogue end (size=3) */
+  92               	/* function wl_unregister_packet_group size 30 (25) */
+  94               	.global	wl_do
+  96               	wl_do:
+  97               	/* prologue: frame size=0 */
+  98 0070 CF93      		push r28
+  99 0072 DF93      		push r29
+ 100               	/* prologue end (size=2) */
+ 101 0074 8091 0000 		lds r24,wl_timeout
+ 102 0078 9091 0000 		lds r25,(wl_timeout)+1
+ 103 007c 892B      		or r24,r25
+ 104 007e 01F0      		breq .L14
+ 105 0080 C0E0      		ldi r28,lo8(wl_packet_groups)
+ 106 0082 D0E0      		ldi r29,hi8(wl_packet_groups)
+ 107               	.L16:
+ 108 0084 E881      		ld r30,Y
+ 109 0086 F981      		ldd r31,Y+1
+ 110 0088 3097      		sbiw r30,0
+ 111 008a 01F0      		breq .L17
+ 112 008c 0280      		ldd __tmp_reg__,Z+2
+ 113 008e F381      		ldd r31,Z+3
+ 114 0090 E02D      		mov r30,__tmp_reg__
+ 115 0092 3097      		sbiw r30,0
+ 116 0094 01F0      		breq .L17
+ 117 0096 0995      		icall
+ 118               	.L17:
+ 119 0098 2296      		adiw r28,2
+ 120 009a 80E0      		ldi r24,hi8(wl_packet_groups+32)
+ 121 009c C030      		cpi r28,lo8(wl_packet_groups+32)
+ 122 009e D807      		cpc r29,r24
+ 123 00a0 01F4      		brne .L16
+ 124 00a2 1092 0000 		sts (wl_timeout)+1,__zero_reg__
+ 125 00a6 1092 0000 		sts wl_timeout,__zero_reg__
+ 126               	.L14:
+ 127 00aa 80E0      		ldi r24,lo8(wl_buf)
+ 128 00ac 90E0      		ldi r25,hi8(wl_buf)
+ 129 00ae 0E94 0000 		call xbee_get_packet
+ 130 00b2 9C01      		movw r18,r24
+ 131 00b4 97FD      		sbrc r25,7
+ 132 00b6 00C0      		rjmp .L33
+ 133 00b8 8091 0000 		lds r24,wl_buf
+ 134 00bc 8938      		cpi r24,lo8(-119)
+ 135 00be 01F4      		brne .L23
+ 136 00c0 2330      		cpi r18,3
+ 137 00c2 3105      		cpc r19,__zero_reg__
+ 138 00c4 01F0      		breq .+2
+ 139 00c6 00C0      		rjmp .L33
+ 140 00c8 8091 0000 		lds r24,wl_buf+1
+ 141 00cc 9091 0000 		lds r25,wl_buf+2
+ 142 00d0 E82F      		mov r30,r24
+ 143 00d2 E295      		swap r30
+ 144 00d4 EF70      		andi r30,0x0f
+ 145 00d6 FF27      		clr r31
+ 146 00d8 EE0F      		lsl r30
+ 147 00da FF1F      		rol r31
+ 148 00dc E050      		subi r30,lo8(-(wl_packet_groups))
+ 149 00de F040      		sbci r31,hi8(-(wl_packet_groups))
+ 150 00e0 0190      		ld __tmp_reg__,Z+
+ 151 00e2 F081      		ld r31,Z
+ 152 00e4 E02D      		mov r30,__tmp_reg__
+ 153 00e6 3097      		sbiw r30,0
+ 154 00e8 01F0      		breq .L33
+ 155 00ea 0480      		ldd __tmp_reg__,Z+4
+ 156 00ec F581      		ldd r31,Z+5
+ 157 00ee E02D      		mov r30,__tmp_reg__
+ 158 00f0 3097      		sbiw r30,0
+ 159 00f2 01F0      		breq .L33
+ 160 00f4 60E0      		ldi r22,lo8(0)
+ 161 00f6 70E0      		ldi r23,hi8(0)
+ 162 00f8 9923      		tst r25
+ 163 00fa 01F4      		brne .L28
+ 164 00fc 61E0      		ldi r22,lo8(1)
+ 165 00fe 70E0      		ldi r23,hi8(1)
+ 166               	.L28:
+ 167 0100 9927      		clr r25
+ 168 0102 8F70      		andi r24,lo8(15)
+ 169 0104 9070      		andi r25,hi8(15)
+ 170 0106 0995      		icall
+ 171 0108 00C0      		rjmp .L33
+ 172               	.L23:
+ 173 010a 8138      		cpi r24,lo8(-127)
+ 174 010c 01F4      		brne .L33
+ 175 010e 2730      		cpi r18,7
+ 176 0110 3105      		cpc r19,__zero_reg__
+ 177 0112 04F0      		brlt .L33
+ 178 0114 6091 0000 		lds r22,wl_buf+1
+ 179 0118 9091 0000 		lds r25,wl_buf+2
+ 180 011c 8091 0000 		lds r24,wl_buf+6
+ 181 0120 E091 0000 		lds r30,wl_buf+5
+ 182 0124 FF27      		clr r31
+ 183 0126 EE0F      		lsl r30
+ 184 0128 FF1F      		rol r31
+ 185 012a E050      		subi r30,lo8(-(wl_packet_groups))
+ 186 012c F040      		sbci r31,hi8(-(wl_packet_groups))
+ 187 012e 0190      		ld __tmp_reg__,Z+
+ 188 0130 F081      		ld r31,Z
+ 189 0132 E02D      		mov r30,__tmp_reg__
+ 190 0134 3097      		sbiw r30,0
+ 191 0136 01F0      		breq .L33
+ 192 0138 0680      		ldd __tmp_reg__,Z+6
+ 193 013a F781      		ldd r31,Z+7
+ 194 013c E02D      		mov r30,__tmp_reg__
+ 195 013e 3097      		sbiw r30,0
+ 196 0140 01F0      		breq .L33
+ 197 0142 2750      		subi r18,lo8(-(-7))
+ 198 0144 3040      		sbci r19,hi8(-(-7))
+ 199 0146 7727      		clr r23
+ 200 0148 762F      		mov r23,r22
+ 201 014a 6627      		clr r22
+ 202 014c 690F      		add r22,r25
+ 203 014e 711D      		adc r23,__zero_reg__
+ 204 0150 40E0      		ldi r20,lo8(wl_buf+7)
+ 205 0152 50E0      		ldi r21,hi8(wl_buf+7)
+ 206 0154 0995      		icall
+ 207               	.L33:
+ 208               	/* epilogue: frame size=0 */
+ 209 0156 DF91      		pop r29
+ 210 0158 CF91      		pop r28
+ 211 015a 0895      		ret
+ 212               	/* epilogue end (size=3) */
+ 213               	/* function wl_do size 118 (113) */
+ 216               	wl_send_packet:
+ 217               	/* prologue: frame size=128 */
+ 218 015c AF92      		push r10
+ 219 015e BF92      		push r11
+ 220 0160 CF92      		push r12
+ 221 0162 EF92      		push r14
+ 222 0164 0F93      		push r16
+ 223 0166 1F93      		push r17
+ 224 0168 CF93      		push r28
+ 225 016a DF93      		push r29
+ 226 016c CDB7      		in r28,__SP_L__
+ 227 016e DEB7      		in r29,__SP_H__
+ 228 0170 C058      		subi r28,lo8(128)
+ 229 0172 D040      		sbci r29,hi8(128)
+ 230 0174 0FB6      		in __tmp_reg__,__SREG__
+ 231 0176 F894      		cli
+ 232 0178 DEBF      		out __SP_H__,r29
+ 233 017a 0FBE      		out __SREG__,__tmp_reg__
+ 234 017c CDBF      		out __SP_L__,r28
+ 235               	/* prologue end (size=17) */
+ 236 017e 982F      		mov r25,r24
+ 237 0180 E62F      		mov r30,r22
+ 238 0182 B901      		movw r22,r18
+ 239 0184 5801      		movw r10,r16
+ 240 0186 0C2D      		mov r16,r12
+ 241 0188 CC20      		tst r12
+ 242 018a 01F0      		breq .L37
+ 243 018c 8C2D      		mov r24,r12
+ 244 018e 8F70      		andi r24,lo8(15)
+ 245 0190 092F      		mov r16,r25
+ 246 0192 0295      		swap r16
+ 247 0194 007F      		andi r16,0xf0
+ 248 0196 082B      		or r16,r24
+ 249               	.L37:
+ 250 0198 9983      		std Y+1,r25
+ 251 019a EA83      		std Y+2,r30
+ 252 019c E0E0      		ldi r30,lo8(0)
+ 253 019e F0E0      		ldi r31,hi8(0)
+ 254 01a0 9E01      		movw r18,r28
+ 255 01a2 2D5F      		subi r18,lo8(-(3))
+ 256 01a4 3F4F      		sbci r19,hi8(-(3))
+ 257 01a6 00C0      		rjmp .L39
+ 258               	.L40:
+ 259 01a8 DA01      		movw r26,r20
+ 260 01aa 8D91      		ld r24,X+
+ 261 01ac AD01      		movw r20,r26
+ 262 01ae D901      		movw r26,r18
+ 263 01b0 8D93      		st X+,r24
+ 264 01b2 9D01      		movw r18,r26
+ 265 01b4 3196      		adiw r30,1
+ 266               	.L39:
+ 267 01b6 E617      		cp r30,r22
+ 268 01b8 F707      		cpc r31,r23
+ 269 01ba 04F0      		brlt .L40
+ 270 01bc 6E5F      		subi r22,lo8(-(2))
+ 271 01be 7F4F      		sbci r23,hi8(-(2))
+ 272 01c0 2E2D      		mov r18,r14
+ 273 01c2 A501      		movw r20,r10
+ 274 01c4 CE01      		movw r24,r28
+ 275 01c6 0196      		adiw r24,1
+ 276 01c8 0E94 0000 		call xbee_send_packet
+ 277               	/* epilogue: frame size=128 */
+ 278 01cc C058      		subi r28,lo8(-128)
+ 279 01ce DF4F      		sbci r29,hi8(-128)
+ 280 01d0 0FB6      		in __tmp_reg__,__SREG__
+ 281 01d2 F894      		cli
+ 282 01d4 DEBF      		out __SP_H__,r29
+ 283 01d6 0FBE      		out __SREG__,__tmp_reg__
+ 284 01d8 CDBF      		out __SP_L__,r28
+ 285 01da DF91      		pop r29
+ 286 01dc CF91      		pop r28
+ 287 01de 1F91      		pop r17
+ 288 01e0 0F91      		pop r16
+ 289 01e2 EF90      		pop r14
+ 290 01e4 CF90      		pop r12
+ 291 01e6 BF90      		pop r11
+ 292 01e8 AF90      		pop r10
+ 293 01ea 0895      		ret
+ 294               	/* epilogue end (size=16) */
+ 295               	/* function wl_send_packet size 72 (39) */
+ 297               	.global	wl_send_pan_packet
+ 299               	wl_send_pan_packet:
+ 300               	/* prologue: frame size=0 */
+ 301 01ec CF92      		push r12
+ 302 01ee EF92      		push r14
+ 303 01f0 0F93      		push r16
+ 304 01f2 1F93      		push r17
+ 305               	/* prologue end (size=4) */
+ 306 01f4 C02E      		mov r12,r16
+ 307 01f6 EE24      		clr r14
+ 308 01f8 0FEF      		ldi r16,lo8(-1)
+ 309 01fa 1FEF      		ldi r17,hi8(-1)
+ 310 01fc 0E94 0000 		call wl_send_packet
+ 311               	/* epilogue: frame size=0 */
+ 312 0200 1F91      		pop r17
+ 313 0202 0F91      		pop r16
+ 314 0204 EF90      		pop r14
+ 315 0206 CF90      		pop r12
+ 316 0208 0895      		ret
+ 317               	/* epilogue end (size=5) */
+ 318               	/* function wl_send_pan_packet size 15 (6) */
+ 320               	.global	wl_send_global_packet
+ 322               	wl_send_global_packet:
+ 323               	/* prologue: frame size=0 */
+ 324 020a CF92      		push r12
+ 325 020c EF92      		push r14
+ 326 020e 0F93      		push r16
+ 327 0210 1F93      		push r17
+ 328               	/* prologue end (size=4) */
+ 329 0212 C02E      		mov r12,r16
+ 330 0214 74E0      		ldi r23,lo8(4)
+ 331 0216 E72E      		mov r14,r23
+ 332 0218 0FEF      		ldi r16,lo8(-1)
+ 333 021a 1FEF      		ldi r17,hi8(-1)
+ 334 021c 0E94 0000 		call wl_send_packet
+ 335               	/* epilogue: frame size=0 */
+ 336 0220 1F91      		pop r17
+ 337 0222 0F91      		pop r16
+ 338 0224 EF90      		pop r14
+ 339 0226 CF90      		pop r12
+ 340 0228 0895      		ret
+ 341               	/* epilogue end (size=5) */
+ 342               	/* function wl_send_global_packet size 16 (7) */
+ 344               	.global	wl_send_robot_to_robot_packet
+ 346               	wl_send_robot_to_robot_packet:
+ 347               	/* prologue: frame size=0 */
+ 348 022a CF92      		push r12
+ 349 022c EF92      		push r14
+ 350 022e 0F93      		push r16
+ 351 0230 1F93      		push r17
+ 352               	/* prologue end (size=4) */
+ 353 0232 CE2C      		mov r12,r14
+ 354 0234 EE24      		clr r14
+ 355 0236 0E94 0000 		call wl_send_packet
+ 356               	/* epilogue: frame size=0 */
+ 357 023a 1F91      		pop r17
+ 358 023c 0F91      		pop r16
+ 359 023e EF90      		pop r14
+ 360 0240 CF90      		pop r12
+ 361 0242 0895      		ret
+ 362               	/* epilogue end (size=5) */
+ 363               	/* function wl_send_robot_to_robot_packet size 13 (4) */
+ 365               	.global	wl_send_robot_to_robot_global_packet
+ 367               	wl_send_robot_to_robot_global_packet:
+ 368               	/* prologue: frame size=0 */
+ 369 0244 CF92      		push r12
+ 370 0246 EF92      		push r14
+ 371 0248 0F93      		push r16
+ 372 024a 1F93      		push r17
+ 373               	/* prologue end (size=4) */
+ 374 024c CE2C      		mov r12,r14
+ 375 024e E4E0      		ldi r30,lo8(4)
+ 376 0250 EE2E      		mov r14,r30
+ 377 0252 0E94 0000 		call wl_send_packet
+ 378               	/* epilogue: frame size=0 */
+ 379 0256 1F91      		pop r17
+ 380 0258 0F91      		pop r16
+ 381 025a EF90      		pop r14
+ 382 025c CF90      		pop r12
+ 383 025e 0895      		ret
+ 384               	/* epilogue end (size=5) */
+ 385               	/* function wl_send_robot_to_robot_global_packet size 14 (5) */
+ 387               	.global	wl_get_xbee_id
+ 389               	wl_get_xbee_id:
+ 390               	/* prologue: frame size=0 */
+ 391               	/* prologue end (size=0) */
+ 392 0260 0E94 0000 		call xbee_get_address
+ 393               	/* epilogue: frame size=0 */
+ 394 0264 0895      		ret
+ 395               	/* epilogue end (size=1) */
+ 396               	/* function wl_get_xbee_id size 3 (2) */
+ 398               	.global	wl_get_channel
+ 400               	wl_get_channel:
+ 401               	/* prologue: frame size=0 */
+ 402               	/* prologue end (size=0) */
+ 403 0266 0E94 0000 		call xbee_get_channel
+ 404               	/* epilogue: frame size=0 */
+ 405 026a 0895      		ret
+ 406               	/* epilogue end (size=1) */
+ 407               	/* function wl_get_channel size 3 (2) */
+ 409               	.global	wl_set_channel
+ 411               	wl_set_channel:
+ 412               	/* prologue: frame size=0 */
+ 413               	/* prologue end (size=0) */
+ 414 026c 0E94 0000 		call xbee_set_channel
+ 415               	/* epilogue: frame size=0 */
+ 416 0270 0895      		ret
+ 417               	/* epilogue end (size=1) */
+ 418               	/* function wl_set_channel size 3 (2) */
+ 420               	.global	wl_get_pan
+ 422               	wl_get_pan:
+ 423               	/* prologue: frame size=0 */
+ 424               	/* prologue end (size=0) */
+ 425 0272 0E94 0000 		call xbee_get_pan_id
+ 426               	/* epilogue: frame size=0 */
+ 427 0276 0895      		ret
+ 428               	/* epilogue end (size=1) */
+ 429               	/* function wl_get_pan size 3 (2) */
+ 431               	.global	wl_set_pan
+ 433               	wl_set_pan:
+ 434               	/* prologue: frame size=0 */
+ 435               	/* prologue end (size=0) */
+ 436 0278 0E94 0000 		call xbee_set_pan_id
+ 437               	/* epilogue: frame size=0 */
+ 438 027c 0895      		ret
+ 439               	/* epilogue end (size=1) */
+ 440               	/* function wl_set_pan size 3 (2) */
+ 442               	.global	wl_terminate
+ 444               	wl_terminate:
+ 445               	/* prologue: frame size=0 */
+ 446 027e CF93      		push r28
+ 447 0280 DF93      		push r29
+ 448               	/* prologue end (size=2) */
+ 449 0282 C0E0      		ldi r28,lo8(wl_packet_groups)
+ 450 0284 D0E0      		ldi r29,hi8(wl_packet_groups)
+ 451               	.L62:
+ 452 0286 E881      		ld r30,Y
+ 453 0288 F981      		ldd r31,Y+1
+ 454 028a 3097      		sbiw r30,0
+ 455 028c 01F0      		breq .L63
+ 456 028e 0084      		ldd __tmp_reg__,Z+8
+ 457 0290 F185      		ldd r31,Z+9
+ 458 0292 E02D      		mov r30,__tmp_reg__
+ 459 0294 3097      		sbiw r30,0
+ 460 0296 01F0      		breq .L63
+ 461 0298 0995      		icall
+ 462               	.L63:
+ 463 029a 2296      		adiw r28,2
+ 464 029c 80E0      		ldi r24,hi8(wl_packet_groups+32)
+ 465 029e C030      		cpi r28,lo8(wl_packet_groups+32)
+ 466 02a0 D807      		cpc r29,r24
+ 467 02a2 01F4      		brne .L62
+ 468 02a4 0E94 0000 		call xbee_terminate
+ 469               	/* epilogue: frame size=0 */
+ 470 02a8 DF91      		pop r29
+ 471 02aa CF91      		pop r28
+ 472 02ac 0895      		ret
+ 473               	/* epilogue end (size=3) */
+ 474               	/* function wl_terminate size 24 (19) */
+ 476               	.global	wl_init
+ 478               	wl_init:
+ 479               	/* prologue: frame size=0 */
+ 480               	/* prologue end (size=0) */
+ 481 02ae E0E0      		ldi r30,lo8(wl_packet_groups)
+ 482 02b0 F0E0      		ldi r31,hi8(wl_packet_groups)
+ 483               	.L71:
+ 484 02b2 1192      		st Z+,__zero_reg__
+ 485 02b4 1192      		st Z+,__zero_reg__
+ 486 02b6 20E0      		ldi r18,hi8(wl_packet_groups+32)
+ 487 02b8 E030      		cpi r30,lo8(wl_packet_groups+32)
+ 488 02ba F207      		cpc r31,r18
+ 489 02bc 01F4      		brne .L71
+ 490 02be 0E94 0000 		call xbee_lib_init
+ 491 02c2 8F5F      		subi r24,lo8(-1)
+ 492 02c4 9F4F      		sbci r25,hi8(-1)
+ 493 02c6 01F4      		brne .L73
+ 494 02c8 8FEF      		ldi r24,lo8(-1)
+ 495 02ca 9FEF      		ldi r25,hi8(-1)
+ 496 02cc 0895      		ret
+ 497               	.L73:
+ 498 02ce 60E0      		ldi r22,lo8(gs(timer_handler))
+ 499 02d0 70E0      		ldi r23,hi8(gs(timer_handler))
+ 500 02d2 88E0      		ldi r24,lo8(8)
+ 501 02d4 90E0      		ldi r25,hi8(8)
+ 502 02d6 0E94 0000 		call rtc_init
+ 503 02da 80E0      		ldi r24,lo8(0)
+ 504 02dc 90E0      		ldi r25,hi8(0)
+ 505 02de 0895      		ret
+ 506               	/* epilogue: frame size=0 */
+ 507               	/* epilogue: noreturn */
+ 508               	/* epilogue end (size=0) */
+ 509               	/* function wl_init size 26 (26) */
+ 511               		.lcomm wl_timeout,2
+ 512               		.lcomm wl_buf,128
+ 513               		.lcomm wl_packet_groups,32
+ 514               	/* File "wireless.c": code  369 = 0x0171 ( 279), prologues  39, epilogues  51 */
+DEFINED SYMBOLS
+                            *ABS*:00000000 wireless.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:12     .text:00000000 timer_handler
+                             .bss:00000000 wl_timeout
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:26     .text:0000000e wl_register_packet_group
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:512    .bss:00000082 wl_packet_groups
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:56     .text:00000034 wl_unregister_packet_group
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:96     .text:00000070 wl_do
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:511    .bss:00000002 wl_buf
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:216    .text:0000015c wl_send_packet
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:299    .text:000001ec wl_send_pan_packet
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:322    .text:0000020a wl_send_global_packet
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:346    .text:0000022a wl_send_robot_to_robot_packet
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:367    .text:00000244 wl_send_robot_to_robot_global_packet
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:389    .text:00000260 wl_get_xbee_id
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:400    .text:00000266 wl_get_channel
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:411    .text:0000026c wl_set_channel
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:422    .text:00000272 wl_get_pan
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:433    .text:00000278 wl_set_pan
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:444    .text:0000027e wl_terminate
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccu8lDFd.s:478    .text:000002ae wl_init
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+xbee_get_packet
+xbee_send_packet
+xbee_get_address
+xbee_get_channel
+xbee_set_channel
+xbee_get_pan_id
+xbee_set_pan_id
+xbee_terminate
+xbee_lib_init
+rtc_init
Index: demos/hunter_prey_john/projects/libwireless/lib/wl_token_ring.lst
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wl_token_ring.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wl_token_ring.lst	(revision 1694)
@@ -0,0 +1,1093 @@
+   1               		.file	"wl_token_ring.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  10               		.text
+  11               	.global	wl_token_ring_leave
+  13               	wl_token_ring_leave:
+  14               	/* prologue: frame size=0 */
+  15               	/* prologue end (size=0) */
+  16 0000 84E0      		ldi r24,lo8(4)
+  17 0002 90E0      		ldi r25,hi8(4)
+  18 0004 9093 0000 		sts (ringState)+1,r25
+  19 0008 8093 0000 		sts ringState,r24
+  20               	/* epilogue: frame size=0 */
+  21 000c 0895      		ret
+  22               	/* epilogue end (size=1) */
+  23               	/* function wl_token_ring_leave size 7 (6) */
+  25               	.global	wl_token_ring_set_bom_functions
+  27               	wl_token_ring_set_bom_functions:
+  28               	/* prologue: frame size=0 */
+  29               	/* prologue end (size=0) */
+  30 000e 9093 0000 		sts (bom_on_function)+1,r25
+  31 0012 8093 0000 		sts bom_on_function,r24
+  32 0016 7093 0000 		sts (bom_off_function)+1,r23
+  33 001a 6093 0000 		sts bom_off_function,r22
+  34 001e 5093 0000 		sts (get_max_bom_function)+1,r21
+  35 0022 4093 0000 		sts get_max_bom_function,r20
+  36               	/* epilogue: frame size=0 */
+  37 0026 0895      		ret
+  38               	/* epilogue end (size=1) */
+  39               	/* function wl_token_ring_set_bom_functions size 13 (12) */
+  42               	wl_token_ring_cleanup:
+  43               	/* prologue: frame size=0 */
+  44               	/* prologue end (size=0) */
+  45               	/* epilogue: frame size=0 */
+  46 0028 0895      		ret
+  47               	/* epilogue end (size=1) */
+  48               	/* function wl_token_ring_cleanup size 1 (0) */
+  51               	wl_token_ring_response_handler:
+  52               	/* prologue: frame size=0 */
+  53               	/* prologue end (size=0) */
+  54               	/* epilogue: frame size=0 */
+  55 002a 0895      		ret
+  56               	/* epilogue end (size=1) */
+  57               	/* function wl_token_ring_response_handler size 1 (0) */
+  59               	.global	wl_token_iterator_has_next
+  61               	wl_token_iterator_has_next:
+  62               	/* prologue: frame size=0 */
+  63               	/* prologue end (size=0) */
+  64 002c 20E0      		ldi r18,lo8(0)
+  65 002e 30E0      		ldi r19,hi8(0)
+  66 0030 8091 0000 		lds r24,iteratorCount
+  67 0034 9091 0000 		lds r25,(iteratorCount)+1
+  68 0038 8F5F      		subi r24,lo8(-1)
+  69 003a 9F4F      		sbci r25,hi8(-1)
+  70 003c 01F0      		breq .L10
+  71 003e 21E0      		ldi r18,lo8(1)
+  72 0040 30E0      		ldi r19,hi8(1)
+  73               	.L10:
+  74 0042 C901      		movw r24,r18
+  75               	/* epilogue: frame size=0 */
+  76 0044 0895      		ret
+  77               	/* epilogue end (size=1) */
+  78               	/* function wl_token_iterator_has_next size 14 (13) */
+  80               	.global	wl_token_get_matrix_size
+  82               	wl_token_get_matrix_size:
+  83               	/* prologue: frame size=0 */
+  84               	/* prologue end (size=0) */
+  85 0046 0E94 0000 		call sensor_matrix_get_size
+  86               	/* epilogue: frame size=0 */
+  87 004a 0895      		ret
+  88               	/* epilogue end (size=1) */
+  89               	/* function wl_token_get_matrix_size size 3 (2) */
+  91               	.global	wl_token_get_num_robots
+  93               	wl_token_get_num_robots:
+  94               	/* prologue: frame size=0 */
+  95               	/* prologue end (size=0) */
+  96 004c 0E94 0000 		call sensor_matrix_get_joined
+  97               	/* epilogue: frame size=0 */
+  98 0050 0895      		ret
+  99               	/* epilogue end (size=1) */
+ 100               	/* function wl_token_get_num_robots size 3 (2) */
+ 102               	.global	wl_token_get_robots_in_ring
+ 104               	wl_token_get_robots_in_ring:
+ 105               	/* prologue: frame size=0 */
+ 106               	/* prologue end (size=0) */
+ 107 0052 0E94 0000 		call sensor_matrix_get_joined
+ 108               	/* epilogue: frame size=0 */
+ 109 0056 0895      		ret
+ 110               	/* epilogue end (size=1) */
+ 111               	/* function wl_token_get_robots_in_ring size 3 (2) */
+ 113               	.global	wl_token_iterator_next
+ 115               	wl_token_iterator_next:
+ 116               	/* prologue: frame size=0 */
+ 117 0058 0F93      		push r16
+ 118 005a 1F93      		push r17
+ 119 005c CF93      		push r28
+ 120 005e DF93      		push r29
+ 121               	/* prologue end (size=4) */
+ 122 0060 C091 0000 		lds r28,iteratorCount
+ 123 0064 D091 0000 		lds r29,(iteratorCount)+1
+ 124 0068 D7FD      		sbrc r29,7
+ 125 006a 00C0      		rjmp .L19
+ 126 006c 2196      		adiw r28,1
+ 127 006e D093 0000 		sts (iteratorCount)+1,r29
+ 128 0072 C093 0000 		sts iteratorCount,r28
+ 129 0076 2197      		sbiw r28,1
+ 130 0078 00C0      		rjmp .L21
+ 131               	.L22:
+ 132 007a 8091 0000 		lds r24,iteratorCount
+ 133 007e 9091 0000 		lds r25,(iteratorCount)+1
+ 134 0082 0196      		adiw r24,1
+ 135 0084 9093 0000 		sts (iteratorCount)+1,r25
+ 136 0088 8093 0000 		sts iteratorCount,r24
+ 137               	.L21:
+ 138 008c 8091 0000 		lds r24,iteratorCount
+ 139 0090 9091 0000 		lds r25,(iteratorCount)+1
+ 140 0094 0E94 0000 		call sensor_matrix_get_in_ring
+ 141 0098 892B      		or r24,r25
+ 142 009a 01F4      		brne .L23
+ 143 009c 0091 0000 		lds r16,iteratorCount
+ 144 00a0 1091 0000 		lds r17,(iteratorCount)+1
+ 145 00a4 0E94 0000 		call sensor_matrix_get_size
+ 146 00a8 0817      		cp r16,r24
+ 147 00aa 1907      		cpc r17,r25
+ 148 00ac 04F0      		brlt .L22
+ 149               	.L23:
+ 150 00ae 0091 0000 		lds r16,iteratorCount
+ 151 00b2 1091 0000 		lds r17,(iteratorCount)+1
+ 152 00b6 0E94 0000 		call sensor_matrix_get_size
+ 153 00ba 0817      		cp r16,r24
+ 154 00bc 1907      		cpc r17,r25
+ 155 00be 01F4      		brne .L19
+ 156 00c0 8FEF      		ldi r24,lo8(-1)
+ 157 00c2 9FEF      		ldi r25,hi8(-1)
+ 158 00c4 9093 0000 		sts (iteratorCount)+1,r25
+ 159 00c8 8093 0000 		sts iteratorCount,r24
+ 160               	.L19:
+ 161 00cc CE01      		movw r24,r28
+ 162               	/* epilogue: frame size=0 */
+ 163 00ce DF91      		pop r29
+ 164 00d0 CF91      		pop r28
+ 165 00d2 1F91      		pop r17
+ 166 00d4 0F91      		pop r16
+ 167 00d6 0895      		ret
+ 168               	/* epilogue end (size=5) */
+ 169               	/* function wl_token_iterator_next size 64 (55) */
+ 171               	.global	wl_token_iterator_begin
+ 173               	wl_token_iterator_begin:
+ 174               	/* prologue: frame size=0 */
+ 175 00d8 CF93      		push r28
+ 176 00da DF93      		push r29
+ 177               	/* prologue end (size=2) */
+ 178 00dc C0E0      		ldi r28,lo8(0)
+ 179 00de D0E0      		ldi r29,hi8(0)
+ 180 00e0 00C0      		rjmp .L28
+ 181               	.L29:
+ 182 00e2 2196      		adiw r28,1
+ 183               	.L28:
+ 184 00e4 CE01      		movw r24,r28
+ 185 00e6 0E94 0000 		call sensor_matrix_get_in_ring
+ 186 00ea 892B      		or r24,r25
+ 187 00ec 01F4      		brne .L30
+ 188 00ee 0E94 0000 		call sensor_matrix_get_size
+ 189 00f2 C817      		cp r28,r24
+ 190 00f4 D907      		cpc r29,r25
+ 191 00f6 04F0      		brlt .L29
+ 192               	.L30:
+ 193 00f8 0E94 0000 		call sensor_matrix_get_size
+ 194 00fc C817      		cp r28,r24
+ 195 00fe D907      		cpc r29,r25
+ 196 0100 01F4      		brne .L32
+ 197 0102 CFEF      		ldi r28,lo8(-1)
+ 198 0104 DFEF      		ldi r29,hi8(-1)
+ 199               	.L32:
+ 200 0106 D093 0000 		sts (iteratorCount)+1,r29
+ 201 010a C093 0000 		sts iteratorCount,r28
+ 202               	/* epilogue: frame size=0 */
+ 203 010e DF91      		pop r29
+ 204 0110 CF91      		pop r28
+ 205 0112 0895      		ret
+ 206               	/* epilogue end (size=3) */
+ 207               	/* function wl_token_iterator_begin size 30 (25) */
+ 209               	.global	wl_token_is_robot_in_ring
+ 211               	wl_token_is_robot_in_ring:
+ 212               	/* prologue: frame size=0 */
+ 213               	/* prologue end (size=0) */
+ 214 0114 0E94 0000 		call sensor_matrix_get_in_ring
+ 215               	/* epilogue: frame size=0 */
+ 216 0118 0895      		ret
+ 217               	/* epilogue end (size=1) */
+ 218               	/* function wl_token_is_robot_in_ring size 3 (2) */
+ 220               	.global	wl_token_get_sensor_reading
+ 222               	wl_token_get_sensor_reading:
+ 223               	/* prologue: frame size=0 */
+ 224 011a 0F93      		push r16
+ 225 011c 1F93      		push r17
+ 226 011e CF93      		push r28
+ 227 0120 DF93      		push r29
+ 228               	/* prologue end (size=4) */
+ 229 0122 EC01      		movw r28,r24
+ 230 0124 8B01      		movw r16,r22
+ 231 0126 CB01      		movw r24,r22
+ 232 0128 0E94 0000 		call wl_token_is_robot_in_ring
+ 233 012c 892B      		or r24,r25
+ 234 012e 01F0      		breq .L38
+ 235 0130 0E94 0000 		call wl_get_xbee_id
+ 236 0134 C817      		cp r28,r24
+ 237 0136 D907      		cpc r29,r25
+ 238 0138 01F0      		breq .L40
+ 239 013a CE01      		movw r24,r28
+ 240 013c 0E94 0000 		call wl_token_is_robot_in_ring
+ 241 0140 892B      		or r24,r25
+ 242 0142 01F0      		breq .L38
+ 243               	.L40:
+ 244 0144 B801      		movw r22,r16
+ 245 0146 CE01      		movw r24,r28
+ 246 0148 0E94 0000 		call sensor_matrix_get_reading
+ 247 014c 00C0      		rjmp .L42
+ 248               	.L38:
+ 249 014e 8FEF      		ldi r24,lo8(-1)
+ 250 0150 9FEF      		ldi r25,hi8(-1)
+ 251               	.L42:
+ 252               	/* epilogue: frame size=0 */
+ 253 0152 DF91      		pop r29
+ 254 0154 CF91      		pop r28
+ 255 0156 1F91      		pop r17
+ 256 0158 0F91      		pop r16
+ 257 015a 0895      		ret
+ 258               	/* epilogue end (size=5) */
+ 259               	/* function wl_token_get_sensor_reading size 33 (24) */
+ 261               	.global	wl_token_get_my_sensor_reading
+ 263               	wl_token_get_my_sensor_reading:
+ 264               	/* prologue: frame size=0 */
+ 265 015c 0F93      		push r16
+ 266 015e 1F93      		push r17
+ 267               	/* prologue end (size=2) */
+ 268 0160 8C01      		movw r16,r24
+ 269 0162 0E94 0000 		call wl_get_xbee_id
+ 270 0166 B801      		movw r22,r16
+ 271 0168 0E94 0000 		call wl_token_get_sensor_reading
+ 272               	/* epilogue: frame size=0 */
+ 273 016c 1F91      		pop r17
+ 274 016e 0F91      		pop r16
+ 275 0170 0895      		ret
+ 276               	/* epilogue end (size=3) */
+ 277               	/* function wl_token_get_my_sensor_reading size 11 (6) */
+ 279               	.global	wl_token_ring_unregister
+ 281               	wl_token_ring_unregister:
+ 282               	/* prologue: frame size=0 */
+ 283               	/* prologue end (size=0) */
+ 284 0172 80E0      		ldi r24,lo8(wl_token_ring_handler)
+ 285 0174 90E0      		ldi r25,hi8(wl_token_ring_handler)
+ 286 0176 0E94 0000 		call wl_unregister_packet_group
+ 287               	/* epilogue: frame size=0 */
+ 288 017a 0895      		ret
+ 289               	/* epilogue end (size=1) */
+ 290               	/* function wl_token_ring_unregister size 5 (4) */
+ 292               	.global	wl_token_ring_join
+ 294               	wl_token_ring_join:
+ 295               	/* prologue: frame size=0 */
+ 296 017c 0F93      		push r16
+ 297               	/* prologue end (size=1) */
+ 298 017e 82E0      		ldi r24,lo8(2)
+ 299 0180 90E0      		ldi r25,hi8(2)
+ 300 0182 9093 0000 		sts (ringState)+1,r25
+ 301 0186 8093 0000 		sts ringState,r24
+ 302 018a 88E0      		ldi r24,lo8(8)
+ 303 018c 90E0      		ldi r25,hi8(8)
+ 304 018e 9093 0000 		sts (joinDelay)+1,r25
+ 305 0192 8093 0000 		sts joinDelay,r24
+ 306 0196 00E0      		ldi r16,lo8(0)
+ 307 0198 20E0      		ldi r18,lo8(0)
+ 308 019a 30E0      		ldi r19,hi8(0)
+ 309 019c 40E0      		ldi r20,lo8(0)
+ 310 019e 50E0      		ldi r21,hi8(0)
+ 311 01a0 64E0      		ldi r22,lo8(4)
+ 312 01a2 82E0      		ldi r24,lo8(2)
+ 313 01a4 0E94 0000 		call wl_send_global_packet
+ 314 01a8 892B      		or r24,r25
+ 315 01aa 01F0      		breq .L49
+ 316 01ac 8FEF      		ldi r24,lo8(-1)
+ 317 01ae 9FEF      		ldi r25,hi8(-1)
+ 318 01b0 00C0      		rjmp .L51
+ 319               	.L49:
+ 320 01b2 80E0      		ldi r24,lo8(0)
+ 321 01b4 90E0      		ldi r25,hi8(0)
+ 322               	.L51:
+ 323               	/* epilogue: frame size=0 */
+ 324 01b6 0F91      		pop r16
+ 325 01b8 0895      		ret
+ 326               	/* epilogue end (size=2) */
+ 327               	/* function wl_token_ring_join size 31 (28) */
+ 330               	wl_token_pass_token:
+ 331               	/* prologue: frame size=0 */
+ 332 01ba 6F92      		push r6
+ 333 01bc 7F92      		push r7
+ 334 01be 9F92      		push r9
+ 335 01c0 AF92      		push r10
+ 336 01c2 BF92      		push r11
+ 337 01c4 CF92      		push r12
+ 338 01c6 DF92      		push r13
+ 339 01c8 EF92      		push r14
+ 340 01ca FF92      		push r15
+ 341 01cc 0F93      		push r16
+ 342 01ce 1F93      		push r17
+ 343 01d0 CF93      		push r28
+ 344 01d2 DF93      		push r29
+ 345 01d4 CDB7      		in r28,__SP_L__
+ 346 01d6 DEB7      		in r29,__SP_H__
+ 347               	/* prologue end (size=15) */
+ 348 01d8 6DB6      		in r6,__SP_L__
+ 349 01da 7EB6      		in r7,__SP_H__
+ 350 01dc 0E94 0000 		call wl_get_xbee_id
+ 351 01e0 8C01      		movw r16,r24
+ 352 01e2 0E94 0000 		call sensor_matrix_get_size
+ 353 01e6 880F      		lsl r24
+ 354 01e8 991F      		rol r25
+ 355 01ea 2DB7      		in r18,__SP_L__
+ 356 01ec 3EB7      		in r19,__SP_H__
+ 357 01ee 281B      		sub r18,r24
+ 358 01f0 390B      		sbc r19,r25
+ 359 01f2 0FB6      		in __tmp_reg__,__SREG__
+ 360 01f4 F894      		cli
+ 361 01f6 3EBF      		out __SP_H__,r19
+ 362 01f8 0FBE      		out __SREG__,__tmp_reg__
+ 363 01fa 2DBF      		out __SP_L__,r18
+ 364 01fc ADB6      		in r10,__SP_L__
+ 365 01fe BEB6      		in r11,__SP_H__
+ 366 0200 0894      		sec
+ 367 0202 A11C      		adc r10,__zero_reg__
+ 368 0204 B11C      		adc r11,__zero_reg__
+ 369 0206 8091 0000 		lds r24,accepted
+ 370 020a 9091 0000 		lds r25,(accepted)+1
+ 371 020e 3FEF      		ldi r19,hi8(-1)
+ 372 0210 8F3F      		cpi r24,lo8(-1)
+ 373 0212 9307      		cpc r25,r19
+ 374 0214 01F4      		brne .L54
+ 375               	.L74:
+ 376 0216 0F5F      		subi r16,lo8(-(1))
+ 377 0218 1F4F      		sbci r17,hi8(-(1))
+ 378 021a 0E94 0000 		call sensor_matrix_get_size
+ 379 021e 0817      		cp r16,r24
+ 380 0220 1907      		cpc r17,r25
+ 381 0222 01F4      		brne .L57
+ 382 0224 00E0      		ldi r16,lo8(0)
+ 383 0226 10E0      		ldi r17,hi8(0)
+ 384               	.L57:
+ 385 0228 C801      		movw r24,r16
+ 386 022a 0E94 0000 		call sensor_matrix_get_in_ring
+ 387 022e 892B      		or r24,r25
+ 388 0230 01F0      		breq .+2
+ 389 0232 00C0      		rjmp .L73
+ 390 0234 00C0      		rjmp .L74
+ 391               	.L54:
+ 392 0236 61E0      		ldi r22,lo8(1)
+ 393 0238 70E0      		ldi r23,hi8(1)
+ 394 023a 0E94 0000 		call sensor_matrix_set_in_ring
+ 395 023e 9090 0000 		lds r9,accepted
+ 396 0242 8FEF      		ldi r24,lo8(-1)
+ 397 0244 9FEF      		ldi r25,hi8(-1)
+ 398 0246 9093 0000 		sts (accepted)+1,r25
+ 399 024a 8093 0000 		sts accepted,r24
+ 400               	.L61:
+ 401 024e 00E0      		ldi r16,lo8(0)
+ 402 0250 10E0      		ldi r17,hi8(0)
+ 403 0252 CC24      		clr r12
+ 404 0254 DD24      		clr r13
+ 405 0256 7501      		movw r14,r10
+ 406 0258 00C0      		rjmp .L62
+ 407               	.L63:
+ 408 025a C801      		movw r24,r16
+ 409 025c 0E94 0000 		call sensor_matrix_get_in_ring
+ 410 0260 892B      		or r24,r25
+ 411 0262 01F0      		breq .L64
+ 412 0264 0E94 0000 		call wl_get_xbee_id
+ 413 0268 0817      		cp r16,r24
+ 414 026a 1907      		cpc r17,r25
+ 415 026c 01F0      		breq .L64
+ 416 026e F701      		movw r30,r14
+ 417 0270 0083      		st Z,r16
+ 418 0272 0E94 0000 		call wl_get_xbee_id
+ 419 0276 B801      		movw r22,r16
+ 420 0278 0E94 0000 		call sensor_matrix_get_reading
+ 421 027c F701      		movw r30,r14
+ 422 027e 8183      		std Z+1,r24
+ 423 0280 0894      		sec
+ 424 0282 C11C      		adc r12,__zero_reg__
+ 425 0284 D11C      		adc r13,__zero_reg__
+ 426 0286 22E0      		ldi r18,lo8(2)
+ 427 0288 30E0      		ldi r19,hi8(2)
+ 428 028a E20E      		add r14,r18
+ 429 028c F31E      		adc r15,r19
+ 430               	.L64:
+ 431 028e 0F5F      		subi r16,lo8(-(1))
+ 432 0290 1F4F      		sbci r17,hi8(-(1))
+ 433               	.L62:
+ 434 0292 0E94 0000 		call sensor_matrix_get_size
+ 435 0296 0817      		cp r16,r24
+ 436 0298 1907      		cpc r17,r25
+ 437 029a 04F0      		brlt .L63
+ 438 029c CC0C      		lsl r12
+ 439 029e DD1C      		rol r13
+ 440 02a0 00E0      		ldi r16,lo8(0)
+ 441 02a2 9601      		movw r18,r12
+ 442 02a4 A501      		movw r20,r10
+ 443 02a6 62E0      		ldi r22,lo8(2)
+ 444 02a8 82E0      		ldi r24,lo8(2)
+ 445 02aa 0E94 0000 		call wl_send_global_packet
+ 446 02ae 892B      		or r24,r25
+ 447 02b0 01F4      		brne .L68
+ 448 02b2 C92C      		mov r12,r9
+ 449 02b4 DD24      		clr r13
+ 450 02b6 82E0      		ldi r24,lo8(2)
+ 451 02b8 E82E      		mov r14,r24
+ 452 02ba 8601      		movw r16,r12
+ 453 02bc 20E0      		ldi r18,lo8(0)
+ 454 02be 30E0      		ldi r19,hi8(0)
+ 455 02c0 40E0      		ldi r20,lo8(0)
+ 456 02c2 50E0      		ldi r21,hi8(0)
+ 457 02c4 61E0      		ldi r22,lo8(1)
+ 458 02c6 82E0      		ldi r24,lo8(2)
+ 459 02c8 0E94 0000 		call wl_send_robot_to_robot_global_packet
+ 460 02cc 892B      		or r24,r25
+ 461 02ce 01F4      		brne .L68
+ 462 02d0 D092 0000 		sts (wl_token_next_robot)+1,r13
+ 463 02d4 C092 0000 		sts wl_token_next_robot,r12
+ 464 02d8 84E0      		ldi r24,lo8(4)
+ 465 02da 90E0      		ldi r25,hi8(4)
+ 466 02dc 9093 0000 		sts (deathDelay)+1,r25
+ 467 02e0 8093 0000 		sts deathDelay,r24
+ 468 02e4 80E0      		ldi r24,lo8(0)
+ 469 02e6 90E0      		ldi r25,hi8(0)
+ 470 02e8 00C0      		rjmp .L71
+ 471               	.L73:
+ 472 02ea 902E      		mov r9,r16
+ 473 02ec 00C0      		rjmp .L61
+ 474               	.L68:
+ 475 02ee 8FEF      		ldi r24,lo8(-1)
+ 476 02f0 9FEF      		ldi r25,hi8(-1)
+ 477               	.L71:
+ 478 02f2 0FB6      		in __tmp_reg__,__SREG__
+ 479 02f4 F894      		cli
+ 480 02f6 7EBE      		out __SP_H__,r7
+ 481 02f8 0FBE      		out __SREG__,__tmp_reg__
+ 482 02fa 6DBE      		out __SP_L__,r6
+ 483               	/* epilogue: frame size=0 */
+ 484 02fc DF91      		pop r29
+ 485 02fe CF91      		pop r28
+ 486 0300 1F91      		pop r17
+ 487 0302 0F91      		pop r16
+ 488 0304 FF90      		pop r15
+ 489 0306 EF90      		pop r14
+ 490 0308 DF90      		pop r13
+ 491 030a CF90      		pop r12
+ 492 030c BF90      		pop r11
+ 493 030e AF90      		pop r10
+ 494 0310 9F90      		pop r9
+ 495 0312 7F90      		pop r7
+ 496 0314 6F90      		pop r6
+ 497 0316 0895      		ret
+ 498               	/* epilogue end (size=14) */
+ 499               	/* function wl_token_pass_token size 175 (146) */
+ 502               	wl_token_ring_receive_handler:
+ 503               	/* prologue: frame size=0 */
+ 504 0318 AF92      		push r10
+ 505 031a BF92      		push r11
+ 506 031c CF92      		push r12
+ 507 031e DF92      		push r13
+ 508 0320 EF92      		push r14
+ 509 0322 FF92      		push r15
+ 510 0324 0F93      		push r16
+ 511 0326 1F93      		push r17
+ 512 0328 CF93      		push r28
+ 513 032a DF93      		push r29
+ 514               	/* prologue end (size=10) */
+ 515 032c 6B01      		movw r12,r22
+ 516 032e 8A01      		movw r16,r20
+ 517 0330 E901      		movw r28,r18
+ 518 0332 8330      		cpi r24,lo8(3)
+ 519 0334 01F4      		brne .+2
+ 520 0336 00C0      		rjmp .L79
+ 521 0338 8430      		cpi r24,lo8(4)
+ 522 033a 00F4      		brsh .L82
+ 523 033c 8130      		cpi r24,lo8(1)
+ 524 033e 01F0      		breq .L77
+ 525 0340 8230      		cpi r24,lo8(2)
+ 526 0342 01F0      		breq .+2
+ 527 0344 00C0      		rjmp .L137
+ 528 0346 00C0      		rjmp .L78
+ 529               	.L82:
+ 530 0348 8430      		cpi r24,lo8(4)
+ 531 034a 01F4      		brne .+2
+ 532 034c 00C0      		rjmp .L80
+ 533 034e 8530      		cpi r24,lo8(5)
+ 534 0350 01F0      		breq .+2
+ 535 0352 00C0      		rjmp .L137
+ 536 0354 00C0      		rjmp .L81
+ 537               	.L77:
+ 538 0356 8091 0000 		lds r24,wl_token_next_robot
+ 539 035a 9091 0000 		lds r25,(wl_token_next_robot)+1
+ 540 035e 6817      		cp r22,r24
+ 541 0360 7907      		cpc r23,r25
+ 542 0362 01F0      		breq .L83
+ 543 0364 0E94 0000 		call wl_get_xbee_id
+ 544 0368 2091 0000 		lds r18,wl_token_next_robot
+ 545 036c 3091 0000 		lds r19,(wl_token_next_robot)+1
+ 546 0370 8217      		cp r24,r18
+ 547 0372 9307      		cpc r25,r19
+ 548 0374 01F0      		breq .L83
+ 549 0376 8091 0000 		lds r24,bom_on_count
+ 550 037a 9091 0000 		lds r25,(bom_on_count)+1
+ 551 037e 0397      		sbiw r24,3
+ 552 0380 04F4      		brge .L83
+ 553 0382 8091 0000 		lds r24,ringState
+ 554 0386 9091 0000 		lds r25,(ringState)+1
+ 555 038a 0397      		sbiw r24,3
+ 556 038c 01F0      		breq .+2
+ 557 038e 00C0      		rjmp .L137
+ 558               	.L83:
+ 559 0390 CFEF      		ldi r28,lo8(-1)
+ 560 0392 DFEF      		ldi r29,hi8(-1)
+ 561 0394 D093 0000 		sts (bom_on_count)+1,r29
+ 562 0398 C093 0000 		sts bom_on_count,r28
+ 563 039c D093 0000 		sts (deathDelay)+1,r29
+ 564 03a0 C093 0000 		sts deathDelay,r28
+ 565 03a4 61E0      		ldi r22,lo8(1)
+ 566 03a6 70E0      		ldi r23,hi8(1)
+ 567 03a8 C601      		movw r24,r12
+ 568 03aa 0E94 0000 		call sensor_matrix_set_in_ring
+ 569 03ae 8091 0000 		lds r24,ringState
+ 570 03b2 9091 0000 		lds r25,(ringState)+1
+ 571 03b6 8330      		cpi r24,3
+ 572 03b8 9105      		cpc r25,__zero_reg__
+ 573 03ba 01F4      		brne .L87
+ 574 03bc 0E94 0000 		call wl_get_xbee_id
+ 575 03c0 61E0      		ldi r22,lo8(1)
+ 576 03c2 70E0      		ldi r23,hi8(1)
+ 577 03c4 0E94 0000 		call sensor_matrix_set_in_ring
+ 578 03c8 81E0      		ldi r24,lo8(1)
+ 579 03ca 90E0      		ldi r25,hi8(1)
+ 580 03cc 9093 0000 		sts (ringState)+1,r25
+ 581 03d0 8093 0000 		sts ringState,r24
+ 582 03d4 D093 0000 		sts (joinDelay)+1,r29
+ 583 03d8 C093 0000 		sts joinDelay,r28
+ 584 03dc 00C0      		rjmp .L89
+ 585               	.L87:
+ 586 03de 8430      		cpi r24,4
+ 587 03e0 9105      		cpc r25,__zero_reg__
+ 588 03e2 01F0      		breq .L90
+ 589 03e4 892B      		or r24,r25
+ 590 03e6 01F4      		brne .L89
+ 591               	.L90:
+ 592 03e8 0E94 0000 		call wl_get_xbee_id
+ 593 03ec 60E0      		ldi r22,lo8(0)
+ 594 03ee 70E0      		ldi r23,hi8(0)
+ 595 03f0 00C0      		rjmp .L140
+ 596               	.L89:
+ 597 03f2 00E0      		ldi r16,lo8(0)
+ 598 03f4 20E0      		ldi r18,lo8(0)
+ 599 03f6 30E0      		ldi r19,hi8(0)
+ 600 03f8 40E0      		ldi r20,lo8(0)
+ 601 03fa 50E0      		ldi r21,hi8(0)
+ 602 03fc 63E0      		ldi r22,lo8(3)
+ 603 03fe 82E0      		ldi r24,lo8(2)
+ 604 0400 0E94 0000 		call wl_send_global_packet
+ 605 0404 E091 0000 		lds r30,bom_on_function
+ 606 0408 F091 0000 		lds r31,(bom_on_function)+1
+ 607 040c 0995      		icall
+ 608 040e 84E6      		ldi r24,lo8(100)
+ 609 0410 90E0      		ldi r25,hi8(100)
+ 610 0412 0E94 0000 		call delay_ms
+ 611 0416 E091 0000 		lds r30,bom_off_function
+ 612 041a F091 0000 		lds r31,(bom_off_function)+1
+ 613 041e 0995      		icall
+ 614 0420 0E94 0000 		call wl_get_xbee_id
+ 615 0424 0E94 0000 		call sensor_matrix_get_in_ring
+ 616 0428 892B      		or r24,r25
+ 617 042a 01F4      		brne .+2
+ 618 042c 00C0      		rjmp .L137
+ 619 042e 00C0      		rjmp .L141
+ 620               	.L78:
+ 621 0430 8FEF      		ldi r24,lo8(-1)
+ 622 0432 9FEF      		ldi r25,hi8(-1)
+ 623 0434 9093 0000 		sts (bom_on_count)+1,r25
+ 624 0438 8093 0000 		sts bom_on_count,r24
+ 625 043c 9093 0000 		sts (deathDelay)+1,r25
+ 626 0440 8093 0000 		sts deathDelay,r24
+ 627 0444 61E0      		ldi r22,lo8(1)
+ 628 0446 70E0      		ldi r23,hi8(1)
+ 629 0448 C601      		movw r24,r12
+ 630 044a 0E94 0000 		call sensor_matrix_set_in_ring
+ 631 044e CE01      		movw r24,r28
+ 632 0450 62E0      		ldi r22,lo8(2)
+ 633 0452 70E0      		ldi r23,hi8(2)
+ 634 0454 0E94 0000 		call __divmodhi4
+ 635 0458 5B01      		movw r10,r22
+ 636 045a C0E0      		ldi r28,lo8(0)
+ 637 045c D0E0      		ldi r29,hi8(0)
+ 638 045e EE24      		clr r14
+ 639 0460 FF24      		clr r15
+ 640 0462 00C0      		rjmp .L93
+ 641               	.L94:
+ 642 0464 CC15      		cp r28,r12
+ 643 0466 DD05      		cpc r29,r13
+ 644 0468 01F4      		brne .+2
+ 645 046a 00C0      		rjmp .L95
+ 646 046c EA14      		cp r14,r10
+ 647 046e FB04      		cpc r15,r11
+ 648 0470 04F4      		brge .L97
+ 649 0472 F801      		movw r30,r16
+ 650 0474 8081      		ld r24,Z
+ 651 0476 9927      		clr r25
+ 652 0478 8C17      		cp r24,r28
+ 653 047a 9D07      		cpc r25,r29
+ 654 047c 01F4      		brne .L97
+ 655 047e 8091 0000 		lds r24,accepted
+ 656 0482 9091 0000 		lds r25,(accepted)+1
+ 657 0486 8C17      		cp r24,r28
+ 658 0488 9D07      		cpc r25,r29
+ 659 048a 01F4      		brne .L100
+ 660 048c 8FEF      		ldi r24,lo8(-1)
+ 661 048e 9FEF      		ldi r25,hi8(-1)
+ 662 0490 9093 0000 		sts (accepted)+1,r25
+ 663 0494 8093 0000 		sts accepted,r24
+ 664               	.L100:
+ 665 0498 F801      		movw r30,r16
+ 666 049a 4181      		ldd r20,Z+1
+ 667 049c 5527      		clr r21
+ 668 049e BE01      		movw r22,r28
+ 669 04a0 C601      		movw r24,r12
+ 670 04a2 0E94 0000 		call sensor_matrix_set_reading
+ 671 04a6 CE01      		movw r24,r28
+ 672 04a8 0E94 0000 		call sensor_matrix_get_in_ring
+ 673 04ac 61E0      		ldi r22,lo8(1)
+ 674 04ae 70E0      		ldi r23,hi8(1)
+ 675 04b0 CE01      		movw r24,r28
+ 676 04b2 0E94 0000 		call sensor_matrix_set_in_ring
+ 677 04b6 0894      		sec
+ 678 04b8 E11C      		adc r14,__zero_reg__
+ 679 04ba F11C      		adc r15,__zero_reg__
+ 680 04bc 0E5F      		subi r16,lo8(-(2))
+ 681 04be 1F4F      		sbci r17,hi8(-(2))
+ 682 04c0 00C0      		rjmp .L95
+ 683               	.L97:
+ 684 04c2 CE01      		movw r24,r28
+ 685 04c4 0E94 0000 		call sensor_matrix_get_in_ring
+ 686 04c8 892B      		or r24,r25
+ 687 04ca 01F0      		breq .L102
+ 688 04cc 60E0      		ldi r22,lo8(0)
+ 689 04ce 70E0      		ldi r23,hi8(0)
+ 690 04d0 CE01      		movw r24,r28
+ 691 04d2 0E94 0000 		call sensor_matrix_set_in_ring
+ 692               	.L102:
+ 693 04d6 0E94 0000 		call wl_get_xbee_id
+ 694 04da C817      		cp r28,r24
+ 695 04dc D907      		cpc r29,r25
+ 696 04de 01F4      		brne .L104
+ 697 04e0 8091 0000 		lds r24,ringState
+ 698 04e4 9091 0000 		lds r25,(ringState)+1
+ 699 04e8 0197      		sbiw r24,1
+ 700 04ea 01F4      		brne .L104
+ 701 04ec 1092 0000 		sts (ringState)+1,__zero_reg__
+ 702 04f0 1092 0000 		sts ringState,__zero_reg__
+ 703 04f4 0E94 0000 		call wl_token_ring_join
+ 704               	.L104:
+ 705 04f8 8091 0000 		lds r24,acceptor
+ 706 04fc 9091 0000 		lds r25,(acceptor)+1
+ 707 0500 C817      		cp r28,r24
+ 708 0502 D907      		cpc r29,r25
+ 709 0504 01F4      		brne .L95
+ 710 0506 0E94 0000 		call wl_get_xbee_id
+ 711 050a 60E0      		ldi r22,lo8(0)
+ 712 050c 70E0      		ldi r23,hi8(0)
+ 713 050e 0E94 0000 		call sensor_matrix_set_in_ring
+ 714 0512 1092 0000 		sts (ringState)+1,__zero_reg__
+ 715 0516 1092 0000 		sts ringState,__zero_reg__
+ 716 051a 8FEF      		ldi r24,lo8(-1)
+ 717 051c 9FEF      		ldi r25,hi8(-1)
+ 718 051e 9093 0000 		sts (acceptor)+1,r25
+ 719 0522 8093 0000 		sts acceptor,r24
+ 720 0526 0E94 0000 		call wl_token_ring_join
+ 721               	.L95:
+ 722 052a 2196      		adiw r28,1
+ 723               	.L93:
+ 724 052c 0E94 0000 		call sensor_matrix_get_size
+ 725 0530 C817      		cp r28,r24
+ 726 0532 D907      		cpc r29,r25
+ 727 0534 04F4      		brge .+2
+ 728 0536 00C0      		rjmp .L94
+ 729 0538 8601      		movw r16,r12
+ 730               	.L138:
+ 731 053a 0F5F      		subi r16,lo8(-(1))
+ 732 053c 1F4F      		sbci r17,hi8(-(1))
+ 733 053e 0E94 0000 		call sensor_matrix_get_size
+ 734 0542 0817      		cp r16,r24
+ 735 0544 1907      		cpc r17,r25
+ 736 0546 01F4      		brne .L110
+ 737 0548 00E0      		ldi r16,lo8(0)
+ 738 054a 10E0      		ldi r17,hi8(0)
+ 739               	.L110:
+ 740 054c C801      		movw r24,r16
+ 741 054e 0E94 0000 		call sensor_matrix_get_in_ring
+ 742 0552 892B      		or r24,r25
+ 743 0554 01F4      		brne .L112
+ 744 0556 0C15      		cp r16,r12
+ 745 0558 1D05      		cpc r17,r13
+ 746 055a 01F4      		brne .L138
+ 747               	.L112:
+ 748 055c C02E      		mov r12,r16
+ 749 055e DD24      		clr r13
+ 750 0560 0E94 0000 		call wl_get_xbee_id
+ 751 0564 C816      		cp r12,r24
+ 752 0566 D906      		cpc r13,r25
+ 753 0568 01F0      		breq .L116
+ 754 056a D092 0000 		sts (wl_token_next_robot)+1,r13
+ 755 056e C092 0000 		sts wl_token_next_robot,r12
+ 756               	.L116:
+ 757 0572 0E94 0000 		call wl_get_xbee_id
+ 758 0576 EC01      		movw r28,r24
+ 759 0578 2196      		adiw r28,1
+ 760 057a 01E0      		ldi r16,lo8(1)
+ 761 057c 10E0      		ldi r17,hi8(1)
+ 762               	.L117:
+ 763 057e 0E94 0000 		call sensor_matrix_get_size
+ 764 0582 C817      		cp r28,r24
+ 765 0584 D907      		cpc r29,r25
+ 766 0586 01F4      		brne .L118
+ 767 0588 C0E0      		ldi r28,lo8(0)
+ 768 058a D0E0      		ldi r29,hi8(0)
+ 769               	.L118:
+ 770 058c CC15      		cp r28,r12
+ 771 058e DD05      		cpc r29,r13
+ 772 0590 01F0      		breq .L120
+ 773 0592 CE01      		movw r24,r28
+ 774 0594 0E94 0000 		call sensor_matrix_get_in_ring
+ 775 0598 892B      		or r24,r25
+ 776 059a 01F0      		breq .L122
+ 777 059c 0F5F      		subi r16,lo8(-(1))
+ 778 059e 1F4F      		sbci r17,hi8(-(1))
+ 779               	.L122:
+ 780 05a0 2196      		adiw r28,1
+ 781 05a2 00C0      		rjmp .L117
+ 782               	.L120:
+ 783 05a4 000F      		lsl r16
+ 784 05a6 111F      		rol r17
+ 785 05a8 000F      		lsl r16
+ 786 05aa 111F      		rol r17
+ 787 05ac 1093 0000 		sts (deathDelay)+1,r17
+ 788 05b0 0093 0000 		sts deathDelay,r16
+ 789 05b4 0E94 0000 		call sensor_matrix_get_joined
+ 790 05b8 892B      		or r24,r25
+ 791 05ba 01F0      		breq .+2
+ 792 05bc 00C0      		rjmp .L137
+ 793 05be 8091 0000 		lds r24,ringState
+ 794 05c2 9091 0000 		lds r25,(ringState)+1
+ 795 05c6 0297      		sbiw r24,2
+ 796 05c8 01F0      		breq .+2
+ 797 05ca 00C0      		rjmp .L137
+ 798 05cc 42E0      		ldi r20,lo8(2)
+ 799 05ce E42E      		mov r14,r20
+ 800 05d0 8601      		movw r16,r12
+ 801 05d2 20E0      		ldi r18,lo8(0)
+ 802 05d4 30E0      		ldi r19,hi8(0)
+ 803 05d6 40E0      		ldi r20,lo8(0)
+ 804 05d8 50E0      		ldi r21,hi8(0)
+ 805 05da 61E0      		ldi r22,lo8(1)
+ 806 05dc 82E0      		ldi r24,lo8(2)
+ 807 05de 0E94 0000 		call wl_send_robot_to_robot_global_packet
+ 808 05e2 00C0      		rjmp .L137
+ 809               	.L79:
+ 810 05e4 1092 0000 		sts (bom_on_count)+1,__zero_reg__
+ 811 05e8 1092 0000 		sts bom_on_count,__zero_reg__
+ 812 05ec E091 0000 		lds r30,get_max_bom_function
+ 813 05f0 F091 0000 		lds r31,(get_max_bom_function)+1
+ 814 05f4 0995      		icall
+ 815 05f6 8C01      		movw r16,r24
+ 816 05f8 0E94 0000 		call wl_get_xbee_id
+ 817 05fc A801      		movw r20,r16
+ 818 05fe B601      		movw r22,r12
+ 819 0600 0E94 0000 		call sensor_matrix_set_reading
+ 820 0604 00C0      		rjmp .L137
+ 821               	.L80:
+ 822 0606 8091 0000 		lds r24,ringState
+ 823 060a 9091 0000 		lds r25,(ringState)+1
+ 824 060e 0197      		sbiw r24,1
+ 825 0610 01F0      		breq .+2
+ 826 0612 00C0      		rjmp .L137
+ 827 0614 8091 0000 		lds r24,accepted
+ 828 0618 9091 0000 		lds r25,(accepted)+1
+ 829 061c 8617      		cp r24,r22
+ 830 061e 9707      		cpc r25,r23
+ 831 0620 01F4      		brne .L127
+ 832 0622 8FEF      		ldi r24,lo8(-1)
+ 833 0624 9FEF      		ldi r25,hi8(-1)
+ 834 0626 9093 0000 		sts (accepted)+1,r25
+ 835 062a 8093 0000 		sts accepted,r24
+ 836 062e 00C0      		rjmp .L129
+ 837               	.L127:
+ 838 0630 8F5F      		subi r24,lo8(-1)
+ 839 0632 9F4F      		sbci r25,hi8(-1)
+ 840 0634 01F0      		breq .+2
+ 841 0636 00C0      		rjmp .L137
+ 842               	.L129:
+ 843 0638 8601      		movw r16,r12
+ 844               	.L139:
+ 845 063a 0150      		subi r16,lo8(-(-1))
+ 846 063c 1040      		sbci r17,hi8(-(-1))
+ 847 063e 17FF      		sbrs r17,7
+ 848 0640 00C0      		rjmp .L131
+ 849 0642 0E94 0000 		call sensor_matrix_get_size
+ 850 0646 8C01      		movw r16,r24
+ 851 0648 0150      		subi r16,lo8(-(-1))
+ 852 064a 1040      		sbci r17,hi8(-(-1))
+ 853               	.L131:
+ 854 064c 0E94 0000 		call wl_get_xbee_id
+ 855 0650 0817      		cp r16,r24
+ 856 0652 1907      		cpc r17,r25
+ 857 0654 01F0      		breq .L133
+ 858 0656 C801      		movw r24,r16
+ 859 0658 0E94 0000 		call sensor_matrix_get_in_ring
+ 860 065c 892B      		or r24,r25
+ 861 065e 01F4      		brne .L137
+ 862 0660 00C0      		rjmp .L139
+ 863               	.L133:
+ 864 0662 D092 0000 		sts (accepted)+1,r13
+ 865 0666 C092 0000 		sts accepted,r12
+ 866 066a 31E0      		ldi r19,lo8(1)
+ 867 066c E32E      		mov r14,r19
+ 868 066e 8601      		movw r16,r12
+ 869 0670 20E0      		ldi r18,lo8(0)
+ 870 0672 30E0      		ldi r19,hi8(0)
+ 871 0674 40E0      		ldi r20,lo8(0)
+ 872 0676 50E0      		ldi r21,hi8(0)
+ 873 0678 65E0      		ldi r22,lo8(5)
+ 874 067a 82E0      		ldi r24,lo8(2)
+ 875 067c 0E94 0000 		call wl_send_robot_to_robot_global_packet
+ 876 0680 0E94 0000 		call sensor_matrix_get_joined
+ 877 0684 0197      		sbiw r24,1
+ 878 0686 01F4      		brne .L137
+ 879               	.L141:
+ 880 0688 0E94 0000 		call wl_token_pass_token
+ 881 068c 00C0      		rjmp .L137
+ 882               	.L81:
+ 883 068e 88E0      		ldi r24,lo8(8)
+ 884 0690 90E0      		ldi r25,hi8(8)
+ 885 0692 9093 0000 		sts (joinDelay)+1,r25
+ 886 0696 8093 0000 		sts joinDelay,r24
+ 887 069a 83E0      		ldi r24,lo8(3)
+ 888 069c 90E0      		ldi r25,hi8(3)
+ 889 069e 9093 0000 		sts (ringState)+1,r25
+ 890 06a2 8093 0000 		sts ringState,r24
+ 891 06a6 7093 0000 		sts (acceptor)+1,r23
+ 892 06aa 6093 0000 		sts acceptor,r22
+ 893 06ae 0E94 0000 		call wl_get_xbee_id
+ 894 06b2 61E0      		ldi r22,lo8(1)
+ 895 06b4 70E0      		ldi r23,hi8(1)
+ 896               	.L140:
+ 897 06b6 0E94 0000 		call sensor_matrix_set_in_ring
+ 898               	.L137:
+ 899               	/* epilogue: frame size=0 */
+ 900 06ba DF91      		pop r29
+ 901 06bc CF91      		pop r28
+ 902 06be 1F91      		pop r17
+ 903 06c0 0F91      		pop r16
+ 904 06c2 FF90      		pop r15
+ 905 06c4 EF90      		pop r14
+ 906 06c6 DF90      		pop r13
+ 907 06c8 CF90      		pop r12
+ 908 06ca BF90      		pop r11
+ 909 06cc AF90      		pop r10
+ 910 06ce 0895      		ret
+ 911               	/* epilogue end (size=11) */
+ 912               	/* function wl_token_ring_receive_handler size 483 (462) */
+ 915               	wl_token_ring_timeout_handler:
+ 916               	/* prologue: frame size=0 */
+ 917 06d0 0F93      		push r16
+ 918 06d2 1F93      		push r17
+ 919               	/* prologue end (size=2) */
+ 920 06d4 8091 0000 		lds r24,deathDelay
+ 921 06d8 9091 0000 		lds r25,(deathDelay)+1
+ 922 06dc 892B      		or r24,r25
+ 923 06de 01F4      		brne .L143
+ 924 06e0 0091 0000 		lds r16,wl_token_next_robot
+ 925 06e4 1091 0000 		lds r17,(wl_token_next_robot)+1
+ 926 06e8 0E94 0000 		call wl_get_xbee_id
+ 927 06ec 0817      		cp r16,r24
+ 928 06ee 1907      		cpc r17,r25
+ 929 06f0 01F0      		breq .L145
+ 930 06f2 60E0      		ldi r22,lo8(0)
+ 931 06f4 70E0      		ldi r23,hi8(0)
+ 932 06f6 8091 0000 		lds r24,wl_token_next_robot
+ 933 06fa 9091 0000 		lds r25,(wl_token_next_robot)+1
+ 934 06fe 0E94 0000 		call sensor_matrix_set_in_ring
+ 935 0702 8FEF      		ldi r24,lo8(-1)
+ 936 0704 9FEF      		ldi r25,hi8(-1)
+ 937 0706 9093 0000 		sts (wl_token_next_robot)+1,r25
+ 938 070a 8093 0000 		sts wl_token_next_robot,r24
+ 939 070e 84E0      		ldi r24,lo8(4)
+ 940 0710 90E0      		ldi r25,hi8(4)
+ 941 0712 9093 0000 		sts (deathDelay)+1,r25
+ 942 0716 8093 0000 		sts deathDelay,r24
+ 943               	.L145:
+ 944 071a 8091 0000 		lds r24,ringState
+ 945 071e 9091 0000 		lds r25,(ringState)+1
+ 946 0722 0197      		sbiw r24,1
+ 947 0724 01F4      		brne .L143
+ 948 0726 0E94 0000 		call wl_token_pass_token
+ 949               	.L143:
+ 950 072a 8091 0000 		lds r24,joinDelay
+ 951 072e 9091 0000 		lds r25,(joinDelay)+1
+ 952 0732 892B      		or r24,r25
+ 953 0734 01F4      		brne .L148
+ 954 0736 0E94 0000 		call sensor_matrix_get_joined
+ 955 073a 892B      		or r24,r25
+ 956 073c 01F4      		brne .L150
+ 957 073e 0E94 0000 		call wl_get_xbee_id
+ 958 0742 61E0      		ldi r22,lo8(1)
+ 959 0744 70E0      		ldi r23,hi8(1)
+ 960 0746 0E94 0000 		call sensor_matrix_set_in_ring
+ 961 074a 81E0      		ldi r24,lo8(1)
+ 962 074c 90E0      		ldi r25,hi8(1)
+ 963 074e 9093 0000 		sts (ringState)+1,r25
+ 964 0752 8093 0000 		sts ringState,r24
+ 965 0756 84E0      		ldi r24,lo8(4)
+ 966 0758 90E0      		ldi r25,hi8(4)
+ 967 075a 9093 0000 		sts (deathDelay)+1,r25
+ 968 075e 8093 0000 		sts deathDelay,r24
+ 969 0762 0E94 0000 		call wl_get_xbee_id
+ 970 0766 9093 0000 		sts (wl_token_next_robot)+1,r25
+ 971 076a 8093 0000 		sts wl_token_next_robot,r24
+ 972 076e 00C0      		rjmp .L148
+ 973               	.L150:
+ 974 0770 0E94 0000 		call wl_token_ring_join
+ 975 0774 0E94 0000 		call rand
+ 976 0778 6FEF      		ldi r22,lo8(4095)
+ 977 077a 7FE0      		ldi r23,hi8(4095)
+ 978 077c 0E94 0000 		call __divmodhi4
+ 979 0780 6F5F      		subi r22,lo8(-(1))
+ 980 0782 7F4F      		sbci r23,hi8(-(1))
+ 981 0784 7093 0000 		sts (joinDelay)+1,r23
+ 982 0788 6093 0000 		sts joinDelay,r22
+ 983               	.L148:
+ 984 078c 8091 0000 		lds r24,deathDelay
+ 985 0790 9091 0000 		lds r25,(deathDelay)+1
+ 986 0794 97FD      		sbrc r25,7
+ 987 0796 00C0      		rjmp .L152
+ 988 0798 0197      		sbiw r24,1
+ 989 079a 9093 0000 		sts (deathDelay)+1,r25
+ 990 079e 8093 0000 		sts deathDelay,r24
+ 991               	.L152:
+ 992 07a2 8091 0000 		lds r24,joinDelay
+ 993 07a6 9091 0000 		lds r25,(joinDelay)+1
+ 994 07aa 97FD      		sbrc r25,7
+ 995 07ac 00C0      		rjmp .L154
+ 996 07ae 0197      		sbiw r24,1
+ 997 07b0 9093 0000 		sts (joinDelay)+1,r25
+ 998 07b4 8093 0000 		sts joinDelay,r24
+ 999               	.L154:
+ 1000 07b8 8091 0000 		lds r24,bom_on_count
+ 1001 07bc 9091 0000 		lds r25,(bom_on_count)+1
+ 1002 07c0 97FD      		sbrc r25,7
+ 1003 07c2 00C0      		rjmp .L158
+ 1004 07c4 0196      		adiw r24,1
+ 1005 07c6 9093 0000 		sts (bom_on_count)+1,r25
+ 1006 07ca 8093 0000 		sts bom_on_count,r24
+ 1007               	.L158:
+ 1008               	/* epilogue: frame size=0 */
+ 1009 07ce 1F91      		pop r17
+ 1010 07d0 0F91      		pop r16
+ 1011 07d2 0895      		ret
+ 1012               	/* epilogue end (size=3) */
+ 1013               	/* function wl_token_ring_timeout_handler size 131 (126) */
+ 1015               	.global	wl_token_ring_register
+ 1017               	wl_token_ring_register:
+ 1018               	/* prologue: frame size=0 */
+ 1019               	/* prologue end (size=0) */
+ 1020 07d4 0E94 0000 		call wl_get_xbee_id
+ 1021 07d8 8F3F      		cpi r24,255
+ 1022 07da 9105      		cpc r25,__zero_reg__
+ 1023 07dc 01F0      		breq .L160
+ 1024 07de 04F0      		brlt .L160
+ 1025 07e0 8FEF      		ldi r24,lo8(-1)
+ 1026 07e2 9FEF      		ldi r25,hi8(-1)
+ 1027 07e4 0895      		ret
+ 1028               	.L160:
+ 1029 07e6 0E94 0000 		call sensor_matrix_create
+ 1030 07ea 0E94 0000 		call wl_get_xbee_id
+ 1031 07ee 60E0      		ldi r22,lo8(0)
+ 1032 07f0 70E0      		ldi r23,hi8(0)
+ 1033 07f2 0E94 0000 		call sensor_matrix_set_in_ring
+ 1034 07f6 80E0      		ldi r24,lo8(wl_token_ring_handler)
+ 1035 07f8 90E0      		ldi r25,hi8(wl_token_ring_handler)
+ 1036 07fa 0E94 0000 		call wl_register_packet_group
+ 1037 07fe 80E0      		ldi r24,lo8(0)
+ 1038 0800 90E0      		ldi r25,hi8(0)
+ 1039 0802 0895      		ret
+ 1040               	/* epilogue: frame size=0 */
+ 1041               	/* epilogue: noreturn */
+ 1042               	/* epilogue end (size=0) */
+ 1043               	/* function wl_token_ring_register size 24 (24) */
+ 1045               		.lcomm iteratorCount,2
+ 1046               		.data
+ 1049               	bom_on_function:
+ 1050 0000 0000      		.word	gs(bom_on)
+ 1053               	bom_off_function:
+ 1054 0002 0000      		.word	gs(bom_off)
+ 1057               	get_max_bom_function:
+ 1058 0004 0000      		.word	gs(get_max_bom)
+ 1061               	wl_token_ring_handler:
+ 1062 0006 0200      		.word	2
+ 1063 0008 0000      		.word	gs(wl_token_ring_timeout_handler)
+ 1064 000a 0000      		.word	gs(wl_token_ring_response_handler)
+ 1065 000c 0000      		.word	gs(wl_token_ring_receive_handler)
+ 1066 000e 0000      		.word	gs(wl_token_ring_cleanup)
+ 1069               	wl_token_next_robot:
+ 1070 0010 FFFF      		.word	-1
+ 1071               		.lcomm bom_on_count,2
+ 1072               		.lcomm ringState,2
+ 1075               	deathDelay:
+ 1076 0012 FFFF      		.word	-1
+ 1079               	joinDelay:
+ 1080 0014 FFFF      		.word	-1
+ 1083               	accepted:
+ 1084 0016 FFFF      		.word	-1
+ 1087               	acceptor:
+ 1088 0018 FFFF      		.word	-1
+ 1089               	/* File "wl_token_ring.c": code 1035 = 0x040b ( 939), prologues  40, epilogues  56 */
+DEFINED SYMBOLS
+                            *ABS*:00000000 wl_token_ring.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:13     .text:00000000 wl_token_ring_leave
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:1071   .bss:00000004 ringState
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:27     .text:0000000e wl_token_ring_set_bom_functions
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:1049   .data:00000000 bom_on_function
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:1053   .data:00000002 bom_off_function
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:1057   .data:00000004 get_max_bom_function
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:42     .text:00000028 wl_token_ring_cleanup
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:51     .text:0000002a wl_token_ring_response_handler
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:61     .text:0000002c wl_token_iterator_has_next
+                             .bss:00000000 iteratorCount
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:82     .text:00000046 wl_token_get_matrix_size
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:93     .text:0000004c wl_token_get_num_robots
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:104    .text:00000052 wl_token_get_robots_in_ring
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:115    .text:00000058 wl_token_iterator_next
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:173    .text:000000d8 wl_token_iterator_begin
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:211    .text:00000114 wl_token_is_robot_in_ring
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:222    .text:0000011a wl_token_get_sensor_reading
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:263    .text:0000015c wl_token_get_my_sensor_reading
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:281    .text:00000172 wl_token_ring_unregister
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:1061   .data:00000006 wl_token_ring_handler
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:294    .text:0000017c wl_token_ring_join
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:1079   .data:00000014 joinDelay
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:330    .text:000001ba wl_token_pass_token
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:1083   .data:00000016 accepted
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:1069   .data:00000010 wl_token_next_robot
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:1075   .data:00000012 deathDelay
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:502    .text:00000318 wl_token_ring_receive_handler
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:1045   .bss:00000002 bom_on_count
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:1087   .data:00000018 acceptor
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:915    .text:000006d0 wl_token_ring_timeout_handler
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccyQFxcu.s:1017   .text:000007d4 wl_token_ring_register
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+sensor_matrix_get_size
+sensor_matrix_get_joined
+sensor_matrix_get_in_ring
+wl_get_xbee_id
+sensor_matrix_get_reading
+wl_unregister_packet_group
+wl_send_global_packet
+sensor_matrix_set_in_ring
+wl_send_robot_to_robot_global_packet
+delay_ms
+__divmodhi4
+sensor_matrix_set_reading
+rand
+sensor_matrix_create
+wl_register_packet_group
+bom_on
+bom_off
+get_max_bom
Index: demos/hunter_prey_john/projects/libwireless/lib/wl_basic.lst
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wl_basic.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wl_basic.lst	(revision 1694)
@@ -0,0 +1,178 @@
+   1               		.file	"wl_basic.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  10               		.text
+  11               	.global	wl_basic_packet_receive_handler
+  13               	wl_basic_packet_receive_handler:
+  14               	/* prologue: frame size=0 */
+  15               	/* prologue end (size=0) */
+  16 0000 91E0      		ldi r25,lo8(1)
+  17 0002 9093 0000 		sts current_packet,r25
+  18 0006 8093 0000 		sts current_packet+1,r24
+  19 000a 7093 0000 		sts (current_packet+2)+1,r23
+  20 000e 6093 0000 		sts current_packet+2,r22
+  21 0012 5093 0000 		sts (current_packet+4)+1,r21
+  22 0016 4093 0000 		sts current_packet+4,r20
+  23 001a 3093 0000 		sts (current_packet+6)+1,r19
+  24 001e 2093 0000 		sts current_packet+6,r18
+  25               	/* epilogue: frame size=0 */
+  26 0022 0895      		ret
+  27               	/* epilogue end (size=1) */
+  28               	/* function wl_basic_packet_receive_handler size 18 (17) */
+  30               	.global	wl_basic_do_default
+  32               	wl_basic_do_default:
+  33               	/* prologue: frame size=0 */
+  34 0024 CF93      		push r28
+  35 0026 DF93      		push r29
+  36               	/* prologue end (size=2) */
+  37 0028 EC01      		movw r28,r24
+  38 002a 0E94 0000 		call wl_do
+  39 002e 8091 0000 		lds r24,current_packet
+  40 0032 8130      		cpi r24,lo8(1)
+  41 0034 01F0      		breq .L4
+  42 0036 80E0      		ldi r24,lo8(0)
+  43 0038 90E0      		ldi r25,hi8(0)
+  44 003a 00C0      		rjmp .L6
+  45               	.L4:
+  46 003c 1092 0000 		sts current_packet,__zero_reg__
+  47 0040 8091 0000 		lds r24,current_packet+6
+  48 0044 9091 0000 		lds r25,(current_packet+6)+1
+  49 0048 9983      		std Y+1,r25
+  50 004a 8883      		st Y,r24
+  51 004c 8091 0000 		lds r24,current_packet+4
+  52 0050 9091 0000 		lds r25,(current_packet+4)+1
+  53               	.L6:
+  54               	/* epilogue: frame size=0 */
+  55 0054 DF91      		pop r29
+  56 0056 CF91      		pop r28
+  57 0058 0895      		ret
+  58               	/* epilogue end (size=3) */
+  59               	/* function wl_basic_do_default size 27 (22) */
+  61               	.global	wl_basic_send_global_packet
+  63               	wl_basic_send_global_packet:
+  64               	/* prologue: frame size=0 */
+  65 005a 0F93      		push r16
+  66               	/* prologue end (size=1) */
+  67 005c 9A01      		movw r18,r20
+  68 005e 00E0      		ldi r16,lo8(0)
+  69 0060 AB01      		movw r20,r22
+  70 0062 682F      		mov r22,r24
+  71 0064 88E0      		ldi r24,lo8(8)
+  72 0066 0E94 0000 		call wl_send_global_packet
+  73               	/* epilogue: frame size=0 */
+  74 006a 0F91      		pop r16
+  75 006c 0895      		ret
+  76               	/* epilogue end (size=2) */
+  77               	/* function wl_basic_send_global_packet size 10 (7) */
+  79               	.global	wl_basic_send_robot_packet
+  81               	wl_basic_send_robot_packet:
+  82               	/* prologue: frame size=0 */
+  83 006e EF92      		push r14
+  84 0070 0F93      		push r16
+  85 0072 1F93      		push r17
+  86               	/* prologue end (size=3) */
+  87 0074 EE24      		clr r14
+  88 0076 8901      		movw r16,r18
+  89 0078 9A01      		movw r18,r20
+  90 007a AB01      		movw r20,r22
+  91 007c 682F      		mov r22,r24
+  92 007e 88E0      		ldi r24,lo8(8)
+  93 0080 0E94 0000 		call wl_send_robot_to_robot_global_packet
+  94               	/* epilogue: frame size=0 */
+  95 0084 1F91      		pop r17
+  96 0086 0F91      		pop r16
+  97 0088 EF90      		pop r14
+  98 008a 0895      		ret
+  99               	/* epilogue end (size=4) */
+ 100               	/* function wl_basic_send_robot_packet size 15 (8) */
+ 102               	.global	wl_basic_register_handler
+ 104               	wl_basic_register_handler:
+ 105               	/* prologue: frame size=0 */
+ 106               	/* prologue end (size=0) */
+ 107 008c 28E0      		ldi r18,lo8(8)
+ 108 008e 30E0      		ldi r19,hi8(8)
+ 109 0090 3093 0000 		sts (wl_basic_group_handler)+1,r19
+ 110 0094 2093 0000 		sts wl_basic_group_handler,r18
+ 111 0098 1092 0000 		sts (wl_basic_group_handler+2)+1,__zero_reg__
+ 112 009c 1092 0000 		sts wl_basic_group_handler+2,__zero_reg__
+ 113 00a0 1092 0000 		sts (wl_basic_group_handler+4)+1,__zero_reg__
+ 114 00a4 1092 0000 		sts wl_basic_group_handler+4,__zero_reg__
+ 115 00a8 9093 0000 		sts (wl_basic_group_handler+6)+1,r25
+ 116 00ac 8093 0000 		sts wl_basic_group_handler+6,r24
+ 117 00b0 1092 0000 		sts (wl_basic_group_handler+8)+1,__zero_reg__
+ 118 00b4 1092 0000 		sts wl_basic_group_handler+8,__zero_reg__
+ 119 00b8 80E0      		ldi r24,lo8(wl_basic_group_handler)
+ 120 00ba 90E0      		ldi r25,hi8(wl_basic_group_handler)
+ 121 00bc 0E94 0000 		call wl_register_packet_group
+ 122               	/* epilogue: frame size=0 */
+ 123 00c0 0895      		ret
+ 124               	/* epilogue end (size=1) */
+ 125               	/* function wl_basic_register_handler size 27 (26) */
+ 127               	.global	wl_basic_init
+ 129               	wl_basic_init:
+ 130               	/* prologue: frame size=0 */
+ 131 00c2 EF92      		push r14
+ 132 00c4 FF92      		push r15
+ 133 00c6 0F93      		push r16
+ 134 00c8 1F93      		push r17
+ 135               	/* prologue end (size=4) */
+ 136 00ca 8C01      		movw r16,r24
+ 137 00cc 0E94 0000 		call wl_init
+ 138 00d0 7C01      		movw r14,r24
+ 139 00d2 C801      		movw r24,r16
+ 140 00d4 0E94 0000 		call wl_basic_register_handler
+ 141 00d8 1092 0000 		sts current_packet,__zero_reg__
+ 142 00dc C701      		movw r24,r14
+ 143               	/* epilogue: frame size=0 */
+ 144 00de 1F91      		pop r17
+ 145 00e0 0F91      		pop r16
+ 146 00e2 FF90      		pop r15
+ 147 00e4 EF90      		pop r14
+ 148 00e6 0895      		ret
+ 149               	/* epilogue end (size=5) */
+ 150               	/* function wl_basic_init size 19 (10) */
+ 152               	.global	wl_basic_init_default
+ 154               	wl_basic_init_default:
+ 155               	/* prologue: frame size=0 */
+ 156               	/* prologue end (size=0) */
+ 157 00e8 80E0      		ldi r24,lo8(gs(wl_basic_packet_receive_handler))
+ 158 00ea 90E0      		ldi r25,hi8(gs(wl_basic_packet_receive_handler))
+ 159 00ec 0E94 0000 		call wl_basic_init
+ 160               	/* epilogue: frame size=0 */
+ 161 00f0 0895      		ret
+ 162               	/* epilogue end (size=1) */
+ 163               	/* function wl_basic_init_default size 5 (4) */
+ 165               		.comm wl_basic_group_handler,10,1
+ 166               		.comm current_packet,8,1
+ 167               	/* File "wl_basic.c": code  121 = 0x0079 (  94), prologues  10, epilogues  17 */
+DEFINED SYMBOLS
+                            *ABS*:00000000 wl_basic.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgiM73B.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgiM73B.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgiM73B.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgiM73B.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgiM73B.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgiM73B.s:13     .text:00000000 wl_basic_packet_receive_handler
+                            *COM*:00000008 current_packet
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgiM73B.s:32     .text:00000024 wl_basic_do_default
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgiM73B.s:63     .text:0000005a wl_basic_send_global_packet
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgiM73B.s:81     .text:0000006e wl_basic_send_robot_packet
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgiM73B.s:104    .text:0000008c wl_basic_register_handler
+                            *COM*:0000000a wl_basic_group_handler
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgiM73B.s:129    .text:000000c2 wl_basic_init
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgiM73B.s:154    .text:000000e8 wl_basic_init_default
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+wl_do
+wl_send_global_packet
+wl_send_robot_to_robot_global_packet
+wl_register_packet_group
+wl_init
Index: demos/hunter_prey_john/projects/libwireless/lib/wl_error_group.lst
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wl_error_group.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wl_error_group.lst	(revision 1694)
@@ -0,0 +1,99 @@
+   1               		.file	"wl_error_group.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  10               		.text
+  11               	.global	wl_error_response_receive
+  13               	wl_error_response_receive:
+  14               	/* prologue: frame size=0 */
+  15               	/* prologue end (size=0) */
+  16               	/* epilogue: frame size=0 */
+  17 0000 0895      		ret
+  18               	/* epilogue end (size=1) */
+  19               	/* function wl_error_response_receive size 1 (0) */
+  21               	.global	wl_error_handle_receive
+  23               	wl_error_handle_receive:
+  24               	/* prologue: frame size=0 */
+  25               	/* prologue end (size=0) */
+  26               	/* epilogue: frame size=0 */
+  27 0002 0895      		ret
+  28               	/* epilogue end (size=1) */
+  29               	/* function wl_error_handle_receive size 1 (0) */
+  31               	.global	wl_error_send_string
+  33               	wl_error_send_string:
+  34               	/* prologue: frame size=0 */
+  35 0004 0F93      		push r16
+  36               	/* prologue end (size=1) */
+  37 0006 FC01      		movw r30,r24
+  38 0008 0190      		ld __tmp_reg__,Z+
+  39 000a 0020      		tst __tmp_reg__
+  40 000c 01F4      		brne .-6
+  41 000e E81B      		sub r30,r24
+  42 0010 F90B      		sbc r31,r25
+  43 0012 01E0      		ldi r16,lo8(1)
+  44 0014 9F01      		movw r18,r30
+  45 0016 AC01      		movw r20,r24
+  46 0018 61E0      		ldi r22,lo8(1)
+  47 001a 81E0      		ldi r24,lo8(1)
+  48 001c 0E94 0000 		call wl_send_global_packet
+  49               	/* epilogue: frame size=0 */
+  50 0020 0F91      		pop r16
+  51 0022 0895      		ret
+  52               	/* epilogue end (size=2) */
+  53               	/* function wl_error_send_string size 16 (13) */
+  55               	.global	wl_error_unregister
+  57               	wl_error_unregister:
+  58               	/* prologue: frame size=0 */
+  59               	/* prologue end (size=0) */
+  60 0024 80E0      		ldi r24,lo8(wl_error_handler)
+  61 0026 90E0      		ldi r25,hi8(wl_error_handler)
+  62 0028 0E94 0000 		call wl_unregister_packet_group
+  63               	/* epilogue: frame size=0 */
+  64 002c 0895      		ret
+  65               	/* epilogue end (size=1) */
+  66               	/* function wl_error_unregister size 5 (4) */
+  68               	.global	wl_error_register
+  70               	wl_error_register:
+  71               	/* prologue: frame size=0 */
+  72               	/* prologue end (size=0) */
+  73 002e 80E0      		ldi r24,lo8(wl_error_handler)
+  74 0030 90E0      		ldi r25,hi8(wl_error_handler)
+  75 0032 0E94 0000 		call wl_register_packet_group
+  76               	/* epilogue: frame size=0 */
+  77 0036 0895      		ret
+  78               	/* epilogue end (size=1) */
+  79               	/* function wl_error_register size 5 (4) */
+  81               	.global	wl_error_handler
+  82               		.data
+  85               	wl_error_handler:
+  86 0000 0100      		.word	1
+  87 0002 0000      		.word	0
+  88 0004 0000      		.word	gs(wl_error_response_receive)
+  89 0006 0000      		.word	gs(wl_error_handle_receive)
+  90 0008 0000      		.word	0
+  91               	/* File "wl_error_group.c": code   28 = 0x001c (  21), prologues   1, epilogues   6 */
+DEFINED SYMBOLS
+                            *ABS*:00000000 wl_error_group.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgMln1L.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgMln1L.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgMln1L.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgMln1L.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgMln1L.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgMln1L.s:13     .text:00000000 wl_error_response_receive
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgMln1L.s:23     .text:00000002 wl_error_handle_receive
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgMln1L.s:33     .text:00000004 wl_error_send_string
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgMln1L.s:57     .text:00000024 wl_error_unregister
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgMln1L.s:85     .data:00000000 wl_error_handler
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccgMln1L.s:70     .text:0000002e wl_error_register
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+wl_send_global_packet
+wl_unregister_packet_group
+wl_register_packet_group
Index: demos/hunter_prey_john/projects/libwireless/lib/Makefile
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/Makefile	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/Makefile	(revision 1694)
@@ -0,0 +1,225 @@
+############################
+### Update this Section ####
+############################
+COLONYROOT = ../../..
+
+# Target file name (without extension).
+TARGET = libwireless
+COLONET_TARGET = libwireless_colonet
+
+############################
+# don't touch this unless you know what you're doing.
+
+CDEFS = 
+
+# MCU name
+MCU = atmega128
+
+
+# Processor frequency.
+#     This will define a symbol, F_CPU, in all source code files equal to the 
+#     processor frequency. You can then use this symbol in your source code to 
+#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+#     automatically to create a 32-bit value in your source code.
+F_CPU = 16000000
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(wildcard *.c)
+
+# List Assembler source files here.
+#     Make them always end in a capital .S.  Files ending in a lowercase .s
+#     will not be considered source files but generated files (assembler
+#     output from the compiler), and will be deleted upon "make clean"!
+#     Even though the DOS/Win* filesystem matches both .s and .S the same,
+#     it will preserve the spelling of the filenames, and gcc itself does
+#     care about how the name is spelled on its command-line.
+ASRC = 
+
+# Optimization level, can be [0, 1, 2, 3, s]. 
+#     0 = turn off optimization. s = optimize for size.
+#     (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+# Debugging format.
+#     Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+#     AVR Studio 4.10 requires dwarf-2.
+#     AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG =
+# dwarf-2
+
+# List any extra directories to look for include files here.
+#     Each directory must be seperated by a space.
+#     Use forward slashes for directory separators.
+#     For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = 
+
+# Compiler flag to set the C Standard level.
+#     c89   = "ANSI" C
+#     gnu89 = c89 plus GCC extensions
+#     c99   = ISO C99 standard (not yet fully implemented)
+#     gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here
+CDEFS += -DF_CPU=$(F_CPU)UL 
+CDEFS += -DROBOT
+
+# Place -I options here
+CINCS = -I$(COLONYROOT)/lib/include/libdragonfly
+CINCS += -L$(COLONYROOT)/lib/bin
+
+
+#---------------- Compiler Options ----------------
+#  -g*:          generate debugging information
+#  -O*:          optimization level
+#  -f...:        tuning, see GCC manual and avr-libc documentation
+#  -Wall...:     warning level
+#  -Wa,...:      tell GCC to pass this to the assembler.
+#    -adhlns...: create assembler listing
+CFLAGS =
+#CFLAGS += -g$(DEBUG)
+CFLAGS += $(CDEFS) $(CINCS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
+CFLAGS += -Wall -Wstrict-prototypes
+CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB = 
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB = 
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+MATH_LIB = -lm
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+AR = avr-ar
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+DOXYGEN = doxygen
+WINSHELL = cmd
+
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = --------  end  --------
+MSG_COMPILING = Compiling:
+MSG_CLEANING = Cleaning project:
+
+# Define all object files.
+OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) 
+
+# Define all listing files.
+LST = $(SRC:.c=.lst) $(ASRC:.S=.lst) 
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) -Wall $(GENDEPFLAGS)
+ALL_ASFLAGS = rcs
+
+# Default target.
+all: begin build end
+
+dist: all publish
+
+publish:
+	$(COPY) $(TARGET).a $(COLONYROOT)/lib/bin
+	$(COPY) *.h $(COLONYROOT)/lib/include/$(TARGET)
+
+build: $(OBJ)
+	$(AR) $(ALL_ASFLAGS) $(TARGET).a $(OBJ)
+
+computer:
+	gcc *.c -Wall -Wshadow -Wextra -g -I. -c
+	ar rcs $(TARGET).a $(OBJ)
+
+# we should fine a better way to do this.....
+bayboard:
+	avr-gcc *.c -DBAYBOARD -mmcu=atmega164p -I. -DF_CPU=8000000UL -DROBOT -I../../../../lib/include/libbayboard \
+			-L../../../../lib/bin/bayboard -Wall -Wshadow -Wextra -std=gnu99 -MD -MP -MF -c
+	avr-ar rcs $(TARGET).a $(OBJ)
+
+colonet:
+	g++ -Wall -Wshadow -Wextra *.c -g -I. -c
+	ar rcs $(COLONET_TARGET).a $(OBJ)
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+	@echo
+	@echo $(MSG_BEGIN)
+
+end:
+	@echo $(MSG_END)
+	@echo
+
+# Compile: create object files from C source files.
+%.o : %.c
+	@echo
+	@echo $(MSG_COMPILING) $<
+	$(CC) -c $(ALL_CFLAGS) $< -o $@ 
+
+
+# Target: clean project.
+clean: begin clean_list end
+
+clean_list :
+	@echo
+	@echo $(MSG_CLEANING)
+	$(REMOVE) $(TARGET).a
+	$(REMOVE) $(COLONET_TARGET).a
+	$(REMOVE) $(OBJ)
+	$(REMOVE) $(LST)
+	$(REMOVE) $(SRC:.c=.s)
+	$(REMOVE) $(SRC:.c=.d)
+	$(REMOVE) -r docs
+	$(REMOVEDIR) .dep
+
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
Index: demos/hunter_prey_john/projects/libwireless/lib/wl_token_ring.c
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wl_token_ring.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wl_token_ring.c	(revision 1694)
@@ -0,0 +1,858 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file wl_token_ring.c
+ * @brief Token Ring Implementation
+ *
+ * Implementation of the token ring packet group.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#include <wl_token_ring.h>
+
+#include <stdlib.h>
+
+#include <wl_defs.h>
+#include <wireless.h>
+#include <sensor_matrix.h>
+
+#ifdef ROBOT
+#ifndef FIREFLY
+#include <bom.h>
+#endif
+#include <time.h>
+#endif
+
+
+//#define DEFAULT_SENSOR_MATRIX_SIZE 20
+
+/*Ring States*/
+
+#define NONMEMBER 0
+#define MEMBER 1
+#define JOINING 2
+#define ACCEPTED 3
+#define LEAVING 4
+
+/*Frame Types*/
+#define TOKEN_JOIN_ACCEPT_FRAME	1
+#define WL_TOKEN_PASS_FRAME	2
+
+/*Function Prototypes*/
+
+/*Wireless Library Prototypes*/
+static void wl_token_ring_timeout_handler(void);
+static void wl_token_ring_response_handler(int frame, int received);
+static void wl_token_ring_receive_handler(char type, int source, unsigned char* packet, int length);
+static void wl_token_ring_cleanup(void);
+
+/*Helper Functions*/
+static int wl_token_pass_token(void);
+static int get_token_distance(int robot1, int robot2);
+static void wl_token_get_token(void);
+
+/*Packet Handling Routines*/
+static void wl_token_pass_receive(int source);
+static void wl_token_sensor_matrix_receive(int source, unsigned char* sensorData, int sensorDataLength);
+static void wl_token_bom_on_receive(int source);
+static void wl_token_join_receive(int source);
+static void wl_token_join_accept_receive(int source);
+
+/*Global Variables*/
+
+//the robot we are waiting to say it has received the token. -1 if unspecified
+static int wl_token_next_robot = -1;
+
+//true if the robot should be in the token ring, 0 otherwise
+static int ringState = NONMEMBER;
+//the id of the robot who accepted us into the token ring, only used in ACCEPTED state
+static int acceptor = -1;
+//id of the robot we are accepting
+static int accepted = -1;
+
+//the counter for when we assume a robot is dead
+static int deathDelay = -1;
+//the counter for joining, before we form our own token ring
+static int joinDelay = -1;
+
+//current robot to check in the iterator
+static int iteratorCount = 0;
+
+// the amount of time a robot has had its BOM on for
+static int bom_on_count = 0;
+
+#ifndef ROBOT
+static void do_nothing(void) {}
+static int get_nothing(void) {return -1;}
+#endif
+
+#ifdef ROBOT
+#ifndef FIREFLY
+static void (*bom_on_function) (void) = bom_on;
+static void (*bom_off_function) (void) = bom_off;
+static int (*get_max_bom_function) (void) = get_max_bom;
+#else
+static void (*bom_on_function) (void) = do_nothing;
+static void (*bom_off_function) (void) = do_nothing;
+static int (*get_max_bom_function) (void) = get_nothing;
+#endif
+#else
+static void (*bom_on_function) (void) = do_nothing;
+static void (*bom_off_function) (void) = do_nothing;
+static int (*get_max_bom_function) (void) = get_nothing;
+#endif
+
+static PacketGroupHandler wl_token_ring_handler =
+	{WL_TOKEN_RING_GROUP, wl_token_ring_timeout_handler,
+		wl_token_ring_response_handler, wl_token_ring_receive_handler,
+		wl_token_ring_cleanup};
+
+/**
+ * Causes the robot to join an existing token ring, or create one
+ * if no token ring exists. The token ring uses global and robot to robot
+ * packets, and does not rely on any PAN.
+ **/
+int wl_token_ring_join()
+{
+	WL_DEBUG_PRINT("Joining the token ring.\r\n");
+
+	ringState = JOINING;
+	joinDelay = DEATH_DELAY * 2;
+	if (wl_send_global_packet(WL_TOKEN_RING_GROUP, WL_TOKEN_JOIN, NULL, 0, 0) != 0) {
+		return -1;
+	}
+
+	return 0;
+}
+
+/**
+ * Causes the robot to leave the token ring. The robot stops
+ * alerting others of its location, but continues storing the
+ * locations of other robots.
+ **/
+void wl_token_ring_leave()
+{
+	ringState = LEAVING;
+}
+
+/**
+ * Initialize the token ring packet group and register it with the
+ * wireless library. The robot will not join a token ring.
+ **/
+int wl_token_ring_register()
+{
+	if (wl_get_xbee_id() > 0xFF)
+	{
+		//Note: if this becomes an issue (unlikely), we could limit sensor information
+		//to half a byte and use 12 bits for the id
+		WL_DEBUG_PRINT("XBee ID must be single byte for token ring, is ");
+		WL_DEBUG_PRINT_INT(wl_get_xbee_id());
+		WL_DEBUG_PRINT(".\r\n");
+		return -1;
+	}
+
+	sensor_matrix_create();
+	//add ourselves to the sensor matrix
+	sensor_matrix_set_in_ring(wl_get_xbee_id(), 0);
+
+	wl_register_packet_group(&wl_token_ring_handler);
+
+	return 0;
+}
+
+/**
+ * Removes the packet group from the wireless library.
+ **/
+void wl_token_ring_unregister()
+{
+	wl_unregister_packet_group(&wl_token_ring_handler);
+}
+
+/**
+ * Sets the functions that are called when the BOM ought to be
+ * turned on or off. This could be used for things such as
+ * charging stations, which have multiple BOMs.
+ *
+ * @param on_function the function to be called when the BOM
+ * should be turned on
+ * @param off_function the function to be called when the BOM
+ * should be turned off
+ * @param max_bom_function the function to be called when a
+ * measurement of the maximum BOM reading is needed.
+ **/
+void wl_token_ring_set_bom_functions(void (*on_function) (void),
+	void (*off_function) (void), int (*max_bom_function) (void))
+{
+	bom_on_function = on_function;
+	bom_off_function = off_function;
+	get_max_bom_function = max_bom_function;
+}
+
+/**
+ * Called to cleanup the token ring packet group.
+ **/
+static void wl_token_ring_cleanup()
+{
+}
+
+/**
+ * Called approximately every quarter second by the wireless library.
+ **/
+static void wl_token_ring_timeout_handler()
+{
+	//someone is not responding, assume they are dead
+	if (deathDelay == 0)
+	{
+		//pass the token to the next robot if we think someone has died
+		//also, declare that person dead, as long as it isn't us
+		if (wl_token_next_robot != wl_get_xbee_id())
+		{
+			sensor_matrix_set_in_ring(wl_token_next_robot, 0);
+			WL_DEBUG_PRINT("Robot ");
+			WL_DEBUG_PRINT_INT(wl_token_next_robot);
+			WL_DEBUG_PRINT(" has died.\r\n");
+			wl_token_next_robot = -1;
+			deathDelay = DEATH_DELAY;
+		}
+
+		// we may have been dropped from the ring when this is received
+		if (ringState == MEMBER) {
+			wl_token_pass_token();
+		}
+	}
+
+	//we must start our own token ring, no one is responding to us
+	if (joinDelay == 0)
+	{
+		if (sensor_matrix_get_joined() == 0)
+		{
+			WL_DEBUG_PRINT("Creating our own token ring, no robots seem to exist.\r\n");
+			sensor_matrix_set_in_ring(wl_get_xbee_id(), 1);
+			ringState = MEMBER;
+			//this will make us pass the token to ourself
+			//repeatedly, and other robots when they join
+			deathDelay = DEATH_DELAY;
+			wl_token_next_robot = wl_get_xbee_id();
+		}
+		else
+		{
+			WL_DEBUG_PRINT("Attempting to join the token ring again.\r\n");
+			//attempt to rejoin with a random delay
+      //TODO: should we use the constant JOIN_DELAY ?
+			wl_token_ring_join();
+			joinDelay = rand() / (RAND_MAX / JOIN_DELAY) + 1;
+		}
+	}
+
+	if (deathDelay >= 0) {
+		deathDelay--;
+	}
+
+	if (joinDelay >= 0) {
+		joinDelay--;
+	}
+
+	if (bom_on_count >= 0) {
+		bom_on_count++;
+	}
+}
+
+/**
+ * Called when the XBee tells us if a packet we sent has been received.
+ *
+ * @param frame the frame number assigned when the packet was sent
+ * @param received 1 if the packet was received, 0 otherwise
+ **/
+static void wl_token_ring_response_handler(int frame, int received)
+{
+	if (!received)
+	{
+		WL_DEBUG_PRINT("FAILED.\r\n");
+	}
+}
+
+/**
+ * Called when we recieve a token ring packet.
+ * @param type the type of the packet
+ * @param source the id of the robot who sent the packet
+ * @param packet the data in the packet
+ * @param length the length of the packet in bytes
+ **/
+static void wl_token_ring_receive_handler(char type, int source, unsigned char* packet, int length)
+{
+	switch (type)
+	{
+		case WL_TOKEN_PASS:
+			wl_token_pass_receive(source);
+			break;
+		case WL_TOKEN_SENSOR_MATRIX:
+			wl_token_sensor_matrix_receive(source, packet, length);
+			break;
+		case WL_TOKEN_BOM_ON:
+			//add the robot to the sensor matrix if it is not already there
+			wl_token_bom_on_receive(source);
+			break;
+		case WL_TOKEN_JOIN:
+			wl_token_join_receive(source);
+			break;
+		case WL_TOKEN_JOIN_ACCEPT:
+			wl_token_join_accept_receive(source);
+			break;
+		default:
+			WL_DEBUG_PRINT("Unimplemented token ring packet received.\r\n");
+			break;
+	}
+}
+
+/**
+ * Returns the BOM reading robot source has for robot dest.
+ *
+ * @param source the robot that made the BOM reading
+ * @param dest the robot whose relative location is returned
+ *
+ * @return a BOM reading from robot source to robot dest,
+ * in the range 0-15, or -1 if it is unknown
+ **/
+int wl_token_get_sensor_reading(int source, int dest)
+{
+	if (wl_token_is_robot_in_ring(dest) &&
+			(source == wl_get_xbee_id() || wl_token_is_robot_in_ring(source))) {
+		return sensor_matrix_get_reading(source, dest);
+	}
+
+	return -1;
+}
+
+/**
+ * Returns the BOM reading we have for robot dest.
+ *
+ * @param dest the robot whose relative location is returned
+ *
+ * @return a BOM reading from us to robot dest, in the range
+ * 0-15, or -1 if it is unkown
+ **/
+int wl_token_get_my_sensor_reading(int dest)
+{
+	return wl_token_get_sensor_reading(wl_get_xbee_id(), dest);
+}
+
+
+/**
+ * Returns the number of robots in the token ring.
+ *
+ * @return the number of robots in the token ring
+ **/
+int wl_token_get_robots_in_ring(void)
+{
+	return sensor_matrix_get_joined();
+}
+
+/**
+ * Returns true if the specified robot is in the token ring, false
+ * otherwise.
+ *
+ * @param robot the robot to check for whether it is in the token ring
+ * @return nonzero if the robot is in the token ring, zero otherwise
+ **/
+int wl_token_is_robot_in_ring(int robot)
+{
+	return sensor_matrix_get_in_ring(robot);
+}
+
+/**
+ * Begins iterating through the robots in the token ring.
+ *
+ * @see wl_token_iterator_has_next, wl_token_iterator_next
+ **/
+void wl_token_iterator_begin(void)
+{
+	int i = 0;
+  //TODO: the compiler may or may not optimize this such that my comment is useless:
+  // instead of calling sensor_matrix_get_size every iteration of the while loop and incurring
+  // the overhead of a function call each iteration, call it only once before the loop and store
+  // the value in a variable and check against that variable in the loop condition
+	while (!sensor_matrix_get_in_ring(i) && i < sensor_matrix_get_size()) {
+		i++;
+	}
+
+  //TODO: if you do the above comment, then you can compare this to the variable also
+	if (i == sensor_matrix_get_size()) {
+		i = -1;
+	}
+
+	iteratorCount = i;
+}
+
+/**
+ * Returns true if there are more robots in the token ring
+ * to iterate through, and false otherwise.
+ *
+ * @return nonzero if there are more robots to iterate through,
+ * zero otherwise
+ *
+ * @see wl_token_iterator_begin, wl_token_iterator_next
+ **/
+int wl_token_iterator_has_next(void)
+{
+	return iteratorCount != -1;
+}
+
+/**
+ * Returns the next robot ID in the token ring.
+ *
+ * @return the next robot ID in the token ring, or -1 if none exists
+ *
+ * @see wl_token_iterator_begin, wl_token_iterator_has_next
+ **/
+int wl_token_iterator_next(void)
+{
+	int result = iteratorCount;
+	if (result < 0) {
+		return result;
+	}
+
+  //TODO: the compiler may or may not optimize this such that my comment is useless:
+  // instead of calling sensor_matrix_get_size every iteration of the while loop and incurring
+  // the overhead of a function call each iteration, call it only once before the loop and store
+  // the value in a variable and check against that variable in the loop condition
+	iteratorCount++;
+	while (!sensor_matrix_get_in_ring(iteratorCount)
+		&& iteratorCount < sensor_matrix_get_size()) {
+		iteratorCount++;
+	}
+
+  //TODO: if you do the above comment, then you can compare this to the variable also
+	if (iteratorCount == sensor_matrix_get_size()) {
+		iteratorCount = -1;
+	}
+
+	return result;
+}
+
+/**
+ * Returns the number of robots currently in the token ring.
+ *
+ * @return the number of robots in the token ring
+ **/
+int wl_token_get_num_robots(void)
+{
+	return sensor_matrix_get_joined();
+}
+
+/**
+ * Returns the number of robots in the sensor matrix.
+ *
+ * @return the number of robots in the sensor matrix
+ **/
+int wl_token_get_matrix_size(void)
+{
+	return sensor_matrix_get_size();
+}
+
+/**
+ * This method is called when we receive a token pass packet.
+ *
+ * @param source the robot who passed the token to us.
+ **/
+static void wl_token_pass_receive(int source)
+{
+	WL_DEBUG_PRINT("Received token from ");
+	WL_DEBUG_PRINT_INT(source);
+	WL_DEBUG_PRINT(", expected ");
+	WL_DEBUG_PRINT_INT(wl_token_next_robot);
+	WL_DEBUG_PRINT(".\n");
+	// this prevents two tokens from being passed around at a time (second clause is in case we are joining)
+	if ((source != wl_token_next_robot && wl_get_xbee_id() != wl_token_next_robot) && bom_on_count <= DEATH_DELAY / 2 &&
+		ringState != ACCEPTED)
+	{
+		WL_DEBUG_PRINT("Received token pass when a robot should not have died yet.\n");
+		WL_DEBUG_PRINT("There are probably two tokens going around, packet ignored.\n");
+		return;
+	}
+	bom_on_count = -1;
+	deathDelay = -1;
+	sensor_matrix_set_in_ring(source, 1);
+	wl_token_get_token();
+}
+
+/**
+ * This method is called when we receive a token pass packet.
+ * @param source is the robot it came from
+ * @param nextRobot is the robot the token was passed to
+ * @param sensorData a char with an id followed by a char with the sensor
+ *		reading for that robot, repeated for sensorDataLength bytes
+ * @param sensorDataLength the length in bytes of sensorData
+ */
+static void wl_token_sensor_matrix_receive(int source, unsigned char* sensorData, int sensorDataLength)
+{
+	int i, j;
+	char nextRobot;
+
+	bom_on_count = -1;
+	deathDelay = -1;
+	sensor_matrix_set_in_ring(source, 1);
+
+	//with this packet, we are passed the id of the next robot in the ring
+	//and the sensor matrix, a list of id and sensor reading pairs (two bytes for both)
+	j = 0;
+  //TODO: the compiler may or may not optimize this such that my comment is useless:
+  // instead of calling sensor_matrix_get_size every iteration of the while loop and incurring
+  // the overhead of a function call each iteration, call it only once before the loop and store
+  // the value in a variable and check against that variable in the loop condition
+	for (i = 0; i < sensor_matrix_get_size(); i++)
+	{
+		if (i == source) {
+			continue;
+		}
+
+		//set the sensor information we receive
+		if (j < sensorDataLength / 2 && sensorData[2 * j] == i)
+		{
+			//the robot we were going to accept has already been accepted
+			if (accepted == i)
+			{
+				accepted = -1;
+				WL_DEBUG_PRINT("Someone accepted the robot we did.\r\n");
+			}
+			sensor_matrix_set_reading(source, i,
+						sensorData[2 * j + 1]);
+			if (!sensor_matrix_get_in_ring(i))
+			{
+				WL_DEBUG_PRINT("Robot ");
+				WL_DEBUG_PRINT_INT(i);
+				WL_DEBUG_PRINT(" has been added to the sensor matrix of robot ");
+				WL_DEBUG_PRINT_INT(wl_get_xbee_id());
+				WL_DEBUG_PRINT(" due to a packet from robot ");
+				WL_DEBUG_PRINT_INT(source);
+				WL_DEBUG_PRINT(".\r\n");
+			}
+			sensor_matrix_set_in_ring(i, 1);
+			j++;
+		}
+		else
+		{
+			if (sensor_matrix_get_in_ring(i))
+			{
+				WL_DEBUG_PRINT("Robot ");
+				WL_DEBUG_PRINT_INT(i);
+				WL_DEBUG_PRINT(" has been removed from the sensor matrix of robot ");
+				WL_DEBUG_PRINT_INT(wl_get_xbee_id());
+				WL_DEBUG_PRINT(" due to a packet from robot ");
+				WL_DEBUG_PRINT_INT(source);
+				WL_DEBUG_PRINT(".\r\n");
+				sensor_matrix_set_in_ring(i, 0);
+			}
+
+			if (i == wl_get_xbee_id() && ringState == MEMBER)
+			{
+				ringState = NONMEMBER;
+				wl_token_ring_join();
+
+				WL_DEBUG_PRINT("We have been removed from the ring ");
+				WL_DEBUG_PRINT("and are rejoining.\r\n");
+			}
+
+			//the person who accepted us is dead... let's ask again
+			if (i == acceptor)
+			{
+				sensor_matrix_set_in_ring(wl_get_xbee_id(), 0);
+				ringState = NONMEMBER;
+				acceptor = -1;
+				wl_token_ring_join();
+			}
+		}
+	}
+	
+	// get the next robot in the token ring
+	i = source + 1;
+	while (1)
+	{
+		if (i == sensor_matrix_get_size()) {
+			i = 0;
+		}
+
+		if (sensor_matrix_get_in_ring(i) || i == source)
+		{
+			nextRobot = (char)i;
+			break;
+		}
+
+		i++;
+	}
+
+	if (nextRobot != wl_get_xbee_id())
+		wl_token_next_robot = nextRobot;
+
+	deathDelay = get_token_distance(wl_get_xbee_id(), nextRobot) * DEATH_DELAY;
+
+	if (sensor_matrix_get_joined() == 0 && ringState == JOINING)
+		wl_send_robot_to_robot_global_packet(WL_TOKEN_RING_GROUP, WL_TOKEN_PASS, NULL, 0, nextRobot, WL_TOKEN_PASS_FRAME);
+}
+
+/**
+ * Gets the distance in the token ring between two robots.
+ *
+ * @param robot1 the first robot
+ * @param robot2 the second robot
+ *
+ * @return the number of passes before the token is expected
+ * to reach robot2 from robot1
+ **/
+static int get_token_distance(int robot1, int robot2)
+{
+	int curr = robot1 + 1;
+	int count = 1;
+	while (1)
+	{
+    //TODO: the compiler may or may not optimize this such that my comment is useless:
+    // instead of calling sensor_matrix_get_size every iteration of the while loop and incurring
+    // the overhead of a function call each iteration, call it only once before the loop and store
+    // the value in a variable and check against that variable in the loop condition
+		if (curr == sensor_matrix_get_size())
+			curr = 0;
+		if (curr == robot2)
+			break;
+		if (sensor_matrix_get_in_ring(curr))
+			count++;
+		curr++;
+	}
+	return count;
+}
+
+/**
+ * Passes the token to the next robot in the token ring.
+ **/
+static int wl_token_pass_token()
+{
+	char nextRobot = 0xFF;
+	int i = wl_get_xbee_id() + 1;
+	char buf[2 * sensor_matrix_get_size()];
+	if (accepted == -1)
+	{
+		while (1)
+		{
+      //TODO: the compiler may or may not optimize this such that my comment is useless:
+      // instead of calling sensor_matrix_get_size every iteration of the while loop and incurring
+      // the overhead of a function call each iteration, call it only once before the loop and store
+      // the value in a variable and check against that variable in the loop condition
+			if (i == sensor_matrix_get_size()) {
+				i = 0;
+			}
+
+			if (sensor_matrix_get_in_ring(i))
+			{
+				nextRobot = (char)i;
+				break;
+			}
+
+			i++;
+		}
+	}
+	else
+	{
+		WL_DEBUG_PRINT("Accepting new robot, sending it the token.\r\n");
+		//add a new robot to the token ring
+		sensor_matrix_set_in_ring(accepted, 1);
+		nextRobot = accepted;
+		accepted = -1;
+	}
+
+	int j = 0;
+  //TODO: the compiler may or may not optimize this such that my comment is useless:
+  // instead of calling sensor_matrix_get_size every iteration of the while loop and incurring
+  // the overhead of a function call each iteration, call it only once before the loop and store
+  // the value in a variable and check against that variable in the loop condition
+	for (i = 0; i < sensor_matrix_get_size(); i++) {
+		if (sensor_matrix_get_in_ring(i) && i != wl_get_xbee_id())
+		{
+			buf[2*j] = i;
+			buf[2*j + 1] = sensor_matrix_get_reading(wl_get_xbee_id(), i);
+			j++;
+		}
+	}
+
+	int packetSize = 2 * j * sizeof(char);
+	WL_DEBUG_PRINT("Passing the token to robot ");
+	WL_DEBUG_PRINT_INT(nextRobot);
+	WL_DEBUG_PRINT(".\r\n");
+	if (wl_send_global_packet(WL_TOKEN_RING_GROUP, WL_TOKEN_SENSOR_MATRIX, buf, packetSize, 0) != 0)
+		return -1;
+	if (wl_send_robot_to_robot_global_packet(WL_TOKEN_RING_GROUP, WL_TOKEN_PASS, NULL, 0, nextRobot, WL_TOKEN_PASS_FRAME))
+		return -1;
+
+	wl_token_next_robot = nextRobot;
+	deathDelay = DEATH_DELAY;
+
+	return 0;
+}
+
+/**
+ * Called when a packet is received stating that another robot has turned
+ * its BOM on. Our BOM is then read, and the data is added to the sensor
+ * matrix.
+ *
+ * @param source the robot whose BOM is on
+ **/
+static void wl_token_bom_on_receive(int source)
+{
+	int max;
+
+	WL_DEBUG_PRINT("Robot ");
+	WL_DEBUG_PRINT_INT(source);
+	WL_DEBUG_PRINT(" has flashed its bom.\r\n");
+
+	bom_on_count = 0;
+
+	max = get_max_bom_function();
+	sensor_matrix_set_reading(wl_get_xbee_id(),
+		source, max);
+
+	WL_DEBUG_PRINT("Max: ");
+	WL_DEBUG_PRINT_INT(max);
+	WL_DEBUG_PRINT("\n\n");
+}
+
+/**
+ * This method is called when we receive the token. Upon receiving
+ * the token, we must send a BOM_ON packet, flash the BOM, and send
+ * the token to the next robot.
+ *
+ * If there is a pending request for the token, this is processed first.
+ **/
+static void wl_token_get_token()
+{
+	WL_DEBUG_PRINT("We have the token.\r\n");
+	if (ringState == ACCEPTED)
+	{
+		sensor_matrix_set_in_ring(wl_get_xbee_id(), 1);
+		WL_DEBUG_PRINT("Now a member of the token ring.\r\n");
+		ringState = MEMBER;
+		joinDelay = -1;
+	}
+
+	if (ringState == LEAVING || ringState == NONMEMBER)
+	{
+		sensor_matrix_set_in_ring(wl_get_xbee_id(), 0);
+		if (ringState == NONMEMBER)
+		{
+			WL_DEBUG_PRINT("We should have left the token ring, but didn't.\r\n");
+		}
+		return;
+	}
+
+	WL_DEBUG_PRINT("Our BOM has been flashed.\r\n");
+	wl_send_global_packet(WL_TOKEN_RING_GROUP, WL_TOKEN_BOM_ON, NULL, 0, 0);
+
+	bom_on_function();
+	#ifdef ROBOT
+	delay_ms(BOM_DELAY);
+	#endif
+	bom_off_function();
+
+	if (!sensor_matrix_get_in_ring(wl_get_xbee_id()))
+	{
+		WL_DEBUG_PRINT("Removed from sensor matrix while flashing BOM.\r\n");
+		return;
+	}
+
+	wl_token_pass_token();
+}
+
+/**
+ * Called when a request to join the token ring is received.
+ * If we are the robot preceding the requester in the ring,
+ * we respond with a JOIN_ACCEPT packet and pass the token to
+ * this robot when we receive the token.
+ *
+ * @param source the robot who requested to join
+ **/
+static void wl_token_join_receive(int source)
+{
+	WL_DEBUG_PRINT("Received joining request from robot ");
+	WL_DEBUG_PRINT_INT(source);
+	WL_DEBUG_PRINT(".\r\n");
+
+	//we cannot accept the request if we are not a member
+	if (ringState != MEMBER)
+		return;
+	//if they didn't get our response, see if we should respond again
+	if (accepted == source)
+		accepted = -1;
+	//we can only accept one request at a time
+	if (accepted != -1)
+		return;
+
+	//check if we are the preceding robot in the token ring
+	int i = source - 1;
+	while (1)
+	{
+		if (i < 0)
+			i = sensor_matrix_get_size() - 1;
+
+		//we must send a join acceptance
+		if (i == wl_get_xbee_id())
+			break;
+
+		//another robot will handle it
+		if (sensor_matrix_get_in_ring(i))
+			return;
+
+		i--;
+	}
+
+	accepted = source;
+	wl_send_robot_to_robot_global_packet(WL_TOKEN_RING_GROUP, WL_TOKEN_JOIN_ACCEPT,
+		NULL, 0, source, TOKEN_JOIN_ACCEPT_FRAME);
+
+	WL_DEBUG_PRINT("Accepting robot ");
+	WL_DEBUG_PRINT_INT(source);
+	WL_DEBUG_PRINT(" into the token ring.\r\n");
+
+	// the token ring has not started yet
+	if (sensor_matrix_get_joined() == 1)
+		wl_token_pass_token();
+}
+
+/**
+ * Called when we receive a JOIN_ACCEPT packet in attempting to join
+ * the token ring.
+ * Our attempt to join the ring is stopped, and we wait for the token.
+ *
+ * @param source the robot who accepted us
+ **/
+static void wl_token_join_accept_receive(int source)
+{
+	WL_DEBUG_PRINT("Accepted into the token ring by robot ");
+	WL_DEBUG_PRINT_INT(source);
+	WL_DEBUG_PRINT(".\r\n");
+	joinDelay = JOIN_DELAY;
+	ringState = ACCEPTED;
+	acceptor = source;
+
+	//add ourselves to the token ring
+	sensor_matrix_set_in_ring(wl_get_xbee_id(), 1);
+}
Index: demos/hunter_prey_john/projects/libwireless/lib/wl_error_group.c
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wl_error_group.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wl_error_group.c	(revision 1694)
@@ -0,0 +1,122 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file wl_error_group.h
+ * @brief Error Packets
+ *
+ * A wireless group for sending error packets.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#include "wl_error_group.h"
+#include "wireless.h"
+#include "wl_defs.h"
+
+#include <string.h>
+
+
+
+void wl_error_response_receive(int frame, int received);
+void wl_error_handle_receive(char type, int source, unsigned char* packet,
+							int length);
+
+PacketGroupHandler wl_error_handler =
+		{WL_ERROR_GROUP, NULL,
+		wl_error_response_receive, wl_error_handle_receive, NULL};
+
+void wl_error_response_receive(int frame, int received)
+{
+	WL_DEBUG_PRINT("Response received.\r\n");
+	if (!received)
+	{
+		WL_DEBUG_PRINT("FAILED.\r\n");
+	}
+}
+/**
+ * Register this packet group with the wireless library.
+ * This function must be called before any other wl_error
+ * function.
+ **/
+void wl_error_register(void)
+{
+	wl_register_packet_group(&wl_error_handler);
+}
+
+/**
+ * Unregister this packet group with the wireless library.
+ * This function must be called after wl_error_register.
+ *
+ * @see wl_error_register
+ **/
+void wl_error_unregister(void)
+{
+	wl_unregister_packet_group(&wl_error_handler);
+}
+
+/**
+ * Handles receiving an error packet.
+ *
+ * @param type the packet type
+ * @param source the 16-bit address of the packet's sender
+ * @param packet the packet data
+ * @param length the length in bytes of the packet
+ **/
+void wl_error_handle_receive(char type, int source, unsigned char* packet,
+							int length)
+{
+	switch (type)
+	{
+		case WL_ERROR_STRING_TYPE:
+			if (packet[length - 1] != 0)
+			{
+				WL_DEBUG_PRINT(
+					"Error packet string should be null terminated.\r\n");
+				break;
+			}
+			WL_DEBUG_PRINT("Error packet received from robot ");
+			WL_DEBUG_PRINT_INT(source);
+			WL_DEBUG_PRINT(":\r\n");
+			WL_DEBUG_PRINT((char*)packet);
+			WL_DEBUG_PRINT("\r\n");
+			break;
+		default:
+			WL_DEBUG_PRINT("Error packet of unknown type received.\r\n");
+			break;
+	}
+}
+
+/**
+ * Send an error message as a string.
+ *
+ * @param str the error message to send
+ **/
+void wl_error_send_string(char* str)
+{
+	wl_send_global_packet(WL_ERROR_GROUP, WL_ERROR_STRING_TYPE,
+		str, strlen(str) + 1, 1);
+}
+
Index: demos/hunter_prey_john/projects/libwireless/lib/wireless.c
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wireless.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wireless.c	(revision 1694)
@@ -0,0 +1,466 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file wireless.c
+ * @brief Wireless Library Implementation
+ *
+ * Implementation of the wireless library.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#include "wireless.h"
+#include "xbee.h"
+
+#include <stddef.h>
+
+#ifdef WL_DEBUG
+#include <stdio.h>
+#endif
+
+#include "wl_defs.h"
+
+#ifndef ROBOT
+	#include <sys/time.h>
+	#include <signal.h>
+#else
+	#include <time.h>
+	#include <bom.h>
+#endif
+
+/*Function Prototypes*/
+
+static void wl_do_timeout(void);
+
+//Note: the actual frame sent has group as the first four bits and
+//frame as the last four.
+static int wl_send_packet(char group, char type, char* data, int len, int dest, char options, char frame);
+
+/*Data Members*/
+
+//used to store incoming and outgoing packets
+//TODO: does this need to be 128?  can it be smaller to save memory?
+//TODO: this shouldn't be hardcoded as 128.  it should be a define.
+static unsigned char wl_buf[128];
+//1 if we have timed out since we last checked, 0 otherwise.
+static int wl_timeout = 0;
+
+static PacketGroupHandler* wl_packet_groups[WL_MAX_PACKET_GROUPS];
+
+#ifndef ROBOT
+
+//called when we time out, or receive interrupt
+static void sig_handler(int signo)
+{
+	switch (signo)
+	{
+		case SIGALRM:
+			wl_timeout = 1;
+			break;
+		case SIGINT:
+			wl_terminate();
+			exit(1);
+			break;
+	}
+	return;
+}
+#else
+
+//called when the timer ticks
+static void timer_handler(void)
+{
+	wl_timeout = 1;
+}
+
+#endif
+
+/**
+ * Initializes the wireless library. Must be called before any
+ * other function.
+ *
+ * @param wl_port File descriptor for wireless port, or NULL for default.
+ **/
+int wl_init()
+{
+	int i;
+  //TODO: using memset here instead of this loop, *might* be less instructions and *might* reduce code size but not sure
+	for (i = 0; i < WL_MAX_PACKET_GROUPS; i++)
+		wl_packet_groups[i] = NULL;
+
+	if (xbee_lib_init() == -1) {
+		return -1;
+	}
+
+	//begin timeout timer
+#ifdef ROBOT
+#ifdef FIREFLY
+	rtc_init(PRESCALE_DIV_256, 32, &timer_handler);
+#else
+	//TODO: FIX THIS
+	#ifdef BAYBOARD
+	rtc_init(10 * HALF_SECOND, &timer_handler);
+	#else
+	rtc_init(HALF_SECOND, &timer_handler);
+	#endif
+#endif
+#else
+
+	//create our timer
+	struct itimerval timer_val;
+	struct timeval interval;
+	interval.tv_sec = 0;
+	interval.tv_usec = 500000;
+	struct timeval first_time;
+	first_time.tv_sec = 0;
+	first_time.tv_usec = 500000;
+	timer_val.it_interval = interval;
+	timer_val.it_value = first_time;
+	if(setitimer(ITIMER_REAL,&timer_val,NULL)==-1)
+	{
+		WL_DEBUG_PRINT("Error creating a timer.\r\n");
+		perror("Failure's cause");
+		exit(1);
+	}
+
+	//create signal handler
+	struct sigaction wl_sig_act;
+	wl_sig_act.sa_handler = sig_handler;
+	wl_sig_act.sa_flags = 0;
+	sigemptyset(&wl_sig_act.sa_mask);
+	sigaction(SIGALRM, &wl_sig_act, 0);
+	sigaction(SIGINT, &wl_sig_act, 0);
+#endif
+
+	return 0;
+}
+
+/**
+ * Uninitializes the wireless library.
+ **/
+void wl_terminate()
+{
+	int i;
+	for (i = 0; i < WL_MAX_PACKET_GROUPS; i++) {
+		if (wl_packet_groups[i] != NULL &&
+			wl_packet_groups[i]->unregister != NULL) {
+			wl_packet_groups[i]->unregister();
+		}
+	}
+
+	xbee_terminate();
+}
+
+/**
+ * Set the PAN for the XBee to join.
+ *
+ * @param pan the new PAN
+ *
+ * @see wl_get_pan
+ **/
+int wl_set_pan(int pan)
+{
+	return xbee_set_pan_id(pan);
+}
+
+/**
+ * Get the PAN the XBee is currently part of.
+ *
+ * @return the PAN of the XBee
+ *
+ * @see wl_set_pan
+ **/
+int wl_get_pan(void)
+{
+	return xbee_get_pan_id();
+}
+
+/**
+ * Set the channel the XBee is listening to.
+ *
+ * @param channel the new channel to join
+ *
+ * @see wl_get_channel
+ **/
+int wl_set_channel(int channel)
+{
+	return xbee_set_channel(channel);
+}
+
+/**
+ * Get the channel the XBee is part of.
+ *
+ * @return the channel the XBee is part of
+ *
+ * @see wl_set_channel
+ **/
+int wl_get_channel(void)
+{
+	return xbee_get_channel();
+}
+
+/**
+ * Returns the 16-bit address of the XBee module.
+ *
+ * @return the 16-bit address of the XBee module.
+ **/
+int wl_get_xbee_id()
+{
+	return xbee_get_address();
+}
+
+/**
+ * Send a packet to a specific XBee without specifying a PAN.
+ *
+ * @param group the packet group
+ * @param type the packet type
+ * @param data the packet data
+ * @param len the packet length in bytes
+ * @param dest the 16-bit address of the XBee to send the packet to
+ * @param frame the frame number to see with a TX_STATUS response
+ **/
+int wl_send_robot_to_robot_global_packet(char group, char type, char* data, int len, int dest, char frame)
+{
+	return wl_send_packet(group, type, data, len, dest, XBEE_OPTIONS_BROADCAST_ALL_PANS, frame);
+}
+
+/**
+ * Send a packet to a specific XBee in the same PAN.
+ *
+ * @param group the packet group
+ * @param type the packet type
+ * @param data the packet data
+ * @param len the packet length in bytes
+ * @param dest the 16-bit address of the XBee to send the packet to
+ * @param frame the frame number to see with a TX_STATUS response
+ **/
+int wl_send_robot_to_robot_packet(char group, char type, char* data, int len, int dest, char frame)
+{
+	return wl_send_packet(group, type, data, len, dest, XBEE_OPTIONS_NONE, frame);
+}
+
+/**
+ * Send a packet to all XBees in all PANs.
+ *
+ * @param group the packet group
+ * @param type the packet type
+ * @param data the packet data
+ * @param len the packet length in bytes
+ * @param frame the frame number to see with a TX_STATUS response
+ **/
+int wl_send_global_packet(char group, char type, char* data, int len, char frame)
+{
+	return wl_send_packet(group, type, data, len, XBEE_BROADCAST, XBEE_OPTIONS_BROADCAST_ALL_PANS, frame);
+}
+
+/**
+ * Send a packet to all XBee's in the same PAN.
+ *
+ * @param group the packet group
+ * @param type the packet type
+ * @param data the packet data
+ * @param len the packet length in bytes
+ * @param frame the frame number to see with a TX_STATUS response
+ **/
+void wl_send_pan_packet(char group, char type, char* data, int len, char frame)
+{
+	wl_send_packet(group, type, data, len, XBEE_BROADCAST,
+			XBEE_OPTIONS_NONE, frame);
+}
+
+/**
+ * Send a packet.
+ *
+ * @param group the packet group
+ * @param type the packet type
+ * @param data the packet data
+ * @param len the packet length in bytes
+ * @param dest the destination of the packet
+ * @param options the options for sending the packet
+ * @param frame the frame number to see with a TX_STATUS response
+ **/
+int wl_send_packet(char group, char type, char* data, int len, int dest, char options, char frame)
+{
+  //TODO: does this need to be 128?  can it be smaller to save memory?
+  //TODO: this shouldn't be hardcoded as 128.  it should be a define.
+	char buf[128];
+	int i;
+	if (frame != 0)
+		frame = (frame & 0x0F) | ((group & 0x0F) << 4);
+
+	buf[0] = group;
+	buf[1] = type;
+	for (i = 0; i < len; i++)
+		buf[2 + i] = data[i];
+
+	return xbee_send_packet(buf, len + 2, dest, options, frame);
+}
+
+/**
+ * Register a packet group with the wireless library. The event
+ * handlers in the packet group will be called whenever an
+ * event dealing with the packet group's group code occurs.
+ *
+ * @param h the PacketGroupHandler to register
+ **/
+void wl_register_packet_group(PacketGroupHandler* h)
+{
+	if (h->groupCode >= WL_MAX_PACKET_GROUPS)
+	{
+		WL_DEBUG_PRINT("Packet group code too large.\r\n");
+		return;
+	}
+	if (wl_packet_groups[h->groupCode] != NULL)
+	{
+		WL_DEBUG_PRINT("Packet group code already registered.\r\n");
+		return;
+	}
+	wl_packet_groups[h->groupCode] = h;
+}
+
+/**
+ * Unregister a packet group from the wireless library.
+ *
+ * @param h the packet group to remove
+ **/
+void wl_unregister_packet_group(PacketGroupHandler* h)
+{
+	unsigned int groupCode = h->groupCode;
+	PacketGroupHandler* p = wl_packet_groups[groupCode];
+	if (p != NULL && p->unregister != NULL)
+		p->unregister();
+	wl_packet_groups[groupCode] = NULL;
+}
+
+/**
+ * Called when the timer is triggered. This calls the timeout
+ * handlers of all the registered packet groups.
+ **/
+void wl_do_timeout()
+{
+	int i;
+	for (i = 0; i < WL_MAX_PACKET_GROUPS; i++)
+		if (wl_packet_groups[i] != NULL &&
+			wl_packet_groups[i]->timeout_handler != NULL)
+			wl_packet_groups[i]->timeout_handler();
+}
+
+/**
+ * Performs wireless library functionality. This function must
+ * be called frequently for wireless to perform effectively.
+ * This function will call timeout handlers, as well as
+ * received packet and transmit status handlers.
+ **/
+void wl_do()
+{
+	if (wl_timeout)
+	{
+		wl_do_timeout();
+		wl_timeout = 0;
+	}
+
+	int len = xbee_get_packet(wl_buf);
+	if (len < 0)//no packet received
+		return;
+
+	if (wl_buf[0] == XBEE_TX_STATUS)
+	{
+		if (len != 3)
+		{
+			WL_DEBUG_PRINT("Transmit Status packet should be of length 3.\r\n");
+			return;
+		}
+
+		//the first four bits are the packet group
+		//this only works with under 16 groups
+		int group = (int)(wl_buf[1] >> 4);
+		int success = 0;
+		if (wl_buf[2] == 0)
+		{
+			success = 1;
+		}
+		else
+		{
+			WL_DEBUG_PRINT("No response received.\r\n");
+			if (wl_buf[2] == 2)
+			{
+				WL_DEBUG_PRINT("CCA Failure\r\n");
+			}
+			if (wl_buf[2] == 3)
+			{
+				WL_DEBUG_PRINT("Purged\r\n");
+			}
+		}
+
+		if (wl_packet_groups[group] != NULL && wl_packet_groups[group]->handle_response != NULL)
+			wl_packet_groups[group]->handle_response((int)wl_buf[1] & 0x0F, success);
+	}
+	else if (wl_buf[0] == XBEE_RX)
+	{
+    //TODO: what does this 7 represent?  It shouldn't be hardcoded.  It should be set as a define
+		if (len < 7)
+		{
+			WL_DEBUG_PRINT("Packet is too small.\r\n");
+			return;
+		}
+
+		int source = ((int)wl_buf[1] << 8) + ((int)wl_buf[2]);
+
+		/*
+		//unused for now
+		int signalStrength = wl_buf[3];
+		//1 for Address broadcast, 2 for PAN broadcast
+		int options = wl_buf[4];
+		*/
+
+    //TODO: these indices, etc should be defined, not hardcoded
+		int group = wl_buf[5];
+		int type = wl_buf[6];
+		int packetLen = len - 7;
+
+		if (wl_packet_groups[group] != NULL && wl_packet_groups[group]->handle_receive != NULL) {
+			wl_packet_groups[group]->handle_receive(type, source, wl_buf + 7, packetLen);
+		}
+	}
+	else
+	{
+		WL_DEBUG_PRINT("Unexpected packet received from XBee.\r\n");
+		#ifdef WL_DEBUG
+		#ifndef ROBOT
+		printf("0x%2X\n", wl_buf[0]);
+		printf("%c%c%d\n", wl_buf[2], wl_buf[3], wl_buf[4]);
+		#endif
+		#endif
+	}
+}
+
+
+#ifndef ROBOT
+void wl_set_com_port(char* port)
+{
+	xbee_set_com_port(port);
+}
+#endif
+
Index: demos/hunter_prey_john/projects/libwireless/lib/wl_basic.c
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wl_basic.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wl_basic.c	(revision 1694)
@@ -0,0 +1,111 @@
+/**
+ * @file wl_basic.c
+ * @brief High Level Wireless Packet Sending-Receiving Functions
+ *
+ * Abstracted wireless functionality for sending and receiving packets
+ *
+ * @author Christopher Mar, Colony Project, CMU Robotics Club
+ **/
+
+#include "wl_basic.h"
+
+/**
+ * Wrapper for wl_init().
+ * Initializes wireless and registers a packet handler function for Basic Group.
+ *
+ * @param handle_receive function pointer to handler function for Basic Group
+ * @return 0 on success, -1 on error 
+ **/
+int wl_basic_init( void(*handle_receive) (char type, int source,
+                   unsigned char* packet, int length) ) {
+    int returnme = wl_init();
+    wl_basic_register_handler(handle_receive);
+    current_packet.new_flag = 0;
+    return returnme;
+}
+
+/**
+ * Wrapper for wl_init().
+ * Initializes wireless and registers the default packet handler for Basig Group.
+ *
+ **/
+int wl_basic_init_default( ) {
+    return wl_basic_init(&wl_basic_packet_receive_handler);
+}
+
+/**
+ * Internal function to register a packet group handler for Basic Group.
+ *
+ * @param handle_receive function pointer to handler function for Basic Group
+ **/
+void wl_basic_register_handler( void (*handle_receive) (char type, int source,
+                        unsigned char* packet, int length)) {
+    wl_basic_group_handler.groupCode = WL_BASIC_GROUP;
+    wl_basic_group_handler.timeout_handler = 0;
+    wl_basic_group_handler.handle_response = 0;
+    wl_basic_group_handler.handle_receive = handle_receive;
+    wl_basic_group_handler.unregister = 0;
+
+    wl_register_packet_group(&wl_basic_group_handler);
+}
+
+/**
+ * Send a packet to a single robot in Basic Group.
+ *
+ * @param type Packet type
+ * @param data Packet buffer, data you want to send
+ * @param len Length of the data buffer in bytes
+ * @param dest Robot ID of the destination robot
+ **/
+void wl_basic_send_robot_packet( char type, char* data, int len, int dest ) {
+    wl_send_robot_to_robot_global_packet(WL_BASIC_GROUP, type, data, len, dest, 0);
+}
+
+/**
+ * Send a packet to all robots in Basic Group.
+ *
+ * @param type Packet type
+ * @param data Packet buffer, data you want to send
+ * @param len Length of the data buffer in bytes
+ **/
+void wl_basic_send_global_packet( char type, char* data, int len ) {
+    wl_send_global_packet(WL_BASIC_GROUP, type, data, len, 0);
+}
+
+/**
+ * Default packet handler used if none is specified on init.
+ * This should not be called directly by any user program.
+ *
+ * @param type Packet type
+ * @param source the robot ID of the sending robot
+ * @param packet Packet buffer, data you received
+ * @param length Length of the data buffer in bytes
+ **/
+void wl_basic_packet_receive_handler( char type, int source, unsigned char* packet, int length ) {
+    current_packet.new_flag = 1;
+    current_packet.type = type;
+    current_packet.source = source;
+    current_packet.data = packet;
+    current_packet.length = length;
+}
+
+/**
+ * Wrapper for wl_do() for use with the Basic Wireless group.
+ * Can only be called if wl_basic_init_default and your packets
+ *  are handled with the default packet handler.
+ * To access packet information, use PacketInfo current_packet.
+ *
+ * @param length a pointer to int to store the length of the data buffer
+ * 
+ * @return pointer to the data of the packet just received, 0 if no new packet
+ **/
+unsigned char* wl_basic_do_default( int *length ) {
+    wl_do();
+    if (current_packet.new_flag == 1) { 
+        current_packet.new_flag = 0;
+        *length = current_packet.length;
+        return current_packet.data;
+    }
+    return 0;
+}
+
Index: demos/hunter_prey_john/projects/libwireless/lib/xbee.c
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/xbee.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/xbee.c	(revision 1694)
@@ -0,0 +1,1043 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file xbee.c
+ * @brief XBee Interface
+ *
+ * Implementation of low level communication with the XBee in API mode.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#include "xbee.h"
+#include "wl_defs.h"
+
+#ifndef ROBOT
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <errno.h>
+#include <termios.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#else
+
+#include <serial.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+
+#endif
+
+#include <string.h>
+
+#define XBEE_FRAME_START 0x7E
+#define XBEE_GET_PACKET_TIMEOUT 1000
+
+/*Frame Types*/
+#define XBEE_FRAME_STATUS 0x8A
+#define XBEE_FRAME_AT_COMMAND 0x08
+#define XBEE_FRAME_AT_COMMAND_RESPONSE 0x88
+#define XBEE_FRAME_TX_REQUEST_64 0x00
+#define XBEE_FRAME_TX_REQUEST_16 0x01
+#define XBEE_FRAME_TX_STATUS XBEE_TX_STATUS
+#define XBEE_FRAME_RX_64 0x80
+#define XBEE_FRAME_RX_16 XBEE_RX
+
+/*Internal Function Prototypes*/
+
+/*I/O Functions*/
+static int xbee_send(char* buf, int size);
+static int xbee_send_string(char* c);
+
+#ifndef ROBOT
+static int xbee_read(char* buf, int size);
+#endif
+
+/*Command Mode Functions
+ * Called during initialization.
+ */
+static int xbee_enter_command_mode(void);
+static int xbee_exit_command_mode(void);
+static int xbee_enter_api_mode(void);
+static int xbee_exit_api_mode(void);
+static int xbee_wait_for_string(char* s, int len);
+static int xbee_wait_for_ok(void);
+
+/*API Mode Functions*/
+
+static int xbee_handle_packet(char* packet, int len);
+static void xbee_handle_at_command_response(char* command, char result, char* extra, int extraLen);
+static void xbee_handle_status(char status);
+static int xbee_verify_checksum(char* packet, int len);
+static char xbee_compute_checksum(char* packet, int len);
+static int xbee_send_frame(char* buf, int len);
+static int xbee_send_read_at_command(char* command);
+static int xbee_send_modify_at_command(char* command, char* value);
+
+/*Global Variables*/
+
+#ifndef ROBOT
+static char* xbee_com_port = XBEE_PORT_DEFAULT;
+static int xbee_stream;
+static pthread_t* xbee_listen_thread;
+#endif
+
+// TODO: is this a good size?
+#define XBEE_BUFFER_SIZE	128
+#define PACKET_BUFFER_SIZE	108
+// a buffer for data received from the XBee
+char arrival_buf[XBEE_BUFFER_SIZE];
+// location of last unread byte in buffer
+volatile int buffer_last = 0;
+// first unread byte in buffer
+volatile int buffer_first = 0;
+
+
+//used to store packets as they are read
+static char xbee_buf[PACKET_BUFFER_SIZE];
+static int currentBufPos = 0;
+
+//XBee status
+static unsigned int xbee_panID = XBEE_PAN_DEFAULT;
+static unsigned int xbee_pending_panID = XBEE_PAN_DEFAULT;
+static int xbee_channel = XBEE_CHANNEL_DEFAULT;
+static int xbee_pending_channel = XBEE_CHANNEL_DEFAULT;
+static volatile unsigned int xbee_address = 0;
+
+/*Function Implementations*/
+
+#ifdef ROBOT
+
+/**
+ * Interrupt for the robot. Adds bytes received from the xbee
+ * to the buffer.
+ **/
+#ifndef FIREFLY
+ISR(USART1_RX_vect)
+{
+	char c = UDR1;
+	arrival_buf[buffer_last] = c;
+	int t = buffer_last + 1;
+	if (t == XBEE_BUFFER_SIZE)
+		t = 0;
+	if (t == buffer_first)
+	{
+		WL_DEBUG_PRINT("\nOut of space in buffer.\n");
+	}
+	buffer_last = t;
+}
+#else
+SIGNAL(SIG_USART0_RECV)
+{
+	char c = UDR0;
+	arrival_buf[buffer_last] = c;
+	int t = buffer_last + 1;
+	if (t == XBEE_BUFFER_SIZE)
+		t = 0;
+	if (t == buffer_first)
+	{
+		WL_DEBUG_PRINT("Out of space in buffer.\n");
+	}
+	buffer_last = t;
+}
+#endif
+
+#else
+
+// Computer code
+
+/**
+ * Thread that listens to the xbee.
+ **/
+static void* listen_to_xbee(void* x)
+{
+	char c;
+	while (1)
+	{
+		if (xbee_read(&c, 1) != 0) {
+			WL_DEBUG_PRINT("xbee_read failed.\n");
+			return NULL;
+		}
+
+		arrival_buf[buffer_last] = c;
+		int t = buffer_last + 1;
+		if (t == XBEE_BUFFER_SIZE)
+			t = 0;
+		if (t == buffer_first)
+		{
+			WL_DEBUG_PRINT("Out of space in buffer.\n");
+		}
+		buffer_last = t;
+
+		usleep(1000);
+	}
+
+	return NULL;
+}
+
+#endif
+
+/**
+ * Initializes the XBee library so that other functions may be used.
+ **/
+int xbee_lib_init()
+{
+	WL_DEBUG_PRINT("in xbee_init\n");
+#ifdef ROBOT
+
+	//enable the receiving interrupt
+#ifdef FIREFLY
+	UCSR0B |= _BV(RXCIE) | _BV(RXEN);
+#else
+#ifdef BAYBOARD
+	UCSR1B |= _BV(RXCIE1);
+#else
+	UCSR1B |= _BV(RXCIE);
+#endif
+#endif
+	sei();
+#else
+	xbee_stream = open(xbee_com_port, O_RDWR);
+	if (xbee_stream == -1/* || lockf(xbee_stream, F_TEST, 0) != 0*/)
+	{
+		WL_DEBUG_PRINT("Failed to open connection to XBee on port ");
+		WL_DEBUG_PRINT_INT(xbee_com_port);
+		WL_DEBUG_PRINT(".\n");
+		return -1;
+	} else {
+	  WL_DEBUG_PRINT("Successfully opened connection to XBee on port ");
+		WL_DEBUG_PRINT_INT(xbee_com_port);
+		WL_DEBUG_PRINT(".\n");
+	}
+
+	// set baud rate, etc. correctly
+	struct termios options;
+
+	tcgetattr(xbee_stream, &options);
+	cfsetispeed(&options, B9600);
+	cfsetospeed(&options, B9600);
+	options.c_iflag &= ~ICRNL;
+	options.c_oflag &= ~OCRNL;
+	options.c_cflag |= (CLOCAL | CREAD);
+	options.c_cflag &= ~PARENB;
+	options.c_cflag &= ~CSTOPB;
+	options.c_cflag &= ~CSIZE;
+	options.c_cflag |= CS8;
+	options.c_lflag &= ~ICANON;
+	options.c_cc[VMIN] = 1;
+	options.c_cc[VTIME] = 50;
+
+	if (tcsetattr(xbee_stream, TCSANOW, &options))
+	{
+		WL_DEBUG_PRINT("Error setting attributes.\n");
+		return -1;
+	}
+
+	xbee_listen_thread = (pthread_t*)malloc(sizeof(pthread_t));
+	if (xbee_listen_thread == NULL)
+	{
+		WL_DEBUG_PRINT("Malloc failed.\n");
+		return -1;
+	}
+
+	int ret = pthread_create(xbee_listen_thread, NULL, listen_to_xbee, NULL);
+	if (ret)
+	{
+		WL_DEBUG_PRINT("Failed to create listener thread.\n");
+		return -1;
+	}
+#endif
+
+	WL_DEBUG_PRINT("Entering command mode.\n");
+
+	if (xbee_enter_command_mode() != 0) {
+		return -1;
+	}
+
+	WL_DEBUG_PRINT("Entered command mode.\n");
+
+	if (xbee_enter_api_mode() != 0) {
+		return -1;
+	}
+
+	WL_DEBUG_PRINT("Entered api mode.\n");
+
+	if (xbee_exit_command_mode() != 0) {
+	     return -1;
+	}
+	
+	WL_DEBUG_PRINT("Left command mode.\n");
+
+	if (xbee_send_read_at_command("MY")) {
+		return -1;
+	}
+	WL_DEBUG_PRINT("Getting ATMY address.\n");
+
+#ifndef ROBOT
+	int i;
+	for (i = 0; xbee_address == 0 && i < XBEE_GET_PACKET_TIMEOUT; i++) {
+	  ret = xbee_get_packet(NULL);
+
+	  usleep(1000);
+	  
+/* 	  if (ret == -1) { */
+/* 	    WL_DEBUG_PRINT("xbee_get_packet(NULL) failed.\n"); */
+/* 	    return -1; */
+/* 	  } */
+	}
+#else
+	//wait to return until the address is set
+  //TODO: this shouldn't wait indefinitely.  There should be some sort of reasonable timeout
+  // so if the address is never set right, an error can be returned instead of having the
+  // robot hang forever
+	while (xbee_address == 0) {
+	  xbee_get_packet(NULL);
+	}
+#endif
+	WL_DEBUG_PRINT("Got ATMY address.\n");
+
+#ifndef ROBOT
+	if (i == XBEE_GET_PACKET_TIMEOUT) { // We timed-out.
+
+	  WL_DEBUG_PRINT("xbee_get_packet timed out.\n");
+	  return -1;
+	} else {
+	  return 0;
+	}
+#else
+	return 0;
+#endif
+}
+
+/**
+ * Call when finished using the XBee library. This releases
+ * all sued resources.
+ **/
+void xbee_terminate()
+{
+	#ifndef ROBOT
+	pthread_cancel(*xbee_listen_thread);
+    pthread_join(*xbee_listen_thread, NULL);
+	free(xbee_listen_thread);
+	lockf(xbee_stream, F_ULOCK, 0);
+	close(xbee_stream);
+  #else
+  xbee_exit_api_mode();
+	#endif
+}
+
+/**
+ * Send a buffer buf of size bytes to the XBee.
+ *
+ * @param buf the buffer of data to send
+ * @param size the number of bytes to send
+ **/
+static int xbee_send(char* buf, int size)
+{
+#ifdef ROBOT
+	int i;
+	for (i = 0; i < size; i++) {
+		xbee_putc(buf[i]);
+	}
+
+	return 0;
+
+#else
+
+	int ret = write(xbee_stream, buf, size);
+	//success
+	if (ret == size)
+		return 0;
+	if (ret == -1)
+	{
+		//interrupted by system signal, probably timer interrupt.
+		//just try again
+		if (errno == 4)
+		{
+			return xbee_send(buf, size);
+		}
+		WL_DEBUG_PRINT("Failed to write to xbee\r\n");
+		return -1;
+	}
+
+	//write was interrupted after writing ret bytes
+	return xbee_send(buf + ret, size - ret);
+#endif
+}
+
+/**
+ * Sends a string to the XBee.
+ *
+ * @param c the string to send to the XBEE
+ **/
+static int xbee_send_string(char* c)
+{
+	return xbee_send(c, strlen(c));
+}
+
+#ifndef ROBOT
+static int xbee_read(char* buf, int size)
+{
+	if (read(xbee_stream, buf, size) == -1) {
+		WL_DEBUG_PRINT("Failed to read from xbee.\r\n");
+		return -1;
+	}
+
+	return 0;
+}
+#endif
+
+/**
+ * Enter into command mode.
+ **/
+static int xbee_enter_command_mode()
+{
+	if (xbee_send_string("+++") != 0) {
+		return -1;
+	}
+
+	if (xbee_wait_for_ok() != 0) {
+	  return -1;
+	}
+	  return 0;
+}
+
+/**
+ * Exit from command mode.
+ **/
+static int xbee_exit_command_mode()
+{
+	if (xbee_send_string("ATCN\r") != 0) {
+		return -1;
+	}
+
+	xbee_wait_for_ok();
+
+	return 0;
+}
+
+/**
+ * Enter API mode.
+ **/
+static int xbee_enter_api_mode()
+{
+	if (xbee_send_string("ATAP 1\r") != 0) {
+		return -1;
+	}
+	xbee_wait_for_ok();
+
+	return 0;
+}
+
+/**
+ * Exit API mode.
+ **/
+static int xbee_exit_api_mode()
+{
+	if (xbee_send_modify_at_command("AP","0") != 0) {
+		return -1;
+	}
+
+	return 0;
+}
+
+/**
+ * Wait until the string "OK\r" is received from the XBee.
+ **/
+static int xbee_wait_for_ok()
+{
+	return xbee_wait_for_string("OK\r", 3);
+}
+
+/**
+ * Delay until the specified string is received from
+ * the XBee. Discards all other XBee data.
+ *
+ * @param s the string to receive
+ * @param len the length of the string
+ **/
+static int xbee_wait_for_string(char* s, int len)
+{
+	char* curr = s;
+	while (curr - s < len) {
+		// check if buffer is empty
+		if (buffer_last != buffer_first) {
+			char c = arrival_buf[buffer_first++];
+			if (buffer_first == XBEE_BUFFER_SIZE) {
+				buffer_first = 0;
+			}
+
+			if (c == *curr) {
+				curr++;
+			} else {
+#ifndef ROBOT
+			  //return -1; // Computer is less forgiving.
+			  curr = s;
+#else
+			  curr = s;
+#endif
+			}
+		} // else buffer is empty.
+
+#ifndef ROBOT
+		usleep(100);
+#endif
+	}
+
+	return 0;
+}
+
+/**
+ * Verifies that the packets checksum is correct.
+ * (If the checksum is correct, the sum of the bytes
+ * is 0xFF.)
+ *
+ * @param packet the packet received. This includes the first
+ * three bytes, which are header information from the XBee.
+ *
+ * @param len The length of the packet received from the XBee
+ *
+ * @return 0 if the checksum is incorrect, nonzero
+ * otherwise
+ **/
+int xbee_verify_checksum(char* packet, int len)
+{
+	unsigned char sum = 0;
+	int i;
+	for (i = 3; i < len; i++)
+		sum += (unsigned char)packet[i];
+	return sum == 0xFF;
+}
+
+/**
+ * Returns the checksum of the given packet.
+ *
+ * @param buf the data for the packet to send
+ * @param len the length of the packet in bytes
+ *
+ * @return the checksum of the packet, which will
+ * become the last byte sent in the packet
+ **/
+char xbee_compute_checksum(char* buf, int len)
+{
+	int i;
+	unsigned char sum = 0;
+	for (i = 0; i < len; i++)
+		sum += (unsigned char)buf[i];
+	return 0xFF - sum;
+}
+
+/**
+ * Adds header information and checksum to the given
+ * packet and sends it. Header information includes
+ * XBEE_FRAME_START and the packet length, as two bytes.
+ *
+ * @param buf the packet data
+ * @param len the size in bytes of the packet data
+ *
+ **/
+static int xbee_send_frame(char* buf, int len)
+{
+	char prefix[3];
+	prefix[0] = XBEE_FRAME_START;
+	prefix[1] = (len & 0xFF00) >> 8;
+	prefix[2] = len & 0xFF;
+	char checksum = xbee_compute_checksum(buf, len);
+
+	if (xbee_send(prefix, 3) != 0) {
+		return -1;
+	}
+
+	if (xbee_send(buf, len) != 0) {
+		return -1;
+	}
+
+	if (xbee_send(&checksum, 1) != 0) {
+		return -1;
+	}
+
+	return 0;
+}
+
+/**
+ * Resets the XBee Modem (including baud rate when on robot)
+ * 
+ * Used for launching bootloader
+ **/
+int xbee_reset(void)
+{
+#ifdef ROBOT
+	xbee_send_modify_at_command("BD", "3");
+#endif
+	xbee_send_read_at_command("FR");
+    // delay 150 ms to wait for reset
+#ifndef ROBOT
+	usleep(150000);
+#else
+	_delay_ms(150);
+#endif
+
+	return 0;
+}
+
+/**
+ * Sends an AT command to read a parameter.
+ *
+ * @param command the AT command to send. For exmaple,
+ * use ID to read the PAN ID and MY to return the XBee ID.
+ * See the XBee reference guide for a complete listing.
+ **/
+static int xbee_send_read_at_command(char* command)
+{
+	return xbee_send_modify_at_command(command, NULL);
+}
+
+/**
+ * Sends the given AT command.
+ *
+ * @param command the AT command to send (e.g., MY, ID)
+ * @param value the value to pass as a parameter
+ * (or NULL if there is no parameter)
+ **/
+static int xbee_send_modify_at_command(char* command, char* value)
+{
+	char buf[16];
+	int i;
+
+	buf[0] = XBEE_FRAME_AT_COMMAND;
+	buf[1] = 1;
+	buf[2] = command[0];
+	buf[3] = command[1];
+	int valueLen = 0;
+	if (value != NULL)
+	{
+		valueLen = strlen(value);
+		if (valueLen > 8)
+		{
+			WL_DEBUG_PRINT("AT Command too large.\r\n");
+			return -1;
+		}
+
+		for (i = 0; i < valueLen; i++) {
+			buf[4 + i] = value[i];
+		}
+	}
+
+	return xbee_send_frame(buf, 4 + valueLen);
+}
+
+/**
+ * Send the specified packet.
+ *
+ * @param packet the packet data to send
+ * @param len the number of bytes in the packet
+ *
+ * @param dest the ID of the XBee to send the packet to,
+ * or XBEE_BROADCAST to send the message to all robots
+ * in the PAN.
+ *
+ * @param options a combination of the flags
+ * XBEE_OPTIONS_NONE, XBEE_OPTIONS_DISABLE_RESPONSE and
+ * XBEE_OPTIONS_BROADCAST_ALL_PANS
+ *
+ * @param frame the frame number to associate this packet
+ * with. This will be used to identify the response when
+ * the XBee alerts us as to whether or not our message
+ * was received.
+ **/
+int xbee_send_packet(char* packet, int len, int dest, char options, char frame)
+{
+	char buf[5];
+	char prefix[3];
+	int i;
+	unsigned char checksum = 0;
+
+	if (len > 100)
+	{
+		WL_DEBUG_PRINT("Packet is too large.\r\n");
+		return -1;
+	}
+
+	//data for sending request
+	buf[0] = XBEE_FRAME_TX_REQUEST_16;
+	buf[1] = frame;
+	buf[2] = (dest >> 8) & 0xFF;
+	buf[3] = dest & 0xFF;
+	buf[4] = options;
+
+	//packet prefix, do this here so we don't need an extra buffer
+	prefix[0] = XBEE_FRAME_START;
+	prefix[1] = ((5 + len) & 0xFF00) >> 8;
+	prefix[2] = (5 + len) & 0xFF;
+
+	for (i = 0; i < 5; i++)
+		checksum += (unsigned char)buf[i];
+	for (i = 0; i < len; i++)
+		checksum += (unsigned char)packet[i];
+	checksum = 0xFF - checksum;
+
+	if (xbee_send(prefix, 3) != 0) {
+		return -1;
+	}
+
+	if (xbee_send(buf, 5) != 0) {
+		return -1;
+	}
+
+	if (xbee_send(packet, len) != 0) {
+		return -1;
+	}
+
+	if (xbee_send((char*)&checksum, 1) != 0) {
+		return -1;
+	}
+
+	return 0;
+}
+
+/**
+ * Reads a packet received from the XBee. This function
+ * is non-blocking. The resulting packet is stored in dest.
+ * Only returns transmission response packets and
+ * received packets. The returned packet does not include
+ * header information or the checksum. This method also
+ * handles special packets dealt with by the XBee library,
+ * and so should be called frequently while the XBee is in
+ * use.<br><br>
+ *
+ * The first byte of the packet will be either
+ * XBEE_TX_STATUS or XBEE_RX to indicated
+ * a response to a sent message or a received message,
+ * respectively.<br><br>
+ *
+ * For a status response packet:<br>
+ * The first byte will be XBEE_TX_STATUS.<br>
+ * The second byte will be the frame number.<br>
+ * The third byte will be the result. 0 indicates success,
+ * and nonzero indicates that an error ocurred in
+ * transmitting the packet.<br><br>
+ *
+ * For a received packet:<br>
+ * The first byte will be XBEE_RX.<br>
+ * The second and third bytes will be the 16-bit
+ * address of the packet's sender.<br>
+ * The fourth byte is the signal strength.<br>
+ * The fifth byte is 1 if the packet were sent to
+ * a specific address, and 2 if it is a broadcast packet.<br><br>
+ *
+ * @param dest set to the packet data
+ * @return the length of the packet, or -1 if no packet
+ * is available
+ **/
+int xbee_get_packet(unsigned char* dest)
+{
+     int ret;
+	//start reading a packet with XBEE_FRAME_START
+	if (currentBufPos == 0)
+	{
+		do
+		{
+			if (buffer_first == XBEE_BUFFER_SIZE)
+				buffer_first = 0;
+			// check if buffer is empty
+			if (buffer_first == buffer_last) {
+				return -1;
+			}
+		} while (arrival_buf[buffer_first++] != XBEE_FRAME_START);
+
+		if (buffer_first == XBEE_BUFFER_SIZE) {
+			buffer_first = 0;
+		}
+		xbee_buf[0] = XBEE_FRAME_START;
+		currentBufPos++;
+	}
+
+	int len = -1;
+	if (currentBufPos >= 3) {
+		len = (int)xbee_buf[2] + ((int)xbee_buf[1] << 8);
+	}
+
+	while (len == -1 //packet length has not been read yet
+		|| currentBufPos < len + 4)
+	{
+		if (currentBufPos == 3)
+		{
+			len = (int)xbee_buf[2] + ((int)xbee_buf[1] << 8);
+			if (len > 120)
+			{
+				WL_DEBUG_PRINT("Packet too large. Probably error in XBee transmission.\n");
+				currentBufPos = 0;
+				return -1;
+			}
+		}
+
+		// check if buffer is empty
+		if (buffer_first == buffer_last) {
+			return -1;
+		}
+		xbee_buf[currentBufPos++] = arrival_buf[buffer_first++];
+		if (buffer_first == XBEE_BUFFER_SIZE) {
+			buffer_first = 0;
+		}
+	}
+
+	currentBufPos = 0;
+
+	if (!xbee_verify_checksum(xbee_buf, len + 4))
+	{
+		WL_DEBUG_PRINT("XBee checksum failed.\r\n");
+		return -1;
+	}
+
+	//we will take care of the packet
+	
+	ret = xbee_handle_packet(xbee_buf+3, len);
+	if (ret == 1) {
+		return 3;
+	}
+	
+	if (dest == NULL) {
+		return -1;
+	}
+
+	int i;
+	for (i = 3; i < len + 3; i++) {
+		dest[i - 3] = xbee_buf[i];
+	}
+	return len;
+}
+
+/**
+ * Handles modem status packets.
+ *
+ * @param status the type of status packet received.
+ **/
+void xbee_handle_status(char status)
+{
+	switch (status)
+	{
+		case 0:
+			WL_DEBUG_PRINT("XBee hardware reset.\r\n");
+			break;
+		case 1:
+			WL_DEBUG_PRINT("Watchdog timer reset.\r\n");
+			break;
+		case 2:
+			WL_DEBUG_PRINT("Associated.\r\n");
+			break;
+		case 3:
+			WL_DEBUG_PRINT("Disassociated.\r\n");
+			break;
+		case 4:
+			WL_DEBUG_PRINT("Synchronization lost.\r\n");
+			break;
+		case 5:
+			WL_DEBUG_PRINT("Coordinator realignment.\r\n");
+			break;
+		case 6:
+			WL_DEBUG_PRINT("Coordinator started.\r\n");
+			break;
+	}
+}
+
+/**
+ * Handles AT command response packets.
+ * @param command the two character AT command, e.g. MY or ID
+ * @param result 0 for success, 1 for an error
+ * @param extra the hex value of the requested register
+ * @param extraLen the length in bytes of extra
+ **/
+static void xbee_handle_at_command_response(char* command, char result, char* extra, int extraLen)
+{
+	if (result == 1)
+	{
+		WL_DEBUG_PRINT("Error with AT");
+		WL_DEBUG_PRINT(command);
+		WL_DEBUG_PRINT(" packet.\r\n");
+	}
+	WL_DEBUG_PRINT("AT");
+	WL_DEBUG_PRINT(command);
+	WL_DEBUG_PRINT(" command was successful.\r\n");
+
+	if (command[0] == 'I' && command[1] == 'D')
+	{
+		xbee_panID = xbee_pending_panID;
+		WL_DEBUG_PRINT("PAN ID set to ");
+		WL_DEBUG_PRINT_INT(xbee_panID);
+		WL_DEBUG_PRINT(".\r\n");
+		return;
+	}
+
+	if (command[0] == 'C' && command[1] == 'H')
+	{
+		xbee_channel = xbee_pending_channel;
+		WL_DEBUG_PRINT("Channel set to ");
+		WL_DEBUG_PRINT_INT(xbee_channel);
+		WL_DEBUG_PRINT(".\r\n");
+		return;
+	}
+
+	if (command[0] == 'M' && command[1] == 'Y' && extraLen != 0)
+	{
+		xbee_address = 0;
+		int i;
+		for (i = 0; i < extraLen; i++) {
+			xbee_address = (xbee_address << 8) + extra[i];
+		}
+
+		WL_DEBUG_PRINT("XBee address is ");
+		WL_DEBUG_PRINT_INT(xbee_address);
+		WL_DEBUG_PRINT(".\r\n");
+
+		if (xbee_address == 0)
+		{
+			WL_DEBUG_PRINT("XBee 16-bit address must be set using ATMY.\r\n");
+			#ifndef ROBOT
+			exit(0);
+			#endif
+		}
+	}
+}
+
+/**
+ * Attempts to handle the packet if it is dealt with
+ * by the library.
+ * We will handle the following packet types:
+ *    Modem Status
+ *    AT Command Response
+ *
+ * @param packet the packet to handle
+ * @param len the length of the packet
+ *
+ * @return 1 if we have handled the packet, 0 otherwise
+ */
+static int xbee_handle_packet(char* packet, int len)
+{
+
+	char command[3] = {1, 2, 3};
+	if (len <= 0) //this should not happend
+	{
+		WL_DEBUG_PRINT("Non-positive packet length.\r\n");
+		return 0;
+	}
+
+	switch ((unsigned char)packet[0]) //packet type
+	{
+		case XBEE_FRAME_STATUS:
+			xbee_handle_status(packet[1]);
+			return 1;
+		case XBEE_FRAME_AT_COMMAND_RESPONSE:
+			command[0] = packet[2];
+			command[1] = packet[3];
+			command[2] = 0;
+			xbee_handle_at_command_response(command, packet[4], packet + 5, len - 5);
+			return 1;
+	}
+	return 0;
+}
+
+/**
+ * Sets the personal area network id.
+ *
+ * @param id the new personal area network (PAN) id
+ **/
+int xbee_set_pan_id(int id)
+{
+	char s[3];
+	s[0] = (id >> 8) & 0xFF;
+	s[1] = id & 0xFF;
+	s[2] = 0;
+	xbee_pending_panID = id;
+	return xbee_send_modify_at_command("ID", s);
+}
+
+/**
+ * Get the PAN ID for the XBee.
+ *
+ * @return the personal area network id, or
+ * XBEE_PAN_DEFAULT if it has not yet been set.
+ **/
+unsigned int xbee_get_pan_id()
+{
+	return xbee_panID;
+}
+
+/**
+ * Set the channel the XBee is using.
+ *
+ * @param channel the channel the XBee will not use,
+ * between 0x0B and 0x1A
+ *
+ * @see xbee_get_channel
+ **/
+int xbee_set_channel(int channel)
+{
+	if (channel < 0x0B || channel > 0x1A)
+	{
+		WL_DEBUG_PRINT("Channel out of range.\r\n");
+		return -1;
+	}
+
+	char s[3];
+	s[0] = channel & 0xFF;
+	s[1] = 0;
+	xbee_pending_channel = channel;
+
+	return xbee_send_modify_at_command("CH", s);
+}
+
+/**
+ * Returns the channel which the XBee is currently using.
+ *
+ * @return the channel the XBee is using
+ *
+ * @see xbee_set_channel
+ **/
+int xbee_get_channel(void)
+{
+	return xbee_channel;
+}
+
+/**
+ * Get the 16-bit address of the XBee.
+ * This is used to specify who to send messages to
+ * and who messages are from.
+ *
+ * @return the 16-bit address of the XBee.
+ **/
+unsigned int xbee_get_address()
+{
+	return xbee_address;
+}
+
+#ifndef ROBOT
+void xbee_set_com_port(char* port)
+{
+	xbee_com_port = port;
+}
+#endif
Index: demos/hunter_prey_john/projects/libwireless/lib/sensor_matrix.c
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/sensor_matrix.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/sensor_matrix.c	(revision 1694)
@@ -0,0 +1,160 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file sensor_matrix.c
+ * @brief Sensor Matrix implementation
+ *
+ * Implementation of a sensor matrix for storing localization implementation.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#include "wl_defs.h"
+#include "sensor_matrix.h"
+
+// the global sensor matrix
+SensorMatrix m;
+
+/**
+ * Initializes the sensor matrix.
+ *
+ * @return the newly created sensor matrix
+ **/
+void sensor_matrix_create()
+{
+	int i, j;
+
+	m.numJoined = 0;
+
+	for (i = 0; i < MAXIMUM_XBEE_ID; i++)
+	{
+		m.joined[i] = 0;
+#ifndef BAYBOARD
+		for (j = 0; j < MAXIMUM_XBEE_ID; j++)
+			m.matrix[i][j] = READING_UNKNOWN;
+#endif
+	}
+}
+
+/**
+ * Sets the sensor reading for robot robot to reading.
+ *
+ * @param observer the id of the robot who made the reading
+ * @param robot the id of the robot who the reading is for
+ * @param reading the BOM reading from observer to robot
+ */
+void sensor_matrix_set_reading(int observer, int robot, int reading)
+{
+#ifndef BAYBOARD
+	if (robot >= MAXIMUM_XBEE_ID || observer >= MAXIMUM_XBEE_ID)
+	{
+		WL_DEBUG_PRINT("ID too large.");
+		return;
+	}
+
+	m.matrix[observer][robot] = (unsigned char)reading;
+#endif
+}
+
+/**
+ * Gets the sensor reading for a robot to another robot.
+ *
+ * @param observer the robot whose reading we check
+ * @param robot the robot who we are checking the reading to
+ *
+ * @return the observer's BOM reading for robot
+ **/
+int sensor_matrix_get_reading(int observer, int robot)
+{
+#ifndef BAYBOARD
+	if (observer >= MAXIMUM_XBEE_ID || robot >= MAXIMUM_XBEE_ID)
+		return -1;
+
+	return (int)m.matrix[observer][robot];
+#else
+	return -1;
+#endif
+}
+
+/**
+ * Sets whether or not the given robot is part of the token ring.
+ *
+ * @param robot the robot to set as a member / nonmember of the token ring
+ * @param in 1 if the robot is in the token ring, 0 otherwise
+ **/
+void sensor_matrix_set_in_ring(int robot, int in)
+{
+	if (robot >= MAXIMUM_XBEE_ID)
+	{
+		WL_DEBUG_PRINT("ID too large.");
+		return;
+	}
+
+	if (in == 1 && m.joined[robot] == 0)
+		m.numJoined++;
+
+	if (in == 0 && m.joined[robot])
+		m.numJoined--;
+	m.joined[robot] = in;
+}
+
+/**
+ * Checks if the given robot is in the token ring.
+ *
+ * @param robot the ID of the robot to check
+ *
+ * @return 1 if the robot is in the token ring, 0 otherwise
+ **/
+int sensor_matrix_get_in_ring(int robot)
+{
+	if (robot >= MAXIMUM_XBEE_ID)
+		return -1;
+
+	return m.joined[robot];
+}
+
+/**
+ * Returns the number of robots which have joined the
+ * token ring.
+ *
+ * @return the number of robots in the token ring
+ **/
+int sensor_matrix_get_joined(void)
+{
+	return m.numJoined;
+}
+
+/**
+ * Returns the maximum XBee id of a robot which can be stored
+ * in the sensor matrix.
+ *
+ * @return the maximum number of robots which can be stored
+ **/
+int sensor_matrix_get_size(void)
+{
+	return MAXIMUM_XBEE_ID;
+}
+
Index: demos/hunter_prey_john/projects/libwireless/lib/xbee.h
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/xbee.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/xbee.h	(revision 1694)
@@ -0,0 +1,101 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file xbee.h
+ * @brief Contains definitions for using the XBee
+ *
+ * Contains definitions for interfacing with the 
+ * XBee module, from either a robot or a computer.
+ * To use a robot, define ROBOT in wl_defs.h, and
+ * to use a computer, don't define ROBOT.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef XBEE_H
+#define XBEE_H
+
+/**
+ * The port to use the XBee from on the computer.
+ * Also, a backup port if the other is used.
+ **/
+#ifndef ROBOT
+#define XBEE_PORT_DEFAULT "/dev/ttyUSB1"
+#endif
+
+/**
+ * @defgroup xbee XBee
+ * @brief Interface with the XBee module
+ *
+ * Interface with the XBee module.
+ *
+ * @{
+ **/
+
+/*Definitions*/
+/**@brief Unset PAN, uses XBee default **/
+#define XBEE_PAN_DEFAULT 0xFFFF
+/**@brief Unset channel, uses XBee default **/
+#define XBEE_CHANNEL_DEFAULT 0
+/**@brief Broadcast to all robots in the PAN **/
+#define XBEE_BROADCAST 0xFFFF
+/**@brief No special options **/
+#define XBEE_OPTIONS_NONE 0x00
+/**@brief Do not receive a TX_STATUS message from this packet **/
+#define XBEE_OPTIONS_DISABLE_RESPONSE 0x01
+/**@brief Send the packet to all PANS **/
+#define XBEE_OPTIONS_BROADCAST_ALL_PANS 0x04
+/**@brief A transmit status packet **/
+#define XBEE_TX_STATUS 0x89
+/**@brief A packet received from another XBee **/
+#define XBEE_RX 0x81
+
+/**@brief Initialize the XBee library **/
+int xbee_lib_init(void);
+/**@brief Uninitialize the XBee library **/
+void xbee_terminate(void);
+/**@brief Get a packet from the XBee **/
+int xbee_get_packet(unsigned char* packet);
+/**@brief Send a packet to the XBee **/
+int xbee_send_packet(char* packet, int len, int dest, char options, char frame);
+/**@brief Set the PAN ID for the XBee **/
+int xbee_set_pan_id(int id);
+/**@brief Get the XBee's PAN ID **/
+unsigned int xbee_get_pan_id(void);
+/**@brief Set the channel the XBee is currently using **/
+int xbee_set_channel(int channel);
+/**@brief Get the channel the XBee is currently using **/
+int xbee_get_channel(void);
+/**@brief Get the XBee's 16-bit address **/
+unsigned int xbee_get_address(void);
+/**@brief Set the com port on a computer, undefined on the robot**/
+void xbee_set_com_port(char* port);
+/**@brief Reset XBee **/
+int xbee_reset(void);
+
+/**@}**/ //end defgroup
+
+#endif
Index: demos/hunter_prey_john/projects/libwireless/lib/wl_basic.h
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wl_basic.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wl_basic.h	(revision 1694)
@@ -0,0 +1,65 @@
+/**
+ * @file wl_basic.h
+ * @brief High Level Wireless Packet Sending-Receiving Functions
+ *
+ * Abstracted wireless functionality for sending and receiving packets
+ *
+ * @author Christopher Mar, Colony Project, CMU Robotics Club
+ **/
+
+/**
+ * @defgroup wl_basic Wireless Basic
+ * @brief Wireless abstraction for easily sending and receing packets.
+ *
+ * A high level abstraction of the wireless library.
+ *
+ * This will allow you to easily send and receive packets.
+ *
+ * @{
+ **/
+
+#ifndef WL_BASIC_H
+#define WL_BASIC_H
+
+#include "wireless.h"
+
+/** @brief default wireless group for basic sending and receiving packets **/
+#define WL_BASIC_GROUP 8
+
+/** @brief PacketGroupHandler struct for Basic Group **/
+PacketGroupHandler wl_basic_group_handler;
+
+/**
+ * @brief struct that contains relevant packet information
+ **/
+struct PacketInfo {
+    char new_flag;
+    char type;
+    int source;
+    unsigned char* data;
+    int length;
+};
+
+/**
+ * @brief current packet information, correct after wl_basic_do()
+ **/
+struct PacketInfo current_packet;
+
+/** @brief init wireless for Basic Group **/
+int wl_basic_init( void (*handle_receive) (char type, int source, unsigned char* packet, int length) );
+/** @brief init wireless for Basic Group with default packet handling **/
+int wl_basic_init_default( void );
+/** @brief internal function to register a packet handler function **/
+void wl_basic_register_handler( void (*handle_receive) (char type, int source, unsigned char* packet, int length) );
+/** @brief send a packet to a single robot in Basic Group **/
+void wl_basic_send_robot_packet( char type, char* data, int len, int dest );
+/** @brief send a packet to all robots in Basic Group **/
+void wl_basic_send_global_packet( char type, char* data, int len );
+/** @brief internal default packet handler if none is specified on init **/
+void wl_basic_packet_receive_handler( char type, int source, unsigned char* packet, int length );
+/** @brief wrapper for wl_do() to return packet data buffer **/
+unsigned char* wl_basic_do_default( int *length );
+/** @} **/ // end defgroup
+
+#endif
+
Index: demos/hunter_prey_john/projects/libwireless/lib/Doxyfile
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/Doxyfile	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/Doxyfile	(revision 1694)
@@ -0,0 +1,1237 @@
+# Doxyfile 1.4.6
+               
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = libwireless
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 1.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = docs
+     
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, 
+# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, 
+# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, 
+# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, 
+# Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# This tag can be used to specify the encoding used in the generated output. 
+# The encoding is not always determined by the language that is chosen, 
+# but also whether or not the output is meant for Windows or non-Windows users. 
+# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
+# forces the Windows encoding (this is the default for the Windows binary), 
+# whereas setting the tag to NO uses a Unix-style encoding (the default for 
+# all platforms other than Windows).
+
+USE_WINDOWS_ENCODING   = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = 
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like the Qt-style comments (thus requiring an 
+# explicit @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member 
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for Java. 
+# For instance, namespaces will be presented as packages, qualified scopes 
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to 
+# include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also make the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from the 
+# version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = 
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
+
+FILE_PATTERNS          = 
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
+# generate a call dependency graph for every global function or class method. 
+# Note that enabling this option will significantly increase the time of a run. 
+# So in most cases it will be better to enable call graphs for selected 
+# functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that a graph may be further truncated if the graph's 
+# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH 
+# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), 
+# the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, which results in a white background. 
+# Warning: Depending on the platform used, enabling this option may lead to 
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to 
+# read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO
Index: demos/hunter_prey_john/projects/libwireless/lib/sensor_matrix.h
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/sensor_matrix.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/sensor_matrix.h	(revision 1694)
@@ -0,0 +1,101 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file sensor_matrix.h
+ * @brief Definitions for sensor matrices
+ *
+ * Contains functions and declarations for using sensor matrices.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef SENSOR_MATRIX_H
+#define SENSOR_MATRIX_H
+
+
+/**
+ * @defgroup sensormatrix Sensor Matrix
+ * @brief the robot sensor matrix
+ *
+ * These functions and structures are used for localization
+ * to determine the relative directions of robots.
+ *
+ * @{
+ **/
+
+#define MAXIMUM_XBEE_ID		0x10
+#define READING_UNKNOWN		0xFF
+
+/**
+ * @struct SensorMatrix
+ *
+ * A sensor matrix.
+ **/
+//TODO: the order of member variables in this struct should be changed in case the compile packs the struct
+// In order to achieve the best packing, the variables should be listed in order of decreasing memory size.
+// Thus, pointers should be first, followed by int, followed by char.
+typedef struct
+{
+	/**
+	 * The number of robots in the token ring.
+	 **/
+	int numJoined;
+	/**
+	 * The element representing a robot is true if that robot
+	 * is in the token ring and false otherwise.
+	 **/
+	unsigned char joined[MAXIMUM_XBEE_ID];
+
+	// on the bayboard, we don't include the matrix to save memory.
+#ifndef BAYBOARD
+	/**
+	 * The matrix. Each row represents the readings of one
+	 * robot.
+	 **/
+	unsigned char matrix[MAXIMUM_XBEE_ID][MAXIMUM_XBEE_ID];
+#endif
+} SensorMatrix;
+
+/**@brief Create a sensor matrix **/
+void sensor_matrix_create(void);
+/**@brief Set a reading in a sensor matrix **/
+void sensor_matrix_set_reading(int observer, int robot, int reading);
+/**@brief Get a reading in a sensor matrix **/
+int sensor_matrix_get_reading(int observer, int robot);
+/**@brief Set whether the robot is in the token ring **/
+void sensor_matrix_set_in_ring(int robot, int in);
+/**@brief Get whether the robot is in the sensor ring **/
+int sensor_matrix_get_in_ring(int robot);
+/**@brief Get the number of robots which have joined the token ring **/
+int sensor_matrix_get_joined(void);
+/**@brief Get the maximum size of the sensor matrix **/
+int sensor_matrix_get_size(void);
+
+/** @} **/ //end defgroup
+
+
+#endif
+
Index: demos/hunter_prey_john/projects/libwireless/lib/wl_defs.h
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wl_defs.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wl_defs.h	(revision 1694)
@@ -0,0 +1,97 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file wl_defs.h
+ * @brief Definitions for Wireless
+ *
+ * Contains definitions for wireless packet groups, packet types,
+ * debugging information, etc.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef WL_DEFS_H
+#define WL_DEFS_H
+
+//comment out this line if using a computer hooked up to an xbee
+//#define ROBOT
+
+//uncomment this line for debug information
+//#define WL_DEBUG
+
+// Packet Groups and Types
+
+// Error group
+#define WL_ERROR_GROUP 1
+
+#define WL_ERROR_STRING_TYPE 1
+
+// Token Ring group
+#define WL_TOKEN_RING_GROUP 2
+
+#define WL_TOKEN_PASS 1
+#define WL_TOKEN_SENSOR_MATRIX 2
+#define WL_TOKEN_BOM_ON 3
+#define WL_TOKEN_JOIN 4
+#define WL_TOKEN_JOIN_ACCEPT 5
+
+// timing constants
+#ifndef FIREFLY
+#define BOM_DELAY 100
+#else
+#define BOM_DELAY 200
+#endif
+
+#define DEATH_DELAY 4
+#define JOIN_DELAY 8
+
+#ifdef WL_DEBUG
+
+#ifdef ROBOT
+#include <serial.h>
+#endif
+
+#ifdef ROBOT
+#define WL_DEBUG_PRINT( s ) usb_puts( s )
+#else
+#define WL_DEBUG_PRINT( s ) printf( s )
+#endif
+
+#ifdef ROBOT
+#define WL_DEBUG_PRINT_INT( i ) usb_puti(i)
+#else
+#define WL_DEBUG_PRINT_INT( i ) printf("%i", i)
+#endif
+
+#else
+
+#define WL_DEBUG_PRINT( s )
+#define WL_DEBUG_PRINT_INT( i )
+
+#endif
+
+#endif
+
Index: demos/hunter_prey_john/projects/libwireless/lib/wireless.h
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wireless.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wireless.h	(revision 1694)
@@ -0,0 +1,164 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file wireless.h
+ * @brief Contains definitions for the wireless library.
+ *
+ * Contains functions for the wireless library.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef WIRELESS_H
+#define WIRELESS_H
+
+//Note: If this is raised above 16, we will need to do
+//something about frame numbers for TX Status packets.
+/**
+ * The maximum number of packet groups.
+ **/
+//TODO: a PacketGroupHandler is at least 10 bytes (I don't know if function pointers are 2 bytes
+// or 4 bytes).  That means that in the c file, your array of packet groups is at least 160 bytes.
+// Normally that might be fine (the robot's avr chips have 4k SRAM), but austin's chip only has
+// 1k SRAM, so if this number can be reduced or if the size of the struct could be reduced, that would be a plus.
+#define WL_MAX_PACKET_GROUPS 16
+
+/**
+ * @defgroup wireless Wireless
+ * @brief Wireless definitions.
+ *
+ * Contains functions and definitions for dealing with wireless functionality.<br><br>
+ *
+ * The wireless library provides a modular method for dealing with
+ * wireless packets, by allowing packet groups to be registered.
+ * A packet group is a collection of packets which share a packet
+ * group code. Each packet in the group also has a type. A packet
+ * group code and type are sent with each packet. When a packet
+ * with a group code registered in the wireless library is
+ * received, the corresponding event handler is called. The
+ * event handler uses the packet type and other information
+ * stored in the packet to respond.<br><br>
+ *
+ * This architecture allows different wireless functionality to be
+ * defined and handled separately, making it simpler and more
+ * efficient to take advantage of the XBee's wireless functionality.
+ *
+ * @{
+ **/
+
+/**
+ * @struct PacketGroupHandler
+ * A PacketGroupHandler represents a packet group, and is used to
+ * register a packet group with the wireless library. It contains
+ * handlers for various events which can occur related to a packet
+ * group.
+ **/
+//TODO: the order of member variables in this struct should be changed in case the compile packs the struct
+// In order to achieve the best packing, the variables should be listed in order of decreasing memory size.
+// Thus, pointers should be first, followed by int, followed by char.
+typedef struct
+{
+	/**
+	 * The group code for this packet group. This number
+	 * must be unique. The maximum number of packet groups
+	 * is defined by WL_MAX_PACKET_GROUPS.
+	 **/
+  //TODO: if this number must be less than or equal to WL_MAX_PACKET_GROUPS, don't you only need
+  // one byte for it and it can be made an unsigned char?
+	unsigned int groupCode;
+
+	/**
+	 * Called every half second (not in interrupt,
+	 * but in wl_do).
+	 **/
+	void (*timeout_handler) (void);
+
+	/**
+	 * Called when a transmit status packet is received
+	 * from the XBee where the first four bits of the frame
+	 * are  the group code.
+	 *
+	 * @param frame the last four bits of the frame
+	 * @param received is true if we received an ack, 0 if
+	 * we did not.
+	 **/
+	void (*handle_response) (int frame, int received);
+
+	/**
+	 * Called when we receive a packet from this group.
+	 *
+	 * @param type the packet type
+	 * @param source the 16-bit address of the XBee this
+	 * packet was sent from
+	 * @param packet the packet received
+	 * @param length the length of the packet
+	 **/
+	void (*handle_receive) (char type, int source, unsigned char* packet, int length);
+
+	/**
+	 * Called for any cleanup when the network is turned off.
+	 **/
+	void (*unregister) (void);
+
+} PacketGroupHandler;
+
+/**@brief Initialize the wireless library **/
+int wl_init(void);
+/**@brief Uninitialize the wireless library **/
+void wl_terminate(void);
+/**@brief Perform wireless library functionality **/
+void wl_do(void);
+/**@brief Register a packet group with the wireless library **/
+void wl_register_packet_group(PacketGroupHandler* h);
+/**@brief Unregister a packet group with the wireless library **/
+void wl_unregister_packet_group(PacketGroupHandler* h);
+
+/**@brief Send a packet to a specific robot in any PAN **/
+int wl_send_robot_to_robot_global_packet(char group, char type, char* data, int len, int dest, char frame);
+/**@brief Send a packet to a specific robot in our PAN **/
+int wl_send_robot_to_robot_packet(char group, char type, char* data, int len, int dest, char frame);
+/**@brief Send a packet to all robots **/
+int wl_send_global_packet(char group, char type, char* data, int len, char frame);
+/**@brief Send a packet to all robots in our PAN **/
+void wl_send_pan_packet(char group, char type, char* data, int len, char frame);
+
+/**@brief Set the PAN we are using **/
+int wl_set_pan(int pan);
+/**@brief Get the PAN we are using **/
+int wl_get_pan(void);
+/**@brief Set the channel we are using **/
+int wl_set_channel(int channel);
+/**@brief Get the channel we are using **/
+int wl_get_channel(void);
+/**@brief Get the 16-bit address of the XBee module **/
+int wl_get_xbee_id(void);
+/**@brief Set the com port on a computer, undefined on the robot.**/
+void wl_set_com_port(char* port);
+
+/** @} **/ // end defgroup
+
+#endif
+
Index: demos/hunter_prey_john/projects/libwireless/lib/wl_token_ring.h
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wl_token_ring.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wl_token_ring.h	(revision 1694)
@@ -0,0 +1,85 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file wl_token_ring.h
+ * @brief Declarations for the token ring packet group
+ * 
+ * Contains declarations for the token ring packet group.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef WL_TOKEN_RING_H
+#define WL_TOKEN_RING_H
+
+/**
+ * @defgroup tokenring Token Ring
+ * @brief Wireless library token ring implementation
+ *
+ * This packet group is used to form a token ring, which
+ * keeps track of the relative directions of the robots
+ * from one another.
+ *
+ * @{
+ **/
+
+/**@brief Register the token ring group with the wireless library.**/
+int wl_token_ring_register(void);
+/**@brief Unregister the token ring group with the wirelss library.**/
+void wl_token_ring_unregister(void);
+/**@brief Set the functions called to turn the bom on and off.**/
+void wl_token_ring_set_bom_functions(void (*on_function) (void), void (*off_function) (void),
+  int (*max_bom_function) (void));
+
+/**@brief Join the token ring **/
+int wl_token_ring_join(void);
+/**@brief Leave the token ring **/
+void wl_token_ring_leave(void);
+
+/**@brief Return the number of robots in the token ring **/
+int wl_token_get_robots_in_ring(void);
+/**@brief Return whether a given robot is in the token ring **/
+int wl_token_is_robot_in_ring(int robot);
+
+/**@brief Begin iterating through robots in the token ring **/
+void wl_token_iterator_begin(void);
+/**@brief Returns whether there are more robots to iterate through **/
+int wl_token_iterator_has_next(void);
+/**@brief Returns the ID of the next robot in the token ring **/
+int wl_token_iterator_next(void);
+
+/**@brief Return the latest BOM reading between two robots **/
+int wl_token_get_sensor_reading(int source, int dest);
+/**@brief Return the latest BOM reading between us and another robot **/
+int wl_token_get_my_sensor_reading(int dest);
+/**@brief Return the number of robots in the sensor matrix.*/
+int wl_token_get_num_robots(void);
+/**@brief Return the number of non-null elements in the sensor matrix*/
+int wl_token_get_matrix_size(void);
+
+/** @} **/ //end token ring group
+
+#endif
Index: demos/hunter_prey_john/projects/libwireless/lib/wl_error_group.h
===================================================================
--- demos/hunter_prey_john/projects/libwireless/lib/wl_error_group.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libwireless/lib/wl_error_group.h	(revision 1694)
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file wl_error_group.h
+ * @brief Error Packets
+ *
+ * A packet group for sending error packets.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef WL_ERROR_GROUP_H
+#define WL_ERROR_GROUP_H
+
+/**
+ * @file wl_error_group.h
+ * @brief A packet group for error messages.
+ *
+ * A packet group for sending and receiving error
+ * messages.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+/**
+ * @defgroup wlerror Error Packets
+ * @brief Functions for sending and receiving error packets
+ * 
+ * Functions for sending and receiving error packets.
+ * 
+ * @{
+ **/
+
+/**@brief Register this packet group with the wireless library **/
+void wl_error_register(void);
+/**@brief Unregister this packet group with the wireless library **/
+void wl_error_unregister(void);
+/**@brief Send a string in an error packet **/
+void wl_error_send_string(char* str);
+
+/** @} **/ // end defgroup
+
+#endif
Index: demos/hunter_prey_john/projects/libdragonfly/reset.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/reset.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/reset.lst	(revision 1694)
@@ -0,0 +1,58 @@
+   1               		.file	"reset.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	reset
+  20               	reset:
+  21               	.LFB6:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LM2:
+  26 0000 81B5      		in r24,65-0x20
+  27 0002 887F      		andi r24,lo8(-8)
+  28 0004 81BD      		out 65-0x20,r24
+  29               	.LM3:
+  30 0006 81B5      		in r24,65-0x20
+  31 0008 8860      		ori r24,lo8(8)
+  32 000a 81BD      		out 65-0x20,r24
+  33               	.LBB8:
+  34               	.LBB9:
+  35               	.LBB10:
+  36               	.LBB11:
+  37               	.LM4:
+  38 000c 80E6      		ldi r24,lo8(-5536)
+  39 000e 9AEE      		ldi r25,hi8(-5536)
+  40               	.LVL0:
+  41               	/* #APP */
+  42 0010 0197      		1: sbiw r24,1
+  43 0012 01F4      		brne 1b
+  44               	/* #NOAPP */
+  45               	.LBE11:
+  46               	.LBE10:
+  47               	.LBE9:
+  48               	.LBE8:
+  49               	/* epilogue: frame size=0 */
+  50 0014 0895      		ret
+  51               	/* epilogue end (size=1) */
+  52               	/* function reset size 13 (12) */
+  53               	.LFE6:
+  79               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 reset.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4GZxBR.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4GZxBR.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4GZxBR.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4GZxBR.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4GZxBR.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4GZxBR.s:20     .text:00000000 reset
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
Index: demos/hunter_prey_john/projects/libdragonfly/rangefinder.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/rangefinder.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/rangefinder.lst	(revision 1694)
@@ -0,0 +1,178 @@
+   1               		.file	"rangefinder.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	linearize_distance
+  20               	linearize_distance:
+  21               	.LFB4:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LVL0:
+  26               	.LM2:
+  27 0000 8B31      		cpi r24,27
+  28 0002 9105      		cpc r25,__zero_reg__
+  29 0004 04F0      		brlt .L2
+  30               	.LM3:
+  31 0006 8336      		cpi r24,99
+  32 0008 9105      		cpc r25,__zero_reg__
+  33 000a 04F4      		brge .L2
+  34               	.LBB2:
+  35               	.LM4:
+  36 000c FC01      		movw r30,r24
+  37               	.LVL1:
+  38 000e EE0F      		lsl r30
+  39 0010 FF1F      		rol r31
+  40               	.LVL2:
+  41 0012 E050      		subi r30,lo8(-(IR_dist_conversion-54))
+  42 0014 F040      		sbci r31,hi8(-(IR_dist_conversion-54))
+  43               	.LBE2:
+  44               	/* #APP */
+  45 0016 8591      		lpm r24, Z+
+  46 0018 9491      		lpm r25, Z
+  47               		
+  48               	/* #NOAPP */
+  49 001a 0895      		ret
+  50               	.LVL3:
+  51               	.L2:
+  52 001c 8FEF      		ldi r24,lo8(-1)
+  53 001e 9FEF      		ldi r25,hi8(-1)
+  54               	.LVL4:
+  55               	.LM5:
+  56 0020 0895      		ret
+  57               	/* epilogue: frame size=0 */
+  58               	/* epilogue: noreturn */
+  59               	/* epilogue end (size=0) */
+  60               	/* function linearize_distance size 21 (21) */
+  61               	.LFE4:
+  63               	.global	range_read_distance
+  65               	range_read_distance:
+  66               	.LFB3:
+  67               	.LM6:
+  68               	/* prologue: frame size=0 */
+  69               	/* prologue end (size=0) */
+  70               	.LVL5:
+  71               	.LM7:
+  72 0022 0E94 0000 		call analog_get8
+  73               	.LVL6:
+  74 0026 0E94 0000 		call linearize_distance
+  75               	/* epilogue: frame size=0 */
+  76 002a 0895      		ret
+  77               	/* epilogue end (size=1) */
+  78               	/* function range_read_distance size 5 (4) */
+  79               	.LFE3:
+  81               	.global	range_init
+  83               	range_init:
+  84               	.LFB2:
+  85               	.LM8:
+  86               	/* prologue: frame size=0 */
+  87               	/* prologue end (size=0) */
+  88               	.LM9:
+  89 002c 60E0      		ldi r22,lo8(0)
+  90 002e 70E0      		ldi r23,hi8(0)
+  91 0030 84E1      		ldi r24,lo8(20)
+  92 0032 90E0      		ldi r25,hi8(20)
+  93 0034 0E94 0000 		call digital_output
+  94               	/* epilogue: frame size=0 */
+  95 0038 0895      		ret
+  96               	/* epilogue end (size=1) */
+  97               	/* function range_init size 7 (6) */
+  98               	.LFE2:
+ 100               		.section	.progmem.data,"a",@progbits
+ 103               	IR_dist_conversion:
+ 104 0000 4701      		.word	327
+ 105 0002 3B01      		.word	315
+ 106 0004 2F01      		.word	303
+ 107 0006 2301      		.word	291
+ 108 0008 1901      		.word	281
+ 109 000a 0F01      		.word	271
+ 110 000c 0601      		.word	262
+ 111 000e FD00      		.word	253
+ 112 0010 F500      		.word	245
+ 113 0012 EE00      		.word	238
+ 114 0014 E700      		.word	231
+ 115 0016 E000      		.word	224
+ 116 0018 DA00      		.word	218
+ 117 001a D400      		.word	212
+ 118 001c CE00      		.word	206
+ 119 001e C800      		.word	200
+ 120 0020 C300      		.word	195
+ 121 0022 BE00      		.word	190
+ 122 0024 B900      		.word	185
+ 123 0026 B500      		.word	181
+ 124 0028 B100      		.word	177
+ 125 002a AD00      		.word	173
+ 126 002c A800      		.word	168
+ 127 002e A500      		.word	165
+ 128 0030 A100      		.word	161
+ 129 0032 9E00      		.word	158
+ 130 0034 9B00      		.word	155
+ 131 0036 9700      		.word	151
+ 132 0038 9400      		.word	148
+ 133 003a 9100      		.word	145
+ 134 003c 8F00      		.word	143
+ 135 003e 8C00      		.word	140
+ 136 0040 8900      		.word	137
+ 137 0042 8600      		.word	134
+ 138 0044 8400      		.word	132
+ 139 0046 8200      		.word	130
+ 140 0048 7F00      		.word	127
+ 141 004a 7D00      		.word	125
+ 142 004c 7B00      		.word	123
+ 143 004e 7900      		.word	121
+ 144 0050 7700      		.word	119
+ 145 0052 7500      		.word	117
+ 146 0054 7300      		.word	115
+ 147 0056 7200      		.word	114
+ 148 0058 6F00      		.word	111
+ 149 005a 6E00      		.word	110
+ 150 005c 6C00      		.word	108
+ 151 005e 6A00      		.word	106
+ 152 0060 6900      		.word	105
+ 153 0062 6800      		.word	104
+ 154 0064 6600      		.word	102
+ 155 0066 6400      		.word	100
+ 156 0068 6300      		.word	99
+ 157 006a 6200      		.word	98
+ 158 006c 6100      		.word	97
+ 159 006e 5F00      		.word	95
+ 160 0070 5E00      		.word	94
+ 161 0072 5D00      		.word	93
+ 162 0074 5B00      		.word	91
+ 163 0076 5A00      		.word	90
+ 164 0078 5900      		.word	89
+ 165 007a 5800      		.word	88
+ 166 007c 5700      		.word	87
+ 167 007e 5600      		.word	86
+ 168 0080 5400      		.word	84
+ 169 0082 5300      		.word	83
+ 170 0084 5300      		.word	83
+ 171 0086 5200      		.word	82
+ 172 0088 5100      		.word	81
+ 173 008a 5000      		.word	80
+ 174 008c 4F00      		.word	79
+ 175 008e 4E00      		.word	78
+ 216               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 rangefinder.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDmnIJ.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDmnIJ.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDmnIJ.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDmnIJ.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDmnIJ.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDmnIJ.s:20     .text:00000000 linearize_distance
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDmnIJ.s:103    .progmem.data:00000000 IR_dist_conversion
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDmnIJ.s:65     .text:00000022 range_read_distance
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDmnIJ.s:83     .text:0000002c range_init
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+analog_get8
+digital_output
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/motor.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/motor.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/motor.o.d	(revision 1694)
@@ -0,0 +1,23 @@
+motor.o: motor.c motor.h f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h
+
+motor.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/analog.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/analog.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/analog.o.d	(revision 1694)
@@ -0,0 +1,40 @@
+analog.o: analog.c f:/winavr-20070525/bin/../avr/include/util/delay.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/util/delay_basic.h \
+  f:/winavr-20070525/bin/../avr/include/avr/interrupt.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h analog.h serial.h \
+  f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h
+
+f:/winavr-20070525/bin/../avr/include/util/delay.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/util/delay_basic.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/interrupt.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+analog.h:
+
+serial.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/encoders.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/encoders.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/encoders.o.d	(revision 1694)
@@ -0,0 +1,28 @@
+encoders.o: encoders.c encoders.h spi.h ring_buffer.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h
+
+encoders.h:
+
+spi.h:
+
+ring_buffer.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/lcd.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/lcd.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/lcd.o.d	(revision 1694)
@@ -0,0 +1,32 @@
+lcd.o: lcd.c f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h \
+  f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h lcd.h \
+  time.h
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h:
+
+lcd.h:
+
+time.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/odometry.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/odometry.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/odometry.o.d	(revision 1694)
@@ -0,0 +1,42 @@
+odometry.o: odometry.c odometry.h encoders.h \
+  f:/winavr-20070525/bin/../avr/include/math.h \
+  f:/winavr-20070525/bin/../avr/include/avr/interrupt.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h time.h serial.h \
+  f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h
+
+odometry.h:
+
+encoders.h:
+
+f:/winavr-20070525/bin/../avr/include/math.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/interrupt.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+time.h:
+
+serial.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/move.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/move.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/move.o.d	(revision 1694)
@@ -0,0 +1,28 @@
+move.o: move.c move.h motor.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h rangefinder.h
+
+move.h:
+
+motor.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+rangefinder.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/battery.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/battery.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/battery.o.d	(revision 1694)
@@ -0,0 +1,11 @@
+battery.o: battery.c battery.h analog.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h
+
+battery.h:
+
+analog.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/dio.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/dio.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/dio.o.d	(revision 1694)
@@ -0,0 +1,31 @@
+dio.o: dio.c f:/winavr-20070525/bin/../avr/include/avr/interrupt.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h dio.h time.h \
+  lights.h
+
+f:/winavr-20070525/bin/../avr/include/avr/interrupt.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+dio.h:
+
+time.h:
+
+lights.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/dragonfly_lib.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/dragonfly_lib.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/dragonfly_lib.o.d	(revision 1694)
@@ -0,0 +1,80 @@
+dragonfly_lib.o: dragonfly_lib.c dragonfly_lib.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h \
+  f:/winavr-20070525/bin/../avr/include/avr/interrupt.h \
+  f:/winavr-20070525/bin/../avr/include/util/delay.h \
+  f:/winavr-20070525/bin/../avr/include/util/delay_basic.h \
+  f:/winavr-20070525/bin/../avr/include/util/twi.h atomic.h analog.h \
+  dio.h time.h lcd.h lights.h motor.h serial.h \
+  f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h buzzer.h \
+  rangefinder.h bom.h encoders.h move.h reset.h \
+  f:/winavr-20070525/bin/../avr/include/math.h eeprom.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stdbool.h
+
+dragonfly_lib.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/interrupt.h:
+
+f:/winavr-20070525/bin/../avr/include/util/delay.h:
+
+f:/winavr-20070525/bin/../avr/include/util/delay_basic.h:
+
+f:/winavr-20070525/bin/../avr/include/util/twi.h:
+
+atomic.h:
+
+analog.h:
+
+dio.h:
+
+time.h:
+
+lcd.h:
+
+lights.h:
+
+motor.h:
+
+serial.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h:
+
+buzzer.h:
+
+rangefinder.h:
+
+bom.h:
+
+encoders.h:
+
+move.h:
+
+reset.h:
+
+f:/winavr-20070525/bin/../avr/include/math.h:
+
+eeprom.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stdbool.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/bom.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/bom.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/bom.o.d	(revision 1694)
@@ -0,0 +1,36 @@
+bom.o: bom.c bom.h dio.h serial.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h analog.h
+
+bom.h:
+
+dio.h:
+
+serial.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+analog.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/i2c.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/i2c.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/i2c.o.d	(revision 1694)
@@ -0,0 +1,31 @@
+i2c.o: i2c.c f:/winavr-20070525/bin/../avr/include/avr/interrupt.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h \
+  f:/winavr-20070525/bin/../avr/include/util/twi.h i2c.h ring_buffer.h
+
+f:/winavr-20070525/bin/../avr/include/avr/interrupt.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+f:/winavr-20070525/bin/../avr/include/util/twi.h:
+
+i2c.h:
+
+ring_buffer.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/serial.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/serial.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/serial.o.d	(revision 1694)
@@ -0,0 +1,29 @@
+serial.o: serial.c f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h serial.h \
+  f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+serial.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/buzzer.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/buzzer.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/buzzer.o.d	(revision 1694)
@@ -0,0 +1,25 @@
+buzzer.o: buzzer.c f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h buzzer.h time.h
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+buzzer.h:
+
+time.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/reset.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/reset.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/reset.o.d	(revision 1694)
@@ -0,0 +1,32 @@
+reset.o: reset.c f:/winavr-20070525/bin/../avr/include/avr/interrupt.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h \
+  f:/winavr-20070525/bin/../avr/include/util/delay.h \
+  f:/winavr-20070525/bin/../avr/include/util/delay_basic.h reset.h
+
+f:/winavr-20070525/bin/../avr/include/avr/interrupt.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+f:/winavr-20070525/bin/../avr/include/util/delay.h:
+
+f:/winavr-20070525/bin/../avr/include/util/delay_basic.h:
+
+reset.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/rangefinder.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/rangefinder.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/rangefinder.o.d	(revision 1694)
@@ -0,0 +1,35 @@
+rangefinder.o: rangefinder.c \
+  f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h rangefinder.h \
+  analog.h dio.h
+
+f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+rangefinder.h:
+
+analog.h:
+
+dio.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/eeprom.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/eeprom.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/eeprom.o.d	(revision 1694)
@@ -0,0 +1,23 @@
+eeprom.o: eeprom.c f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h eeprom.h
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+eeprom.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/lights.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/lights.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/lights.o.d	(revision 1694)
@@ -0,0 +1,80 @@
+lights.o: lights.c dragonfly_lib.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h \
+  f:/winavr-20070525/bin/../avr/include/avr/interrupt.h \
+  f:/winavr-20070525/bin/../avr/include/util/delay.h \
+  f:/winavr-20070525/bin/../avr/include/util/delay_basic.h \
+  f:/winavr-20070525/bin/../avr/include/util/twi.h atomic.h analog.h \
+  dio.h time.h lcd.h lights.h motor.h serial.h \
+  f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h buzzer.h \
+  rangefinder.h bom.h encoders.h move.h reset.h \
+  f:/winavr-20070525/bin/../avr/include/math.h eeprom.h \
+  f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stdbool.h
+
+dragonfly_lib.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/interrupt.h:
+
+f:/winavr-20070525/bin/../avr/include/util/delay.h:
+
+f:/winavr-20070525/bin/../avr/include/util/delay_basic.h:
+
+f:/winavr-20070525/bin/../avr/include/util/twi.h:
+
+atomic.h:
+
+analog.h:
+
+dio.h:
+
+time.h:
+
+lcd.h:
+
+lights.h:
+
+motor.h:
+
+serial.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/pgmspace.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stddef.h:
+
+buzzer.h:
+
+rangefinder.h:
+
+bom.h:
+
+encoders.h:
+
+move.h:
+
+reset.h:
+
+f:/winavr-20070525/bin/../avr/include/math.h:
+
+eeprom.h:
+
+f:\winavr-20070525\bin\../lib/gcc/avr/4.1.2/include/stdbool.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/spi.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/spi.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/spi.o.d	(revision 1694)
@@ -0,0 +1,26 @@
+spi.o: spi.c f:/winavr-20070525/bin/../avr/include/avr/interrupt.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h spi.h
+
+f:/winavr-20070525/bin/../avr/include/avr/interrupt.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+spi.h:
Index: demos/hunter_prey_john/projects/libdragonfly/.dep/time.o.d
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/.dep/time.o.d	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/.dep/time.o.d	(revision 1694)
@@ -0,0 +1,32 @@
+time.o: time.c f:/winavr-20070525/bin/../avr/include/avr/interrupt.h \
+  f:/winavr-20070525/bin/../avr/include/avr/io.h \
+  f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h \
+  f:/winavr-20070525/bin/../avr/include/inttypes.h \
+  f:/winavr-20070525/bin/../avr/include/stdint.h \
+  f:/winavr-20070525/bin/../avr/include/avr/iom128.h \
+  f:/winavr-20070525/bin/../avr/include/avr/portpins.h \
+  f:/winavr-20070525/bin/../avr/include/avr/version.h \
+  f:/winavr-20070525/bin/../avr/include/util/delay.h \
+  f:/winavr-20070525/bin/../avr/include/util/delay_basic.h time.h
+
+f:/winavr-20070525/bin/../avr/include/avr/interrupt.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/io.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/sfr_defs.h:
+
+f:/winavr-20070525/bin/../avr/include/inttypes.h:
+
+f:/winavr-20070525/bin/../avr/include/stdint.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/iom128.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/portpins.h:
+
+f:/winavr-20070525/bin/../avr/include/avr/version.h:
+
+f:/winavr-20070525/bin/../avr/include/util/delay.h:
+
+f:/winavr-20070525/bin/../avr/include/util/delay_basic.h:
+
+time.h:
Index: demos/hunter_prey_john/projects/libdragonfly/lights.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/lights.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/lights.lst	(revision 1694)
@@ -0,0 +1,1719 @@
+   1               		.file	"lights.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  19               	output_compare:
+  20               	.LFB12:
+  21               	.LM1:
+  22               	/* prologue: frame size=0 */
+  23 0000 CF93      		push r28
+  24 0002 DF93      		push r29
+  25               	/* prologue end (size=2) */
+  26 0004 2091 0000 		lds r18,pwm_read_buffer
+  27 0008 3091 0000 		lds r19,(pwm_read_buffer)+1
+  28               	.L14:
+  29               	.LBB58:
+  30               	.LM2:
+  31 000c E091 0000 		lds r30,current_pwm_channel
+  32 0010 AE2F      		mov r26,r30
+  33 0012 BB27      		clr r27
+  34               	.LM3:
+  35 0014 92B7      		in r25,82-0x20
+  36 0016 AA0F      		lsl r26
+  37 0018 BB1F      		rol r27
+  38 001a A20F      		add r26,r18
+  39 001c B31F      		adc r27,r19
+  40 001e ED01      		movw r28,r26
+  41 0020 8981      		ldd r24,Y+1
+  42 0022 8F5F      		subi r24,lo8(-(1))
+  43 0024 9817      		cp r25,r24
+  44 0026 00F0      		brlo .L8
+  45               	.LM4:
+  46 0028 85B3      		in r24,53-0x20
+  47 002a 9A81      		ldd r25,Y+2
+  48 002c 892B      		or r24,r25
+  49 002e 85BB      		out 53-0x20,r24
+  50               	.LM5:
+  51 0030 E530      		cpi r30,lo8(5)
+  52 0032 01F0      		breq .L8
+  53               	.LM6:
+  54 0034 EF5F      		subi r30,lo8(-(1))
+  55 0036 E093 0000 		sts current_pwm_channel,r30
+  56               	.LM7:
+  57 003a FF27      		clr r31
+  58 003c EE0F      		lsl r30
+  59 003e FF1F      		rol r31
+  60 0040 E20F      		add r30,r18
+  61 0042 F31F      		adc r31,r19
+  62 0044 E181      		ldd r30,Z+1
+  63 0046 EF3F      		cpi r30,lo8(-1)
+  64 0048 01F0      		breq .L14
+  65               	.LM8:
+  66 004a E1BF      		out 81-0x20,r30
+  67 004c 00C0      		rjmp .L14
+  68               	.L8:
+  69               	.LBE58:
+  70               	/* epilogue: frame size=0 */
+  71 004e DF91      		pop r29
+  72 0050 CF91      		pop r28
+  73 0052 0895      		ret
+  74               	/* epilogue end (size=3) */
+  75               	/* function output_compare size 42 (37) */
+  76               	.LFE12:
+  78               	.global	__vector_16
+  80               	__vector_16:
+  81               	.LFB13:
+  82               	.LM9:
+  83               	/* prologue: frame size=0 */
+  84 0054 1F92      		push __zero_reg__
+  85 0056 0F92      		push __tmp_reg__
+  86 0058 0FB6      		in __tmp_reg__,__SREG__
+  87 005a 0F92      		push __tmp_reg__
+  88 005c 1124      		clr __zero_reg__
+  89 005e 2F93      		push r18
+  90 0060 3F93      		push r19
+  91 0062 4F93      		push r20
+  92 0064 5F93      		push r21
+  93 0066 6F93      		push r22
+  94 0068 7F93      		push r23
+  95 006a 8F93      		push r24
+  96 006c 9F93      		push r25
+  97 006e AF93      		push r26
+  98 0070 BF93      		push r27
+  99 0072 EF93      		push r30
+ 100 0074 FF93      		push r31
+ 101               	/* prologue end (size=17) */
+ 102               	.LM10:
+ 103 0076 8091 0000 		lds r24,pwm_page_flip
+ 104 007a 8823      		tst r24
+ 105 007c 01F0      		breq .L16
+ 106               	.LBB59:
+ 107               	.LM11:
+ 108 007e 2091 0000 		lds r18,pwm_read_buffer
+ 109 0082 3091 0000 		lds r19,(pwm_read_buffer)+1
+ 110               	.LVL0:
+ 111               	.LM12:
+ 112 0086 8091 0000 		lds r24,pwm_free_buffer
+ 113 008a 9091 0000 		lds r25,(pwm_free_buffer)+1
+ 114 008e 9093 0000 		sts (pwm_read_buffer)+1,r25
+ 115 0092 8093 0000 		sts pwm_read_buffer,r24
+ 116               	.LM13:
+ 117 0096 3093 0000 		sts (pwm_free_buffer)+1,r19
+ 118 009a 2093 0000 		sts pwm_free_buffer,r18
+ 119               	.LM14:
+ 120 009e 1092 0000 		sts pwm_page_flip,__zero_reg__
+ 121               	.L16:
+ 122               	.LBE59:
+ 123               	.LM15:
+ 124 00a2 85B3      		in r24,53-0x20
+ 125 00a4 8767      		ori r24,lo8(119)
+ 126 00a6 85BB      		out 53-0x20,r24
+ 127               	.LM16:
+ 128 00a8 85B3      		in r24,53-0x20
+ 129 00aa E091 0000 		lds r30,pwm_read_buffer
+ 130 00ae F091 0000 		lds r31,(pwm_read_buffer)+1
+ 131 00b2 9081      		ld r25,Z
+ 132 00b4 8923      		and r24,r25
+ 133 00b6 85BB      		out 53-0x20,r24
+ 134               	.LM17:
+ 135 00b8 1092 0000 		sts current_pwm_channel,__zero_reg__
+ 136               	.LM18:
+ 137 00bc 8181      		ldd r24,Z+1
+ 138 00be 81BF      		out 81-0x20,r24
+ 139               	.LM19:
+ 140 00c0 0E94 0000 		call output_compare
+ 141               	.LVL1:
+ 142               	/* epilogue: frame size=0 */
+ 143 00c4 FF91      		pop r31
+ 144 00c6 EF91      		pop r30
+ 145 00c8 BF91      		pop r27
+ 146 00ca AF91      		pop r26
+ 147 00cc 9F91      		pop r25
+ 148 00ce 8F91      		pop r24
+ 149 00d0 7F91      		pop r23
+ 150 00d2 6F91      		pop r22
+ 151 00d4 5F91      		pop r21
+ 152 00d6 4F91      		pop r20
+ 153 00d8 3F91      		pop r19
+ 154 00da 2F91      		pop r18
+ 155 00dc 0F90      		pop __tmp_reg__
+ 156 00de 0FBE      		out __SREG__,__tmp_reg__
+ 157 00e0 0F90      		pop __tmp_reg__
+ 158 00e2 1F90      		pop __zero_reg__
+ 159 00e4 1895      		reti
+ 160               	/* epilogue end (size=17) */
+ 161               	/* function __vector_16 size 73 (39) */
+ 162               	.LFE13:
+ 164               	.global	__vector_15
+ 166               	__vector_15:
+ 167               	.LFB14:
+ 168               	.LM20:
+ 169               	/* prologue: frame size=0 */
+ 170 00e6 1F92      		push __zero_reg__
+ 171 00e8 0F92      		push __tmp_reg__
+ 172 00ea 0FB6      		in __tmp_reg__,__SREG__
+ 173 00ec 0F92      		push __tmp_reg__
+ 174 00ee 1124      		clr __zero_reg__
+ 175 00f0 2F93      		push r18
+ 176 00f2 3F93      		push r19
+ 177 00f4 4F93      		push r20
+ 178 00f6 5F93      		push r21
+ 179 00f8 6F93      		push r22
+ 180 00fa 7F93      		push r23
+ 181 00fc 8F93      		push r24
+ 182 00fe 9F93      		push r25
+ 183 0100 AF93      		push r26
+ 184 0102 BF93      		push r27
+ 185 0104 EF93      		push r30
+ 186 0106 FF93      		push r31
+ 187               	/* prologue end (size=17) */
+ 188               	.LM21:
+ 189 0108 0E94 0000 		call output_compare
+ 190               	/* epilogue: frame size=0 */
+ 191 010c FF91      		pop r31
+ 192 010e EF91      		pop r30
+ 193 0110 BF91      		pop r27
+ 194 0112 AF91      		pop r26
+ 195 0114 9F91      		pop r25
+ 196 0116 8F91      		pop r24
+ 197 0118 7F91      		pop r23
+ 198 011a 6F91      		pop r22
+ 199 011c 5F91      		pop r21
+ 200 011e 4F91      		pop r20
+ 201 0120 3F91      		pop r19
+ 202 0122 2F91      		pop r18
+ 203 0124 0F90      		pop __tmp_reg__
+ 204 0126 0FBE      		out __SREG__,__tmp_reg__
+ 205 0128 0F90      		pop __tmp_reg__
+ 206 012a 1F90      		pop __zero_reg__
+ 207 012c 1895      		reti
+ 208               	/* epilogue end (size=17) */
+ 209               	/* function __vector_15 size 36 (2) */
+ 210               	.LFE14:
+ 213               	apply_orbs:
+ 214               	.LFB17:
+ 215               	.LM22:
+ 216               	/* prologue: frame size=0 */
+ 217 012e EF92      		push r14
+ 218 0130 FF92      		push r15
+ 219 0132 1F93      		push r17
+ 220 0134 CF93      		push r28
+ 221 0136 DF93      		push r29
+ 222               	/* prologue end (size=5) */
+ 223               	.LM23:
+ 224 0138 8091 0000 		lds r24,enable_orb_pwm
+ 225 013c 8823      		tst r24
+ 226 013e 01F4      		brne .+2
+ 227 0140 00C0      		rjmp .L22
+ 228               	.LM24:
+ 229 0142 E091 0000 		lds r30,pwm_write_buffer
+ 230 0146 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 231 014a 8FEF      		ldi r24,lo8(-1)
+ 232 014c 8083      		st Z,r24
+ 233               	.LBB77:
+ 234               	.LBB78:
+ 235               	.LM25:
+ 236 014e 9091 0000 		lds r25,orb_values
+ 237               	.LVL2:
+ 238 0152 E091 0000 		lds r30,pwm_write_buffer
+ 239 0156 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 240 015a 9150      		subi r25,lo8(-(-1))
+ 241 015c 9183      		std Z+1,r25
+ 242 015e 9F5F      		subi r25,lo8(-(1))
+ 243 0160 E091 0000 		lds r30,pwm_write_buffer
+ 244 0164 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 245 0168 81E0      		ldi r24,lo8(1)
+ 246 016a 8283      		std Z+2,r24
+ 247 016c 9923      		tst r25
+ 248 016e 01F0      		breq .L24
+ 249 0170 E091 0000 		lds r30,pwm_write_buffer
+ 250 0174 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 251 0178 8081      		ld r24,Z
+ 252 017a 8E7F      		andi r24,lo8(-2)
+ 253 017c 8083      		st Z,r24
+ 254               	.L24:
+ 255 017e 9091 0000 		lds r25,orb_values+1
+ 256               	.LVL3:
+ 257 0182 E091 0000 		lds r30,pwm_write_buffer
+ 258 0186 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 259 018a 9150      		subi r25,lo8(-(-1))
+ 260 018c 9383      		std Z+3,r25
+ 261 018e 9F5F      		subi r25,lo8(-(1))
+ 262 0190 E091 0000 		lds r30,pwm_write_buffer
+ 263 0194 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 264 0198 82E0      		ldi r24,lo8(2)
+ 265 019a 8483      		std Z+4,r24
+ 266 019c 9923      		tst r25
+ 267 019e 01F0      		breq .L26
+ 268 01a0 E091 0000 		lds r30,pwm_write_buffer
+ 269 01a4 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 270 01a8 8081      		ld r24,Z
+ 271 01aa 8D7F      		andi r24,lo8(-3)
+ 272 01ac 8083      		st Z,r24
+ 273               	.L26:
+ 274 01ae 9091 0000 		lds r25,orb_values+2
+ 275               	.LVL4:
+ 276 01b2 E091 0000 		lds r30,pwm_write_buffer
+ 277 01b6 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 278 01ba 9150      		subi r25,lo8(-(-1))
+ 279 01bc 9583      		std Z+5,r25
+ 280 01be 9F5F      		subi r25,lo8(-(1))
+ 281 01c0 E091 0000 		lds r30,pwm_write_buffer
+ 282 01c4 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 283 01c8 84E0      		ldi r24,lo8(4)
+ 284 01ca 8683      		std Z+6,r24
+ 285 01cc 9923      		tst r25
+ 286 01ce 01F0      		breq .L28
+ 287 01d0 E091 0000 		lds r30,pwm_write_buffer
+ 288 01d4 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 289 01d8 8081      		ld r24,Z
+ 290 01da 8B7F      		andi r24,lo8(-5)
+ 291 01dc 8083      		st Z,r24
+ 292               	.L28:
+ 293               	.LM26:
+ 294 01de 9091 0000 		lds r25,orb_values+3
+ 295               	.LVL5:
+ 296 01e2 E091 0000 		lds r30,pwm_write_buffer
+ 297 01e6 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 298 01ea 9150      		subi r25,lo8(-(-1))
+ 299 01ec 9783      		std Z+7,r25
+ 300 01ee 9F5F      		subi r25,lo8(-(1))
+ 301 01f0 E091 0000 		lds r30,pwm_write_buffer
+ 302 01f4 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 303 01f8 80E1      		ldi r24,lo8(16)
+ 304 01fa 8087      		std Z+8,r24
+ 305 01fc 9923      		tst r25
+ 306 01fe 01F0      		breq .L30
+ 307 0200 E091 0000 		lds r30,pwm_write_buffer
+ 308 0204 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 309 0208 8081      		ld r24,Z
+ 310 020a 8F7E      		andi r24,lo8(-17)
+ 311 020c 8083      		st Z,r24
+ 312               	.L30:
+ 313 020e 9091 0000 		lds r25,orb_values+4
+ 314               	.LVL6:
+ 315 0212 E091 0000 		lds r30,pwm_write_buffer
+ 316 0216 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 317 021a 9150      		subi r25,lo8(-(-1))
+ 318 021c 9187      		std Z+9,r25
+ 319 021e 9F5F      		subi r25,lo8(-(1))
+ 320 0220 E091 0000 		lds r30,pwm_write_buffer
+ 321 0224 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 322 0228 80E2      		ldi r24,lo8(32)
+ 323 022a 8287      		std Z+10,r24
+ 324 022c 9923      		tst r25
+ 325 022e 01F0      		breq .L32
+ 326 0230 E091 0000 		lds r30,pwm_write_buffer
+ 327 0234 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 328 0238 8081      		ld r24,Z
+ 329 023a 8F7D      		andi r24,lo8(-33)
+ 330 023c 8083      		st Z,r24
+ 331               	.L32:
+ 332 023e 9091 0000 		lds r25,orb_values+5
+ 333               	.LVL7:
+ 334 0242 E091 0000 		lds r30,pwm_write_buffer
+ 335 0246 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 336 024a 9150      		subi r25,lo8(-(-1))
+ 337 024c 9387      		std Z+11,r25
+ 338 024e 9F5F      		subi r25,lo8(-(1))
+ 339 0250 E091 0000 		lds r30,pwm_write_buffer
+ 340 0254 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 341 0258 80E4      		ldi r24,lo8(64)
+ 342 025a 8487      		std Z+12,r24
+ 343 025c 9923      		tst r25
+ 344 025e 01F0      		breq .L34
+ 345 0260 E091 0000 		lds r30,pwm_write_buffer
+ 346 0264 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 347 0268 8081      		ld r24,Z
+ 348 026a 8F7B      		andi r24,lo8(-65)
+ 349 026c 8083      		st Z,r24
+ 350               	.L34:
+ 351               	.LBE78:
+ 352               	.LBE77:
+ 353               	.LBB79:
+ 354               	.LBB80:
+ 355               	.LM27:
+ 356 026e E091 0000 		lds r30,pwm_write_buffer
+ 357 0272 F091 0000 		lds r31,(pwm_write_buffer)+1
+ 358 0276 AF01      		movw r20,r30
+ 359               	.LVL8:
+ 360 0278 4F5F      		subi r20,lo8(-(1))
+ 361 027a 5F4F      		sbci r21,hi8(-(1))
+ 362               	.LM28:
+ 363 027c DF01      		movw r26,r30
+ 364               	.LVL9:
+ 365 027e 1396      		adiw r26,3
+ 366               	.LM29:
+ 367 0280 9181      		ldd r25,Z+1
+ 368               	.LVL10:
+ 369 0282 8381      		ldd r24,Z+3
+ 370 0284 8917      		cp r24,r25
+ 371 0286 00F0      		brlo .L36
+ 372 0288 11E0      		ldi r17,lo8(1)
+ 373               	.LVL11:
+ 374 028a 00C0      		rjmp .L38
+ 375               	.LVL12:
+ 376               	.L36:
+ 377 028c 8183      		std Z+1,r24
+ 378 028e 9383      		std Z+3,r25
+ 379 0290 EA01      		movw r28,r20
+ 380 0292 9981      		ldd r25,Y+1
+ 381               	.LVL13:
+ 382 0294 FD01      		movw r30,r26
+ 383 0296 8181      		ldd r24,Z+1
+ 384 0298 8983      		std Y+1,r24
+ 385 029a 9183      		std Z+1,r25
+ 386 029c 10E0      		ldi r17,lo8(0)
+ 387               	.LVL14:
+ 388               	.L38:
+ 389 029e FD01      		movw r30,r26
+ 390               	.LVL15:
+ 391 02a0 3296      		adiw r30,2
+ 392 02a2 9C91      		ld r25,X
+ 393               	.LVL16:
+ 394 02a4 ED01      		movw r28,r26
+ 395 02a6 8A81      		ldd r24,Y+2
+ 396 02a8 8917      		cp r24,r25
+ 397 02aa 00F4      		brsh .L39
+ 398 02ac 8C93      		st X,r24
+ 399 02ae 9A83      		std Y+2,r25
+ 400 02b0 9981      		ldd r25,Y+1
+ 401               	.LVL17:
+ 402 02b2 8181      		ldd r24,Z+1
+ 403 02b4 8983      		std Y+1,r24
+ 404 02b6 9183      		std Z+1,r25
+ 405 02b8 10E0      		ldi r17,lo8(0)
+ 406               	.L39:
+ 407 02ba 62E0      		ldi r22,lo8(2)
+ 408 02bc E62E      		mov r14,r22
+ 409 02be F12C      		mov r15,__zero_reg__
+ 410               	.LVL18:
+ 411 02c0 EE0E      		add r14,r30
+ 412 02c2 FF1E      		adc r15,r31
+ 413 02c4 ED01      		movw r28,r26
+ 414 02c6 9A81      		ldd r25,Y+2
+ 415               	.LVL19:
+ 416 02c8 8281      		ldd r24,Z+2
+ 417 02ca 8917      		cp r24,r25
+ 418 02cc 00F4      		brsh .L41
+ 419 02ce 8A83      		std Y+2,r24
+ 420 02d0 9283      		std Z+2,r25
+ 421 02d2 9181      		ldd r25,Z+1
+ 422               	.LVL20:
+ 423 02d4 E701      		movw r28,r14
+ 424 02d6 8981      		ldd r24,Y+1
+ 425 02d8 8183      		std Z+1,r24
+ 426 02da 9983      		std Y+1,r25
+ 427 02dc 10E0      		ldi r17,lo8(0)
+ 428               	.L41:
+ 429 02de 9701      		movw r18,r14
+ 430               	.LVL21:
+ 431 02e0 2E5F      		subi r18,lo8(-(2))
+ 432 02e2 3F4F      		sbci r19,hi8(-(2))
+ 433 02e4 9281      		ldd r25,Z+2
+ 434               	.LVL22:
+ 435 02e6 E701      		movw r28,r14
+ 436 02e8 8A81      		ldd r24,Y+2
+ 437 02ea 8917      		cp r24,r25
+ 438 02ec 00F4      		brsh .L43
+ 439 02ee 8283      		std Z+2,r24
+ 440 02f0 9A83      		std Y+2,r25
+ 441 02f2 9981      		ldd r25,Y+1
+ 442               	.LVL23:
+ 443 02f4 E901      		movw r28,r18
+ 444 02f6 8981      		ldd r24,Y+1
+ 445 02f8 E701      		movw r28,r14
+ 446 02fa 8983      		std Y+1,r24
+ 447 02fc E901      		movw r28,r18
+ 448 02fe 9983      		std Y+1,r25
+ 449 0300 10E0      		ldi r17,lo8(0)
+ 450               	.L43:
+ 451 0302 B901      		movw r22,r18
+ 452               	.LVL24:
+ 453 0304 6E5F      		subi r22,lo8(-(2))
+ 454 0306 7F4F      		sbci r23,hi8(-(2))
+ 455 0308 E701      		movw r28,r14
+ 456 030a 9A81      		ldd r25,Y+2
+ 457               	.LVL25:
+ 458 030c E901      		movw r28,r18
+ 459 030e 8A81      		ldd r24,Y+2
+ 460 0310 8917      		cp r24,r25
+ 461 0312 00F4      		brsh .L45
+ 462 0314 E701      		movw r28,r14
+ 463 0316 8A83      		std Y+2,r24
+ 464 0318 E901      		movw r28,r18
+ 465 031a 9A83      		std Y+2,r25
+ 466 031c 9981      		ldd r25,Y+1
+ 467               	.LVL26:
+ 468 031e EB01      		movw r28,r22
+ 469 0320 8981      		ldd r24,Y+1
+ 470 0322 E901      		movw r28,r18
+ 471 0324 8983      		std Y+1,r24
+ 472 0326 EB01      		movw r28,r22
+ 473 0328 9983      		std Y+1,r25
+ 474 032a 00C0      		rjmp .L47
+ 475               	.LVL27:
+ 476               	.L45:
+ 477               	.LM30:
+ 478 032c 1123      		tst r17
+ 479 032e 01F0      		breq .+2
+ 480 0330 00C0      		rjmp .L48
+ 481               	.LVL28:
+ 482               	.L47:
+ 483               	.LM31:
+ 484 0332 EA01      		movw r28,r20
+ 485 0334 9881      		ld r25,Y
+ 486               	.LVL29:
+ 487 0336 8C91      		ld r24,X
+ 488 0338 8917      		cp r24,r25
+ 489 033a 00F0      		brlo .L49
+ 490 033c 61E0      		ldi r22,lo8(1)
+ 491               	.LVL30:
+ 492 033e 00C0      		rjmp .L51
+ 493               	.LVL31:
+ 494               	.L49:
+ 495 0340 EA01      		movw r28,r20
+ 496 0342 8883      		st Y,r24
+ 497 0344 9C93      		st X,r25
+ 498 0346 9981      		ldd r25,Y+1
+ 499               	.LVL32:
+ 500 0348 ED01      		movw r28,r26
+ 501 034a 8981      		ldd r24,Y+1
+ 502 034c EA01      		movw r28,r20
+ 503 034e 8983      		std Y+1,r24
+ 504 0350 ED01      		movw r28,r26
+ 505 0352 9983      		std Y+1,r25
+ 506 0354 60E0      		ldi r22,lo8(0)
+ 507               	.LVL33:
+ 508               	.L51:
+ 509 0356 9C91      		ld r25,X
+ 510               	.LVL34:
+ 511 0358 8081      		ld r24,Z
+ 512 035a 8917      		cp r24,r25
+ 513 035c 00F4      		brsh .L52
+ 514 035e 8C93      		st X,r24
+ 515 0360 9083      		st Z,r25
+ 516 0362 ED01      		movw r28,r26
+ 517 0364 9981      		ldd r25,Y+1
+ 518               	.LVL35:
+ 519 0366 8181      		ldd r24,Z+1
+ 520 0368 8983      		std Y+1,r24
+ 521 036a 9183      		std Z+1,r25
+ 522 036c 60E0      		ldi r22,lo8(0)
+ 523               	.L52:
+ 524 036e 9081      		ld r25,Z
+ 525               	.LVL36:
+ 526 0370 E701      		movw r28,r14
+ 527 0372 8881      		ld r24,Y
+ 528 0374 8917      		cp r24,r25
+ 529 0376 00F4      		brsh .L54
+ 530 0378 8083      		st Z,r24
+ 531 037a 9883      		st Y,r25
+ 532 037c 9181      		ldd r25,Z+1
+ 533               	.LVL37:
+ 534 037e 8981      		ldd r24,Y+1
+ 535 0380 8183      		std Z+1,r24
+ 536 0382 9983      		std Y+1,r25
+ 537 0384 60E0      		ldi r22,lo8(0)
+ 538               	.L54:
+ 539 0386 E701      		movw r28,r14
+ 540 0388 9881      		ld r25,Y
+ 541               	.LVL38:
+ 542 038a E901      		movw r28,r18
+ 543 038c 8881      		ld r24,Y
+ 544 038e 8917      		cp r24,r25
+ 545 0390 00F4      		brsh .L56
+ 546 0392 E701      		movw r28,r14
+ 547 0394 8883      		st Y,r24
+ 548 0396 E901      		movw r28,r18
+ 549 0398 9883      		st Y,r25
+ 550 039a E701      		movw r28,r14
+ 551 039c 9981      		ldd r25,Y+1
+ 552               	.LVL39:
+ 553 039e E901      		movw r28,r18
+ 554 03a0 8981      		ldd r24,Y+1
+ 555 03a2 E701      		movw r28,r14
+ 556 03a4 8983      		std Y+1,r24
+ 557 03a6 E901      		movw r28,r18
+ 558 03a8 9983      		std Y+1,r25
+ 559 03aa 00C0      		rjmp .L58
+ 560               	.LVL40:
+ 561               	.L56:
+ 562               	.LM32:
+ 563 03ac 6623      		tst r22
+ 564 03ae 01F0      		breq .+2
+ 565 03b0 00C0      		rjmp .L48
+ 566               	.LVL41:
+ 567               	.L58:
+ 568               	.LM33:
+ 569 03b2 EA01      		movw r28,r20
+ 570 03b4 9881      		ld r25,Y
+ 571               	.LVL42:
+ 572 03b6 8C91      		ld r24,X
+ 573 03b8 8917      		cp r24,r25
+ 574 03ba 00F0      		brlo .L59
+ 575 03bc 21E0      		ldi r18,lo8(1)
+ 576               	.LVL43:
+ 577 03be 00C0      		rjmp .L61
+ 578               	.LVL44:
+ 579               	.L59:
+ 580 03c0 EA01      		movw r28,r20
+ 581 03c2 8883      		st Y,r24
+ 582 03c4 9C93      		st X,r25
+ 583 03c6 9981      		ldd r25,Y+1
+ 584               	.LVL45:
+ 585 03c8 ED01      		movw r28,r26
+ 586 03ca 8981      		ldd r24,Y+1
+ 587 03cc EA01      		movw r28,r20
+ 588 03ce 8983      		std Y+1,r24
+ 589 03d0 ED01      		movw r28,r26
+ 590 03d2 9983      		std Y+1,r25
+ 591 03d4 20E0      		ldi r18,lo8(0)
+ 592               	.LVL46:
+ 593               	.L61:
+ 594 03d6 9C91      		ld r25,X
+ 595               	.LVL47:
+ 596 03d8 8081      		ld r24,Z
+ 597 03da 8917      		cp r24,r25
+ 598 03dc 00F4      		brsh .L62
+ 599 03de 8C93      		st X,r24
+ 600 03e0 9083      		st Z,r25
+ 601 03e2 ED01      		movw r28,r26
+ 602 03e4 9981      		ldd r25,Y+1
+ 603               	.LVL48:
+ 604 03e6 8181      		ldd r24,Z+1
+ 605 03e8 8983      		std Y+1,r24
+ 606 03ea 9183      		std Z+1,r25
+ 607 03ec 20E0      		ldi r18,lo8(0)
+ 608               	.L62:
+ 609 03ee 9081      		ld r25,Z
+ 610               	.LVL49:
+ 611 03f0 E701      		movw r28,r14
+ 612 03f2 8881      		ld r24,Y
+ 613 03f4 8917      		cp r24,r25
+ 614 03f6 00F4      		brsh .L64
+ 615 03f8 8083      		st Z,r24
+ 616 03fa 9883      		st Y,r25
+ 617 03fc 9181      		ldd r25,Z+1
+ 618               	.LVL50:
+ 619 03fe 8981      		ldd r24,Y+1
+ 620 0400 8183      		std Z+1,r24
+ 621 0402 9983      		std Y+1,r25
+ 622 0404 00C0      		rjmp .L66
+ 623               	.LVL51:
+ 624               	.L64:
+ 625               	.LM34:
+ 626 0406 2223      		tst r18
+ 627 0408 01F4      		brne .L48
+ 628               	.LVL52:
+ 629               	.L66:
+ 630               	.LM35:
+ 631 040a EA01      		movw r28,r20
+ 632 040c 9881      		ld r25,Y
+ 633               	.LVL53:
+ 634 040e 8C91      		ld r24,X
+ 635 0410 8917      		cp r24,r25
+ 636 0412 00F0      		brlo .L67
+ 637 0414 21E0      		ldi r18,lo8(1)
+ 638               	.LVL54:
+ 639 0416 00C0      		rjmp .L69
+ 640               	.LVL55:
+ 641               	.L67:
+ 642 0418 EA01      		movw r28,r20
+ 643 041a 8883      		st Y,r24
+ 644 041c 9C93      		st X,r25
+ 645 041e 9981      		ldd r25,Y+1
+ 646               	.LVL56:
+ 647 0420 ED01      		movw r28,r26
+ 648 0422 8981      		ldd r24,Y+1
+ 649 0424 EA01      		movw r28,r20
+ 650 0426 8983      		std Y+1,r24
+ 651 0428 ED01      		movw r28,r26
+ 652 042a 9983      		std Y+1,r25
+ 653 042c 20E0      		ldi r18,lo8(0)
+ 654               	.LVL57:
+ 655               	.L69:
+ 656 042e 9C91      		ld r25,X
+ 657               	.LVL58:
+ 658 0430 8081      		ld r24,Z
+ 659 0432 8917      		cp r24,r25
+ 660 0434 00F4      		brsh .L70
+ 661 0436 8C93      		st X,r24
+ 662 0438 9083      		st Z,r25
+ 663 043a ED01      		movw r28,r26
+ 664 043c 9981      		ldd r25,Y+1
+ 665               	.LVL59:
+ 666 043e 8181      		ldd r24,Z+1
+ 667 0440 8983      		std Y+1,r24
+ 668 0442 9183      		std Z+1,r25
+ 669 0444 00C0      		rjmp .L72
+ 670               	.LVL60:
+ 671               	.L70:
+ 672               	.LM36:
+ 673 0446 2223      		tst r18
+ 674 0448 01F4      		brne .L48
+ 675               	.LVL61:
+ 676               	.L72:
+ 677               	.LM37:
+ 678 044a FA01      		movw r30,r20
+ 679               	.LVL62:
+ 680 044c 9081      		ld r25,Z
+ 681               	.LVL63:
+ 682 044e 8C91      		ld r24,X
+ 683 0450 8917      		cp r24,r25
+ 684 0452 00F4      		brsh .L48
+ 685 0454 8083      		st Z,r24
+ 686 0456 9C93      		st X,r25
+ 687 0458 9181      		ldd r25,Z+1
+ 688               	.LVL64:
+ 689 045a ED01      		movw r28,r26
+ 690 045c 8981      		ldd r24,Y+1
+ 691 045e 8183      		std Z+1,r24
+ 692 0460 9983      		std Y+1,r25
+ 693               	.LVL65:
+ 694               	.L48:
+ 695               	.LBE80:
+ 696               	.LBE79:
+ 697               	.LBB81:
+ 698               	.LM38:
+ 699 0462 4FB7      		in r20,95-0x20
+ 700               	.LVL66:
+ 701               	.LBB82:
+ 702               	.LBB83:
+ 703               	.LM39:
+ 704               	/* #APP */
+ 705 0464 F894      		cli
+ 706               	/* #NOAPP */
+ 707               	.LBE83:
+ 708               	.LBE82:
+ 709               	.LBB84:
+ 710               	.LM40:
+ 711 0466 2091 0000 		lds r18,pwm_write_buffer
+ 712 046a 3091 0000 		lds r19,(pwm_write_buffer)+1
+ 713               	.LVL67:
+ 714               	.LM41:
+ 715 046e 8091 0000 		lds r24,pwm_free_buffer
+ 716 0472 9091 0000 		lds r25,(pwm_free_buffer)+1
+ 717 0476 9093 0000 		sts (pwm_write_buffer)+1,r25
+ 718 047a 8093 0000 		sts pwm_write_buffer,r24
+ 719               	.LM42:
+ 720 047e 3093 0000 		sts (pwm_free_buffer)+1,r19
+ 721 0482 2093 0000 		sts pwm_free_buffer,r18
+ 722               	.LBE84:
+ 723               	.LBB85:
+ 724               	.LBB86:
+ 725               	.LM43:
+ 726 0486 4FBF      		out 95-0x20,r20
+ 727               	.LM44:
+ 728               	.LBE86:
+ 729               	.LBE85:
+ 730               	.LBE81:
+ 731               	.LM45:
+ 732 0488 81E0      		ldi r24,lo8(1)
+ 733 048a 8093 0000 		sts pwm_page_flip,r24
+ 734 048e 00C0      		rjmp .L86
+ 735               	.LVL68:
+ 736               	.L22:
+ 737 0490 8091 0000 		lds r24,orb_values
+ 738 0494 8111      		cpse r24,__zero_reg__
+ 739 0496 81E0      		ldi r24,lo8(1)
+ 740               	.L75:
+ 741 0498 282F      		mov r18,r24
+ 742               	.LVL69:
+ 743               	.LBB87:
+ 744               	.LM46:
+ 745 049a 8091 0000 		lds r24,orb_values+1
+ 746 049e 8111      		cpse r24,__zero_reg__
+ 747 04a0 2260      		ori r18,lo8(2)
+ 748               	.L76:
+ 749               	.LM47:
+ 750 04a2 8091 0000 		lds r24,orb_values+2
+ 751 04a6 8111      		cpse r24,__zero_reg__
+ 752 04a8 2460      		ori r18,lo8(4)
+ 753               	.L78:
+ 754               	.LM48:
+ 755 04aa 8091 0000 		lds r24,orb_values+3
+ 756 04ae 8111      		cpse r24,__zero_reg__
+ 757 04b0 2061      		ori r18,lo8(16)
+ 758               	.L80:
+ 759               	.LM49:
+ 760 04b2 8091 0000 		lds r24,orb_values+4
+ 761 04b6 8111      		cpse r24,__zero_reg__
+ 762 04b8 2062      		ori r18,lo8(32)
+ 763               	.L82:
+ 764               	.LM50:
+ 765 04ba 8091 0000 		lds r24,orb_values+5
+ 766 04be 8111      		cpse r24,__zero_reg__
+ 767 04c0 2064      		ori r18,lo8(64)
+ 768               	.L84:
+ 769               	.LBB88:
+ 770               	.LM51:
+ 771 04c2 9FB7      		in r25,95-0x20
+ 772               	.LVL70:
+ 773               	.LBB89:
+ 774               	.LBB90:
+ 775               	.LM52:
+ 776               	/* #APP */
+ 777 04c4 F894      		cli
+ 778               	/* #NOAPP */
+ 779               	.LBE90:
+ 780               	.LBE89:
+ 781               	.LBB91:
+ 782               	.LM53:
+ 783 04c6 85B3      		in r24,53-0x20
+ 784               	.LVL71:
+ 785               	.LM54:
+ 786 04c8 8767      		ori r24,lo8(119)
+ 787 04ca 2095      		com r18
+ 788 04cc 8223      		and r24,r18
+ 789               	.LM55:
+ 790 04ce 85BB      		out 53-0x20,r24
+ 791               	.LBE91:
+ 792               	.LBB92:
+ 793               	.LBB93:
+ 794               	.LM56:
+ 795 04d0 9FBF      		out 95-0x20,r25
+ 796               	.LM57:
+ 797               	.LVL72:
+ 798               	.L86:
+ 799               	.LBE93:
+ 800               	.LBE92:
+ 801               	.LBE88:
+ 802               	.LBE87:
+ 803               	/* epilogue: frame size=0 */
+ 804 04d2 DF91      		pop r29
+ 805 04d4 CF91      		pop r28
+ 806 04d6 1F91      		pop r17
+ 807 04d8 FF90      		pop r15
+ 808 04da EF90      		pop r14
+ 809 04dc 0895      		ret
+ 810               	/* epilogue end (size=6) */
+ 811               	/* function apply_orbs size 484 (473) */
+ 812               	.LFE17:
+ 814               	.global	orb_n_set
+ 816               	orb_n_set:
+ 817               	.LFB19:
+ 818               	.LM58:
+ 819               	/* prologue: frame size=0 */
+ 820               	/* prologue end (size=0) */
+ 821               	.LVL73:
+ 822 04de 982F      		mov r25,r24
+ 823               	.LBB94:
+ 824               	.LM59:
+ 825 04e0 3FB7      		in r19,95-0x20
+ 826               	.LVL74:
+ 827               	.LBB95:
+ 828               	.LBB96:
+ 829               	.LM60:
+ 830               	/* #APP */
+ 831 04e2 F894      		cli
+ 832               	/* #NOAPP */
+ 833               	.LBE96:
+ 834               	.LBE95:
+ 835               	.LM61:
+ 836 04e4 8091 0000 		lds r24,orb_lock
+ 837               	.LVL75:
+ 838 04e8 8823      		tst r24
+ 839 04ea 01F0      		breq .L88
+ 840               	.LM62:
+ 841 04ec E0E0      		ldi r30,lo8(0)
+ 842 04ee F0E0      		ldi r31,hi8(0)
+ 843 04f0 00C0      		rjmp .L90
+ 844               	.L88:
+ 845 04f2 81E0      		ldi r24,lo8(1)
+ 846 04f4 8093 0000 		sts orb_lock,r24
+ 847 04f8 E1E0      		ldi r30,lo8(1)
+ 848 04fa F0E0      		ldi r31,hi8(1)
+ 849               	.L90:
+ 850               	.LBB97:
+ 851               	.LBB98:
+ 852               	.LM63:
+ 853 04fc 3FBF      		out 95-0x20,r19
+ 854               	.LM64:
+ 855 04fe 3197      		sbiw r30,1
+ 856 0500 01F4      		brne .L93
+ 857               	.LBE98:
+ 858               	.LBE97:
+ 859               	.LBE94:
+ 860               	.LBB99:
+ 861               	.LBB100:
+ 862               	.LM65:
+ 863 0502 892F      		mov r24,r25
+ 864 0504 9927      		clr r25
+ 865 0506 FC01      		movw r30,r24
+ 866 0508 EE0F      		lsl r30
+ 867 050a FF1F      		rol r31
+ 868 050c E80F      		add r30,r24
+ 869 050e F91F      		adc r31,r25
+ 870 0510 E050      		subi r30,lo8(-(orb_values))
+ 871 0512 F040      		sbci r31,hi8(-(orb_values))
+ 872 0514 6083      		st Z,r22
+ 873               	.LM66:
+ 874 0516 4183      		std Z+1,r20
+ 875               	.LM67:
+ 876 0518 2283      		std Z+2,r18
+ 877               	.LBE100:
+ 878               	.LBE99:
+ 879               	.LM68:
+ 880 051a 0E94 0000 		call apply_orbs
+ 881               	.LVL76:
+ 882               	.LM69:
+ 883 051e 1092 0000 		sts orb_lock,__zero_reg__
+ 884               	.LVL77:
+ 885               	.L93:
+ 886 0522 0895      		ret
+ 887               	/* epilogue: frame size=0 */
+ 888               	/* epilogue: noreturn */
+ 889               	/* epilogue end (size=0) */
+ 890               	/* function orb_n_set size 39 (39) */
+ 891               	.LFE19:
+ 893               	.global	orb1_set
+ 895               	orb1_set:
+ 896               	.LFB20:
+ 897               	.LM70:
+ 898               	/* prologue: frame size=0 */
+ 899               	/* prologue end (size=0) */
+ 900               	.LVL78:
+ 901 0524 382F      		mov r19,r24
+ 902               	.LBB101:
+ 903               	.LM71:
+ 904 0526 2FB7      		in r18,95-0x20
+ 905               	.LVL79:
+ 906               	.LBB102:
+ 907               	.LBB103:
+ 908               	.LM72:
+ 909               	/* #APP */
+ 910 0528 F894      		cli
+ 911               	/* #NOAPP */
+ 912               	.LBE103:
+ 913               	.LBE102:
+ 914               	.LM73:
+ 915 052a 8091 0000 		lds r24,orb_lock
+ 916               	.LVL80:
+ 917 052e 8823      		tst r24
+ 918 0530 01F0      		breq .L95
+ 919               	.LM74:
+ 920 0532 80E0      		ldi r24,lo8(0)
+ 921 0534 90E0      		ldi r25,hi8(0)
+ 922 0536 00C0      		rjmp .L97
+ 923               	.L95:
+ 924 0538 81E0      		ldi r24,lo8(1)
+ 925 053a 8093 0000 		sts orb_lock,r24
+ 926 053e 81E0      		ldi r24,lo8(1)
+ 927 0540 90E0      		ldi r25,hi8(1)
+ 928               	.L97:
+ 929               	.LBB104:
+ 930               	.LBB105:
+ 931               	.LM75:
+ 932 0542 2FBF      		out 95-0x20,r18
+ 933               	.LM76:
+ 934 0544 0197      		sbiw r24,1
+ 935 0546 01F4      		brne .L100
+ 936               	.LBE105:
+ 937               	.LBE104:
+ 938               	.LBE101:
+ 939               	.LBB106:
+ 940               	.LBB107:
+ 941               	.LM77:
+ 942 0548 3093 0000 		sts orb_values,r19
+ 943               	.LM78:
+ 944 054c 6093 0000 		sts orb_values+1,r22
+ 945               	.LM79:
+ 946 0550 4093 0000 		sts orb_values+2,r20
+ 947               	.LBE107:
+ 948               	.LBE106:
+ 949               	.LM80:
+ 950 0554 0E94 0000 		call apply_orbs
+ 951               	.LVL81:
+ 952               	.LM81:
+ 953 0558 1092 0000 		sts orb_lock,__zero_reg__
+ 954               	.LVL82:
+ 955               	.L100:
+ 956 055c 0895      		ret
+ 957               	/* epilogue: frame size=0 */
+ 958               	/* epilogue: noreturn */
+ 959               	/* epilogue end (size=0) */
+ 960               	/* function orb1_set size 33 (33) */
+ 961               	.LFE20:
+ 963               	.global	orb2_set
+ 965               	orb2_set:
+ 966               	.LFB21:
+ 967               	.LM82:
+ 968               	/* prologue: frame size=0 */
+ 969               	/* prologue end (size=0) */
+ 970               	.LVL83:
+ 971 055e 382F      		mov r19,r24
+ 972               	.LBB108:
+ 973               	.LM83:
+ 974 0560 2FB7      		in r18,95-0x20
+ 975               	.LVL84:
+ 976               	.LBB109:
+ 977               	.LBB110:
+ 978               	.LM84:
+ 979               	/* #APP */
+ 980 0562 F894      		cli
+ 981               	/* #NOAPP */
+ 982               	.LBE110:
+ 983               	.LBE109:
+ 984               	.LM85:
+ 985 0564 8091 0000 		lds r24,orb_lock
+ 986               	.LVL85:
+ 987 0568 8823      		tst r24
+ 988 056a 01F0      		breq .L102
+ 989               	.LM86:
+ 990 056c 80E0      		ldi r24,lo8(0)
+ 991 056e 90E0      		ldi r25,hi8(0)
+ 992 0570 00C0      		rjmp .L104
+ 993               	.L102:
+ 994 0572 81E0      		ldi r24,lo8(1)
+ 995 0574 8093 0000 		sts orb_lock,r24
+ 996 0578 81E0      		ldi r24,lo8(1)
+ 997 057a 90E0      		ldi r25,hi8(1)
+ 998               	.L104:
+ 999               	.LBB111:
+ 1000               	.LBB112:
+ 1001               	.LM87:
+ 1002 057c 2FBF      		out 95-0x20,r18
+ 1003               	.LM88:
+ 1004 057e 0197      		sbiw r24,1
+ 1005 0580 01F4      		brne .L107
+ 1006               	.LBE112:
+ 1007               	.LBE111:
+ 1008               	.LBE108:
+ 1009               	.LBB113:
+ 1010               	.LBB114:
+ 1011               	.LM89:
+ 1012 0582 3093 0000 		sts orb_values+3,r19
+ 1013               	.LM90:
+ 1014 0586 6093 0000 		sts orb_values+4,r22
+ 1015               	.LM91:
+ 1016 058a 4093 0000 		sts orb_values+5,r20
+ 1017               	.LBE114:
+ 1018               	.LBE113:
+ 1019               	.LM92:
+ 1020 058e 0E94 0000 		call apply_orbs
+ 1021               	.LVL86:
+ 1022               	.LM93:
+ 1023 0592 1092 0000 		sts orb_lock,__zero_reg__
+ 1024               	.LVL87:
+ 1025               	.L107:
+ 1026 0596 0895      		ret
+ 1027               	/* epilogue: frame size=0 */
+ 1028               	/* epilogue: noreturn */
+ 1029               	/* epilogue end (size=0) */
+ 1030               	/* function orb2_set size 33 (33) */
+ 1031               	.LFE21:
+ 1033               	.global	orb_set
+ 1035               	orb_set:
+ 1036               	.LFB22:
+ 1037               	.LM94:
+ 1038               	/* prologue: frame size=0 */
+ 1039               	/* prologue end (size=0) */
+ 1040               	.LVL88:
+ 1041 0598 382F      		mov r19,r24
+ 1042               	.LBB115:
+ 1043               	.LM95:
+ 1044 059a 2FB7      		in r18,95-0x20
+ 1045               	.LVL89:
+ 1046               	.LBB116:
+ 1047               	.LBB117:
+ 1048               	.LM96:
+ 1049               	/* #APP */
+ 1050 059c F894      		cli
+ 1051               	/* #NOAPP */
+ 1052               	.LBE117:
+ 1053               	.LBE116:
+ 1054               	.LM97:
+ 1055 059e 8091 0000 		lds r24,orb_lock
+ 1056               	.LVL90:
+ 1057 05a2 8823      		tst r24
+ 1058 05a4 01F0      		breq .L109
+ 1059               	.LM98:
+ 1060 05a6 80E0      		ldi r24,lo8(0)
+ 1061 05a8 90E0      		ldi r25,hi8(0)
+ 1062 05aa 00C0      		rjmp .L111
+ 1063               	.L109:
+ 1064 05ac 81E0      		ldi r24,lo8(1)
+ 1065 05ae 8093 0000 		sts orb_lock,r24
+ 1066 05b2 81E0      		ldi r24,lo8(1)
+ 1067 05b4 90E0      		ldi r25,hi8(1)
+ 1068               	.L111:
+ 1069               	.LBB118:
+ 1070               	.LBB119:
+ 1071               	.LM99:
+ 1072 05b6 2FBF      		out 95-0x20,r18
+ 1073               	.LM100:
+ 1074 05b8 0197      		sbiw r24,1
+ 1075 05ba 01F4      		brne .L114
+ 1076               	.LBE119:
+ 1077               	.LBE118:
+ 1078               	.LBE115:
+ 1079               	.LBB120:
+ 1080               	.LBB121:
+ 1081               	.LM101:
+ 1082 05bc 3093 0000 		sts orb_values,r19
+ 1083               	.LM102:
+ 1084 05c0 6093 0000 		sts orb_values+1,r22
+ 1085               	.LM103:
+ 1086 05c4 4093 0000 		sts orb_values+2,r20
+ 1087               	.LBE121:
+ 1088               	.LBE120:
+ 1089               	.LBB122:
+ 1090               	.LBB123:
+ 1091               	.LM104:
+ 1092 05c8 3093 0000 		sts orb_values+3,r19
+ 1093               	.LM105:
+ 1094 05cc 6093 0000 		sts orb_values+4,r22
+ 1095               	.LM106:
+ 1096 05d0 4093 0000 		sts orb_values+5,r20
+ 1097               	.LBE123:
+ 1098               	.LBE122:
+ 1099               	.LM107:
+ 1100 05d4 0E94 0000 		call apply_orbs
+ 1101               	.LVL91:
+ 1102               	.LM108:
+ 1103 05d8 1092 0000 		sts orb_lock,__zero_reg__
+ 1104               	.LVL92:
+ 1105               	.L114:
+ 1106 05dc 0895      		ret
+ 1107               	/* epilogue: frame size=0 */
+ 1108               	/* epilogue: noreturn */
+ 1109               	/* epilogue end (size=0) */
+ 1110               	/* function orb_set size 39 (39) */
+ 1111               	.LFE22:
+ 1113               	.global	orbs_set
+ 1115               	orbs_set:
+ 1116               	.LFB23:
+ 1117               	.LM109:
+ 1118               	/* prologue: frame size=0 */
+ 1119 05de EF92      		push r14
+ 1120 05e0 0F93      		push r16
+ 1121               	/* prologue end (size=2) */
+ 1122               	.LVL93:
+ 1123 05e2 582F      		mov r21,r24
+ 1124               	.LBB124:
+ 1125               	.LM110:
+ 1126 05e4 3FB7      		in r19,95-0x20
+ 1127               	.LVL94:
+ 1128               	.LBB125:
+ 1129               	.LBB126:
+ 1130               	.LM111:
+ 1131               	/* #APP */
+ 1132 05e6 F894      		cli
+ 1133               	/* #NOAPP */
+ 1134               	.LBE126:
+ 1135               	.LBE125:
+ 1136               	.LM112:
+ 1137 05e8 8091 0000 		lds r24,orb_lock
+ 1138               	.LVL95:
+ 1139 05ec 8823      		tst r24
+ 1140 05ee 01F0      		breq .L116
+ 1141               	.LM113:
+ 1142 05f0 80E0      		ldi r24,lo8(0)
+ 1143 05f2 90E0      		ldi r25,hi8(0)
+ 1144 05f4 00C0      		rjmp .L118
+ 1145               	.L116:
+ 1146 05f6 81E0      		ldi r24,lo8(1)
+ 1147 05f8 8093 0000 		sts orb_lock,r24
+ 1148 05fc 81E0      		ldi r24,lo8(1)
+ 1149 05fe 90E0      		ldi r25,hi8(1)
+ 1150               	.L118:
+ 1151               	.LBB127:
+ 1152               	.LBB128:
+ 1153               	.LM114:
+ 1154 0600 3FBF      		out 95-0x20,r19
+ 1155               	.LM115:
+ 1156 0602 0197      		sbiw r24,1
+ 1157 0604 01F4      		brne .L121
+ 1158               	.LBE128:
+ 1159               	.LBE127:
+ 1160               	.LBE124:
+ 1161               	.LBB129:
+ 1162               	.LBB130:
+ 1163               	.LM116:
+ 1164 0606 5093 0000 		sts orb_values,r21
+ 1165               	.LM117:
+ 1166 060a 6093 0000 		sts orb_values+1,r22
+ 1167               	.LM118:
+ 1168 060e 4093 0000 		sts orb_values+2,r20
+ 1169               	.LBE130:
+ 1170               	.LBE129:
+ 1171               	.LBB131:
+ 1172               	.LBB132:
+ 1173               	.LM119:
+ 1174 0612 2093 0000 		sts orb_values+3,r18
+ 1175               	.LM120:
+ 1176 0616 0093 0000 		sts orb_values+4,r16
+ 1177               	.LM121:
+ 1178 061a E092 0000 		sts orb_values+5,r14
+ 1179               	.LBE132:
+ 1180               	.LBE131:
+ 1181               	.LM122:
+ 1182 061e 0E94 0000 		call apply_orbs
+ 1183               	.LVL96:
+ 1184               	.LM123:
+ 1185 0622 1092 0000 		sts orb_lock,__zero_reg__
+ 1186               	.LVL97:
+ 1187               	.L121:
+ 1188               	/* epilogue: frame size=0 */
+ 1189 0626 0F91      		pop r16
+ 1190 0628 EF90      		pop r14
+ 1191 062a 0895      		ret
+ 1192               	/* epilogue end (size=3) */
+ 1193               	/* function orbs_set size 43 (38) */
+ 1194               	.LFE23:
+ 1196               	.global	orb_n_set_color
+ 1198               	orb_n_set_color:
+ 1199               	.LFB24:
+ 1200               	.LM124:
+ 1201               	/* prologue: frame size=0 */
+ 1202               	/* prologue end (size=0) */
+ 1203               	.LVL98:
+ 1204               	.LM125:
+ 1205 062c 7727      		clr r23
+ 1206               	.LVL99:
+ 1207 062e AB01      		movw r20,r22
+ 1208 0630 4370      		andi r20,lo8(3)
+ 1209 0632 5070      		andi r21,hi8(3)
+ 1210 0634 25E5      		ldi r18,lo8(85)
+ 1211 0636 30E0      		ldi r19,hi8(85)
+ 1212 0638 D901      		movw r26,r18
+ 1213 063a 4A9F      		mul r20,r26
+ 1214 063c 9001      		movw r18,r0
+ 1215 063e 4B9F      		mul r20,r27
+ 1216 0640 300D      		add r19,r0
+ 1217 0642 5A9F      		mul r21,r26
+ 1218 0644 300D      		add r19,r0
+ 1219 0646 1124      		clr r1
+ 1220 0648 AB01      		movw r20,r22
+ 1221 064a 4C71      		andi r20,lo8(28)
+ 1222 064c 5070      		andi r21,hi8(28)
+ 1223 064e 5595      		asr r21
+ 1224 0650 4795      		ror r20
+ 1225 0652 5595      		asr r21
+ 1226 0654 4795      		ror r20
+ 1227 0656 E4E2      		ldi r30,lo8(36)
+ 1228 0658 F0E0      		ldi r31,hi8(36)
+ 1229 065a DA01      		movw r26,r20
+ 1230 065c AE9F      		mul r26,r30
+ 1231 065e A001      		movw r20,r0
+ 1232 0660 AF9F      		mul r26,r31
+ 1233 0662 500D      		add r21,r0
+ 1234 0664 BE9F      		mul r27,r30
+ 1235 0666 500D      		add r21,r0
+ 1236 0668 1124      		clr r1
+ 1237 066a A5E0      		ldi r26,5
+ 1238 066c 7695      	1:	lsr r23
+ 1239 066e 6795      		ror r22
+ 1240 0670 AA95      		dec r26
+ 1241 0672 01F4      		brne 1b
+ 1242 0674 DB01      		movw r26,r22
+ 1243 0676 AE9F      		mul r26,r30
+ 1244 0678 B001      		movw r22,r0
+ 1245 067a AF9F      		mul r26,r31
+ 1246 067c 700D      		add r23,r0
+ 1247 067e BE9F      		mul r27,r30
+ 1248 0680 700D      		add r23,r0
+ 1249 0682 1124      		clr r1
+ 1250 0684 0E94 0000 		call orb_n_set
+ 1251               	.LVL100:
+ 1252               	/* epilogue: frame size=0 */
+ 1253 0688 0895      		ret
+ 1254               	/* epilogue end (size=1) */
+ 1255               	/* function orb_n_set_color size 47 (46) */
+ 1256               	.LFE24:
+ 1258               	.global	orb1_set_color
+ 1260               	orb1_set_color:
+ 1261               	.LFB25:
+ 1262               	.LM126:
+ 1263               	/* prologue: frame size=0 */
+ 1264               	/* prologue end (size=0) */
+ 1265               	.LVL101:
+ 1266               	.LM127:
+ 1267 068a 9927      		clr r25
+ 1268               	.LVL102:
+ 1269 068c AC01      		movw r20,r24
+ 1270 068e 4370      		andi r20,lo8(3)
+ 1271 0690 5070      		andi r21,hi8(3)
+ 1272 0692 25E5      		ldi r18,lo8(85)
+ 1273 0694 30E0      		ldi r19,hi8(85)
+ 1274 0696 BA01      		movw r22,r20
+ 1275 0698 629F      		mul r22,r18
+ 1276 069a A001      		movw r20,r0
+ 1277 069c 639F      		mul r22,r19
+ 1278 069e 500D      		add r21,r0
+ 1279 06a0 729F      		mul r23,r18
+ 1280 06a2 500D      		add r21,r0
+ 1281 06a4 1124      		clr r1
+ 1282 06a6 9C01      		movw r18,r24
+ 1283 06a8 2C71      		andi r18,lo8(28)
+ 1284 06aa 3070      		andi r19,hi8(28)
+ 1285 06ac 3595      		asr r19
+ 1286 06ae 2795      		ror r18
+ 1287 06b0 3595      		asr r19
+ 1288 06b2 2795      		ror r18
+ 1289 06b4 E4E2      		ldi r30,lo8(36)
+ 1290 06b6 F0E0      		ldi r31,hi8(36)
+ 1291 06b8 2E9F      		mul r18,r30
+ 1292 06ba B001      		movw r22,r0
+ 1293 06bc 2F9F      		mul r18,r31
+ 1294 06be 700D      		add r23,r0
+ 1295 06c0 3E9F      		mul r19,r30
+ 1296 06c2 700D      		add r23,r0
+ 1297 06c4 1124      		clr r1
+ 1298 06c6 25E0      		ldi r18,5
+ 1299 06c8 9695      	1:	lsr r25
+ 1300 06ca 8795      		ror r24
+ 1301 06cc 2A95      		dec r18
+ 1302 06ce 01F4      		brne 1b
+ 1303 06d0 8E9F      		mul r24,r30
+ 1304 06d2 802D      		mov r24,r0
+ 1305 06d4 1124      		clr r1
+ 1306 06d6 0E94 0000 		call orb1_set
+ 1307               	/* epilogue: frame size=0 */
+ 1308 06da 0895      		ret
+ 1309               	/* epilogue end (size=1) */
+ 1310               	/* function orb1_set_color size 41 (40) */
+ 1311               	.LFE25:
+ 1313               	.global	orb2_set_color
+ 1315               	orb2_set_color:
+ 1316               	.LFB26:
+ 1317               	.LM128:
+ 1318               	/* prologue: frame size=0 */
+ 1319               	/* prologue end (size=0) */
+ 1320               	.LVL103:
+ 1321               	.LM129:
+ 1322 06dc 9927      		clr r25
+ 1323               	.LVL104:
+ 1324 06de AC01      		movw r20,r24
+ 1325 06e0 4370      		andi r20,lo8(3)
+ 1326 06e2 5070      		andi r21,hi8(3)
+ 1327 06e4 25E5      		ldi r18,lo8(85)
+ 1328 06e6 30E0      		ldi r19,hi8(85)
+ 1329 06e8 BA01      		movw r22,r20
+ 1330 06ea 629F      		mul r22,r18
+ 1331 06ec A001      		movw r20,r0
+ 1332 06ee 639F      		mul r22,r19
+ 1333 06f0 500D      		add r21,r0
+ 1334 06f2 729F      		mul r23,r18
+ 1335 06f4 500D      		add r21,r0
+ 1336 06f6 1124      		clr r1
+ 1337 06f8 9C01      		movw r18,r24
+ 1338 06fa 2C71      		andi r18,lo8(28)
+ 1339 06fc 3070      		andi r19,hi8(28)
+ 1340 06fe 3595      		asr r19
+ 1341 0700 2795      		ror r18
+ 1342 0702 3595      		asr r19
+ 1343 0704 2795      		ror r18
+ 1344 0706 E4E2      		ldi r30,lo8(36)
+ 1345 0708 F0E0      		ldi r31,hi8(36)
+ 1346 070a 2E9F      		mul r18,r30
+ 1347 070c B001      		movw r22,r0
+ 1348 070e 2F9F      		mul r18,r31
+ 1349 0710 700D      		add r23,r0
+ 1350 0712 3E9F      		mul r19,r30
+ 1351 0714 700D      		add r23,r0
+ 1352 0716 1124      		clr r1
+ 1353 0718 75E0      		ldi r23,5
+ 1354 071a 9695      	1:	lsr r25
+ 1355 071c 8795      		ror r24
+ 1356 071e 7A95      		dec r23
+ 1357 0720 01F4      		brne 1b
+ 1358 0722 8E9F      		mul r24,r30
+ 1359 0724 802D      		mov r24,r0
+ 1360 0726 1124      		clr r1
+ 1361 0728 0E94 0000 		call orb2_set
+ 1362               	/* epilogue: frame size=0 */
+ 1363 072c 0895      		ret
+ 1364               	/* epilogue end (size=1) */
+ 1365               	/* function orb2_set_color size 41 (40) */
+ 1366               	.LFE26:
+ 1368               	.global	orb_set_color
+ 1370               	orb_set_color:
+ 1371               	.LFB27:
+ 1372               	.LM130:
+ 1373               	/* prologue: frame size=0 */
+ 1374               	/* prologue end (size=0) */
+ 1375               	.LVL105:
+ 1376               	.LM131:
+ 1377 072e 9927      		clr r25
+ 1378               	.LVL106:
+ 1379 0730 AC01      		movw r20,r24
+ 1380 0732 4370      		andi r20,lo8(3)
+ 1381 0734 5070      		andi r21,hi8(3)
+ 1382 0736 25E5      		ldi r18,lo8(85)
+ 1383 0738 30E0      		ldi r19,hi8(85)
+ 1384 073a BA01      		movw r22,r20
+ 1385 073c 629F      		mul r22,r18
+ 1386 073e A001      		movw r20,r0
+ 1387 0740 639F      		mul r22,r19
+ 1388 0742 500D      		add r21,r0
+ 1389 0744 729F      		mul r23,r18
+ 1390 0746 500D      		add r21,r0
+ 1391 0748 1124      		clr r1
+ 1392 074a 9C01      		movw r18,r24
+ 1393 074c 2C71      		andi r18,lo8(28)
+ 1394 074e 3070      		andi r19,hi8(28)
+ 1395 0750 3595      		asr r19
+ 1396 0752 2795      		ror r18
+ 1397 0754 3595      		asr r19
+ 1398 0756 2795      		ror r18
+ 1399 0758 E4E2      		ldi r30,lo8(36)
+ 1400 075a F0E0      		ldi r31,hi8(36)
+ 1401 075c 2E9F      		mul r18,r30
+ 1402 075e B001      		movw r22,r0
+ 1403 0760 2F9F      		mul r18,r31
+ 1404 0762 700D      		add r23,r0
+ 1405 0764 3E9F      		mul r19,r30
+ 1406 0766 700D      		add r23,r0
+ 1407 0768 1124      		clr r1
+ 1408 076a F5E0      		ldi r31,5
+ 1409 076c 9695      	1:	lsr r25
+ 1410 076e 8795      		ror r24
+ 1411 0770 FA95      		dec r31
+ 1412 0772 01F4      		brne 1b
+ 1413 0774 8E9F      		mul r24,r30
+ 1414 0776 802D      		mov r24,r0
+ 1415 0778 1124      		clr r1
+ 1416 077a 0E94 0000 		call orb_set
+ 1417               	/* epilogue: frame size=0 */
+ 1418 077e 0895      		ret
+ 1419               	/* epilogue end (size=1) */
+ 1420               	/* function orb_set_color size 41 (40) */
+ 1421               	.LFE27:
+ 1423               	.global	orbs_set_color
+ 1425               	orbs_set_color:
+ 1426               	.LFB28:
+ 1427               	.LM132:
+ 1428               	/* prologue: frame size=0 */
+ 1429 0780 EF92      		push r14
+ 1430 0782 FF92      		push r15
+ 1431 0784 0F93      		push r16
+ 1432 0786 1F93      		push r17
+ 1433               	/* prologue end (size=4) */
+ 1434               	.LVL107:
+ 1435               	.LM133:
+ 1436 0788 7727      		clr r23
+ 1437               	.LVL108:
+ 1438 078a E82F      		mov r30,r24
+ 1439 078c FF27      		clr r31
+ 1440 078e CB01      		movw r24,r22
+ 1441               	.LVL109:
+ 1442 0790 8370      		andi r24,lo8(3)
+ 1443 0792 9070      		andi r25,hi8(3)
+ 1444 0794 A5E5      		ldi r26,lo8(85)
+ 1445 0796 B0E0      		ldi r27,hi8(85)
+ 1446 0798 8A9F      		mul r24,r26
+ 1447 079a 7001      		movw r14,r0
+ 1448 079c 8B9F      		mul r24,r27
+ 1449 079e F00C      		add r15,r0
+ 1450 07a0 9A9F      		mul r25,r26
+ 1451 07a2 F00C      		add r15,r0
+ 1452 07a4 1124      		clr r1
+ 1453 07a6 9B01      		movw r18,r22
+ 1454 07a8 2C71      		andi r18,lo8(28)
+ 1455 07aa 3070      		andi r19,hi8(28)
+ 1456 07ac 3595      		asr r19
+ 1457 07ae 2795      		ror r18
+ 1458 07b0 3595      		asr r19
+ 1459 07b2 2795      		ror r18
+ 1460 07b4 84E2      		ldi r24,lo8(36)
+ 1461 07b6 90E0      		ldi r25,hi8(36)
+ 1462 07b8 289F      		mul r18,r24
+ 1463 07ba 8001      		movw r16,r0
+ 1464 07bc 299F      		mul r18,r25
+ 1465 07be 100D      		add r17,r0
+ 1466 07c0 389F      		mul r19,r24
+ 1467 07c2 100D      		add r17,r0
+ 1468 07c4 1124      		clr r1
+ 1469 07c6 25E0      		ldi r18,5
+ 1470 07c8 7695      	1:	lsr r23
+ 1471 07ca 6795      		ror r22
+ 1472 07cc 2A95      		dec r18
+ 1473 07ce 01F4      		brne 1b
+ 1474 07d0 689F      		mul r22,r24
+ 1475 07d2 9001      		movw r18,r0
+ 1476 07d4 699F      		mul r22,r25
+ 1477 07d6 300D      		add r19,r0
+ 1478 07d8 789F      		mul r23,r24
+ 1479 07da 300D      		add r19,r0
+ 1480 07dc 1124      		clr r1
+ 1481 07de AF01      		movw r20,r30
+ 1482 07e0 4370      		andi r20,lo8(3)
+ 1483 07e2 5070      		andi r21,hi8(3)
+ 1484 07e4 BA01      		movw r22,r20
+ 1485 07e6 6A9F      		mul r22,r26
+ 1486 07e8 A001      		movw r20,r0
+ 1487 07ea 6B9F      		mul r22,r27
+ 1488 07ec 500D      		add r21,r0
+ 1489 07ee 7A9F      		mul r23,r26
+ 1490 07f0 500D      		add r21,r0
+ 1491 07f2 1124      		clr r1
+ 1492 07f4 BF01      		movw r22,r30
+ 1493 07f6 6C71      		andi r22,lo8(28)
+ 1494 07f8 7070      		andi r23,hi8(28)
+ 1495 07fa 7595      		asr r23
+ 1496 07fc 6795      		ror r22
+ 1497 07fe 7595      		asr r23
+ 1498 0800 6795      		ror r22
+ 1499 0802 DB01      		movw r26,r22
+ 1500 0804 A89F      		mul r26,r24
+ 1501 0806 B001      		movw r22,r0
+ 1502 0808 A99F      		mul r26,r25
+ 1503 080a 700D      		add r23,r0
+ 1504 080c B89F      		mul r27,r24
+ 1505 080e 700D      		add r23,r0
+ 1506 0810 1124      		clr r1
+ 1507 0812 B5E0      		ldi r27,5
+ 1508 0814 F695      	1:	lsr r31
+ 1509 0816 E795      		ror r30
+ 1510 0818 BA95      		dec r27
+ 1511 081a 01F4      		brne 1b
+ 1512 081c E89F      		mul r30,r24
+ 1513 081e 802D      		mov r24,r0
+ 1514 0820 1124      		clr r1
+ 1515 0822 0E94 0000 		call orbs_set
+ 1516               	/* epilogue: frame size=0 */
+ 1517 0826 1F91      		pop r17
+ 1518 0828 0F91      		pop r16
+ 1519 082a FF90      		pop r15
+ 1520 082c EF90      		pop r14
+ 1521 082e 0895      		ret
+ 1522               	/* epilogue end (size=5) */
+ 1523               	/* function orbs_set_color size 88 (79) */
+ 1524               	.LFE28:
+ 1526               	.global	orb_enable_timer
+ 1528               	orb_enable_timer:
+ 1529               	.LFB29:
+ 1530               	.LM134:
+ 1531               	/* prologue: frame size=0 */
+ 1532               	/* prologue end (size=0) */
+ 1533               	.LM135:
+ 1534 0830 86E0      		ldi r24,lo8(6)
+ 1535 0832 83BF      		out 83-0x20,r24
+ 1536               	.LM136:
+ 1537 0834 87B7      		in r24,87-0x20
+ 1538 0836 8360      		ori r24,lo8(3)
+ 1539 0838 87BF      		out 87-0x20,r24
+ 1540               	/* epilogue: frame size=0 */
+ 1541 083a 0895      		ret
+ 1542               	/* epilogue end (size=1) */
+ 1543               	/* function orb_enable_timer size 6 (5) */
+ 1544               	.LFE29:
+ 1546               	.global	orb_disable_timer
+ 1548               	orb_disable_timer:
+ 1549               	.LFB30:
+ 1550               	.LM137:
+ 1551               	/* prologue: frame size=0 */
+ 1552               	/* prologue end (size=0) */
+ 1553               	.LM138:
+ 1554 083c 87B7      		in r24,87-0x20
+ 1555 083e 8C7F      		andi r24,lo8(-4)
+ 1556 0840 87BF      		out 87-0x20,r24
+ 1557               	/* epilogue: frame size=0 */
+ 1558 0842 0895      		ret
+ 1559               	/* epilogue end (size=1) */
+ 1560               	/* function orb_disable_timer size 4 (3) */
+ 1561               	.LFE30:
+ 1563               	.global	orb_set_mode
+ 1565               	orb_set_mode:
+ 1566               	.LFB31:
+ 1567               	.LM139:
+ 1568               	/* prologue: frame size=0 */
+ 1569               	/* prologue end (size=0) */
+ 1570               	.LVL110:
+ 1571               	.LM140:
+ 1572 0844 8130      		cpi r24,lo8(1)
+ 1573 0846 01F4      		brne .L137
+ 1574               	.LBB133:
+ 1575               	.LBB134:
+ 1576               	.LM141:
+ 1577 0848 87B7      		in r24,87-0x20
+ 1578               	.LVL111:
+ 1579 084a 8C7F      		andi r24,lo8(-4)
+ 1580 084c 87BF      		out 87-0x20,r24
+ 1581               	.LBE134:
+ 1582               	.LBE133:
+ 1583               	.LM142:
+ 1584 084e 1092 0000 		sts enable_orb_pwm,__zero_reg__
+ 1585               	.LM143:
+ 1586 0852 0E94 0000 		call apply_orbs
+ 1587 0856 0895      		ret
+ 1588               	.LVL112:
+ 1589               	.L137:
+ 1590               	.LM144:
+ 1591 0858 81E0      		ldi r24,lo8(1)
+ 1592               	.LVL113:
+ 1593 085a 8093 0000 		sts enable_orb_pwm,r24
+ 1594               	.LM145:
+ 1595 085e 0E94 0000 		call apply_orbs
+ 1596               	.LBB135:
+ 1597               	.LBB136:
+ 1598               	.LM146:
+ 1599 0862 86E0      		ldi r24,lo8(6)
+ 1600 0864 83BF      		out 83-0x20,r24
+ 1601               	.LM147:
+ 1602 0866 87B7      		in r24,87-0x20
+ 1603 0868 8360      		ori r24,lo8(3)
+ 1604 086a 87BF      		out 87-0x20,r24
+ 1605 086c 0895      		ret
+ 1606               	.LBE136:
+ 1607               	.LBE135:
+ 1608               	/* epilogue: frame size=0 */
+ 1609               	/* epilogue: noreturn */
+ 1610               	/* epilogue end (size=0) */
+ 1611               	/* function orb_set_mode size 21 (21) */
+ 1612               	.LFE31:
+ 1615               	orb_init_common:
+ 1616               	.LFB32:
+ 1617               	.LM148:
+ 1618               	/* prologue: frame size=0 */
+ 1619               	/* prologue end (size=0) */
+ 1620               	.LM149:
+ 1621 086e 85B3      		in r24,53-0x20
+ 1622 0870 8767      		ori r24,lo8(119)
+ 1623 0872 85BB      		out 53-0x20,r24
+ 1624               	.LM150:
+ 1625 0874 84B3      		in r24,52-0x20
+ 1626 0876 8767      		ori r24,lo8(119)
+ 1627 0878 84BB      		out 52-0x20,r24
+ 1628               	.LM151:
+ 1629 087a 40E0      		ldi r20,lo8(0)
+ 1630 087c 60E0      		ldi r22,lo8(0)
+ 1631 087e 80E0      		ldi r24,lo8(0)
+ 1632 0880 0E94 0000 		call orb_set
+ 1633               	/* epilogue: frame size=0 */
+ 1634 0884 0895      		ret
+ 1635               	/* epilogue end (size=1) */
+ 1636               	/* function orb_init_common size 12 (11) */
+ 1637               	.LFE32:
+ 1639               	.global	orb_init_binary
+ 1641               	orb_init_binary:
+ 1642               	.LFB33:
+ 1643               	.LM152:
+ 1644               	/* prologue: frame size=0 */
+ 1645               	/* prologue end (size=0) */
+ 1646               	.LM153:
+ 1647 0886 0E94 0000 		call orb_init_common
+ 1648               	.LM154:
+ 1649 088a 81E0      		ldi r24,lo8(1)
+ 1650 088c 0E94 0000 		call orb_set_mode
+ 1651               	/* epilogue: frame size=0 */
+ 1652 0890 0895      		ret
+ 1653               	/* epilogue end (size=1) */
+ 1654               	/* function orb_init_binary size 6 (5) */
+ 1655               	.LFE33:
+ 1657               	.global	orb_init_pwm
+ 1659               	orb_init_pwm:
+ 1660               	.LFB34:
+ 1661               	.LM155:
+ 1662               	/* prologue: frame size=0 */
+ 1663               	/* prologue end (size=0) */
+ 1664               	.LM156:
+ 1665 0892 0E94 0000 		call orb_init_common
+ 1666               	.LM157:
+ 1667 0896 80E0      		ldi r24,lo8(0)
+ 1668 0898 0E94 0000 		call orb_set_mode
+ 1669               	/* epilogue: frame size=0 */
+ 1670 089c 0895      		ret
+ 1671               	/* epilogue end (size=1) */
+ 1672               	/* function orb_init_pwm size 6 (5) */
+ 1673               	.LFE34:
+ 1675               	.global	orb_init
+ 1677               	orb_init:
+ 1678               	.LFB35:
+ 1679               	.LM158:
+ 1680               	/* prologue: frame size=0 */
+ 1681               	/* prologue end (size=0) */
+ 1682               	.LM159:
+ 1683 089e 0E94 0000 		call orb_init_pwm
+ 1684               	/* epilogue: frame size=0 */
+ 1685 08a2 0895      		ret
+ 1686               	/* epilogue end (size=1) */
+ 1687               	/* function orb_init size 3 (2) */
+ 1688               	.LFE35:
+ 1690               	.global	orb_mask
+ 1691               		.data
+ 1694               	orb_mask:
+ 1695 0000 01        		.byte	1
+ 1696 0001 02        		.byte	2
+ 1697 0002 04        		.byte	4
+ 1698 0003 10        		.byte	16
+ 1699 0004 20        		.byte	32
+ 1700 0005 40        		.byte	64
+ 1701               	.global	enable_orb_pwm
+ 1704               	enable_orb_pwm:
+ 1705 0006 01        		.byte	1
+ 1706               	.global	pwm_read_buffer
+ 1709               	pwm_read_buffer:
+ 1710 0007 0000      		.word	pwm_buffer
+ 1711               	.global	pwm_write_buffer
+ 1714               	pwm_write_buffer:
+ 1715 0009 0000      		.word	pwm_buffer+13
+ 1716               	.global	pwm_free_buffer
+ 1719               	pwm_free_buffer:
+ 1720 000b 0000      		.word	pwm_buffer+26
+ 1721               	.global	pwm_page_flip
+ 1722               	.global	pwm_page_flip
+ 1723               		.section .bss
+ 1726               	pwm_page_flip:
+ 1727 0000 00        		.skip 1,0
+ 1728               	.global	current_pwm_channel
+ 1729               	.global	current_pwm_channel
+ 1732               	current_pwm_channel:
+ 1733 0001 00        		.skip 1,0
+ 1734               	.global	orb_lock
+ 1735               	.global	orb_lock
+ 1738               	orb_lock:
+ 1739 0002 00        		.skip 1,0
+ 1740               		.comm pwm_buffer,39,1
+ 1741               		.comm orb_values,6,1
+ 1926               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 lights.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:19     .text:00000000 output_compare
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1709   .data:00000007 pwm_read_buffer
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1732   .bss:00000001 current_pwm_channel
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:80     .text:00000054 __vector_16
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1726   .bss:00000000 pwm_page_flip
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1719   .data:0000000b pwm_free_buffer
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:166    .text:000000e6 __vector_15
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:213    .text:0000012e apply_orbs
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1704   .data:00000006 enable_orb_pwm
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1714   .data:00000009 pwm_write_buffer
+                            *COM*:00000006 orb_values
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:816    .text:000004de orb_n_set
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1738   .bss:00000002 orb_lock
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:895    .text:00000524 orb1_set
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:965    .text:0000055e orb2_set
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1035   .text:00000598 orb_set
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1115   .text:000005de orbs_set
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1198   .text:0000062c orb_n_set_color
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1260   .text:0000068a orb1_set_color
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1315   .text:000006dc orb2_set_color
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1370   .text:0000072e orb_set_color
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1425   .text:00000780 orbs_set_color
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1528   .text:00000830 orb_enable_timer
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1548   .text:0000083c orb_disable_timer
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1565   .text:00000844 orb_set_mode
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1615   .text:0000086e orb_init_common
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1641   .text:00000886 orb_init_binary
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1659   .text:00000892 orb_init_pwm
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1677   .text:0000089e orb_init
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccJkZ9Kz.s:1694   .data:00000000 orb_mask
+                            *COM*:00000027 pwm_buffer
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
Index: demos/hunter_prey_john/projects/libdragonfly/motor.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/motor.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/motor.lst	(revision 1694)
@@ -0,0 +1,210 @@
+   1               		.file	"motor.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	motors_init
+  20               	motors_init:
+  21               	.LFB2:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LM2:
+  26 0000 8BB3      		in r24,59-0x20
+  27 0002 8F70      		andi r24,lo8(15)
+  28 0004 8BBB      		out 59-0x20,r24
+  29               	.LM3:
+  30 0006 8AB3      		in r24,58-0x20
+  31 0008 806F      		ori r24,lo8(-16)
+  32 000a 8ABB      		out 58-0x20,r24
+  33               	.LM4:
+  34 000c 87B3      		in r24,55-0x20
+  35 000e 8066      		ori r24,lo8(96)
+  36 0010 87BB      		out 55-0x20,r24
+  37               	.LM5:
+  38 0012 81EA      		ldi r24,lo8(-95)
+  39 0014 8FBD      		out 79-0x20,r24
+  40               	.LM6:
+  41 0016 89E0      		ldi r24,lo8(9)
+  42 0018 8EBD      		out 78-0x20,r24
+  43               	.LM7:
+  44 001a 1BBC      		out 75-0x20,__zero_reg__
+  45               	.LM8:
+  46 001c 1ABC      		out 74-0x20,__zero_reg__
+  47               	.LM9:
+  48 001e 19BC      		out 73-0x20,__zero_reg__
+  49               	.LM10:
+  50 0020 18BC      		out 72-0x20,__zero_reg__
+  51               	/* epilogue: frame size=0 */
+  52 0022 0895      		ret
+  53               	/* epilogue end (size=1) */
+  54               	/* function motors_init size 18 (17) */
+  55               	.LFE2:
+  57               	.global	motor_l_set
+  59               	motor_l_set:
+  60               	.LFB3:
+  61               	.LM11:
+  62               	/* prologue: frame size=0 */
+  63               	/* prologue end (size=0) */
+  64               	.LVL0:
+  65               	.LM12:
+  66 0024 892B      		or r24,r25
+  67 0026 01F4      		brne .L4
+  68               	.LM13:
+  69 0028 8BB3      		in r24,59-0x20
+  70               	.LVL1:
+  71 002a 8073      		andi r24,lo8(48)
+  72 002c 8031      		cpi r24,lo8(16)
+  73 002e 01F0      		breq .L6
+  74               	.LM14:
+  75 0030 1BBC      		out (74)+1-0x20,__zero_reg__
+  76 0032 1ABC      		out 74-0x20,__zero_reg__
+  77               	.L6:
+  78               	.LM15:
+  79 0034 8BB3      		in r24,59-0x20
+  80 0036 8F7C      		andi r24,lo8(-49)
+  81 0038 8061      		ori r24,lo8(16)
+  82 003a 00C0      		rjmp .L12
+  83               	.LVL2:
+  84               	.L4:
+  85               	.LM16:
+  86 003c 8BB3      		in r24,59-0x20
+  87               	.LVL3:
+  88 003e 8073      		andi r24,lo8(48)
+  89 0040 8032      		cpi r24,lo8(32)
+  90 0042 01F0      		breq .L9
+  91               	.LM17:
+  92 0044 1BBC      		out (74)+1-0x20,__zero_reg__
+  93 0046 1ABC      		out 74-0x20,__zero_reg__
+  94               	.L9:
+  95               	.LM18:
+  96 0048 8BB3      		in r24,59-0x20
+  97 004a 8F7C      		andi r24,lo8(-49)
+  98 004c 8062      		ori r24,lo8(32)
+  99               	.L12:
+ 100 004e 8BBB      		out 59-0x20,r24
+ 101               	.LM19:
+ 102 0050 6ABD      		out 74-0x20,r22
+ 103               	/* epilogue: frame size=0 */
+ 104 0052 0895      		ret
+ 105               	/* epilogue end (size=1) */
+ 106               	/* function motor_l_set size 24 (23) */
+ 107               	.LFE3:
+ 109               	.global	motor_r_set
+ 111               	motor_r_set:
+ 112               	.LFB4:
+ 113               	.LM20:
+ 114               	/* prologue: frame size=0 */
+ 115               	/* prologue end (size=0) */
+ 116               	.LVL4:
+ 117               	.LM21:
+ 118 0054 892B      		or r24,r25
+ 119 0056 01F4      		brne .L14
+ 120               	.LM22:
+ 121 0058 8BB3      		in r24,59-0x20
+ 122               	.LVL5:
+ 123 005a 807C      		andi r24,lo8(-64)
+ 124 005c 8038      		cpi r24,lo8(-128)
+ 125 005e 01F0      		breq .L16
+ 126               	.LM23:
+ 127 0060 19BC      		out (72)+1-0x20,__zero_reg__
+ 128 0062 18BC      		out 72-0x20,__zero_reg__
+ 129               	.L16:
+ 130               	.LM24:
+ 131 0064 8BB3      		in r24,59-0x20
+ 132 0066 8F73      		andi r24,lo8(63)
+ 133 0068 8068      		ori r24,lo8(-128)
+ 134 006a 00C0      		rjmp .L22
+ 135               	.LVL6:
+ 136               	.L14:
+ 137               	.LM25:
+ 138 006c 8BB3      		in r24,59-0x20
+ 139               	.LVL7:
+ 140 006e 807C      		andi r24,lo8(-64)
+ 141 0070 8034      		cpi r24,lo8(64)
+ 142 0072 01F0      		breq .L19
+ 143               	.LM26:
+ 144 0074 19BC      		out (72)+1-0x20,__zero_reg__
+ 145 0076 18BC      		out 72-0x20,__zero_reg__
+ 146               	.L19:
+ 147               	.LM27:
+ 148 0078 8BB3      		in r24,59-0x20
+ 149 007a 8F73      		andi r24,lo8(63)
+ 150 007c 8064      		ori r24,lo8(64)
+ 151               	.L22:
+ 152 007e 8BBB      		out 59-0x20,r24
+ 153               	.LM28:
+ 154 0080 68BD      		out 72-0x20,r22
+ 155               	/* epilogue: frame size=0 */
+ 156 0082 0895      		ret
+ 157               	/* epilogue end (size=1) */
+ 158               	/* function motor_r_set size 24 (23) */
+ 159               	.LFE4:
+ 161               	.global	motor1_set
+ 163               	motor1_set:
+ 164               	.LFB5:
+ 165               	.LM29:
+ 166               	/* prologue: frame size=0 */
+ 167               	/* prologue end (size=0) */
+ 168               	.LVL8:
+ 169               	.LM30:
+ 170 0084 0E94 0000 		call motor_l_set
+ 171               	.LVL9:
+ 172               	/* epilogue: frame size=0 */
+ 173 0088 0895      		ret
+ 174               	/* epilogue end (size=1) */
+ 175               	/* function motor1_set size 3 (2) */
+ 176               	.LFE5:
+ 178               	.global	motor2_set
+ 180               	motor2_set:
+ 181               	.LFB6:
+ 182               	.LM31:
+ 183               	/* prologue: frame size=0 */
+ 184               	/* prologue end (size=0) */
+ 185               	.LVL10:
+ 186               	.LM32:
+ 187 008a 0E94 0000 		call motor_r_set
+ 188               	.LVL11:
+ 189               	/* epilogue: frame size=0 */
+ 190 008e 0895      		ret
+ 191               	/* epilogue end (size=1) */
+ 192               	/* function motor2_set size 3 (2) */
+ 193               	.LFE6:
+ 195               	.global	motors_off
+ 197               	motors_off:
+ 198               	.LFB7:
+ 199               	.LM33:
+ 200               	/* prologue: frame size=0 */
+ 201               	/* prologue end (size=0) */
+ 202               	.LM34:
+ 203 0090 1ABC      		out 74-0x20,__zero_reg__
+ 204               	.LM35:
+ 205 0092 18BC      		out 72-0x20,__zero_reg__
+ 206               	/* epilogue: frame size=0 */
+ 207 0094 0895      		ret
+ 208               	/* epilogue end (size=1) */
+ 209               	/* function motors_off size 3 (2) */
+ 210               	.LFE7:
+ 276               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 motor.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXl9b3V.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXl9b3V.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXl9b3V.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXl9b3V.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXl9b3V.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXl9b3V.s:20     .text:00000000 motors_init
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXl9b3V.s:59     .text:00000024 motor_l_set
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXl9b3V.s:111    .text:00000054 motor_r_set
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXl9b3V.s:163    .text:00000084 motor1_set
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXl9b3V.s:180    .text:0000008a motor2_set
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXl9b3V.s:197    .text:00000090 motors_off
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
Index: demos/hunter_prey_john/projects/libdragonfly/dragonfly_lib.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/dragonfly_lib.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/dragonfly_lib.lst	(revision 1694)
@@ -0,0 +1,222 @@
+   1               		.file	"dragonfly_lib.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	flash_red
+  20               	flash_red:
+  21               	.LFB13:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24 0000 FF92      		push r15
+  25 0002 0F93      		push r16
+  26 0004 1F93      		push r17
+  27               	/* prologue end (size=3) */
+  28               	.LM2:
+  29               	/* #APP */
+  30 0006 F894      		cli
+  31               	.LM3:
+  32               	/* #NOAPP */
+  33 0008 F4B2      		in r15,52-0x20
+  34               	.LVL0:
+  35               	.LM4:
+  36 000a 05B3      		in r16,53-0x20
+  37               	.LVL1:
+  38               	.LM5:
+  39 000c 87E7      		ldi r24,lo8(119)
+  40 000e 84BB      		out 52-0x20,r24
+  41 0010 10E0      		ldi r17,lo8(0)
+  42               	.LVL2:
+  43               	.L2:
+  44               	.LM6:
+  45 0012 87E7      		ldi r24,lo8(119)
+  46 0014 85BB      		out 53-0x20,r24
+  47               	.LM7:
+  48 0016 8CE2      		ldi r24,lo8(300)
+  49 0018 91E0      		ldi r25,hi8(300)
+  50 001a 0E94 0000 		call delay_ms
+  51               	.LM8:
+  52 001e 86E6      		ldi r24,lo8(102)
+  53 0020 85BB      		out 53-0x20,r24
+  54               	.LM9:
+  55 0022 8CE2      		ldi r24,lo8(300)
+  56 0024 91E0      		ldi r25,hi8(300)
+  57 0026 0E94 0000 		call delay_ms
+  58               	.LM10:
+  59 002a 1F5F      		subi r17,lo8(-(1))
+  60 002c 1330      		cpi r17,lo8(3)
+  61 002e 01F4      		brne .L2
+  62               	.LM11:
+  63 0030 F4BA      		out 52-0x20,r15
+  64               	.LM12:
+  65 0032 05BB      		out 53-0x20,r16
+  66               	.LM13:
+  67               	/* #APP */
+  68 0034 7894      		sei
+  69               	/* #NOAPP */
+  70               	/* epilogue: frame size=0 */
+  71 0036 1F91      		pop r17
+  72 0038 0F91      		pop r16
+  73 003a FF90      		pop r15
+  74 003c 0895      		ret
+  75               	/* epilogue end (size=4) */
+  76               	/* function flash_red size 33 (26) */
+  77               	.LFE13:
+  79               	.global	dragonfly_init
+  81               	dragonfly_init:
+  82               	.LFB12:
+  83               	.LM14:
+  84               	/* prologue: frame size=0 */
+  85 003e CF93      		push r28
+  86 0040 DF93      		push r29
+  87               	/* prologue end (size=2) */
+  88               	.LVL3:
+  89 0042 EC01      		movw r28,r24
+  90               	.LM15:
+  91               	/* #APP */
+  92 0044 7894      		sei
+  93               	.LM16:
+  94               	/* #NOAPP */
+  95 0046 8091 6400 		lds r24,100
+  96               	.LVL4:
+  97 004a 8C7F      		andi r24,lo8(-4)
+  98 004c 8093 6400 		sts 100,r24
+  99               	.LM17:
+ 100 0050 8091 6500 		lds r24,101
+ 101 0054 8360      		ori r24,lo8(3)
+ 102 0056 8093 6500 		sts 101,r24
+ 103               	.LM18:
+ 104 005a C0FF      		sbrs r28,0
+ 105 005c 00C0      		rjmp .L8
+ 106               	.LM19:
+ 107 005e 81E0      		ldi r24,lo8(1)
+ 108 0060 90E0      		ldi r25,hi8(1)
+ 109 0062 0E94 0000 		call analog_init
+ 110               	.L8:
+ 111               	.LM20:
+ 112 0066 C1FF      		sbrs r28,1
+ 113 0068 00C0      		rjmp .L10
+ 114               	.LM21:
+ 115 006a 0E94 0000 		call usb_init
+ 116               	.LM22:
+ 117 006e 0E94 0000 		call xbee_init
+ 118               	.L10:
+ 119               	.LM23:
+ 120 0072 C6FF      		sbrs r28,6
+ 121 0074 00C0      		rjmp .L12
+ 122               	.LM24:
+ 123               	/* #APP */
+ 124 0076 7894      		sei
+ 125               	.LM25:
+ 126               	/* #NOAPP */
+ 127 0078 0E94 0000 		call buzzer_init
+ 128               	.L12:
+ 129               	.LM26:
+ 130 007c C2FF      		sbrs r28,2
+ 131 007e 00C0      		rjmp .L14
+ 132               	.LM27:
+ 133               	/* #APP */
+ 134 0080 7894      		sei
+ 135               	.LM28:
+ 136               	/* #NOAPP */
+ 137 0082 0E94 0000 		call orb_init
+ 138               	.L14:
+ 139               	.LM29:
+ 140 0086 C3FF      		sbrs r28,3
+ 141 0088 00C0      		rjmp .L16
+ 142               	.LM30:
+ 143 008a 0E94 0000 		call motors_init
+ 144               	.L16:
+ 145               	.LM31:
+ 146 008e C7FF      		sbrs r28,7
+ 147 0090 00C0      		rjmp .L18
+ 148               	.LM32:
+ 149 0092 0E94 0000 		call lcd_init
+ 150               	.L18:
+ 151               	.LM33:
+ 152 0096 D0FF      		sbrs r29,0
+ 153 0098 00C0      		rjmp .L20
+ 154               	.LM34:
+ 155 009a 0E94 0000 		call range_init
+ 156               	.L20:
+ 157               	.LM35:
+ 158 009e D1FF      		sbrs r29,1
+ 159 00a0 00C0      		rjmp .L22
+ 160               	.LBB9:
+ 161               	.LM36:
+ 162 00a2 0E94 0000 		call get_bom_type
+ 163               	.LVL5:
+ 164               	.LM37:
+ 165 00a6 8F3F      		cpi r24,lo8(-1)
+ 166 00a8 01F4      		brne .L24
+ 167               	.LM38:
+ 168 00aa 0E94 0000 		call flash_red
+ 169               	.LVL6:
+ 170 00ae 00C0      		rjmp .L22
+ 171               	.LVL7:
+ 172               	.L24:
+ 173               	.LM39:
+ 174 00b0 0E94 0000 		call bom_init
+ 175               	.LVL8:
+ 176               	.L22:
+ 177               	.LBE9:
+ 178               	.LM40:
+ 179 00b4 D2FF      		sbrs r29,2
+ 180 00b6 00C0      		rjmp .L26
+ 181               	.LM41:
+ 182 00b8 0E94 0000 		call encoders_init
+ 183               	.L26:
+ 184               	.LBB10:
+ 185               	.LBB11:
+ 186               	.LBB12:
+ 187               	.LBB13:
+ 188               	.LM42:
+ 189 00bc 80EA      		ldi r24,lo8(4000)
+ 190 00be 9FE0      		ldi r25,hi8(4000)
+ 191               	.LVL9:
+ 192               	/* #APP */
+ 193 00c0 0197      		1: sbiw r24,1
+ 194 00c2 01F4      		brne 1b
+ 195               	/* #NOAPP */
+ 196               	.LBE13:
+ 197               	.LBE12:
+ 198               	.LBE11:
+ 199               	.LBE10:
+ 200               	/* epilogue: frame size=0 */
+ 201 00c4 DF91      		pop r29
+ 202 00c6 CF91      		pop r28
+ 203 00c8 0895      		ret
+ 204               	/* epilogue end (size=3) */
+ 205               	/* function dragonfly_init size 75 (70) */
+ 206               	.LFE12:
+ 240               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 dragonfly_lib.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXsoF8M.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXsoF8M.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXsoF8M.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXsoF8M.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXsoF8M.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXsoF8M.s:20     .text:00000000 flash_red
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccXsoF8M.s:81     .text:0000003e dragonfly_init
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+delay_ms
+analog_init
+usb_init
+xbee_init
+buzzer_init
+orb_init
+motors_init
+lcd_init
+range_init
+get_bom_type
+bom_init
+encoders_init
Index: demos/hunter_prey_john/projects/libdragonfly/i2c.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/i2c.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/i2c.lst	(revision 1694)
@@ -0,0 +1,595 @@
+   1               		.file	"i2c.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	i2c_init
+  20               	i2c_init:
+  21               	.LFB2:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LVL0:
+  26               	.LM2:
+  27 0000 7093 0000 		sts (master_recv_function)+1,r23
+  28 0004 6093 0000 		sts master_recv_function,r22
+  29               	.LM3:
+  30 0008 5093 0000 		sts (slave_recv_function)+1,r21
+  31 000c 4093 0000 		sts slave_recv_function,r20
+  32               	.LM4:
+  33 0010 3093 0000 		sts (slave_send_function)+1,r19
+  34 0014 2093 0000 		sts slave_send_function,r18
+  35               	.LM5:
+  36 0018 1092 0000 		sts i2c_write_buff+128,__zero_reg__
+  37 001c 1092 0000 		sts i2c_write_buff+129,__zero_reg__
+  38               	.LM6:
+  39 0020 1092 0000 		sts i2c_addr_buff+128,__zero_reg__
+  40 0024 1092 0000 		sts i2c_addr_buff+129,__zero_reg__
+  41               	.LM7:
+  42 0028 95E4      		ldi r25,lo8(69)
+  43 002a 9093 7400 		sts 116,r25
+  44               	.LM8:
+  45 002e 9CE0      		ldi r25,lo8(12)
+  46 0030 9093 7000 		sts 112,r25
+  47               	.LM9:
+  48 0034 880F      		lsl r24
+  49               	.LVL1:
+  50 0036 8160      		ori r24,lo8(1)
+  51 0038 8093 7200 		sts 114,r24
+  52               	.LM10:
+  53 003c 80E0      		ldi r24,lo8(0)
+  54 003e 90E0      		ldi r25,hi8(0)
+  55               	/* epilogue: frame size=0 */
+  56 0040 0895      		ret
+  57               	/* epilogue end (size=1) */
+  58               	/* function i2c_init size 33 (32) */
+  59               	.LFE2:
+  61               	.global	i2c_send
+  63               	i2c_send:
+  64               	.LFB3:
+  65               	.LM11:
+  66               	/* prologue: frame size=0 */
+  67 0042 6F92      		push r6
+  68 0044 7F92      		push r7
+  69 0046 8F92      		push r8
+  70 0048 9F92      		push r9
+  71 004a AF92      		push r10
+  72 004c BF92      		push r11
+  73 004e DF92      		push r13
+  74 0050 EF92      		push r14
+  75 0052 FF92      		push r15
+  76 0054 0F93      		push r16
+  77 0056 1F93      		push r17
+  78 0058 CF93      		push r28
+  79 005a DF93      		push r29
+  80               	/* prologue end (size=13) */
+  81               	.LVL2:
+  82 005c D82E      		mov r13,r24
+  83 005e 3A01      		movw r6,r20
+  84               	.LM12:
+  85               	/* #APP */
+  86 0060 F894      		cli
+  87               	/* #NOAPP */
+  88 0062 00E0      		ldi r16,lo8(0)
+  89 0064 10E0      		ldi r17,hi8(0)
+  90               	.LVL3:
+  91 0066 4091 0000 		lds r20,i2c_write_buff+130
+  92               	.LVL4:
+  93 006a 8091 0000 		lds r24,i2c_write_buff+128
+  94               	.LVL5:
+  95 006e 882E      		mov r8,r24
+  96 0070 9924      		clr r9
+  97 0072 DD0C      		lsl r13
+  98 0074 8091 0000 		lds r24,i2c_addr_buff+130
+  99 0078 A82E      		mov r10,r24
+ 100 007a BB24      		clr r11
+ 101 007c 7B01      		movw r14,r22
+ 102 007e 00C0      		rjmp .L4
+ 103               	.LVL6:
+ 104               	.L5:
+ 105               	.LM13:
+ 106 0080 8091 0000 		lds r24,i2c_write_buff+129
+ 107 0084 E82F      		mov r30,r24
+ 108 0086 FF27      		clr r31
+ 109 0088 9F01      		movw r18,r30
+ 110 008a 2F5F      		subi r18,lo8(-(1))
+ 111 008c 3F4F      		sbci r19,hi8(-(1))
+ 112 008e C42F      		mov r28,r20
+ 113 0090 DD27      		clr r29
+ 114 0092 C901      		movw r24,r18
+ 115 0094 BE01      		movw r22,r28
+ 116 0096 0E94 0000 		call __divmodhi4
+ 117 009a 8815      		cp r24,r8
+ 118 009c 9905      		cpc r25,r9
+ 119 009e 01F0      		breq .L13
+ 120               	.LM14:
+ 121 00a0 D701      		movw r26,r14
+ 122 00a2 8D91      		ld r24,X+
+ 123 00a4 7D01      		movw r14,r26
+ 124 00a6 E050      		subi r30,lo8(-(i2c_write_buff))
+ 125 00a8 F040      		sbci r31,hi8(-(i2c_write_buff))
+ 126 00aa 8083      		st Z,r24
+ 127 00ac C901      		movw r24,r18
+ 128 00ae BE01      		movw r22,r28
+ 129 00b0 0E94 0000 		call __divmodhi4
+ 130 00b4 8093 0000 		sts i2c_write_buff+129,r24
+ 131               	.LM15:
+ 132 00b8 8091 0000 		lds r24,i2c_addr_buff+129
+ 133 00bc 9927      		clr r25
+ 134 00be FC01      		movw r30,r24
+ 135 00c0 E050      		subi r30,lo8(-(i2c_addr_buff))
+ 136 00c2 F040      		sbci r31,hi8(-(i2c_addr_buff))
+ 137 00c4 D082      		st Z,r13
+ 138 00c6 0196      		adiw r24,1
+ 139 00c8 B501      		movw r22,r10
+ 140 00ca 0E94 0000 		call __divmodhi4
+ 141 00ce 8093 0000 		sts i2c_addr_buff+129,r24
+ 142               	.LM16:
+ 143 00d2 0F5F      		subi r16,lo8(-(1))
+ 144 00d4 1F4F      		sbci r17,hi8(-(1))
+ 145               	.LVL7:
+ 146               	.L4:
+ 147 00d6 0615      		cp r16,r6
+ 148 00d8 1705      		cpc r17,r7
+ 149 00da 01F4      		brne .L5
+ 150               	.LM17:
+ 151               	/* #APP */
+ 152 00dc 7894      		sei
+ 153               	.LM18:
+ 154               	/* #NOAPP */
+ 155 00de 8091 0000 		lds r24,start_flag
+ 156 00e2 9091 0000 		lds r25,(start_flag)+1
+ 157 00e6 892B      		or r24,r25
+ 158 00e8 01F0      		breq .L10
+ 159 00ea 00C0      		rjmp .L14
+ 160               	.LVL8:
+ 161               	.L13:
+ 162               	.LM19:
+ 163               	/* #APP */
+ 164 00ec 7894      		sei
+ 165               	/* #NOAPP */
+ 166 00ee 8FEF      		ldi r24,lo8(-1)
+ 167 00f0 9FEF      		ldi r25,hi8(-1)
+ 168 00f2 00C0      		rjmp .L8
+ 169               	.LVL9:
+ 170               	.L10:
+ 171               	.LM20:
+ 172 00f4 81E0      		ldi r24,lo8(1)
+ 173 00f6 90E0      		ldi r25,hi8(1)
+ 174 00f8 9093 0000 		sts (start_flag)+1,r25
+ 175 00fc 8093 0000 		sts start_flag,r24
+ 176               	.LM21:
+ 177 0100 8091 7400 		lds r24,116
+ 178 0104 8062      		ori r24,lo8(32)
+ 179 0106 8093 7400 		sts 116,r24
+ 180               	.LM22:
+ 181 010a 8091 7400 		lds r24,116
+ 182 010e 8068      		ori r24,lo8(-128)
+ 183 0110 8093 7400 		sts 116,r24
+ 184               	.L14:
+ 185 0114 80E0      		ldi r24,lo8(0)
+ 186 0116 90E0      		ldi r25,hi8(0)
+ 187               	.L8:
+ 188               	/* epilogue: frame size=0 */
+ 189 0118 DF91      		pop r29
+ 190 011a CF91      		pop r28
+ 191 011c 1F91      		pop r17
+ 192 011e 0F91      		pop r16
+ 193 0120 FF90      		pop r15
+ 194 0122 EF90      		pop r14
+ 195 0124 DF90      		pop r13
+ 196 0126 BF90      		pop r11
+ 197 0128 AF90      		pop r10
+ 198 012a 9F90      		pop r9
+ 199 012c 8F90      		pop r8
+ 200 012e 7F90      		pop r7
+ 201 0130 6F90      		pop r6
+ 202 0132 0895      		ret
+ 203               	/* epilogue end (size=14) */
+ 204               	/* function i2c_send size 124 (97) */
+ 205               	.LFE3:
+ 207               	.global	i2c_request
+ 209               	i2c_request:
+ 210               	.LFB4:
+ 211               	.LM23:
+ 212               	/* prologue: frame size=0 */
+ 213 0134 0F93      		push r16
+ 214 0136 1F93      		push r17
+ 215 0138 CF93      		push r28
+ 216 013a DF93      		push r29
+ 217               	/* prologue end (size=4) */
+ 218               	.LVL10:
+ 219 013c 482F      		mov r20,r24
+ 220               	.LM24:
+ 221 013e 8091 0000 		lds r24,i2c_write_buff+129
+ 222               	.LVL11:
+ 223 0142 E82F      		mov r30,r24
+ 224 0144 FF27      		clr r31
+ 225 0146 8F01      		movw r16,r30
+ 226 0148 0F5F      		subi r16,lo8(-(1))
+ 227 014a 1F4F      		sbci r17,hi8(-(1))
+ 228 014c 8091 0000 		lds r24,i2c_write_buff+130
+ 229 0150 C82F      		mov r28,r24
+ 230 0152 DD27      		clr r29
+ 231 0154 C801      		movw r24,r16
+ 232 0156 BE01      		movw r22,r28
+ 233 0158 0E94 0000 		call __divmodhi4
+ 234 015c 2091 0000 		lds r18,i2c_write_buff+128
+ 235 0160 3327      		clr r19
+ 236 0162 8217      		cp r24,r18
+ 237 0164 9307      		cpc r25,r19
+ 238 0166 01F4      		brne .L16
+ 239               	.LM25:
+ 240 0168 8FEF      		ldi r24,lo8(-1)
+ 241 016a 9FEF      		ldi r25,hi8(-1)
+ 242 016c 00C0      		rjmp .L18
+ 243               	.L16:
+ 244               	.LM26:
+ 245 016e E050      		subi r30,lo8(-(i2c_write_buff))
+ 246 0170 F040      		sbci r31,hi8(-(i2c_write_buff))
+ 247 0172 1082      		st Z,__zero_reg__
+ 248 0174 C801      		movw r24,r16
+ 249 0176 BE01      		movw r22,r28
+ 250 0178 0E94 0000 		call __divmodhi4
+ 251 017c 8093 0000 		sts i2c_write_buff+129,r24
+ 252               	.LM27:
+ 253 0180 8091 0000 		lds r24,i2c_addr_buff+129
+ 254 0184 9927      		clr r25
+ 255 0186 FC01      		movw r30,r24
+ 256 0188 E050      		subi r30,lo8(-(i2c_addr_buff))
+ 257 018a F040      		sbci r31,hi8(-(i2c_addr_buff))
+ 258 018c 440F      		lsl r20
+ 259 018e 4160      		ori r20,lo8(1)
+ 260 0190 4083      		st Z,r20
+ 261 0192 6091 0000 		lds r22,i2c_addr_buff+130
+ 262 0196 7727      		clr r23
+ 263 0198 0196      		adiw r24,1
+ 264 019a 0E94 0000 		call __divmodhi4
+ 265 019e 8093 0000 		sts i2c_addr_buff+129,r24
+ 266               	.LM28:
+ 267 01a2 8091 0000 		lds r24,start_flag
+ 268 01a6 9091 0000 		lds r25,(start_flag)+1
+ 269 01aa 892B      		or r24,r25
+ 270 01ac 01F4      		brne .L22
+ 271               	.LM29:
+ 272 01ae 81E0      		ldi r24,lo8(1)
+ 273 01b0 90E0      		ldi r25,hi8(1)
+ 274 01b2 9093 0000 		sts (start_flag)+1,r25
+ 275 01b6 8093 0000 		sts start_flag,r24
+ 276               	.LM30:
+ 277 01ba 8091 7400 		lds r24,116
+ 278 01be 8062      		ori r24,lo8(32)
+ 279 01c0 8093 7400 		sts 116,r24
+ 280               	.LM31:
+ 281 01c4 8091 7400 		lds r24,116
+ 282 01c8 8068      		ori r24,lo8(-128)
+ 283 01ca 8093 7400 		sts 116,r24
+ 284               	.L22:
+ 285 01ce 80E0      		ldi r24,lo8(0)
+ 286 01d0 90E0      		ldi r25,hi8(0)
+ 287               	.L18:
+ 288               	/* epilogue: frame size=0 */
+ 289 01d2 DF91      		pop r29
+ 290 01d4 CF91      		pop r28
+ 291 01d6 1F91      		pop r17
+ 292 01d8 0F91      		pop r16
+ 293 01da 0895      		ret
+ 294               	/* epilogue end (size=5) */
+ 295               	/* function i2c_request size 84 (75) */
+ 296               	.LFE4:
+ 298               	.global	__vector_33
+ 300               	__vector_33:
+ 301               	.LFB5:
+ 302               	.LM32:
+ 303               	/* prologue: frame size=0 */
+ 304 01dc 1F92      		push __zero_reg__
+ 305 01de 0F92      		push __tmp_reg__
+ 306 01e0 0FB6      		in __tmp_reg__,__SREG__
+ 307 01e2 0F92      		push __tmp_reg__
+ 308 01e4 1124      		clr __zero_reg__
+ 309 01e6 2F93      		push r18
+ 310 01e8 3F93      		push r19
+ 311 01ea 4F93      		push r20
+ 312 01ec 5F93      		push r21
+ 313 01ee 6F93      		push r22
+ 314 01f0 7F93      		push r23
+ 315 01f2 8F93      		push r24
+ 316 01f4 9F93      		push r25
+ 317 01f6 AF93      		push r26
+ 318 01f8 BF93      		push r27
+ 319 01fa EF93      		push r30
+ 320 01fc FF93      		push r31
+ 321               	/* prologue end (size=17) */
+ 322               	.LM33:
+ 323 01fe 8091 7100 		lds r24,113
+ 324               	.LM34:
+ 325 0202 887F      		andi r24,lo8(-8)
+ 326 0204 8035      		cpi r24,lo8(80)
+ 327 0206 01F4      		brne .+2
+ 328 0208 00C0      		rjmp .L30
+ 329               	.LM35:
+ 330 020a 8135      		cpi r24,lo8(81)
+ 331 020c 00F4      		brsh .L35
+ 332 020e 8831      		cpi r24,lo8(24)
+ 333 0210 01F4      		brne .+2
+ 334 0212 00C0      		rjmp .L26
+ 335 0214 8931      		cpi r24,lo8(25)
+ 336 0216 00F4      		brsh .L36
+ 337 0218 8830      		cpi r24,lo8(8)
+ 338 021a 01F0      		breq .L25
+ 339 021c 8031      		cpi r24,lo8(16)
+ 340 021e 01F0      		breq .+2
+ 341 0220 00C0      		rjmp .L24
+ 342 0222 00C0      		rjmp .L25
+ 343               	.L36:
+ 344 0224 8033      		cpi r24,lo8(48)
+ 345 0226 01F4      		brne .+2
+ 346 0228 00C0      		rjmp .L28
+ 347 022a 8034      		cpi r24,lo8(64)
+ 348 022c 01F4      		brne .+2
+ 349 022e 00C0      		rjmp .L29
+ 350 0230 8832      		cpi r24,lo8(40)
+ 351 0232 01F0      		breq .+2
+ 352 0234 00C0      		rjmp .L24
+ 353 0236 00C0      		rjmp .L27
+ 354               	.L35:
+ 355 0238 803A      		cpi r24,lo8(-96)
+ 356 023a 01F4      		brne .+2
+ 357 023c 00C0      		rjmp .L32
+ 358 023e 813A      		cpi r24,lo8(-95)
+ 359 0240 00F4      		brsh .L37
+ 360 0242 8036      		cpi r24,lo8(96)
+ 361 0244 01F4      		brne .+2
+ 362 0246 00C0      		rjmp .L32
+ 363 0248 8038      		cpi r24,lo8(-128)
+ 364 024a 01F4      		brne .+2
+ 365 024c 00C0      		rjmp .L33
+ 366 024e 8835      		cpi r24,lo8(88)
+ 367 0250 01F0      		breq .+2
+ 368 0252 00C0      		rjmp .L24
+ 369 0254 00C0      		rjmp .L31
+ 370               	.L37:
+ 371 0256 883B      		cpi r24,lo8(-72)
+ 372 0258 01F4      		brne .+2
+ 373 025a 00C0      		rjmp .L34
+ 374 025c 803C      		cpi r24,lo8(-64)
+ 375 025e 01F4      		brne .+2
+ 376 0260 00C0      		rjmp .L32
+ 377 0262 883A      		cpi r24,lo8(-88)
+ 378 0264 01F0      		breq .+2
+ 379 0266 00C0      		rjmp .L24
+ 380 0268 00C0      		rjmp .L32
+ 381               	.L25:
+ 382               	.LM36:
+ 383 026a 8091 0000 		lds r24,i2c_addr_buff+128
+ 384 026e 9927      		clr r25
+ 385 0270 FC01      		movw r30,r24
+ 386 0272 E050      		subi r30,lo8(-(i2c_addr_buff))
+ 387 0274 F040      		sbci r31,hi8(-(i2c_addr_buff))
+ 388 0276 3081      		ld r19,Z
+ 389 0278 3093 0000 		sts addr_to_send.1407,r19
+ 390 027c 6091 0000 		lds r22,i2c_addr_buff+130
+ 391 0280 7727      		clr r23
+ 392 0282 0196      		adiw r24,1
+ 393 0284 0E94 0000 		call __divmodhi4
+ 394 0288 8093 0000 		sts i2c_addr_buff+128,r24
+ 395               	.LM37:
+ 396 028c 8091 0000 		lds r24,i2c_write_buff+128
+ 397 0290 9927      		clr r25
+ 398 0292 FC01      		movw r30,r24
+ 399 0294 E050      		subi r30,lo8(-(i2c_write_buff))
+ 400 0296 F040      		sbci r31,hi8(-(i2c_write_buff))
+ 401 0298 2081      		ld r18,Z
+ 402 029a 2093 0000 		sts data_to_send.1406,r18
+ 403 029e 6091 0000 		lds r22,i2c_write_buff+130
+ 404 02a2 7727      		clr r23
+ 405 02a4 0196      		adiw r24,1
+ 406 02a6 0E94 0000 		call __divmodhi4
+ 407 02aa 8093 0000 		sts i2c_write_buff+128,r24
+ 408               	.LM38:
+ 409 02ae 3093 7300 		sts 115,r19
+ 410               	.LM39:
+ 411 02b2 8091 7400 		lds r24,116
+ 412 02b6 8F7D      		andi r24,lo8(-33)
+ 413 02b8 00C0      		rjmp .L49
+ 414               	.L26:
+ 415               	.LM40:
+ 416 02ba 8091 0000 		lds r24,data_to_send.1406
+ 417 02be 8093 7300 		sts 115,r24
+ 418               	.LM41:
+ 419 02c2 8091 6500 		lds r24,101
+ 420 02c6 8B7F      		andi r24,lo8(-5)
+ 421 02c8 00C0      		rjmp .L50
+ 422               	.L27:
+ 423               	.LM42:
+ 424 02ca 4091 0000 		lds r20,i2c_write_buff+128
+ 425 02ce 8091 0000 		lds r24,i2c_write_buff+129
+ 426 02d2 4817      		cp r20,r24
+ 427 02d4 01F0      		breq .L51
+ 428               	.LM43:
+ 429 02d6 8091 0000 		lds r24,i2c_addr_buff+128
+ 430 02da 282F      		mov r18,r24
+ 431 02dc 3327      		clr r19
+ 432               	.LM44:
+ 433 02de F901      		movw r30,r18
+ 434 02e0 E050      		subi r30,lo8(-(i2c_addr_buff))
+ 435 02e2 F040      		sbci r31,hi8(-(i2c_addr_buff))
+ 436 02e4 9081      		ld r25,Z
+ 437 02e6 8091 0000 		lds r24,addr_to_send.1407
+ 438 02ea 9817      		cp r25,r24
+ 439 02ec 01F4      		brne .L40
+ 440               	.LM45:
+ 441 02ee 6091 0000 		lds r22,i2c_addr_buff+130
+ 442 02f2 7727      		clr r23
+ 443 02f4 C901      		movw r24,r18
+ 444 02f6 0196      		adiw r24,1
+ 445 02f8 0E94 0000 		call __divmodhi4
+ 446 02fc 8093 0000 		sts i2c_addr_buff+128,r24
+ 447               	.LM46:
+ 448 0300 842F      		mov r24,r20
+ 449 0302 9927      		clr r25
+ 450 0304 FC01      		movw r30,r24
+ 451 0306 E050      		subi r30,lo8(-(i2c_write_buff))
+ 452 0308 F040      		sbci r31,hi8(-(i2c_write_buff))
+ 453 030a 2081      		ld r18,Z
+ 454 030c 2093 7300 		sts 115,r18
+ 455 0310 6091 0000 		lds r22,i2c_write_buff+130
+ 456 0314 7727      		clr r23
+ 457 0316 0196      		adiw r24,1
+ 458 0318 0E94 0000 		call __divmodhi4
+ 459 031c 8093 0000 		sts i2c_write_buff+128,r24
+ 460 0320 00C0      		rjmp .L32
+ 461               	.L40:
+ 462               	.LM47:
+ 463 0322 8091 7400 		lds r24,116
+ 464 0326 8062      		ori r24,lo8(32)
+ 465               	.L49:
+ 466 0328 8093 7400 		sts 116,r24
+ 467 032c 00C0      		rjmp .L32
+ 468               	.L28:
+ 469               	.LM48:
+ 470 032e 8091 6500 		lds r24,101
+ 471 0332 8460      		ori r24,lo8(4)
+ 472 0334 8093 6500 		sts 101,r24
+ 473               	.L51:
+ 474               	.LM49:
+ 475 0338 8091 7400 		lds r24,116
+ 476 033c 8061      		ori r24,lo8(16)
+ 477 033e 8093 7400 		sts 116,r24
+ 478               	.LM50:
+ 479 0342 1092 0000 		sts (start_flag)+1,__zero_reg__
+ 480 0346 1092 0000 		sts start_flag,__zero_reg__
+ 481 034a 00C0      		rjmp .L32
+ 482               	.L29:
+ 483               	.LM51:
+ 484 034c 8091 6500 		lds r24,101
+ 485 0350 8460      		ori r24,lo8(4)
+ 486               	.L50:
+ 487 0352 8093 6500 		sts 101,r24
+ 488 0356 00C0      		rjmp .L32
+ 489               	.L30:
+ 490               	.LM52:
+ 491 0358 E091 0000 		lds r30,master_recv_function
+ 492 035c F091 0000 		lds r31,(master_recv_function)+1
+ 493 0360 3097      		sbiw r30,0
+ 494 0362 01F0      		breq .L32
+ 495               	.LM53:
+ 496 0364 8091 7300 		lds r24,115
+ 497 0368 0995      		icall
+ 498 036a 892B      		or r24,r25
+ 499 036c 01F4      		brne .L32
+ 500               	.LM54:
+ 501 036e 8091 7400 		lds r24,116
+ 502 0372 8F7B      		andi r24,lo8(-65)
+ 503 0374 00C0      		rjmp .L49
+ 504               	.L31:
+ 505               	.LM55:
+ 506 0376 8091 7400 		lds r24,116
+ 507 037a 8064      		ori r24,lo8(64)
+ 508 037c 8093 7400 		sts 116,r24
+ 509               	.LM56:
+ 510 0380 9091 0000 		lds r25,i2c_write_buff+128
+ 511 0384 8091 0000 		lds r24,i2c_write_buff+129
+ 512 0388 9817      		cp r25,r24
+ 513 038a 01F4      		brne .L40
+ 514 038c 00C0      		rjmp .L51
+ 515               	.L34:
+ 516               	.LM57:
+ 517 038e E091 0000 		lds r30,slave_send_function
+ 518 0392 F091 0000 		lds r31,(slave_send_function)+1
+ 519 0396 3097      		sbiw r30,0
+ 520 0398 01F0      		breq .L32
+ 521               	.LM58:
+ 522 039a 0995      		icall
+ 523 039c 8093 7300 		sts 115,r24
+ 524 03a0 00C0      		rjmp .L32
+ 525               	.L33:
+ 526               	.LM59:
+ 527 03a2 E091 0000 		lds r30,slave_recv_function
+ 528 03a6 F091 0000 		lds r31,(slave_recv_function)+1
+ 529 03aa 3097      		sbiw r30,0
+ 530 03ac 01F0      		breq .L32
+ 531               	.LM60:
+ 532 03ae 8091 7300 		lds r24,115
+ 533 03b2 0995      		icall
+ 534 03b4 00C0      		rjmp .L32
+ 535               	.L24:
+ 536               	.LM61:
+ 537 03b6 8091 7400 		lds r24,116
+ 538 03ba 8061      		ori r24,lo8(16)
+ 539 03bc 8093 7400 		sts 116,r24
+ 540               	.LM62:
+ 541 03c0 1092 0000 		sts (start_flag)+1,__zero_reg__
+ 542 03c4 1092 0000 		sts start_flag,__zero_reg__
+ 543               	.LM63:
+ 544 03c8 1092 0000 		sts i2c_write_buff+128,__zero_reg__
+ 545 03cc 1092 0000 		sts i2c_write_buff+129,__zero_reg__
+ 546               	.LM64:
+ 547 03d0 1092 0000 		sts i2c_addr_buff+128,__zero_reg__
+ 548 03d4 1092 0000 		sts i2c_addr_buff+129,__zero_reg__
+ 549               	.L32:
+ 550               	.LM65:
+ 551 03d8 8091 7400 		lds r24,116
+ 552 03dc 8068      		ori r24,lo8(-128)
+ 553 03de 8093 7400 		sts 116,r24
+ 554               	/* epilogue: frame size=0 */
+ 555 03e2 FF91      		pop r31
+ 556 03e4 EF91      		pop r30
+ 557 03e6 BF91      		pop r27
+ 558 03e8 AF91      		pop r26
+ 559 03ea 9F91      		pop r25
+ 560 03ec 8F91      		pop r24
+ 561 03ee 7F91      		pop r23
+ 562 03f0 6F91      		pop r22
+ 563 03f2 5F91      		pop r21
+ 564 03f4 4F91      		pop r20
+ 565 03f6 3F91      		pop r19
+ 566 03f8 2F91      		pop r18
+ 567 03fa 0F90      		pop __tmp_reg__
+ 568 03fc 0FBE      		out __SREG__,__tmp_reg__
+ 569 03fe 0F90      		pop __tmp_reg__
+ 570 0400 1F90      		pop __zero_reg__
+ 571 0402 1895      		reti
+ 572               	/* epilogue end (size=17) */
+ 573               	/* function __vector_33 size 276 (242) */
+ 574               	.LFE5:
+ 576               		.data
+ 579               	addr_to_send.1407:
+ 580 0000 FF        		.byte	-1
+ 581               		.lcomm data_to_send.1406,1
+ 582               		.lcomm start_flag,2
+ 583               		.lcomm master_recv_function,2
+ 584               		.lcomm slave_recv_function,2
+ 585               		.lcomm slave_send_function,2
+ 586               		.comm i2c_write_buff,131,1
+ 587               		.comm i2c_addr_buff,131,1
+ 636               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 i2c.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:20     .text:00000000 i2c_init
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:582    .bss:00000003 master_recv_function
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:583    .bss:00000005 slave_recv_function
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:584    .bss:00000007 slave_send_function
+                            *COM*:00000083 i2c_write_buff
+                            *COM*:00000083 i2c_addr_buff
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:63     .text:00000042 i2c_send
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:581    .bss:00000001 start_flag
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:209    .text:00000134 i2c_request
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:300    .text:000001dc __vector_33
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cci1LvUT.s:579    .data:00000000 addr_to_send.1407
+                             .bss:00000000 data_to_send.1406
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+__divmodhi4
Index: demos/hunter_prey_john/projects/libdragonfly/serial.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/serial.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/serial.lst	(revision 1694)
@@ -0,0 +1,773 @@
+   1               		.file	"serial.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	usb_init
+  20               	usb_init:
+  21               	.LFB3:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LM2:
+  26 0000 1092 9000 		sts 144,__zero_reg__
+  27               	.LM3:
+  28 0004 88E0      		ldi r24,lo8(8)
+  29 0006 89B9      		out 41-0x20,r24
+  30               	.LM4:
+  31 0008 599A      		sbi 43-0x20,1
+  32               	.LM5:
+  33 000a 8AB1      		in r24,42-0x20
+  34 000c 8861      		ori r24,lo8(24)
+  35 000e 8AB9      		out 42-0x20,r24
+  36               	.LM6:
+  37 0010 E5E9      		ldi r30,lo8(149)
+  38 0012 F0E0      		ldi r31,hi8(149)
+  39 0014 8081      		ld r24,Z
+  40 0016 8660      		ori r24,lo8(6)
+  41 0018 8083      		st Z,r24
+  42               	/* epilogue: frame size=0 */
+  43 001a 0895      		ret
+  44               	/* epilogue end (size=1) */
+  45               	/* function usb_init size 14 (13) */
+  46               	.LFE3:
+  48               	.global	xbee_init
+  50               	xbee_init:
+  51               	.LFB4:
+  52               	.LM7:
+  53               	/* prologue: frame size=0 */
+  54               	/* prologue end (size=0) */
+  55               	.LM8:
+  56 001c 1092 9800 		sts 152,__zero_reg__
+  57               	.LM9:
+  58 0020 87E6      		ldi r24,lo8(103)
+  59 0022 8093 9900 		sts 153,r24
+  60               	.LM10:
+  61 0026 EBE9      		ldi r30,lo8(155)
+  62 0028 F0E0      		ldi r31,hi8(155)
+  63 002a 8081      		ld r24,Z
+  64 002c 8260      		ori r24,lo8(2)
+  65 002e 8083      		st Z,r24
+  66               	.LM11:
+  67 0030 EAE9      		ldi r30,lo8(154)
+  68 0032 F0E0      		ldi r31,hi8(154)
+  69 0034 8081      		ld r24,Z
+  70 0036 8861      		ori r24,lo8(24)
+  71 0038 8083      		st Z,r24
+  72               	.LM12:
+  73 003a EDE9      		ldi r30,lo8(157)
+  74 003c F0E0      		ldi r31,hi8(157)
+  75 003e 8081      		ld r24,Z
+  76 0040 8660      		ori r24,lo8(6)
+  77 0042 8083      		st Z,r24
+  78               	/* epilogue: frame size=0 */
+  79 0044 0895      		ret
+  80               	/* epilogue end (size=1) */
+  81               	/* function xbee_init size 21 (20) */
+  82               	.LFE4:
+  84               	.global	usb_putc
+  86               	usb_putc:
+  87               	.LFB5:
+  88               	.LM13:
+  89               	/* prologue: frame size=0 */
+  90               	/* prologue end (size=0) */
+  91               	.LVL0:
+  92               	.L7:
+  93               	.LM14:
+  94 0046 5D9B      		sbis 43-0x20,5
+  95 0048 00C0      		rjmp .L7
+  96               	.LM15:
+  97 004a 8CB9      		out 44-0x20,r24
+  98               	.LM16:
+  99 004c 80E0      		ldi r24,lo8(0)
+ 100 004e 90E0      		ldi r25,hi8(0)
+ 101               	.LVL1:
+ 102               	/* epilogue: frame size=0 */
+ 103 0050 0895      		ret
+ 104               	/* epilogue end (size=1) */
+ 105               	/* function usb_putc size 6 (5) */
+ 106               	.LFE5:
+ 108               	.global	xbee_putc
+ 110               	xbee_putc:
+ 111               	.LFB6:
+ 112               	.LM17:
+ 113               	/* prologue: frame size=0 */
+ 114               	/* prologue end (size=0) */
+ 115               	.LVL2:
+ 116 0052 982F      		mov r25,r24
+ 117               	.LVL3:
+ 118               	.L14:
+ 119               	.LM18:
+ 120 0054 8091 9B00 		lds r24,155
+ 121 0058 85FF      		sbrs r24,5
+ 122 005a 00C0      		rjmp .L14
+ 123               	.LM19:
+ 124 005c 9093 9C00 		sts 156,r25
+ 125               	.LM20:
+ 126 0060 80E0      		ldi r24,lo8(0)
+ 127 0062 90E0      		ldi r25,hi8(0)
+ 128               	/* epilogue: frame size=0 */
+ 129 0064 0895      		ret
+ 130               	/* epilogue end (size=1) */
+ 131               	/* function xbee_putc size 10 (9) */
+ 132               	.LFE6:
+ 134               	.global	usb_getc
+ 136               	usb_getc:
+ 137               	.LFB9:
+ 138               	.LM21:
+ 139               	/* prologue: frame size=0 */
+ 140               	/* prologue end (size=0) */
+ 141               	.L21:
+ 142               	.LM22:
+ 143 0066 5F9B      		sbis 43-0x20,7
+ 144 0068 00C0      		rjmp .L21
+ 145               	.LM23:
+ 146 006a 8CB1      		in r24,44-0x20
+ 147               	.LM24:
+ 148 006c 9927      		clr r25
+ 149               	/* epilogue: frame size=0 */
+ 150 006e 0895      		ret
+ 151               	/* epilogue end (size=1) */
+ 152               	/* function usb_getc size 5 (4) */
+ 153               	.LFE9:
+ 155               	.global	xbee_getc
+ 157               	xbee_getc:
+ 158               	.LFB10:
+ 159               	.LM25:
+ 160               	/* prologue: frame size=0 */
+ 161               	/* prologue end (size=0) */
+ 162               	.L28:
+ 163               	.LM26:
+ 164 0070 8091 9B00 		lds r24,155
+ 165 0074 87FF      		sbrs r24,7
+ 166 0076 00C0      		rjmp .L28
+ 167               	.LM27:
+ 168 0078 8091 9C00 		lds r24,156
+ 169               	.LM28:
+ 170 007c 9927      		clr r25
+ 171               	/* epilogue: frame size=0 */
+ 172 007e 0895      		ret
+ 173               	/* epilogue end (size=1) */
+ 174               	/* function xbee_getc size 8 (7) */
+ 175               	.LFE10:
+ 177               	.global	usb_getc_nb
+ 179               	usb_getc_nb:
+ 180               	.LFB11:
+ 181               	.LM29:
+ 182               	/* prologue: frame size=0 */
+ 183               	/* prologue end (size=0) */
+ 184               	.LVL4:
+ 185 0080 FC01      		movw r30,r24
+ 186               	.LM30:
+ 187 0082 5F99      		sbic 43-0x20,7
+ 188 0084 00C0      		rjmp .L34
+ 189               	.LVL5:
+ 190               	.LM31:
+ 191 0086 8FEF      		ldi r24,lo8(-1)
+ 192 0088 9FEF      		ldi r25,hi8(-1)
+ 193 008a 0895      		ret
+ 194               	.LVL6:
+ 195               	.L34:
+ 196               	.LM32:
+ 197 008c 8CB1      		in r24,44-0x20
+ 198 008e 8083      		st Z,r24
+ 199 0090 80E0      		ldi r24,lo8(0)
+ 200 0092 90E0      		ldi r25,hi8(0)
+ 201               	.LM33:
+ 202 0094 0895      		ret
+ 203               	/* epilogue: frame size=0 */
+ 204               	/* epilogue: noreturn */
+ 205               	/* epilogue end (size=0) */
+ 206               	/* function usb_getc_nb size 11 (11) */
+ 207               	.LFE11:
+ 209               	.global	xbee_getc_nb
+ 211               	xbee_getc_nb:
+ 212               	.LFB12:
+ 213               	.LM34:
+ 214               	/* prologue: frame size=0 */
+ 215               	/* prologue end (size=0) */
+ 216               	.LVL7:
+ 217 0096 FC01      		movw r30,r24
+ 218               	.LM35:
+ 219 0098 8091 9B00 		lds r24,155
+ 220               	.LVL8:
+ 221 009c 87FD      		sbrc r24,7
+ 222 009e 00C0      		rjmp .L39
+ 223               	.LM36:
+ 224 00a0 8FEF      		ldi r24,lo8(-1)
+ 225 00a2 9FEF      		ldi r25,hi8(-1)
+ 226 00a4 0895      		ret
+ 227               	.L39:
+ 228               	.LM37:
+ 229 00a6 8091 9C00 		lds r24,156
+ 230 00aa 8083      		st Z,r24
+ 231 00ac 80E0      		ldi r24,lo8(0)
+ 232 00ae 90E0      		ldi r25,hi8(0)
+ 233               	.LM38:
+ 234 00b0 0895      		ret
+ 235               	/* epilogue: frame size=0 */
+ 236               	/* epilogue: noreturn */
+ 237               	/* epilogue end (size=0) */
+ 238               	/* function xbee_getc_nb size 14 (14) */
+ 239               	.LFE12:
+ 241               		.data
+ 242               	.LC0:
+ 243 0000 3031 3233 		.string	"0123456789ABCDEF"
+ 243      3435 3637 
+ 243      3839 4142 
+ 243      4344 4546 
+ 243      00
+ 244               		.text
+ 245               	.global	hex_digit
+ 247               	hex_digit:
+ 248               	.LFB14:
+ 249               	.LM39:
+ 250               	/* prologue: frame size=0 */
+ 251               	/* prologue end (size=0) */
+ 252               	.LVL9:
+ 253               	.LM40:
+ 254 00b2 8031      		cpi r24,lo8(16)
+ 255 00b4 00F0      		brlo .L44
+ 256               	.LM41:
+ 257 00b6 8FE3      		ldi r24,lo8(63)
+ 258 00b8 90E0      		ldi r25,hi8(63)
+ 259               	.LVL10:
+ 260 00ba 0895      		ret
+ 261               	.LVL11:
+ 262               	.L44:
+ 263               	.LM42:
+ 264 00bc E82F      		mov r30,r24
+ 265 00be FF27      		clr r31
+ 266 00c0 E050      		subi r30,lo8(-(.LC0))
+ 267 00c2 F040      		sbci r31,hi8(-(.LC0))
+ 268 00c4 8081      		ld r24,Z
+ 269               	.LVL12:
+ 270 00c6 9927      		clr r25
+ 271               	.LM43:
+ 272 00c8 0895      		ret
+ 273               	/* epilogue: frame size=0 */
+ 274               	/* epilogue: noreturn */
+ 275               	/* epilogue end (size=0) */
+ 276               	/* function hex_digit size 12 (12) */
+ 277               	.LFE14:
+ 279               	.global	usb_puts
+ 281               	usb_puts:
+ 282               	.LFB7:
+ 283               	.LM44:
+ 284               	/* prologue: frame size=0 */
+ 285               	/* prologue end (size=0) */
+ 286               	.LVL13:
+ 287 00ca FC01      		movw r30,r24
+ 288               	.LVL14:
+ 289 00cc 00C0      		rjmp .L49
+ 290               	.LVL15:
+ 291               	.L55:
+ 292               	.LBB4:
+ 293               	.LBB5:
+ 294               	.LM45:
+ 295 00ce 5D9B      		sbis 43-0x20,5
+ 296 00d0 00C0      		rjmp .L55
+ 297               	.LM46:
+ 298 00d2 8CB9      		out 44-0x20,r24
+ 299               	.LBE5:
+ 300               	.LBE4:
+ 301               	.LM47:
+ 302 00d4 3196      		adiw r30,1
+ 303               	.LVL16:
+ 304               	.L49:
+ 305               	.LM48:
+ 306 00d6 8081      		ld r24,Z
+ 307               	.LVL17:
+ 308 00d8 8823      		tst r24
+ 309 00da 01F4      		brne .L55
+ 310               	.LM49:
+ 311 00dc 80E0      		ldi r24,lo8(0)
+ 312 00de 90E0      		ldi r25,hi8(0)
+ 313               	/* epilogue: frame size=0 */
+ 314 00e0 0895      		ret
+ 315               	/* epilogue end (size=1) */
+ 316               	/* function usb_puts size 12 (11) */
+ 317               	.LFE7:
+ 319               	.global	usb_puti
+ 321               	usb_puti:
+ 322               	.LFB13:
+ 323               	.LM50:
+ 324               	/* prologue: frame size=6 */
+ 325 00e2 0F93      		push r16
+ 326 00e4 1F93      		push r17
+ 327 00e6 CF93      		push r28
+ 328 00e8 DF93      		push r29
+ 329 00ea CDB7      		in r28,__SP_L__
+ 330 00ec DEB7      		in r29,__SP_H__
+ 331 00ee 2697      		sbiw r28,6
+ 332 00f0 0FB6      		in __tmp_reg__,__SREG__
+ 333 00f2 F894      		cli
+ 334 00f4 DEBF      		out __SP_H__,r29
+ 335 00f6 0FBE      		out __SREG__,__tmp_reg__
+ 336 00f8 CDBF      		out __SP_L__,r28
+ 337               	/* prologue end (size=12) */
+ 338               	.LVL18:
+ 339 00fa 9C01      		movw r18,r24
+ 340               	.LM51:
+ 341 00fc DE01      		movw r26,r28
+ 342 00fe 1196      		adiw r26,1
+ 343 0100 E0E0      		ldi r30,lo8(C.1.1534)
+ 344 0102 F0E0      		ldi r31,hi8(C.1.1534)
+ 345 0104 86E0      		ldi r24,lo8(6)
+ 346               	.LVL19:
+ 347               	.L59:
+ 348               	.LM52:
+ 349 0106 0190      		ld r0,Z+
+ 350 0108 0D92      		st X+,r0
+ 351 010a 8150      		subi r24,lo8(-(-1))
+ 352 010c 01F4      		brne .L59
+ 353               	.LM53:
+ 354 010e 37FF      		sbrs r19,7
+ 355 0110 00C0      		rjmp .L60
+ 356               	.L70:
+ 357               	.LBB10:
+ 358               	.LBB11:
+ 359               	.LM54:
+ 360 0112 5D9B      		sbis 43-0x20,5
+ 361 0114 00C0      		rjmp .L70
+ 362               	.LM55:
+ 363 0116 8DE2      		ldi r24,lo8(45)
+ 364 0118 8CB9      		out 44-0x20,r24
+ 365               	.LBE11:
+ 366               	.LBE10:
+ 367               	.LM56:
+ 368 011a 3095      		com r19
+ 369 011c 2195      		neg r18
+ 370 011e 3F4F      		sbci r19,lo8(-1)
+ 371               	.L60:
+ 372 0120 46E0      		ldi r20,lo8(6)
+ 373               	.LVL20:
+ 374 0122 8E01      		movw r16,r28
+ 375 0124 0F5F      		subi r16,lo8(-(1))
+ 376 0126 1F4F      		sbci r17,hi8(-(1))
+ 377               	.L63:
+ 378               	.LM57:
+ 379 0128 4150      		subi r20,lo8(-(-1))
+ 380               	.LM58:
+ 381 012a F801      		movw r30,r16
+ 382 012c E40F      		add r30,r20
+ 383 012e F11D      		adc r31,__zero_reg__
+ 384 0130 C901      		movw r24,r18
+ 385 0132 6AE0      		ldi r22,lo8(10)
+ 386 0134 70E0      		ldi r23,hi8(10)
+ 387 0136 0E94 0000 		call __divmodhi4
+ 388 013a 805D      		subi r24,lo8(-(48))
+ 389 013c 8083      		st Z,r24
+ 390               	.LM59:
+ 391 013e C901      		movw r24,r18
+ 392 0140 6AE0      		ldi r22,lo8(10)
+ 393 0142 70E0      		ldi r23,hi8(10)
+ 394 0144 0E94 0000 		call __divmodhi4
+ 395 0148 9B01      		movw r18,r22
+ 396               	.LM60:
+ 397 014a 672B      		or r22,r23
+ 398 014c 01F4      		brne .L63
+ 399               	.LVL21:
+ 400 014e CE01      		movw r24,r28
+ 401 0150 0196      		adiw r24,1
+ 402 0152 00C0      		rjmp .L64
+ 403               	.L65:
+ 404               	.LM61:
+ 405 0154 FC01      		movw r30,r24
+ 406 0156 E40F      		add r30,r20
+ 407 0158 F11D      		adc r31,__zero_reg__
+ 408 015a E081      		ld r30,Z
+ 409               	.L66:
+ 410               	.LBB12:
+ 411               	.LBB13:
+ 412               	.LM62:
+ 413 015c 5D9B      		sbis 43-0x20,5
+ 414 015e 00C0      		rjmp .L66
+ 415               	.LM63:
+ 416 0160 ECB9      		out 44-0x20,r30
+ 417               	.LBE13:
+ 418               	.LBE12:
+ 419               	.LM64:
+ 420 0162 4F5F      		subi r20,lo8(-(1))
+ 421               	.L64:
+ 422 0164 4630      		cpi r20,lo8(6)
+ 423 0166 00F0      		brlo .L65
+ 424               	.LM65:
+ 425 0168 80E0      		ldi r24,lo8(0)
+ 426 016a 90E0      		ldi r25,hi8(0)
+ 427               	/* epilogue: frame size=6 */
+ 428 016c 2696      		adiw r28,6
+ 429 016e 0FB6      		in __tmp_reg__,__SREG__
+ 430 0170 F894      		cli
+ 431 0172 DEBF      		out __SP_H__,r29
+ 432 0174 0FBE      		out __SREG__,__tmp_reg__
+ 433 0176 CDBF      		out __SP_L__,r28
+ 434 0178 DF91      		pop r29
+ 435 017a CF91      		pop r28
+ 436 017c 1F91      		pop r17
+ 437 017e 0F91      		pop r16
+ 438 0180 0895      		ret
+ 439               	/* epilogue end (size=11) */
+ 440               	/* function usb_puti size 81 (58) */
+ 441               	.LFE13:
+ 443               	.global	usb_puts_P
+ 445               	usb_puts_P:
+ 446               	.LFB8:
+ 447               	.LM66:
+ 448               	/* prologue: frame size=1 */
+ 449 0182 0F93      		push r16
+ 450 0184 1F93      		push r17
+ 451 0186 CF93      		push r28
+ 452 0188 DF93      		push r29
+ 453 018a CDB7      		in r28,__SP_L__
+ 454 018c DEB7      		in r29,__SP_H__
+ 455 018e 2197      		sbiw r28,1
+ 456 0190 0FB6      		in __tmp_reg__,__SREG__
+ 457 0192 F894      		cli
+ 458 0194 DEBF      		out __SP_H__,r29
+ 459 0196 0FBE      		out __SREG__,__tmp_reg__
+ 460 0198 CDBF      		out __SP_L__,r28
+ 461               	/* prologue end (size=12) */
+ 462               	.LVL22:
+ 463 019a 8C01      		movw r16,r24
+ 464 019c 00C0      		rjmp .L80
+ 465               	.LVL23:
+ 466               	.L85:
+ 467               	.LBB16:
+ 468               	.LBB17:
+ 469               	.LM67:
+ 470 019e 5D9B      		sbis 43-0x20,5
+ 471 01a0 00C0      		rjmp .L85
+ 472               	.LM68:
+ 473 01a2 8CB9      		out 44-0x20,r24
+ 474               	.LBE17:
+ 475               	.LBE16:
+ 476               	.LM69:
+ 477 01a4 0F5F      		subi r16,lo8(-(1))
+ 478 01a6 1F4F      		sbci r17,hi8(-(1))
+ 479               	.LVL24:
+ 480               	.L80:
+ 481               	.LM70:
+ 482 01a8 41E0      		ldi r20,lo8(1)
+ 483 01aa 50E0      		ldi r21,hi8(1)
+ 484 01ac B801      		movw r22,r16
+ 485 01ae CE01      		movw r24,r28
+ 486 01b0 0196      		adiw r24,1
+ 487 01b2 0E94 0000 		call memcpy_P
+ 488 01b6 8981      		ldd r24,Y+1
+ 489 01b8 8823      		tst r24
+ 490 01ba 01F4      		brne .L85
+ 491               	/* epilogue: frame size=1 */
+ 492 01bc 2196      		adiw r28,1
+ 493 01be 0FB6      		in __tmp_reg__,__SREG__
+ 494 01c0 F894      		cli
+ 495 01c2 DEBF      		out __SP_H__,r29
+ 496 01c4 0FBE      		out __SREG__,__tmp_reg__
+ 497 01c6 CDBF      		out __SP_L__,r28
+ 498 01c8 DF91      		pop r29
+ 499 01ca CF91      		pop r28
+ 500 01cc 1F91      		pop r17
+ 501 01ce 0F91      		pop r16
+ 502 01d0 0895      		ret
+ 503               	/* epilogue end (size=11) */
+ 504               	/* function usb_puts_P size 40 (17) */
+ 505               	.LFE8:
+ 507               	.global	usb_puth8
+ 509               	usb_puth8:
+ 510               	.LFB16:
+ 511               	.LM71:
+ 512               	/* prologue: frame size=0 */
+ 513               	/* prologue end (size=0) */
+ 514               	.LVL25:
+ 515 01d2 282F      		mov r18,r24
+ 516               	.LM72:
+ 517 01d4 E82F      		mov r30,r24
+ 518               	.LVL26:
+ 519 01d6 E295      		swap r30
+ 520 01d8 EF70      		andi r30,0x0f
+ 521               	.LBB26:
+ 522               	.LBB27:
+ 523               	.LM73:
+ 524 01da E031      		cpi r30,lo8(16)
+ 525 01dc 00F0      		brlo .L89
+ 526               	.LM74:
+ 527 01de 8FE3      		ldi r24,lo8(63)
+ 528 01e0 90E0      		ldi r25,hi8(63)
+ 529               	.LVL27:
+ 530 01e2 00C0      		rjmp .L98
+ 531               	.LVL28:
+ 532               	.L89:
+ 533               	.LM75:
+ 534 01e4 FF27      		clr r31
+ 535 01e6 E050      		subi r30,lo8(-(.LC0))
+ 536 01e8 F040      		sbci r31,hi8(-(.LC0))
+ 537 01ea 8081      		ld r24,Z
+ 538               	.LVL29:
+ 539 01ec 9927      		clr r25
+ 540               	.L98:
+ 541               	.LBE27:
+ 542               	.LBE26:
+ 543               	.LBB28:
+ 544               	.LBB29:
+ 545               	.LM76:
+ 546 01ee 5D9B      		sbis 43-0x20,5
+ 547 01f0 00C0      		rjmp .L98
+ 548               	.LM77:
+ 549 01f2 8CB9      		out 44-0x20,r24
+ 550               	.LBE29:
+ 551               	.LBE28:
+ 552               	.LM78:
+ 553 01f4 822F      		mov r24,r18
+ 554               	.LVL30:
+ 555 01f6 8F70      		andi r24,lo8(15)
+ 556               	.LBB30:
+ 557               	.LBB31:
+ 558               	.LM79:
+ 559 01f8 8031      		cpi r24,lo8(16)
+ 560 01fa 00F0      		brlo .L93
+ 561 01fc 8FE3      		ldi r24,lo8(63)
+ 562 01fe 90E0      		ldi r25,hi8(63)
+ 563               	.LVL31:
+ 564 0200 00C0      		rjmp .L99
+ 565               	.LVL32:
+ 566               	.L93:
+ 567               	.LM80:
+ 568 0202 E82F      		mov r30,r24
+ 569 0204 FF27      		clr r31
+ 570               	.LVL33:
+ 571 0206 E050      		subi r30,lo8(-(.LC0))
+ 572 0208 F040      		sbci r31,hi8(-(.LC0))
+ 573 020a 8081      		ld r24,Z
+ 574               	.LVL34:
+ 575 020c 9927      		clr r25
+ 576               	.LVL35:
+ 577               	.L99:
+ 578               	.LBE31:
+ 579               	.LBE30:
+ 580               	.LBB32:
+ 581               	.LBB33:
+ 582               	.LM81:
+ 583 020e 5D9B      		sbis 43-0x20,5
+ 584 0210 00C0      		rjmp .L99
+ 585               	.LM82:
+ 586 0212 8CB9      		out 44-0x20,r24
+ 587               	.LBE33:
+ 588               	.LBE32:
+ 589               	/* epilogue: frame size=0 */
+ 590 0214 0895      		ret
+ 591               	/* epilogue end (size=1) */
+ 592               	/* function usb_puth8 size 34 (33) */
+ 593               	.LFE16:
+ 595               	.global	usb_puth16
+ 597               	usb_puth16:
+ 598               	.LFB15:
+ 599               	.LM83:
+ 600               	/* prologue: frame size=0 */
+ 601               	/* prologue end (size=0) */
+ 602               	.LVL36:
+ 603 0216 9C01      		movw r18,r24
+ 604               	.LVL37:
+ 605               	.LM84:
+ 606 0218 892F      		mov r24,r25
+ 607 021a 9927      		clr r25
+ 608 021c 8295      		swap r24
+ 609 021e 8F70      		andi r24,0x0f
+ 610 0220 8F70      		andi r24,lo8(15)
+ 611               	.LVL38:
+ 612               	.LBB50:
+ 613               	.LBB51:
+ 614               	.LM85:
+ 615 0222 8031      		cpi r24,lo8(16)
+ 616 0224 00F0      		brlo .L105
+ 617               	.LM86:
+ 618 0226 8FE3      		ldi r24,lo8(63)
+ 619 0228 90E0      		ldi r25,hi8(63)
+ 620               	.LVL39:
+ 621 022a 00C0      		rjmp .L122
+ 622               	.LVL40:
+ 623               	.L105:
+ 624               	.LM87:
+ 625 022c E82F      		mov r30,r24
+ 626 022e FF27      		clr r31
+ 627 0230 E050      		subi r30,lo8(-(.LC0))
+ 628 0232 F040      		sbci r31,hi8(-(.LC0))
+ 629 0234 8081      		ld r24,Z
+ 630               	.LVL41:
+ 631 0236 9927      		clr r25
+ 632               	.L122:
+ 633               	.LBE51:
+ 634               	.LBE50:
+ 635               	.LBB52:
+ 636               	.LBB53:
+ 637               	.LM88:
+ 638 0238 5D9B      		sbis 43-0x20,5
+ 639 023a 00C0      		rjmp .L122
+ 640               	.LM89:
+ 641 023c 8CB9      		out 44-0x20,r24
+ 642               	.LBE53:
+ 643               	.LBE52:
+ 644               	.LM90:
+ 645 023e 832F      		mov r24,r19
+ 646 0240 9927      		clr r25
+ 647 0242 8F70      		andi r24,lo8(15)
+ 648               	.LVL42:
+ 649               	.LBB54:
+ 650               	.LBB55:
+ 651               	.LM91:
+ 652 0244 8031      		cpi r24,lo8(16)
+ 653 0246 00F0      		brlo .L109
+ 654 0248 8FE3      		ldi r24,lo8(63)
+ 655 024a 90E0      		ldi r25,hi8(63)
+ 656               	.LVL43:
+ 657 024c 00C0      		rjmp .L123
+ 658               	.LVL44:
+ 659               	.L109:
+ 660               	.LM92:
+ 661 024e E82F      		mov r30,r24
+ 662 0250 FF27      		clr r31
+ 663               	.LVL45:
+ 664 0252 E050      		subi r30,lo8(-(.LC0))
+ 665 0254 F040      		sbci r31,hi8(-(.LC0))
+ 666 0256 8081      		ld r24,Z
+ 667               	.LVL46:
+ 668 0258 9927      		clr r25
+ 669               	.LVL47:
+ 670               	.L123:
+ 671               	.LBE55:
+ 672               	.LBE54:
+ 673               	.LBB56:
+ 674               	.LBB57:
+ 675               	.LM93:
+ 676 025a 5D9B      		sbis 43-0x20,5
+ 677 025c 00C0      		rjmp .L123
+ 678               	.LM94:
+ 679 025e 8CB9      		out 44-0x20,r24
+ 680               	.LBE57:
+ 681               	.LBE56:
+ 682               	.LM95:
+ 683 0260 C901      		movw r24,r18
+ 684 0262 34E0      		ldi r19,4
+ 685 0264 9695      	1:	lsr r25
+ 686 0266 8795      		ror r24
+ 687 0268 3A95      		dec r19
+ 688 026a 01F4      		brne 1b
+ 689 026c 8F70      		andi r24,lo8(15)
+ 690               	.LVL48:
+ 691               	.LBB58:
+ 692               	.LBB59:
+ 693               	.LM96:
+ 694 026e 8031      		cpi r24,lo8(16)
+ 695 0270 00F0      		brlo .L113
+ 696 0272 8FE3      		ldi r24,lo8(63)
+ 697 0274 90E0      		ldi r25,hi8(63)
+ 698               	.LVL49:
+ 699 0276 00C0      		rjmp .L124
+ 700               	.LVL50:
+ 701               	.L113:
+ 702               	.LM97:
+ 703 0278 E82F      		mov r30,r24
+ 704 027a FF27      		clr r31
+ 705               	.LVL51:
+ 706 027c E050      		subi r30,lo8(-(.LC0))
+ 707 027e F040      		sbci r31,hi8(-(.LC0))
+ 708 0280 8081      		ld r24,Z
+ 709               	.LVL52:
+ 710 0282 9927      		clr r25
+ 711               	.LVL53:
+ 712               	.L124:
+ 713               	.LBE59:
+ 714               	.LBE58:
+ 715               	.LBB60:
+ 716               	.LBB61:
+ 717               	.LM98:
+ 718 0284 5D9B      		sbis 43-0x20,5
+ 719 0286 00C0      		rjmp .L124
+ 720               	.LM99:
+ 721 0288 8CB9      		out 44-0x20,r24
+ 722               	.LVL54:
+ 723               	.LBE61:
+ 724               	.LBE60:
+ 725               	.LM100:
+ 726 028a 822F      		mov r24,r18
+ 727               	.LVL55:
+ 728 028c 8F70      		andi r24,lo8(15)
+ 729               	.LBB62:
+ 730               	.LBB63:
+ 731               	.LM101:
+ 732 028e 8031      		cpi r24,lo8(16)
+ 733 0290 00F0      		brlo .L117
+ 734 0292 8FE3      		ldi r24,lo8(63)
+ 735 0294 90E0      		ldi r25,hi8(63)
+ 736               	.LVL56:
+ 737 0296 00C0      		rjmp .L125
+ 738               	.LVL57:
+ 739               	.L117:
+ 740               	.LM102:
+ 741 0298 E82F      		mov r30,r24
+ 742 029a FF27      		clr r31
+ 743               	.LVL58:
+ 744 029c E050      		subi r30,lo8(-(.LC0))
+ 745 029e F040      		sbci r31,hi8(-(.LC0))
+ 746 02a0 8081      		ld r24,Z
+ 747               	.LVL59:
+ 748 02a2 9927      		clr r25
+ 749               	.LVL60:
+ 750               	.L125:
+ 751               	.LBE63:
+ 752               	.LBE62:
+ 753               	.LBB64:
+ 754               	.LBB65:
+ 755               	.LM103:
+ 756 02a4 5D9B      		sbis 43-0x20,5
+ 757 02a6 00C0      		rjmp .L125
+ 758               	.LM104:
+ 759 02a8 8CB9      		out 44-0x20,r24
+ 760               	.LBE65:
+ 761               	.LBE64:
+ 762               	/* epilogue: frame size=0 */
+ 763 02aa 0895      		ret
+ 764               	/* epilogue end (size=1) */
+ 765               	/* function usb_puth16 size 75 (74) */
+ 766               	.LFE15:
+ 768               		.data
+ 771               	C.1.1534:
+ 772 0011 30        		.byte	48
+ 773 0012 30        		.byte	48
+ 774 0013 30        		.byte	48
+ 775 0014 30        		.byte	48
+ 776 0015 30        		.byte	48
+ 777 0016 30        		.byte	48
+ 906               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 serial.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:20     .text:00000000 usb_init
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:50     .text:0000001c xbee_init
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:86     .text:00000046 usb_putc
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:110    .text:00000052 xbee_putc
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:136    .text:00000066 usb_getc
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:157    .text:00000070 xbee_getc
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:179    .text:00000080 usb_getc_nb
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:211    .text:00000096 xbee_getc_nb
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:247    .text:000000b2 hex_digit
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:281    .text:000000ca usb_puts
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:321    .text:000000e2 usb_puti
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:771    .data:00000011 C.1.1534
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:445    .text:00000182 usb_puts_P
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:509    .text:000001d2 usb_puth8
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccDgrgV.s:597    .text:00000216 usb_puth16
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+__divmodhi4
+memcpy_P
Index: demos/hunter_prey_john/projects/libdragonfly/buzzer.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/buzzer.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/buzzer.lst	(revision 1694)
@@ -0,0 +1,151 @@
+   1               		.file	"buzzer.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	buzzer_init
+  20               	buzzer_init:
+  21               	.LFB2:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	/* epilogue: frame size=0 */
+  26 0000 0895      		ret
+  27               	/* epilogue end (size=1) */
+  28               	/* function buzzer_init size 1 (0) */
+  29               	.LFE2:
+  31               	.global	buzzer_set_val
+  33               	buzzer_set_val:
+  34               	.LFB3:
+  35               	.LM2:
+  36               	/* prologue: frame size=0 */
+  37               	/* prologue end (size=0) */
+  38               	.LVL0:
+  39               	.LM3:
+  40 0002 2CE1      		ldi r18,lo8(28)
+  41 0004 25BD      		out 69-0x20,r18
+  42               	.LM4:
+  43 0006 BF9A      		sbi 55-0x20,7
+  44               	.LM5:
+  45 0008 83BD      		out 67-0x20,r24
+  46               	/* epilogue: frame size=0 */
+  47 000a 0895      		ret
+  48               	/* epilogue end (size=1) */
+  49               	/* function buzzer_set_val size 5 (4) */
+  50               	.LFE3:
+  52               	.global	buzzer_set_freq
+  54               	buzzer_set_freq:
+  55               	.LFB4:
+  56               	.LM6:
+  57               	/* prologue: frame size=0 */
+  58               	/* prologue end (size=0) */
+  59               	.LVL1:
+  60               	.LM7:
+  61 000c 9C01      		movw r18,r24
+  62 000e 4427      		clr r20
+  63 0010 5527      		clr r21
+  64 0012 64E2      		ldi r22,lo8(62500)
+  65 0014 74EF      		ldi r23,hi8(62500)
+  66 0016 80E0      		ldi r24,hlo8(62500)
+  67 0018 90E0      		ldi r25,hhi8(62500)
+  68 001a 0E94 0000 		call __divmodsi4
+  69 001e C901      		movw r24,r18
+  70               	.LVL2:
+  71 0020 0197      		sbiw r24,1
+  72 0022 97FF      		sbrs r25,7
+  73 0024 00C0      		rjmp .L6
+  74               	.LM8:
+  75 0026 80E0      		ldi r24,lo8(0)
+  76 0028 90E0      		ldi r25,hi8(0)
+  77               	.L6:
+  78               	.LM9:
+  79 002a 8F3F      		cpi r24,255
+  80 002c 9105      		cpc r25,__zero_reg__
+  81 002e 01F0      		breq .L7
+  82 0030 04F0      		brlt .L7
+  83 0032 8FEF      		ldi r24,lo8(255)
+  84 0034 90E0      		ldi r25,hi8(255)
+  85               	.L7:
+  86 0036 0E94 0000 		call buzzer_set_val
+  87               	.LVL3:
+  88               	/* epilogue: frame size=0 */
+  89 003a 0895      		ret
+  90               	/* epilogue end (size=1) */
+  91               	/* function buzzer_set_freq size 24 (23) */
+  92               	.LFE4:
+  94               	.global	buzzer_off
+  96               	buzzer_off:
+  97               	.LFB6:
+  98               	.LM10:
+  99               	/* prologue: frame size=0 */
+ 100               	/* prologue end (size=0) */
+ 101               	.LM11:
+ 102 003c 85B5      		in r24,69-0x20
+ 103 003e 887F      		andi r24,lo8(-8)
+ 104 0040 85BD      		out 69-0x20,r24
+ 105               	.LM12:
+ 106 0042 C698      		cbi 56-0x20,6
+ 107               	/* epilogue: frame size=0 */
+ 108 0044 0895      		ret
+ 109               	/* epilogue end (size=1) */
+ 110               	/* function buzzer_off size 5 (4) */
+ 111               	.LFE6:
+ 113               	.global	buzzer_chirp
+ 115               	buzzer_chirp:
+ 116               	.LFB5:
+ 117               	.LM13:
+ 118               	/* prologue: frame size=0 */
+ 119 0046 0F93      		push r16
+ 120 0048 1F93      		push r17
+ 121               	/* prologue end (size=2) */
+ 122               	.LVL4:
+ 123 004a 8C01      		movw r16,r24
+ 124 004c CB01      		movw r24,r22
+ 125               	.LVL5:
+ 126               	.LM14:
+ 127 004e 0E94 0000 		call buzzer_set_freq
+ 128               	.LVL6:
+ 129               	.LM15:
+ 130 0052 C801      		movw r24,r16
+ 131 0054 0E94 0000 		call delay_ms
+ 132               	.LBB4:
+ 133               	.LBB5:
+ 134               	.LM16:
+ 135 0058 85B5      		in r24,69-0x20
+ 136 005a 887F      		andi r24,lo8(-8)
+ 137 005c 85BD      		out 69-0x20,r24
+ 138               	.LM17:
+ 139 005e C698      		cbi 56-0x20,6
+ 140               	.LBE5:
+ 141               	.LBE4:
+ 142               	/* epilogue: frame size=0 */
+ 143 0060 1F91      		pop r17
+ 144 0062 0F91      		pop r16
+ 145 0064 0895      		ret
+ 146               	/* epilogue end (size=3) */
+ 147               	/* function buzzer_chirp size 16 (11) */
+ 148               	.LFE5:
+ 206               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 buzzer.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc3fIAyl.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc3fIAyl.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc3fIAyl.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc3fIAyl.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc3fIAyl.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc3fIAyl.s:20     .text:00000000 buzzer_init
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc3fIAyl.s:33     .text:00000002 buzzer_set_val
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc3fIAyl.s:54     .text:0000000c buzzer_set_freq
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc3fIAyl.s:96     .text:0000003c buzzer_off
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc3fIAyl.s:115    .text:00000046 buzzer_chirp
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+__divmodsi4
+delay_ms
Index: demos/hunter_prey_john/projects/libdragonfly/eeprom.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/eeprom.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/eeprom.lst	(revision 1694)
@@ -0,0 +1,248 @@
+   1               		.file	"eeprom.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	eeprom_put_byte
+  20               	eeprom_put_byte:
+  21               	.LFB2:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LVL0:
+  26               	.L3:
+  27               	.LM2:
+  28 0000 E199      		sbic 60-0x20,1
+  29 0002 00C0      		rjmp .L3
+  30               	.LM3:
+  31 0004 9FBB      		out (62)+1-0x20,r25
+  32 0006 8EBB      		out 62-0x20,r24
+  33               	.LM4:
+  34 0008 6DBB      		out 61-0x20,r22
+  35               	.LM5:
+  36 000a E29A      		sbi 60-0x20,2
+  37               	.LM6:
+  38 000c E19A      		sbi 60-0x20,1
+  39               	.LM7:
+  40 000e 80E0      		ldi r24,lo8(0)
+  41 0010 90E0      		ldi r25,hi8(0)
+  42               	.LVL1:
+  43               	/* epilogue: frame size=0 */
+  44 0012 0895      		ret
+  45               	/* epilogue end (size=1) */
+  46               	/* function eeprom_put_byte size 10 (9) */
+  47               	.LFE2:
+  49               	.global	eeprom_get_byte
+  51               	eeprom_get_byte:
+  52               	.LFB3:
+  53               	.LM8:
+  54               	/* prologue: frame size=0 */
+  55               	/* prologue end (size=0) */
+  56               	.LVL2:
+  57 0014 FB01      		movw r30,r22
+  58               	.LVL3:
+  59               	.L10:
+  60               	.LM9:
+  61 0016 E199      		sbic 60-0x20,1
+  62 0018 00C0      		rjmp .L10
+  63               	.LM10:
+  64 001a 9FBB      		out (62)+1-0x20,r25
+  65 001c 8EBB      		out 62-0x20,r24
+  66               	.LM11:
+  67 001e E09A      		sbi 60-0x20,0
+  68               	.LM12:
+  69 0020 8DB3      		in r24,61-0x20
+  70               	.LVL4:
+  71 0022 8083      		st Z,r24
+  72               	.LM13:
+  73 0024 80E0      		ldi r24,lo8(0)
+  74 0026 90E0      		ldi r25,hi8(0)
+  75               	/* epilogue: frame size=0 */
+  76 0028 0895      		ret
+  77               	/* epilogue end (size=1) */
+  78               	/* function eeprom_get_byte size 11 (10) */
+  79               	.LFE3:
+  81               	.global	get_robotid
+  83               	get_robotid:
+  84               	.LFB4:
+  85               	.LM14:
+  86               	/* prologue: frame size=3 */
+  87 002a CF93      		push r28
+  88 002c DF93      		push r29
+  89 002e CDB7      		in r28,__SP_L__
+  90 0030 DEB7      		in r29,__SP_H__
+  91 0032 2397      		sbiw r28,3
+  92 0034 0FB6      		in __tmp_reg__,__SREG__
+  93 0036 F894      		cli
+  94 0038 DEBF      		out __SP_H__,r29
+  95 003a 0FBE      		out __SREG__,__tmp_reg__
+  96 003c CDBF      		out __SP_L__,r28
+  97               	/* prologue end (size=10) */
+  98               	.LM15:
+  99 003e BE01      		movw r22,r28
+ 100 0040 6D5F      		subi r22,lo8(-(3))
+ 101 0042 7F4F      		sbci r23,hi8(-(3))
+ 102 0044 80E1      		ldi r24,lo8(16)
+ 103 0046 90E0      		ldi r25,hi8(16)
+ 104 0048 0E94 0000 		call eeprom_get_byte
+ 105               	.LM16:
+ 106 004c BE01      		movw r22,r28
+ 107 004e 6F5F      		subi r22,lo8(-(1))
+ 108 0050 7F4F      		sbci r23,hi8(-(1))
+ 109 0052 81E1      		ldi r24,lo8(17)
+ 110 0054 90E0      		ldi r25,hi8(17)
+ 111 0056 0E94 0000 		call eeprom_get_byte
+ 112               	.LM17:
+ 113 005a BE01      		movw r22,r28
+ 114 005c 6E5F      		subi r22,lo8(-(2))
+ 115 005e 7F4F      		sbci r23,hi8(-(2))
+ 116 0060 82E1      		ldi r24,lo8(18)
+ 117 0062 90E0      		ldi r25,hi8(18)
+ 118 0064 0E94 0000 		call eeprom_get_byte
+ 119               	.LVL5:
+ 120               	.LM18:
+ 121 0068 8B81      		ldd r24,Y+3
+ 122 006a 8934      		cpi r24,lo8(73)
+ 123 006c 01F4      		brne .L16
+ 124               	.LVL6:
+ 125               	.LVL7:
+ 126               	.LM19:
+ 127 006e 8981      		ldd r24,Y+1
+ 128               	.LVL8:
+ 129 0070 8434      		cpi r24,lo8(68)
+ 130 0072 01F4      		brne .L16
+ 131               	.LVL9:
+ 132               	.LVL10:
+ 133               	.LM20:
+ 134 0074 8A81      		ldd r24,Y+2
+ 135               	.LVL11:
+ 136 0076 9927      		clr r25
+ 137 0078 00C0      		rjmp .L19
+ 138               	.LVL12:
+ 139               	.L16:
+ 140 007a 8FEF      		ldi r24,lo8(255)
+ 141 007c 90E0      		ldi r25,hi8(255)
+ 142               	.LVL13:
+ 143               	.L19:
+ 144               	/* epilogue: frame size=3 */
+ 145 007e 2396      		adiw r28,3
+ 146 0080 0FB6      		in __tmp_reg__,__SREG__
+ 147 0082 F894      		cli
+ 148 0084 DEBF      		out __SP_H__,r29
+ 149 0086 0FBE      		out __SREG__,__tmp_reg__
+ 150 0088 CDBF      		out __SP_L__,r28
+ 151 008a DF91      		pop r29
+ 152 008c CF91      		pop r28
+ 153 008e 0895      		ret
+ 154               	/* epilogue end (size=9) */
+ 155               	/* function get_robotid size 51 (32) */
+ 156               	.LFE4:
+ 158               	.global	get_bom_type
+ 160               	get_bom_type:
+ 161               	.LFB5:
+ 162               	.LM21:
+ 163               	/* prologue: frame size=4 */
+ 164 0090 CF93      		push r28
+ 165 0092 DF93      		push r29
+ 166 0094 CDB7      		in r28,__SP_L__
+ 167 0096 DEB7      		in r29,__SP_H__
+ 168 0098 2497      		sbiw r28,4
+ 169 009a 0FB6      		in __tmp_reg__,__SREG__
+ 170 009c F894      		cli
+ 171 009e DEBF      		out __SP_H__,r29
+ 172 00a0 0FBE      		out __SREG__,__tmp_reg__
+ 173 00a2 CDBF      		out __SP_L__,r28
+ 174               	/* prologue end (size=10) */
+ 175               	.LM22:
+ 176 00a4 BE01      		movw r22,r28
+ 177 00a6 6C5F      		subi r22,lo8(-(4))
+ 178 00a8 7F4F      		sbci r23,hi8(-(4))
+ 179 00aa 84E1      		ldi r24,lo8(20)
+ 180 00ac 90E0      		ldi r25,hi8(20)
+ 181 00ae 0E94 0000 		call eeprom_get_byte
+ 182               	.LM23:
+ 183 00b2 BE01      		movw r22,r28
+ 184 00b4 6F5F      		subi r22,lo8(-(1))
+ 185 00b6 7F4F      		sbci r23,hi8(-(1))
+ 186 00b8 85E1      		ldi r24,lo8(21)
+ 187 00ba 90E0      		ldi r25,hi8(21)
+ 188 00bc 0E94 0000 		call eeprom_get_byte
+ 189               	.LM24:
+ 190 00c0 BE01      		movw r22,r28
+ 191 00c2 6E5F      		subi r22,lo8(-(2))
+ 192 00c4 7F4F      		sbci r23,hi8(-(2))
+ 193 00c6 86E1      		ldi r24,lo8(22)
+ 194 00c8 90E0      		ldi r25,hi8(22)
+ 195 00ca 0E94 0000 		call eeprom_get_byte
+ 196               	.LM25:
+ 197 00ce BE01      		movw r22,r28
+ 198 00d0 6D5F      		subi r22,lo8(-(3))
+ 199 00d2 7F4F      		sbci r23,hi8(-(3))
+ 200 00d4 87E1      		ldi r24,lo8(23)
+ 201 00d6 90E0      		ldi r25,hi8(23)
+ 202 00d8 0E94 0000 		call eeprom_get_byte
+ 203               	.LVL14:
+ 204               	.LM26:
+ 205 00dc 8C81      		ldd r24,Y+4
+ 206 00de 8234      		cpi r24,lo8(66)
+ 207 00e0 01F4      		brne .L22
+ 208               	.LVL15:
+ 209               	.LVL16:
+ 210               	.LM27:
+ 211 00e2 8981      		ldd r24,Y+1
+ 212               	.LVL17:
+ 213 00e4 8F34      		cpi r24,lo8(79)
+ 214 00e6 01F4      		brne .L22
+ 215               	.LVL18:
+ 216               	.LVL19:
+ 217 00e8 8A81      		ldd r24,Y+2
+ 218               	.LVL20:
+ 219 00ea 8D34      		cpi r24,lo8(77)
+ 220 00ec 01F4      		brne .L22
+ 221               	.LVL21:
+ 222               	.LVL22:
+ 223               	.LM28:
+ 224 00ee 8B81      		ldd r24,Y+3
+ 225               	.LVL23:
+ 226 00f0 9927      		clr r25
+ 227 00f2 00C0      		rjmp .L26
+ 228               	.LVL24:
+ 229               	.L22:
+ 230 00f4 8FEF      		ldi r24,lo8(255)
+ 231 00f6 90E0      		ldi r25,hi8(255)
+ 232               	.LVL25:
+ 233               	.L26:
+ 234               	/* epilogue: frame size=4 */
+ 235 00f8 2496      		adiw r28,4
+ 236 00fa 0FB6      		in __tmp_reg__,__SREG__
+ 237 00fc F894      		cli
+ 238 00fe DEBF      		out __SP_H__,r29
+ 239 0100 0FBE      		out __SREG__,__tmp_reg__
+ 240 0102 CDBF      		out __SP_L__,r28
+ 241 0104 DF91      		pop r29
+ 242 0106 CF91      		pop r28
+ 243 0108 0895      		ret
+ 244               	/* epilogue end (size=9) */
+ 245               	/* function get_bom_type size 61 (42) */
+ 246               	.LFE5:
+ 296               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 eeprom.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccqx6Rxb.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccqx6Rxb.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccqx6Rxb.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccqx6Rxb.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccqx6Rxb.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccqx6Rxb.s:20     .text:00000000 eeprom_put_byte
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccqx6Rxb.s:51     .text:00000014 eeprom_get_byte
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccqx6Rxb.s:83     .text:0000002a get_robotid
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccqx6Rxb.s:160    .text:00000090 get_bom_type
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
Index: demos/hunter_prey_john/projects/libdragonfly/spi.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/spi.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/spi.lst	(revision 1694)
@@ -0,0 +1,160 @@
+   1               		.file	"spi.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	spi_init
+  20               	spi_init:
+  21               	.LFB2:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LVL0:
+  26               	.LM2:
+  27 0000 23ED      		ldi r18,lo8(-45)
+  28 0002 2DB9      		out 45-0x20,r18
+  29               	.LM3:
+  30 0004 21E0      		ldi r18,lo8(1)
+  31 0006 2EB9      		out 46-0x20,r18
+  32               	.LM4:
+  33 0008 27B3      		in r18,55-0x20
+  34 000a 2760      		ori r18,lo8(7)
+  35 000c 27BB      		out 55-0x20,r18
+  36               	.LM5:
+  37 000e BB98      		cbi 55-0x20,3
+  38               	.LM6:
+  39 0010 C09A      		sbi 56-0x20,0
+  40               	.LM7:
+  41 0012 9093 0000 		sts (spi_recv_func)+1,r25
+  42 0016 8093 0000 		sts spi_recv_func,r24
+  43               	.LM8:
+  44 001a 7093 0000 		sts (spi_recv_complete_func)+1,r23
+  45 001e 6093 0000 		sts spi_recv_complete_func,r22
+  46               	.LM9:
+  47 0022 1092 0000 		sts spi_bytes,__zero_reg__
+  48               	/* epilogue: frame size=0 */
+  49 0026 0895      		ret
+  50               	/* epilogue end (size=1) */
+  51               	/* function spi_init size 20 (19) */
+  52               	.LFE2:
+  54               	.global	spi_transfer
+  56               	spi_transfer:
+  57               	.LFB3:
+  58               	.LM10:
+  59               	/* prologue: frame size=0 */
+  60               	/* prologue end (size=0) */
+  61               	.LVL1:
+  62               	.LM11:
+  63 0028 8093 0000 		sts spi_bytes,r24
+  64               	.LM12:
+  65 002c C098      		cbi 56-0x20,0
+  66               	.LM13:
+  67 002e 8FEF      		ldi r24,lo8(-1)
+  68               	.LVL2:
+  69 0030 8FB9      		out 47-0x20,r24
+  70               	/* epilogue: frame size=0 */
+  71 0032 0895      		ret
+  72               	/* epilogue end (size=1) */
+  73               	/* function spi_transfer size 6 (5) */
+  74               	.LFE3:
+  76               	.global	__vector_17
+  78               	__vector_17:
+  79               	.LFB4:
+  80               	.LM14:
+  81               	/* prologue: frame size=0 */
+  82 0034 1F92      		push __zero_reg__
+  83 0036 0F92      		push __tmp_reg__
+  84 0038 0FB6      		in __tmp_reg__,__SREG__
+  85 003a 0F92      		push __tmp_reg__
+  86 003c 1124      		clr __zero_reg__
+  87 003e 2F93      		push r18
+  88 0040 3F93      		push r19
+  89 0042 4F93      		push r20
+  90 0044 5F93      		push r21
+  91 0046 6F93      		push r22
+  92 0048 7F93      		push r23
+  93 004a 8F93      		push r24
+  94 004c 9F93      		push r25
+  95 004e AF93      		push r26
+  96 0050 BF93      		push r27
+  97 0052 EF93      		push r30
+  98 0054 FF93      		push r31
+  99               	/* prologue end (size=17) */
+ 100               	.LM15:
+ 101 0056 8091 0000 		lds r24,spi_bytes
+ 102 005a 8823      		tst r24
+ 103 005c 01F0      		breq .L11
+ 104               	.LM16:
+ 105 005e 8FB1      		in r24,47-0x20
+ 106 0060 E091 0000 		lds r30,spi_recv_func
+ 107 0064 F091 0000 		lds r31,(spi_recv_func)+1
+ 108 0068 0995      		icall
+ 109               	.LM17:
+ 110 006a 8091 0000 		lds r24,spi_bytes
+ 111 006e 8150      		subi r24,lo8(-(-1))
+ 112 0070 8093 0000 		sts spi_bytes,r24
+ 113 0074 8091 0000 		lds r24,spi_bytes
+ 114 0078 8823      		tst r24
+ 115 007a 01F4      		brne .L8
+ 116               	.LM18:
+ 117 007c C09A      		sbi 56-0x20,0
+ 118               	.LM19:
+ 119 007e E091 0000 		lds r30,spi_recv_complete_func
+ 120 0082 F091 0000 		lds r31,(spi_recv_complete_func)+1
+ 121 0086 3097      		sbiw r30,0
+ 122 0088 01F0      		breq .L11
+ 123               	.LM20:
+ 124 008a 0995      		icall
+ 125 008c 00C0      		rjmp .L11
+ 126               	.L8:
+ 127               	.LM21:
+ 128 008e 8FEF      		ldi r24,lo8(-1)
+ 129 0090 8FB9      		out 47-0x20,r24
+ 130               	.L11:
+ 131               	/* epilogue: frame size=0 */
+ 132 0092 FF91      		pop r31
+ 133 0094 EF91      		pop r30
+ 134 0096 BF91      		pop r27
+ 135 0098 AF91      		pop r26
+ 136 009a 9F91      		pop r25
+ 137 009c 8F91      		pop r24
+ 138 009e 7F91      		pop r23
+ 139 00a0 6F91      		pop r22
+ 140 00a2 5F91      		pop r21
+ 141 00a4 4F91      		pop r20
+ 142 00a6 3F91      		pop r19
+ 143 00a8 2F91      		pop r18
+ 144 00aa 0F90      		pop __tmp_reg__
+ 145 00ac 0FBE      		out __SREG__,__tmp_reg__
+ 146 00ae 0F90      		pop __tmp_reg__
+ 147 00b0 1F90      		pop __zero_reg__
+ 148 00b2 1895      		reti
+ 149               	/* epilogue end (size=17) */
+ 150               	/* function __vector_17 size 64 (30) */
+ 151               	.LFE4:
+ 153               		.lcomm spi_bytes,1
+ 154               		.lcomm spi_recv_func,2
+ 155               		.lcomm spi_recv_complete_func,2
+ 196               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 spi.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccYvT9rf.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccYvT9rf.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccYvT9rf.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccYvT9rf.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccYvT9rf.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccYvT9rf.s:20     .text:00000000 spi_init
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccYvT9rf.s:153    .bss:00000001 spi_recv_func
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccYvT9rf.s:154    .bss:00000003 spi_recv_complete_func
+                             .bss:00000000 spi_bytes
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccYvT9rf.s:56     .text:00000028 spi_transfer
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccYvT9rf.s:78     .text:00000034 __vector_17
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
Index: demos/hunter_prey_john/projects/libdragonfly/time.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/time.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/time.lst	(revision 1694)
@@ -0,0 +1,219 @@
+   1               		.file	"time.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	delay_ms
+  20               	delay_ms:
+  21               	.LFB6:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LVL0:
+  26 0000 9C01      		movw r18,r24
+  27 0002 E0E4      		ldi r30,lo8(1600)
+  28 0004 F6E0      		ldi r31,hi8(1600)
+  29 0006 00C0      		rjmp .L2
+  30               	.LVL1:
+  31               	.L3:
+  32               	.LBB4:
+  33               	.LBB5:
+  34               	.LM2:
+  35 0008 CF01      		movw r24,r30
+  36               	/* #APP */
+  37 000a 0197      		1: sbiw r24,1
+  38 000c 01F4      		brne 1b
+  39               	/* #NOAPP */
+  40               	.LBE5:
+  41               	.LBE4:
+  42               	.LM3:
+  43 000e 2150      		subi r18,lo8(-(-1))
+  44 0010 3040      		sbci r19,hi8(-(-1))
+  45               	.LVL2:
+  46               	.L2:
+  47 0012 1216      		cp __zero_reg__,r18
+  48 0014 1306      		cpc __zero_reg__,r19
+  49 0016 04F0      		brlt .L3
+  50               	/* epilogue: frame size=0 */
+  51 0018 0895      		ret
+  52               	/* epilogue end (size=1) */
+  53               	/* function delay_ms size 15 (14) */
+  54               	.LFE6:
+  56               	.global	rtc_init
+  58               	rtc_init:
+  59               	.LFB7:
+  60               	.LM4:
+  61               	/* prologue: frame size=0 */
+  62               	/* prologue end (size=0) */
+  63               	.LVL3:
+  64               	.LM5:
+  65 001a 1092 8900 		sts (136)+1,__zero_reg__
+  66 001e 1092 8800 		sts 136,__zero_reg__
+  67               	.LM6:
+  68 0022 EAE8      		ldi r30,lo8(138)
+  69 0024 F0E0      		ldi r31,hi8(138)
+  70 0026 2081      		ld r18,Z
+  71 0028 2860      		ori r18,lo8(8)
+  72 002a 2083      		st Z,r18
+  73               	.LM7:
+  74 002c 2081      		ld r18,Z
+  75 002e 2260      		ori r18,lo8(2)
+  76 0030 2083      		st Z,r18
+  77               	.LM8:
+  78 0032 24E2      		ldi r18,lo8(-3036)
+  79 0034 34EF      		ldi r19,hi8(-3036)
+  80 0036 3093 8700 		sts (134)+1,r19
+  81 003a 2093 8600 		sts 134,r18
+  82               	.LM9:
+  83 003e EDE7      		ldi r30,lo8(125)
+  84 0040 F0E0      		ldi r31,hi8(125)
+  85 0042 2081      		ld r18,Z
+  86 0044 2061      		ori r18,lo8(16)
+  87 0046 2083      		st Z,r18
+  88               	.LM10:
+  89 0048 7093 0000 		sts (_rtc_f)+1,r23
+  90 004c 6093 0000 		sts _rtc_f,r22
+  91               	.LM11:
+  92 0050 9093 0000 		sts (_rtc_scale)+1,r25
+  93 0054 8093 0000 		sts _rtc_scale,r24
+  94               	/* epilogue: frame size=0 */
+  95 0058 0895      		ret
+  96               	/* epilogue end (size=1) */
+  97               	/* function rtc_init size 32 (31) */
+  98               	.LFE7:
+ 100               	.global	rtc_get
+ 102               	rtc_get:
+ 103               	.LFB8:
+ 104               	.LM12:
+ 105               	/* prologue: frame size=0 */
+ 106               	/* prologue end (size=0) */
+ 107               	.LM13:
+ 108 005a 8091 0000 		lds r24,_rtc_val
+ 109 005e 9091 0000 		lds r25,(_rtc_val)+1
+ 110               	/* epilogue: frame size=0 */
+ 111 0062 0895      		ret
+ 112               	/* epilogue end (size=1) */
+ 113               	/* function rtc_get size 5 (4) */
+ 114               	.LFE8:
+ 116               	.global	rtc_reset
+ 118               	rtc_reset:
+ 119               	.LFB9:
+ 120               	.LM14:
+ 121               	/* prologue: frame size=0 */
+ 122               	/* prologue end (size=0) */
+ 123               	.LM15:
+ 124 0064 1092 0000 		sts (_rtc_val)+1,__zero_reg__
+ 125 0068 1092 0000 		sts _rtc_val,__zero_reg__
+ 126               	/* epilogue: frame size=0 */
+ 127 006c 0895      		ret
+ 128               	/* epilogue end (size=1) */
+ 129               	/* function rtc_reset size 5 (4) */
+ 130               	.LFE9:
+ 132               	.global	__vector_26
+ 134               	__vector_26:
+ 135               	.LFB10:
+ 136               	.LM16:
+ 137               	/* prologue: frame size=0 */
+ 138 006e 1F92      		push __zero_reg__
+ 139 0070 0F92      		push __tmp_reg__
+ 140 0072 0FB6      		in __tmp_reg__,__SREG__
+ 141 0074 0F92      		push __tmp_reg__
+ 142 0076 1124      		clr __zero_reg__
+ 143 0078 2F93      		push r18
+ 144 007a 3F93      		push r19
+ 145 007c 4F93      		push r20
+ 146 007e 5F93      		push r21
+ 147 0080 6F93      		push r22
+ 148 0082 7F93      		push r23
+ 149 0084 8F93      		push r24
+ 150 0086 9F93      		push r25
+ 151 0088 AF93      		push r26
+ 152 008a BF93      		push r27
+ 153 008c EF93      		push r30
+ 154 008e FF93      		push r31
+ 155               	/* prologue end (size=17) */
+ 156               	.LM17:
+ 157 0090 2091 0000 		lds r18,_rtc_pulse
+ 158 0094 3091 0000 		lds r19,(_rtc_pulse)+1
+ 159 0098 8091 0000 		lds r24,_rtc_scale
+ 160 009c 9091 0000 		lds r25,(_rtc_scale)+1
+ 161 00a0 2817      		cp r18,r24
+ 162 00a2 3907      		cpc r19,r25
+ 163 00a4 01F4      		brne .L13
+ 164               	.LM18:
+ 165 00a6 8091 0000 		lds r24,_rtc_val
+ 166 00aa 9091 0000 		lds r25,(_rtc_val)+1
+ 167 00ae 0196      		adiw r24,1
+ 168 00b0 9093 0000 		sts (_rtc_val)+1,r25
+ 169 00b4 8093 0000 		sts _rtc_val,r24
+ 170               	.LM19:
+ 171 00b8 E091 0000 		lds r30,_rtc_f
+ 172 00bc F091 0000 		lds r31,(_rtc_f)+1
+ 173 00c0 3097      		sbiw r30,0
+ 174 00c2 01F0      		breq .L15
+ 175               	.LM20:
+ 176 00c4 0995      		icall
+ 177               	.L15:
+ 178               	.LM21:
+ 179 00c6 1092 0000 		sts (_rtc_pulse)+1,__zero_reg__
+ 180 00ca 1092 0000 		sts _rtc_pulse,__zero_reg__
+ 181               	.L13:
+ 182               	.LM22:
+ 183 00ce 8091 0000 		lds r24,_rtc_pulse
+ 184 00d2 9091 0000 		lds r25,(_rtc_pulse)+1
+ 185 00d6 0196      		adiw r24,1
+ 186 00d8 9093 0000 		sts (_rtc_pulse)+1,r25
+ 187 00dc 8093 0000 		sts _rtc_pulse,r24
+ 188               	/* epilogue: frame size=0 */
+ 189 00e0 FF91      		pop r31
+ 190 00e2 EF91      		pop r30
+ 191 00e4 BF91      		pop r27
+ 192 00e6 AF91      		pop r26
+ 193 00e8 9F91      		pop r25
+ 194 00ea 8F91      		pop r24
+ 195 00ec 7F91      		pop r23
+ 196 00ee 6F91      		pop r22
+ 197 00f0 5F91      		pop r21
+ 198 00f2 4F91      		pop r20
+ 199 00f4 3F91      		pop r19
+ 200 00f6 2F91      		pop r18
+ 201 00f8 0F90      		pop __tmp_reg__
+ 202 00fa 0FBE      		out __SREG__,__tmp_reg__
+ 203 00fc 0F90      		pop __tmp_reg__
+ 204 00fe 1F90      		pop __zero_reg__
+ 205 0100 1895      		reti
+ 206               	/* epilogue end (size=17) */
+ 207               	/* function __vector_26 size 74 (40) */
+ 208               	.LFE10:
+ 210               		.lcomm _rtc_pulse,2
+ 211               		.data
+ 214               	_rtc_scale:
+ 215 0000 2000      		.word	32
+ 216               		.lcomm _rtc_val,2
+ 217               		.lcomm _rtc_f,2
+ 274               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 time.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:20     .text:00000000 delay_ms
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:58     .text:0000001a rtc_init
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:216    .bss:00000004 _rtc_f
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:214    .data:00000000 _rtc_scale
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:102    .text:0000005a rtc_get
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:210    .bss:00000002 _rtc_val
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:118    .text:00000064 rtc_reset
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccxFkKMe.s:134    .text:0000006e __vector_26
+                             .bss:00000000 _rtc_pulse
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
Index: demos/hunter_prey_john/projects/libdragonfly/analog.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/analog.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/analog.lst	(revision 1694)
@@ -0,0 +1,413 @@
+   1               		.file	"analog.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	analog8
+  20               	analog8:
+  21               	.LFB8:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LVL0:
+  26               	.LM2:
+  27 0000 0097      		sbiw r24,0
+  28 0002 01F4      		brne .L2
+  29               	.LM3:
+  30 0004 80E0      		ldi r24,lo8(0)
+  31 0006 90E0      		ldi r25,hi8(0)
+  32               	.LVL1:
+  33 0008 0895      		ret
+  34               	.LVL2:
+  35               	.L2:
+  36               	.LM4:
+  37 000a 0197      		sbiw r24,1
+  38               	.LVL3:
+  39 000c FC01      		movw r30,r24
+  40 000e EE0F      		lsl r30
+  41 0010 FF1F      		rol r31
+  42 0012 E80F      		add r30,r24
+  43 0014 F91F      		adc r31,r25
+  44 0016 E050      		subi r30,lo8(-(an_val))
+  45 0018 F040      		sbci r31,hi8(-(an_val))
+  46 001a 8081      		ld r24,Z
+  47 001c 9927      		clr r25
+  48               	.LM5:
+  49 001e 0895      		ret
+  50               	/* epilogue: frame size=0 */
+  51               	/* epilogue: noreturn */
+  52               	/* epilogue end (size=0) */
+  53               	/* function analog8 size 16 (16) */
+  54               	.LFE8:
+  56               	.global	analog10
+  58               	analog10:
+  59               	.LFB9:
+  60               	.LM6:
+  61               	/* prologue: frame size=0 */
+  62               	/* prologue end (size=0) */
+  63               	.LVL4:
+  64               	.LM7:
+  65 0020 0097      		sbiw r24,0
+  66 0022 01F4      		brne .L7
+  67               	.LM8:
+  68 0024 80E0      		ldi r24,lo8(0)
+  69 0026 90E0      		ldi r25,hi8(0)
+  70               	.LVL5:
+  71 0028 0895      		ret
+  72               	.LVL6:
+  73               	.L7:
+  74               	.LM9:
+  75 002a 0197      		sbiw r24,1
+  76               	.LVL7:
+  77 002c FC01      		movw r30,r24
+  78 002e EE0F      		lsl r30
+  79 0030 FF1F      		rol r31
+  80 0032 E80F      		add r30,r24
+  81 0034 F91F      		adc r31,r25
+  82 0036 E050      		subi r30,lo8(-(an_val))
+  83 0038 F040      		sbci r31,hi8(-(an_val))
+  84 003a 8181      		ldd r24,Z+1
+  85 003c 9281      		ldd r25,Z+2
+  86               	.LM10:
+  87 003e 0895      		ret
+  88               	/* epilogue: frame size=0 */
+  89               	/* epilogue: noreturn */
+  90               	/* epilogue end (size=0) */
+  91               	/* function analog10 size 16 (16) */
+  92               	.LFE9:
+  94               	.global	analog_start_loop
+  96               	analog_start_loop:
+  97               	.LFB10:
+  98               	.LM11:
+  99               	/* prologue: frame size=0 */
+ 100               	/* prologue end (size=0) */
+ 101               	.LM12:
+ 102 0040 8091 0000 		lds r24,adc_loop_status
+ 103 0044 9091 0000 		lds r25,(adc_loop_status)+1
+ 104 0048 0197      		sbiw r24,1
+ 105 004a 01F0      		breq .L14
+ 106               	.LM13:
+ 107 004c 339A      		sbi 38-0x20,3
+ 108               	.LM14:
+ 109 004e 369A      		sbi 38-0x20,6
+ 110               	.LM15:
+ 111 0050 81E0      		ldi r24,lo8(1)
+ 112 0052 90E0      		ldi r25,hi8(1)
+ 113 0054 9093 0000 		sts (adc_loop_status)+1,r25
+ 114 0058 8093 0000 		sts adc_loop_status,r24
+ 115               	.L14:
+ 116 005c 0895      		ret
+ 117               	/* epilogue: frame size=0 */
+ 118               	/* epilogue: noreturn */
+ 119               	/* epilogue end (size=0) */
+ 120               	/* function analog_start_loop size 16 (16) */
+ 121               	.LFE10:
+ 123               	.global	analog_stop_loop
+ 125               	analog_stop_loop:
+ 126               	.LFB11:
+ 127               	.LM16:
+ 128               	/* prologue: frame size=0 */
+ 129               	/* prologue end (size=0) */
+ 130               	.LM17:
+ 131 005e 81E0      		ldi r24,lo8(1)
+ 132 0060 90E0      		ldi r25,hi8(1)
+ 133 0062 9093 0000 		sts (adc_sig_stop_loop)+1,r25
+ 134 0066 8093 0000 		sts adc_sig_stop_loop,r24
+ 135               	/* epilogue: frame size=0 */
+ 136 006a 0895      		ret
+ 137               	/* epilogue end (size=1) */
+ 138               	/* function analog_stop_loop size 7 (6) */
+ 139               	.LFE11:
+ 141               	.global	analog_loop_status
+ 143               	analog_loop_status:
+ 144               	.LFB12:
+ 145               	.LM18:
+ 146               	/* prologue: frame size=0 */
+ 147               	/* prologue end (size=0) */
+ 148               	.LM19:
+ 149 006c 8091 0000 		lds r24,adc_loop_status
+ 150 0070 9091 0000 		lds r25,(adc_loop_status)+1
+ 151               	/* epilogue: frame size=0 */
+ 152 0074 0895      		ret
+ 153               	/* epilogue end (size=1) */
+ 154               	/* function analog_loop_status size 5 (4) */
+ 155               	.LFE12:
+ 157               	.global	set_adc_mux
+ 159               	set_adc_mux:
+ 160               	.LFB16:
+ 161               	.LM20:
+ 162               	/* prologue: frame size=0 */
+ 163               	/* prologue end (size=0) */
+ 164               	.LVL8:
+ 165               	.LM21:
+ 166 0076 E5E6      		ldi r30,lo8(101)
+ 167 0078 F0E0      		ldi r31,hi8(101)
+ 168 007a 2081      		ld r18,Z
+ 169 007c AC01      		movw r20,r24
+ 170 007e 4370      		andi r20,lo8(3)
+ 171 0080 5070      		andi r21,hi8(3)
+ 172 0082 63E0      		ldi r22,3
+ 173 0084 440F      	1:	lsl r20
+ 174 0086 551F      		rol r21
+ 175 0088 6A95      		dec r22
+ 176 008a 01F4      		brne 1b
+ 177 008c 237E      		andi r18,lo8(-29)
+ 178 008e 8470      		andi r24,lo8(4)
+ 179               	.LVL9:
+ 180 0090 282B      		or r18,r24
+ 181 0092 242B      		or r18,r20
+ 182 0094 2083      		st Z,r18
+ 183               	/* epilogue: frame size=0 */
+ 184 0096 0895      		ret
+ 185               	/* epilogue end (size=1) */
+ 186               	/* function set_adc_mux size 17 (16) */
+ 187               	.LFE16:
+ 189               	.global	analog_get10
+ 191               	analog_get10:
+ 192               	.LFB14:
+ 193               	.LM22:
+ 194               	/* prologue: frame size=0 */
+ 195               	/* prologue end (size=0) */
+ 196               	.LVL10:
+ 197 0098 9C01      		movw r18,r24
+ 198               	.LVL11:
+ 199               	.L23:
+ 200               	.LM23:
+ 201 009a 3699      		sbic 38-0x20,6
+ 202 009c 00C0      		rjmp .L23
+ 203               	.LM24:
+ 204 009e 2730      		cpi r18,7
+ 205 00a0 3105      		cpc r19,__zero_reg__
+ 206 00a2 04F4      		brge .L25
+ 207               	.LVL12:
+ 208               	.LM25:
+ 209 00a4 822F      		mov r24,r18
+ 210               	.LVL13:
+ 211 00a6 805A      		subi r24,lo8(-(96))
+ 212 00a8 87B9      		out 39-0x20,r24
+ 213 00aa 00C0      		rjmp .L27
+ 214               	.LVL14:
+ 215               	.L25:
+ 216               	.LM26:
+ 217 00ac 87E6      		ldi r24,lo8(103)
+ 218 00ae 87B9      		out 39-0x20,r24
+ 219               	.LM27:
+ 220 00b0 C901      		movw r24,r18
+ 221 00b2 0897      		sbiw r24,8
+ 222 00b4 0E94 0000 		call set_adc_mux
+ 223               	.LVL15:
+ 224               	.L27:
+ 225               	.LM28:
+ 226 00b8 369A      		sbi 38-0x20,6
+ 227               	.L28:
+ 228               	.LM29:
+ 229 00ba 3699      		sbic 38-0x20,6
+ 230 00bc 00C0      		rjmp .L28
+ 231               	.LM30:
+ 232 00be 24B1      		in r18,36-0x20
+ 233               	.LM31:
+ 234 00c0 85B1      		in r24,37-0x20
+ 235 00c2 9927      		clr r25
+ 236 00c4 880F      		lsl r24
+ 237 00c6 991F      		rol r25
+ 238 00c8 880F      		lsl r24
+ 239 00ca 991F      		rol r25
+ 240 00cc 3327      		clr r19
+ 241 00ce 76E0      		ldi r23,6
+ 242 00d0 3595      	1:	asr r19
+ 243 00d2 2795      		ror r18
+ 244 00d4 7A95      		dec r23
+ 245 00d6 01F4      		brne 1b
+ 246               	.LM32:
+ 247 00d8 822B      		or r24,r18
+ 248 00da 932B      		or r25,r19
+ 249               	/* epilogue: frame size=0 */
+ 250 00dc 0895      		ret
+ 251               	/* epilogue end (size=1) */
+ 252               	/* function analog_get10 size 35 (34) */
+ 253               	.LFE14:
+ 255               	.global	analog_get8
+ 257               	analog_get8:
+ 258               	.LFB13:
+ 259               	.LM33:
+ 260               	/* prologue: frame size=0 */
+ 261               	/* prologue end (size=0) */
+ 262               	.LVL16:
+ 263 00de 9C01      		movw r18,r24
+ 264               	.LVL17:
+ 265               	.L37:
+ 266               	.LM34:
+ 267 00e0 3699      		sbic 38-0x20,6
+ 268 00e2 00C0      		rjmp .L37
+ 269               	.LM35:
+ 270 00e4 2730      		cpi r18,7
+ 271 00e6 3105      		cpc r19,__zero_reg__
+ 272 00e8 04F4      		brge .L39
+ 273               	.LVL18:
+ 274               	.LM36:
+ 275 00ea 822F      		mov r24,r18
+ 276               	.LVL19:
+ 277 00ec 805A      		subi r24,lo8(-(96))
+ 278 00ee 87B9      		out 39-0x20,r24
+ 279 00f0 00C0      		rjmp .L41
+ 280               	.LVL20:
+ 281               	.L39:
+ 282               	.LM37:
+ 283 00f2 87E6      		ldi r24,lo8(103)
+ 284 00f4 87B9      		out 39-0x20,r24
+ 285               	.LM38:
+ 286 00f6 C901      		movw r24,r18
+ 287 00f8 0897      		sbiw r24,8
+ 288 00fa 0E94 0000 		call set_adc_mux
+ 289               	.LVL21:
+ 290               	.L41:
+ 291               	.LM39:
+ 292 00fe 369A      		sbi 38-0x20,6
+ 293               	.L42:
+ 294               	.LM40:
+ 295 0100 3699      		sbic 38-0x20,6
+ 296 0102 00C0      		rjmp .L42
+ 297               	.LM41:
+ 298 0104 85B1      		in r24,37-0x20
+ 299               	.LM42:
+ 300 0106 9927      		clr r25
+ 301               	/* epilogue: frame size=0 */
+ 302 0108 0895      		ret
+ 303               	/* epilogue end (size=1) */
+ 304               	/* function analog_get8 size 22 (21) */
+ 305               	.LFE13:
+ 307               	.global	wheel
+ 309               	wheel:
+ 310               	.LFB15:
+ 311               	.LM43:
+ 312               	/* prologue: frame size=0 */
+ 313               	/* prologue end (size=0) */
+ 314               	.LM44:
+ 315 010a 8AE0      		ldi r24,lo8(10)
+ 316 010c 90E0      		ldi r25,hi8(10)
+ 317 010e 0E94 0000 		call analog_get8
+ 318               	/* epilogue: frame size=0 */
+ 319 0112 0895      		ret
+ 320               	/* epilogue end (size=1) */
+ 321               	/* function wheel size 5 (4) */
+ 322               	.LFE15:
+ 324               	.global	analog_init
+ 326               	analog_init:
+ 327               	.LFB7:
+ 328               	.LM45:
+ 329               	/* prologue: frame size=0 */
+ 330               	/* prologue end (size=0) */
+ 331               	.LVL22:
+ 332 0114 E0E0      		ldi r30,lo8(an_val)
+ 333 0116 F0E0      		ldi r31,hi8(an_val)
+ 334               	.L52:
+ 335               	.LBB2:
+ 336               	.LM46:
+ 337 0118 1282      		std Z+2,__zero_reg__
+ 338 011a 1182      		std Z+1,__zero_reg__
+ 339               	.LM47:
+ 340 011c 1082      		st Z,__zero_reg__
+ 341               	.LM48:
+ 342 011e 3396      		adiw r30,3
+ 343 0120 80E0      		ldi r24,hi8(an_val+33)
+ 344 0122 E030      		cpi r30,lo8(an_val+33)
+ 345 0124 F807      		cpc r31,r24
+ 346               	.LVL23:
+ 347 0126 01F4      		brne .L52
+ 348               	.LBE2:
+ 349               	.LM49:
+ 350 0128 17B8      		out 39-0x20,__zero_reg__
+ 351               	.LM50:
+ 352 012a 87B1      		in r24,39-0x20
+ 353 012c 8166      		ori r24,lo8(97)
+ 354 012e 87B9      		out 39-0x20,r24
+ 355               	.LM51:
+ 356 0130 16B8      		out 38-0x20,__zero_reg__
+ 357               	.LM52:
+ 358 0132 86B1      		in r24,38-0x20
+ 359 0134 8168      		ori r24,lo8(-127)
+ 360 0136 86B9      		out 38-0x20,r24
+ 361               	.LM53:
+ 362 0138 8091 6400 		lds r24,100
+ 363 013c 8C61      		ori r24,lo8(28)
+ 364 013e 8093 6400 		sts 100,r24
+ 365               	.LM54:
+ 366 0142 80E0      		ldi r24,lo8(0)
+ 367 0144 90E0      		ldi r25,hi8(0)
+ 368 0146 0E94 0000 		call set_adc_mux
+ 369               	.LM55:
+ 370 014a 81E0      		ldi r24,lo8(1)
+ 371 014c 90E0      		ldi r25,hi8(1)
+ 372 014e 9093 0000 		sts (adc_current_port)+1,r25
+ 373 0152 8093 0000 		sts adc_current_port,r24
+ 374               	/* epilogue: frame size=0 */
+ 375 0156 0895      		ret
+ 376               	/* epilogue end (size=1) */
+ 377               	/* function analog_init size 34 (33) */
+ 378               	.LFE7:
+ 380               	.global	__vector_21
+ 382               	__vector_21:
+ 383               	.LFB17:
+ 384               	.LM56:
+ 385               	/* prologue: frame size=0 */
+ 386 0158 1F92      		push __zero_reg__
+ 387 015a 0F92      		push __tmp_reg__
+ 388 015c 0FB6      		in __tmp_reg__,__SREG__
+ 389 015e 0F92      		push __tmp_reg__
+ 390 0160 1124      		clr __zero_reg__
+ 391               	/* prologue end (size=5) */
+ 392               	/* epilogue: frame size=0 */
+ 393 0162 0F90      		pop __tmp_reg__
+ 394 0164 0FBE      		out __SREG__,__tmp_reg__
+ 395 0166 0F90      		pop __tmp_reg__
+ 396 0168 1F90      		pop __zero_reg__
+ 397 016a 1895      		reti
+ 398               	/* epilogue end (size=5) */
+ 399               	/* function __vector_21 size 10 (0) */
+ 400               	.LFE17:
+ 402               	.global	adc_loop_status
+ 403               	.global	adc_loop_status
+ 404               		.section .bss
+ 407               	adc_loop_status:
+ 408 0000 0000      		.skip 2,0
+ 409               	.global	adc_sig_stop_loop
+ 410               	.global	adc_sig_stop_loop
+ 413               	adc_sig_stop_loop:
+ 414 0002 0000      		.skip 2,0
+ 415               	.global	adc_current_port
+ 416               	.global	adc_current_port
+ 419               	adc_current_port:
+ 420 0004 0000      		.skip 2,0
+ 421               		.comm an_val,33,1
+ 526               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 analog.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:20     .text:00000000 analog8
+                            *COM*:00000021 an_val
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:58     .text:00000020 analog10
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:96     .text:00000040 analog_start_loop
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:407    .bss:00000000 adc_loop_status
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:125    .text:0000005e analog_stop_loop
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:413    .bss:00000002 adc_sig_stop_loop
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:143    .text:0000006c analog_loop_status
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:159    .text:00000076 set_adc_mux
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:191    .text:00000098 analog_get10
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:257    .text:000000de analog_get8
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:309    .text:0000010a wheel
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:326    .text:00000114 analog_init
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:419    .bss:00000004 adc_current_port
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc1rZiJp.s:382    .text:00000158 __vector_21
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
Index: demos/hunter_prey_john/projects/libdragonfly/encoders.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/encoders.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/encoders.lst	(revision 1694)
@@ -0,0 +1,1283 @@
+   1               		.file	"encoders.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	encoder_read
+  20               	encoder_read:
+  21               	.LFB4:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LVL0:
+  26               	.LM2:
+  27 0000 8823      		tst r24
+  28 0002 01F4      		brne .L2
+  29               	.LM3:
+  30 0004 8091 0000 		lds r24,left_data
+  31 0008 9091 0000 		lds r25,(left_data)+1
+  32               	.LVL1:
+  33 000c 0895      		ret
+  34               	.LVL2:
+  35               	.L2:
+  36               	.LM4:
+  37 000e 8130      		cpi r24,lo8(1)
+  38 0010 01F0      		breq .L5
+  39 0012 8FEF      		ldi r24,lo8(-1)
+  40 0014 9FEF      		ldi r25,hi8(-1)
+  41               	.LVL3:
+  42 0016 0895      		ret
+  43               	.LVL4:
+  44               	.L5:
+  45 0018 8091 0000 		lds r24,right_data
+  46 001c 9091 0000 		lds r25,(right_data)+1
+  47               	.LVL5:
+  48               	.LM5:
+  49 0020 0895      		ret
+  50               	/* epilogue: frame size=0 */
+  51               	/* epilogue: noreturn */
+  52               	/* epilogue end (size=0) */
+  53               	/* function encoder_read size 17 (17) */
+  54               	.LFE4:
+  56               	.global	encoder_get_dx
+  58               	encoder_get_dx:
+  59               	.LFB6:
+  60               	.LM6:
+  61               	/* prologue: frame size=0 */
+  62               	/* prologue end (size=0) */
+  63               	.LVL6:
+  64               	.LM7:
+  65 0022 8823      		tst r24
+  66 0024 01F4      		brne .L9
+  67               	.LM8:
+  68 0026 8091 0000 		lds r24,left_dx
+  69 002a 9091 0000 		lds r25,(left_dx)+1
+  70               	.LVL7:
+  71 002e 0895      		ret
+  72               	.LVL8:
+  73               	.L9:
+  74               	.LM9:
+  75 0030 8130      		cpi r24,lo8(1)
+  76 0032 01F0      		breq .L12
+  77 0034 8FEF      		ldi r24,lo8(-1)
+  78 0036 9FEF      		ldi r25,hi8(-1)
+  79               	.LVL9:
+  80 0038 0895      		ret
+  81               	.LVL10:
+  82               	.L12:
+  83 003a 8091 0000 		lds r24,right_dx
+  84 003e 9091 0000 		lds r25,(right_dx)+1
+  85               	.LVL11:
+  86               	.LM10:
+  87 0042 0895      		ret
+  88               	/* epilogue: frame size=0 */
+  89               	/* epilogue: noreturn */
+  90               	/* epilogue end (size=0) */
+  91               	/* function encoder_get_dx size 17 (17) */
+  92               	.LFE6:
+  94               	.global	encoder_rst_dx
+  96               	encoder_rst_dx:
+  97               	.LFB8:
+  98               	.LM11:
+  99               	/* prologue: frame size=0 */
+ 100               	/* prologue end (size=0) */
+ 101               	.LVL12:
+ 102               	.LM12:
+ 103 0044 8823      		tst r24
+ 104 0046 01F4      		brne .L16
+ 105               	.LM13:
+ 106 0048 1092 0000 		sts (left_dx)+1,__zero_reg__
+ 107 004c 1092 0000 		sts left_dx,__zero_reg__
+ 108 0050 0895      		ret
+ 109               	.L16:
+ 110               	.LM14:
+ 111 0052 8130      		cpi r24,lo8(1)
+ 112 0054 01F4      		brne .L20
+ 113 0056 1092 0000 		sts (right_dx)+1,__zero_reg__
+ 114 005a 1092 0000 		sts right_dx,__zero_reg__
+ 115               	.L20:
+ 116 005e 0895      		ret
+ 117               	/* epilogue: frame size=0 */
+ 118               	/* epilogue: noreturn */
+ 119               	/* epilogue end (size=0) */
+ 120               	/* function encoder_rst_dx size 14 (14) */
+ 121               	.LFE8:
+ 123               	.global	encoder_get_tc
+ 125               	encoder_get_tc:
+ 126               	.LFB9:
+ 127               	.LM15:
+ 128               	/* prologue: frame size=0 */
+ 129               	/* prologue end (size=0) */
+ 130               	.LM16:
+ 131 0060 8091 0000 		lds r24,timecount
+ 132 0064 9091 0000 		lds r25,(timecount)+1
+ 133               	/* epilogue: frame size=0 */
+ 134 0068 0895      		ret
+ 135               	/* epilogue end (size=1) */
+ 136               	/* function encoder_get_tc size 5 (4) */
+ 137               	.LFE9:
+ 139               	.global	encoder_rst_tc
+ 141               	encoder_rst_tc:
+ 142               	.LFB10:
+ 143               	.LM17:
+ 144               	/* prologue: frame size=0 */
+ 145               	/* prologue end (size=0) */
+ 146               	.LM18:
+ 147 006a 1092 0000 		sts timecount,__zero_reg__
+ 148 006e 1092 0000 		sts (timecount)+1,__zero_reg__
+ 149 0072 1092 0000 		sts (timecount)+2,__zero_reg__
+ 150 0076 1092 0000 		sts (timecount)+3,__zero_reg__
+ 151               	/* epilogue: frame size=0 */
+ 152 007a 0895      		ret
+ 153               	/* epilogue end (size=1) */
+ 154               	/* function encoder_rst_tc size 9 (8) */
+ 155               	.LFE10:
+ 157               	.global	encoder_wait
+ 159               	encoder_wait:
+ 160               	.LFB11:
+ 161               	.LM19:
+ 162               	/* prologue: frame size=0 */
+ 163               	/* prologue end (size=0) */
+ 164               	.LVL13:
+ 165 007c 9C01      		movw r18,r24
+ 166               	.LVL14:
+ 167               	.L27:
+ 168               	.LM20:
+ 169 007e 8091 0000 		lds r24,data_ready
+ 170 0082 9091 0000 		lds r25,(data_ready)+1
+ 171 0086 8217      		cp r24,r18
+ 172 0088 9307      		cpc r25,r19
+ 173 008a 04F0      		brlt .L27
+ 174               	.LM21:
+ 175 008c 1092 0000 		sts (data_ready)+1,__zero_reg__
+ 176 0090 1092 0000 		sts data_ready,__zero_reg__
+ 177               	/* epilogue: frame size=0 */
+ 178 0094 0895      		ret
+ 179               	/* epilogue end (size=1) */
+ 180               	/* function encoder_wait size 13 (12) */
+ 181               	.LFE11:
+ 183               	.global	left_data_array_put
+ 185               	left_data_array_put:
+ 186               	.LFB13:
+ 187               	.LM22:
+ 188               	/* prologue: frame size=0 */
+ 189               	/* prologue end (size=0) */
+ 190               	.LVL15:
+ 191               	.LM23:
+ 192 0096 2091 0000 		lds r18,left_data_idx
+ 193 009a 3091 0000 		lds r19,(left_data_idx)+1
+ 194 009e 2D32      		cpi r18,45
+ 195 00a0 3105      		cpc r19,__zero_reg__
+ 196 00a2 01F4      		brne .L33
+ 197               	.LM24:
+ 198 00a4 1092 0000 		sts (left_data_idx)+1,__zero_reg__
+ 199 00a8 1092 0000 		sts left_data_idx,__zero_reg__
+ 200 00ac 00C0      		rjmp .L35
+ 201               	.L33:
+ 202               	.LM25:
+ 203 00ae 2F5F      		subi r18,lo8(-(1))
+ 204 00b0 3F4F      		sbci r19,hi8(-(1))
+ 205 00b2 3093 0000 		sts (left_data_idx)+1,r19
+ 206 00b6 2093 0000 		sts left_data_idx,r18
+ 207               	.L35:
+ 208               	.LM26:
+ 209 00ba E091 0000 		lds r30,left_data_idx
+ 210 00be F091 0000 		lds r31,(left_data_idx)+1
+ 211 00c2 EE0F      		lsl r30
+ 212 00c4 FF1F      		rol r31
+ 213 00c6 E050      		subi r30,lo8(-(left_data_array))
+ 214 00c8 F040      		sbci r31,hi8(-(left_data_array))
+ 215 00ca 9183      		std Z+1,r25
+ 216 00cc 8083      		st Z,r24
+ 217               	/* epilogue: frame size=0 */
+ 218 00ce 0895      		ret
+ 219               	/* epilogue end (size=1) */
+ 220               	/* function left_data_array_put size 29 (28) */
+ 221               	.LFE13:
+ 223               	.global	left_data_array_top
+ 225               	left_data_array_top:
+ 226               	.LFB14:
+ 227               	.LM27:
+ 228               	/* prologue: frame size=0 */
+ 229               	/* prologue end (size=0) */
+ 230 00d0 E091 0000 		lds r30,left_data_idx
+ 231 00d4 F091 0000 		lds r31,(left_data_idx)+1
+ 232 00d8 EE0F      		lsl r30
+ 233 00da FF1F      		rol r31
+ 234 00dc E050      		subi r30,lo8(-(left_data_array))
+ 235 00de F040      		sbci r31,hi8(-(left_data_array))
+ 236               	.LM28:
+ 237 00e0 8081      		ld r24,Z
+ 238 00e2 9181      		ldd r25,Z+1
+ 239               	/* epilogue: frame size=0 */
+ 240 00e4 0895      		ret
+ 241               	/* epilogue end (size=1) */
+ 242               	/* function left_data_array_top size 11 (10) */
+ 243               	.LFE14:
+ 245               	.global	left_data_array_prev
+ 247               	left_data_array_prev:
+ 248               	.LFB15:
+ 249               	.LM29:
+ 250               	/* prologue: frame size=0 */
+ 251               	/* prologue end (size=0) */
+ 252               	.LM30:
+ 253 00e6 E091 0000 		lds r30,left_data_idx
+ 254 00ea F091 0000 		lds r31,(left_data_idx)+1
+ 255 00ee 3097      		sbiw r30,0
+ 256 00f0 01F4      		brne .L40
+ 257               	.LM31:
+ 258 00f2 8091 0000 		lds r24,left_data_array+90
+ 259 00f6 9091 0000 		lds r25,(left_data_array+90)+1
+ 260 00fa 0895      		ret
+ 261               	.L40:
+ 262               	.LM32:
+ 263 00fc EE0F      		lsl r30
+ 264 00fe FF1F      		rol r31
+ 265 0100 E050      		subi r30,lo8(-(left_data_array-2))
+ 266 0102 F040      		sbci r31,hi8(-(left_data_array-2))
+ 267 0104 8081      		ld r24,Z
+ 268 0106 9181      		ldd r25,Z+1
+ 269               	.LM33:
+ 270 0108 0895      		ret
+ 271               	/* epilogue: frame size=0 */
+ 272               	/* epilogue: noreturn */
+ 273               	/* epilogue end (size=0) */
+ 274               	/* function left_data_array_prev size 18 (18) */
+ 275               	.LFE15:
+ 277               	.global	left_data_array_bottom
+ 279               	left_data_array_bottom:
+ 280               	.LFB16:
+ 281               	.LM34:
+ 282               	/* prologue: frame size=0 */
+ 283               	/* prologue end (size=0) */
+ 284               	.LM35:
+ 285 010a E091 0000 		lds r30,left_data_idx
+ 286 010e F091 0000 		lds r31,(left_data_idx)+1
+ 287 0112 ED32      		cpi r30,45
+ 288 0114 F105      		cpc r31,__zero_reg__
+ 289 0116 01F4      		brne .L45
+ 290               	.LM36:
+ 291 0118 8091 0000 		lds r24,left_data_array
+ 292 011c 9091 0000 		lds r25,(left_data_array)+1
+ 293 0120 0895      		ret
+ 294               	.L45:
+ 295               	.LM37:
+ 296 0122 EE0F      		lsl r30
+ 297 0124 FF1F      		rol r31
+ 298 0126 E050      		subi r30,lo8(-(left_data_array))
+ 299 0128 F040      		sbci r31,hi8(-(left_data_array))
+ 300 012a 8281      		ldd r24,Z+2
+ 301 012c 9381      		ldd r25,Z+3
+ 302               	.LM38:
+ 303 012e 0895      		ret
+ 304               	/* epilogue: frame size=0 */
+ 305               	/* epilogue: noreturn */
+ 306               	/* epilogue end (size=0) */
+ 307               	/* function left_data_array_bottom size 19 (19) */
+ 308               	.LFE16:
+ 310               	.global	right_data_array_put
+ 312               	right_data_array_put:
+ 313               	.LFB17:
+ 314               	.LM39:
+ 315               	/* prologue: frame size=0 */
+ 316               	/* prologue end (size=0) */
+ 317               	.LVL16:
+ 318               	.LM40:
+ 319 0130 2091 0000 		lds r18,right_data_idx
+ 320 0134 3091 0000 		lds r19,(right_data_idx)+1
+ 321 0138 2D32      		cpi r18,45
+ 322 013a 3105      		cpc r19,__zero_reg__
+ 323 013c 01F4      		brne .L50
+ 324               	.LM41:
+ 325 013e 1092 0000 		sts (right_data_idx)+1,__zero_reg__
+ 326 0142 1092 0000 		sts right_data_idx,__zero_reg__
+ 327 0146 00C0      		rjmp .L52
+ 328               	.L50:
+ 329               	.LM42:
+ 330 0148 2F5F      		subi r18,lo8(-(1))
+ 331 014a 3F4F      		sbci r19,hi8(-(1))
+ 332 014c 3093 0000 		sts (right_data_idx)+1,r19
+ 333 0150 2093 0000 		sts right_data_idx,r18
+ 334               	.L52:
+ 335               	.LM43:
+ 336 0154 E091 0000 		lds r30,right_data_idx
+ 337 0158 F091 0000 		lds r31,(right_data_idx)+1
+ 338 015c EE0F      		lsl r30
+ 339 015e FF1F      		rol r31
+ 340 0160 E050      		subi r30,lo8(-(right_data_array))
+ 341 0162 F040      		sbci r31,hi8(-(right_data_array))
+ 342 0164 9183      		std Z+1,r25
+ 343 0166 8083      		st Z,r24
+ 344               	/* epilogue: frame size=0 */
+ 345 0168 0895      		ret
+ 346               	/* epilogue end (size=1) */
+ 347               	/* function right_data_array_put size 29 (28) */
+ 348               	.LFE17:
+ 350               	.global	right_data_array_top
+ 352               	right_data_array_top:
+ 353               	.LFB18:
+ 354               	.LM44:
+ 355               	/* prologue: frame size=0 */
+ 356               	/* prologue end (size=0) */
+ 357 016a E091 0000 		lds r30,right_data_idx
+ 358 016e F091 0000 		lds r31,(right_data_idx)+1
+ 359 0172 EE0F      		lsl r30
+ 360 0174 FF1F      		rol r31
+ 361 0176 E050      		subi r30,lo8(-(right_data_array))
+ 362 0178 F040      		sbci r31,hi8(-(right_data_array))
+ 363               	.LM45:
+ 364 017a 8081      		ld r24,Z
+ 365 017c 9181      		ldd r25,Z+1
+ 366               	/* epilogue: frame size=0 */
+ 367 017e 0895      		ret
+ 368               	/* epilogue end (size=1) */
+ 369               	/* function right_data_array_top size 11 (10) */
+ 370               	.LFE18:
+ 372               	.global	right_data_array_prev
+ 374               	right_data_array_prev:
+ 375               	.LFB19:
+ 376               	.LM46:
+ 377               	/* prologue: frame size=0 */
+ 378               	/* prologue end (size=0) */
+ 379               	.LM47:
+ 380 0180 E091 0000 		lds r30,right_data_idx
+ 381 0184 F091 0000 		lds r31,(right_data_idx)+1
+ 382 0188 3097      		sbiw r30,0
+ 383 018a 01F4      		brne .L57
+ 384               	.LM48:
+ 385 018c 8091 0000 		lds r24,right_data_array+90
+ 386 0190 9091 0000 		lds r25,(right_data_array+90)+1
+ 387 0194 0895      		ret
+ 388               	.L57:
+ 389               	.LM49:
+ 390 0196 EE0F      		lsl r30
+ 391 0198 FF1F      		rol r31
+ 392 019a E050      		subi r30,lo8(-(right_data_array-2))
+ 393 019c F040      		sbci r31,hi8(-(right_data_array-2))
+ 394 019e 8081      		ld r24,Z
+ 395 01a0 9181      		ldd r25,Z+1
+ 396               	.LM50:
+ 397 01a2 0895      		ret
+ 398               	/* epilogue: frame size=0 */
+ 399               	/* epilogue: noreturn */
+ 400               	/* epilogue end (size=0) */
+ 401               	/* function right_data_array_prev size 18 (18) */
+ 402               	.LFE19:
+ 404               	.global	right_data_array_bottom
+ 406               	right_data_array_bottom:
+ 407               	.LFB20:
+ 408               	.LM51:
+ 409               	/* prologue: frame size=0 */
+ 410               	/* prologue end (size=0) */
+ 411               	.LM52:
+ 412 01a4 E091 0000 		lds r30,right_data_idx
+ 413 01a8 F091 0000 		lds r31,(right_data_idx)+1
+ 414 01ac ED32      		cpi r30,45
+ 415 01ae F105      		cpc r31,__zero_reg__
+ 416 01b0 01F4      		brne .L62
+ 417               	.LM53:
+ 418 01b2 8091 0000 		lds r24,right_data_array
+ 419 01b6 9091 0000 		lds r25,(right_data_array)+1
+ 420 01ba 0895      		ret
+ 421               	.L62:
+ 422               	.LM54:
+ 423 01bc EE0F      		lsl r30
+ 424 01be FF1F      		rol r31
+ 425 01c0 E050      		subi r30,lo8(-(right_data_array))
+ 426 01c2 F040      		sbci r31,hi8(-(right_data_array))
+ 427 01c4 8281      		ldd r24,Z+2
+ 428 01c6 9381      		ldd r25,Z+3
+ 429               	.LM55:
+ 430 01c8 0895      		ret
+ 431               	/* epilogue: frame size=0 */
+ 432               	/* epilogue: noreturn */
+ 433               	/* epilogue end (size=0) */
+ 434               	/* function right_data_array_bottom size 19 (19) */
+ 435               	.LFE20:
+ 437               	.global	left_data_at
+ 439               	left_data_at:
+ 440               	.LFB21:
+ 441               	.LM56:
+ 442               	/* prologue: frame size=0 */
+ 443               	/* prologue end (size=0) */
+ 444               	.LVL17:
+ 445               	.LM57:
+ 446 01ca E091 0000 		lds r30,left_data_idx
+ 447 01ce F091 0000 		lds r31,(left_data_idx)+1
+ 448               	.LVL18:
+ 449 01d2 E81B      		sub r30,r24
+ 450 01d4 F90B      		sbc r31,r25
+ 451               	.LM58:
+ 452 01d6 F7FD      		sbrc r31,7
+ 453               	.LM59:
+ 454 01d8 BE96      		adiw r30,46
+ 455               	.L67:
+ 456 01da EE0F      		lsl r30
+ 457 01dc FF1F      		rol r31
+ 458               	.LVL19:
+ 459 01de E050      		subi r30,lo8(-(left_data_array))
+ 460 01e0 F040      		sbci r31,hi8(-(left_data_array))
+ 461               	.LM60:
+ 462 01e2 8081      		ld r24,Z
+ 463 01e4 9181      		ldd r25,Z+1
+ 464               	/* epilogue: frame size=0 */
+ 465 01e6 0895      		ret
+ 466               	/* epilogue end (size=1) */
+ 467               	/* function left_data_at size 16 (15) */
+ 468               	.LFE21:
+ 470               	.global	right_data_at
+ 472               	right_data_at:
+ 473               	.LFB22:
+ 474               	.LM61:
+ 475               	/* prologue: frame size=0 */
+ 476               	/* prologue end (size=0) */
+ 477               	.LVL20:
+ 478               	.LM62:
+ 479 01e8 E091 0000 		lds r30,right_data_idx
+ 480 01ec F091 0000 		lds r31,(right_data_idx)+1
+ 481               	.LVL21:
+ 482 01f0 E81B      		sub r30,r24
+ 483 01f2 F90B      		sbc r31,r25
+ 484               	.LM63:
+ 485 01f4 F7FD      		sbrc r31,7
+ 486               	.LM64:
+ 487 01f6 BE96      		adiw r30,46
+ 488               	.L71:
+ 489 01f8 EE0F      		lsl r30
+ 490 01fa FF1F      		rol r31
+ 491 01fc E050      		subi r30,lo8(-(right_data_array))
+ 492 01fe F040      		sbci r31,hi8(-(right_data_array))
+ 493               	.LM65:
+ 494 0200 8081      		ld r24,Z
+ 495 0202 9181      		ldd r25,Z+1
+ 496               	.LVL22:
+ 497               	/* epilogue: frame size=0 */
+ 498 0204 0895      		ret
+ 499               	/* epilogue end (size=1) */
+ 500               	/* function right_data_at size 16 (15) */
+ 501               	.LFE22:
+ 503               	.global	get_dx
+ 505               	get_dx:
+ 506               	.LFB23:
+ 507               	.LM66:
+ 508               	/* prologue: frame size=0 */
+ 509 0206 FF92      		push r15
+ 510 0208 0F93      		push r16
+ 511 020a 1F93      		push r17
+ 512 020c CF93      		push r28
+ 513 020e DF93      		push r29
+ 514               	/* prologue end (size=5) */
+ 515               	.LVL23:
+ 516 0210 F82E      		mov r15,r24
+ 517 0212 8091 0000 		lds r24,left_data_idx
+ 518 0216 9091 0000 		lds r25,(left_data_idx)+1
+ 519               	.LVL24:
+ 520 021a 861B      		sub r24,r22
+ 521 021c 970B      		sbc r25,r23
+ 522 021e EC01      		movw r28,r24
+ 523 0220 A697      		sbiw r28,38
+ 524 0222 DC01      		movw r26,r24
+ 525 0224 8091 0000 		lds r24,right_data_idx
+ 526 0228 9091 0000 		lds r25,(right_data_idx)+1
+ 527 022c 861B      		sub r24,r22
+ 528 022e 970B      		sbc r25,r23
+ 529 0230 BC01      		movw r22,r24
+ 530               	.LVL25:
+ 531 0232 6652      		subi r22,lo8(-(-38))
+ 532 0234 7040      		sbci r23,hi8(-(-38))
+ 533 0236 AC01      		movw r20,r24
+ 534 0238 00E0      		ldi r16,lo8(0)
+ 535 023a 10E0      		ldi r17,hi8(0)
+ 536               	.LVL26:
+ 537               	.LVL27:
+ 538               	.L75:
+ 539               	.LM67:
+ 540 023c FF20      		tst r15
+ 541 023e 01F4      		brne .L76
+ 542 0240 FD01      		movw r30,r26
+ 543               	.LVL28:
+ 544               	.LBB10:
+ 545               	.LBB11:
+ 546               	.LM68:
+ 547 0242 B7FD      		sbrc r27,7
+ 548 0244 BE96      		adiw r30,46
+ 549               	.L78:
+ 550               	.LM69:
+ 551 0246 EE0F      		lsl r30
+ 552 0248 FF1F      		rol r31
+ 553 024a E050      		subi r30,lo8(-(left_data_array))
+ 554 024c F040      		sbci r31,hi8(-(left_data_array))
+ 555 024e 2081      		ld r18,Z
+ 556 0250 3181      		ldd r19,Z+1
+ 557               	.LVL29:
+ 558 0252 FE01      		movw r30,r28
+ 559               	.LVL30:
+ 560               	.LBE11:
+ 561               	.LBE10:
+ 562               	.LBB12:
+ 563               	.LBB13:
+ 564               	.LM70:
+ 565 0254 D7FF      		sbrs r29,7
+ 566 0256 00C0      		rjmp .L80
+ 567 0258 FD01      		movw r30,r26
+ 568 025a 3896      		adiw r30,8
+ 569               	.L80:
+ 570               	.LBE13:
+ 571               	.LBE12:
+ 572               	.LM71:
+ 573 025c EE0F      		lsl r30
+ 574 025e FF1F      		rol r31
+ 575 0260 E050      		subi r30,lo8(-(left_data_array))
+ 576 0262 F040      		sbci r31,hi8(-(left_data_array))
+ 577 0264 00C0      		rjmp .L93
+ 578               	.LVL31:
+ 579               	.L76:
+ 580 0266 FA01      		movw r30,r20
+ 581               	.LVL32:
+ 582               	.LBB14:
+ 583               	.LBB15:
+ 584               	.LM72:
+ 585 0268 57FD      		sbrc r21,7
+ 586 026a BE96      		adiw r30,46
+ 587               	.L83:
+ 588               	.LM73:
+ 589 026c EE0F      		lsl r30
+ 590 026e FF1F      		rol r31
+ 591 0270 E050      		subi r30,lo8(-(right_data_array))
+ 592 0272 F040      		sbci r31,hi8(-(right_data_array))
+ 593 0274 2081      		ld r18,Z
+ 594 0276 3181      		ldd r19,Z+1
+ 595               	.LVL33:
+ 596 0278 FB01      		movw r30,r22
+ 597               	.LVL34:
+ 598               	.LBE15:
+ 599               	.LBE14:
+ 600               	.LBB16:
+ 601               	.LBB17:
+ 602               	.LM74:
+ 603 027a 77FF      		sbrs r23,7
+ 604 027c 00C0      		rjmp .L85
+ 605 027e FA01      		movw r30,r20
+ 606 0280 3896      		adiw r30,8
+ 607               	.L85:
+ 608               	.LBE17:
+ 609               	.LBE16:
+ 610               	.LM75:
+ 611 0282 EE0F      		lsl r30
+ 612 0284 FF1F      		rol r31
+ 613 0286 E050      		subi r30,lo8(-(right_data_array))
+ 614 0288 F040      		sbci r31,hi8(-(right_data_array))
+ 615               	.LVL35:
+ 616               	.L93:
+ 617               	.LVL36:
+ 618 028a 8081      		ld r24,Z
+ 619 028c 9181      		ldd r25,Z+1
+ 620 028e 281B      		sub r18,r24
+ 621 0290 390B      		sbc r19,r25
+ 622               	.LVL37:
+ 623               	.LM76:
+ 624 0292 C901      		movw r24,r18
+ 625 0294 4E96      		adiw r24,30
+ 626 0296 CD97      		sbiw r24,61
+ 627 0298 00F0      		brlo .L87
+ 628               	.LM77:
+ 629 029a 0F5F      		subi r16,lo8(-(1))
+ 630 029c 1F4F      		sbci r17,hi8(-(1))
+ 631 029e 2197      		sbiw r28,1
+ 632 02a0 1197      		sbiw r26,1
+ 633 02a2 6150      		subi r22,lo8(-(-1))
+ 634 02a4 7040      		sbci r23,hi8(-(-1))
+ 635 02a6 4150      		subi r20,lo8(-(-1))
+ 636 02a8 5040      		sbci r21,hi8(-(-1))
+ 637               	.LM78:
+ 638 02aa 0330      		cpi r16,3
+ 639 02ac 1105      		cpc r17,__zero_reg__
+ 640 02ae 01F4      		brne .L75
+ 641 02b0 20E0      		ldi r18,lo8(1024)
+ 642 02b2 34E0      		ldi r19,hi8(1024)
+ 643               	.L87:
+ 644               	.LM79:
+ 645 02b4 C901      		movw r24,r18
+ 646               	/* epilogue: frame size=0 */
+ 647 02b6 DF91      		pop r29
+ 648 02b8 CF91      		pop r28
+ 649 02ba 1F91      		pop r17
+ 650 02bc 0F91      		pop r16
+ 651 02be FF90      		pop r15
+ 652 02c0 0895      		ret
+ 653               	/* epilogue end (size=6) */
+ 654               	/* function get_dx size 97 (86) */
+ 655               	.LFE23:
+ 657               	.global	encoder_get_v
+ 659               	encoder_get_v:
+ 660               	.LFB7:
+ 661               	.LM80:
+ 662               	/* prologue: frame size=0 */
+ 663 02c2 1F93      		push r17
+ 664 02c4 CF93      		push r28
+ 665 02c6 DF93      		push r29
+ 666               	/* prologue end (size=3) */
+ 667               	.LVL38:
+ 668 02c8 182F      		mov r17,r24
+ 669               	.LM81:
+ 670 02ca 60E0      		ldi r22,lo8(0)
+ 671 02cc 70E0      		ldi r23,hi8(0)
+ 672 02ce 0E94 0000 		call get_dx
+ 673               	.LVL39:
+ 674 02d2 EC01      		movw r28,r24
+ 675               	.LVL40:
+ 676               	.LM82:
+ 677 02d4 61E0      		ldi r22,lo8(1)
+ 678 02d6 70E0      		ldi r23,hi8(1)
+ 679 02d8 812F      		mov r24,r17
+ 680 02da 0E94 0000 		call get_dx
+ 681               	.LM83:
+ 682 02de 24E0      		ldi r18,hi8(1024)
+ 683 02e0 C030      		cpi r28,lo8(1024)
+ 684 02e2 D207      		cpc r29,r18
+ 685 02e4 01F4      		brne .L95
+ 686               	.LVL41:
+ 687               	.LM84:
+ 688 02e6 24E0      		ldi r18,hi8(1024)
+ 689 02e8 8030      		cpi r24,lo8(1024)
+ 690 02ea 9207      		cpc r25,r18
+ 691 02ec 01F4      		brne .L97
+ 692 02ee 80E0      		ldi r24,lo8(2048)
+ 693 02f0 98E0      		ldi r25,hi8(2048)
+ 694               	.LVL42:
+ 695 02f2 00C0      		rjmp .L99
+ 696               	.L95:
+ 697               	.LVL43:
+ 698               	.LM85:
+ 699 02f4 24E0      		ldi r18,hi8(1024)
+ 700 02f6 8030      		cpi r24,lo8(1024)
+ 701 02f8 9207      		cpc r25,r18
+ 702 02fa 01F4      		brne .L100
+ 703               	.LM86:
+ 704 02fc CE01      		movw r24,r28
+ 705               	.LVL44:
+ 706               	.L97:
+ 707               	.LM87:
+ 708 02fe 880F      		lsl r24
+ 709 0300 991F      		rol r25
+ 710               	.LVL45:
+ 711 0302 00C0      		rjmp .L99
+ 712               	.LVL46:
+ 713               	.L100:
+ 714               	.LM88:
+ 715 0304 8C0F      		add r24,r28
+ 716 0306 9D1F      		adc r25,r29
+ 717               	.LVL47:
+ 718               	.L99:
+ 719               	/* epilogue: frame size=0 */
+ 720 0308 DF91      		pop r29
+ 721 030a CF91      		pop r28
+ 722 030c 1F91      		pop r17
+ 723 030e 0895      		ret
+ 724               	/* epilogue end (size=4) */
+ 725               	/* function encoder_get_v size 39 (32) */
+ 726               	.LFE7:
+ 728               	.global	encoders_init
+ 730               	encoders_init:
+ 731               	.LFB3:
+ 732               	.LM89:
+ 733               	/* prologue: frame size=0 */
+ 734               	/* prologue end (size=0) */
+ 735               	.LM90:
+ 736 0310 1092 0000 		sts (data_ready)+1,__zero_reg__
+ 737 0314 1092 0000 		sts data_ready,__zero_reg__
+ 738               	.LM91:
+ 739 0318 60E0      		ldi r22,lo8(gs(encoder_recv_complete))
+ 740 031a 70E0      		ldi r23,hi8(gs(encoder_recv_complete))
+ 741 031c 80E0      		ldi r24,lo8(gs(encoder_recv))
+ 742 031e 90E0      		ldi r25,hi8(gs(encoder_recv))
+ 743 0320 0E94 0000 		call spi_init
+ 744               	.LM92:
+ 745 0324 1092 0000 		sts encoder_buf_index,__zero_reg__
+ 746               	.LM93:
+ 747 0328 1092 0000 		sts (left_data_buf)+1,__zero_reg__
+ 748 032c 1092 0000 		sts left_data_buf,__zero_reg__
+ 749               	.LM94:
+ 750 0330 1092 0000 		sts (right_data_buf)+1,__zero_reg__
+ 751 0334 1092 0000 		sts right_data_buf,__zero_reg__
+ 752               	.LM95:
+ 753 0338 8FEF      		ldi r24,lo8(-1)
+ 754 033a 9FEF      		ldi r25,hi8(-1)
+ 755 033c 9093 0000 		sts (left_data)+1,r25
+ 756 0340 8093 0000 		sts left_data,r24
+ 757               	.LM96:
+ 758 0344 9093 0000 		sts (right_data)+1,r25
+ 759 0348 8093 0000 		sts right_data,r24
+ 760               	.LM97:
+ 761 034c 1092 0000 		sts (left_data_idx)+1,__zero_reg__
+ 762 0350 1092 0000 		sts left_data_idx,__zero_reg__
+ 763               	.LM98:
+ 764 0354 1092 0000 		sts (right_data_idx)+1,__zero_reg__
+ 765 0358 1092 0000 		sts right_data_idx,__zero_reg__
+ 766 035c E0E0      		ldi r30,lo8(left_data_array)
+ 767 035e F0E0      		ldi r31,hi8(left_data_array)
+ 768               	.L104:
+ 769               	.LM99:
+ 770 0360 1192      		st Z+,__zero_reg__
+ 771 0362 1192      		st Z+,__zero_reg__
+ 772               	.LM100:
+ 773 0364 80E0      		ldi r24,hi8(left_data_array+92)
+ 774 0366 E030      		cpi r30,lo8(left_data_array+92)
+ 775 0368 F807      		cpc r31,r24
+ 776 036a 01F4      		brne .L104
+ 777 036c E0E0      		ldi r30,lo8(right_data_array)
+ 778 036e F0E0      		ldi r31,hi8(right_data_array)
+ 779               	.L106:
+ 780               	.LM101:
+ 781 0370 1192      		st Z+,__zero_reg__
+ 782 0372 1192      		st Z+,__zero_reg__
+ 783               	.LM102:
+ 784 0374 80E0      		ldi r24,hi8(right_data_array+92)
+ 785 0376 E030      		cpi r30,lo8(right_data_array+92)
+ 786 0378 F807      		cpc r31,r24
+ 787 037a 01F4      		brne .L106
+ 788               	.LM103:
+ 789 037c 85E0      		ldi r24,lo8(5)
+ 790 037e 0E94 0000 		call spi_transfer
+ 791               	/* epilogue: frame size=0 */
+ 792 0382 0895      		ret
+ 793               	/* epilogue end (size=1) */
+ 794               	/* function encoders_init size 58 (57) */
+ 795               	.LFE3:
+ 797               	.global	encoder_recv_complete
+ 799               	encoder_recv_complete:
+ 800               	.LFB2:
+ 801               	.LM104:
+ 802               	/* prologue: frame size=0 */
+ 803               	/* prologue end (size=0) */
+ 804               	.LM105:
+ 805 0384 1092 0000 		sts encoder_buf_index,__zero_reg__
+ 806               	.LM106:
+ 807 0388 8091 0000 		lds r24,data_ready
+ 808 038c 9091 0000 		lds r25,(data_ready)+1
+ 809 0390 0196      		adiw r24,1
+ 810 0392 9093 0000 		sts (data_ready)+1,r25
+ 811 0396 8093 0000 		sts data_ready,r24
+ 812               	.LM107:
+ 813 039a 85E0      		ldi r24,lo8(5)
+ 814 039c 0E94 0000 		call spi_transfer
+ 815               	/* epilogue: frame size=0 */
+ 816 03a0 0895      		ret
+ 817               	/* epilogue end (size=1) */
+ 818               	/* function encoder_recv_complete size 15 (14) */
+ 819               	.LFE2:
+ 821               	.global	encoder_recv
+ 823               	encoder_recv:
+ 824               	.LFB12:
+ 825               	.LM108:
+ 826               	/* prologue: frame size=0 */
+ 827               	/* prologue end (size=0) */
+ 828               	.LVL48:
+ 829               	.LM109:
+ 830 03a2 4091 0000 		lds r20,encoder_buf_index
+ 831 03a6 4230      		cpi r20,lo8(2)
+ 832 03a8 01F0      		breq .L119
+ 833               	.LM110:
+ 834 03aa 4330      		cpi r20,lo8(3)
+ 835 03ac 00F4      		brsh .L122
+ 836 03ae 4423      		tst r20
+ 837 03b0 01F0      		breq .L117
+ 838 03b2 4130      		cpi r20,lo8(1)
+ 839 03b4 01F0      		breq .+2
+ 840 03b6 00C0      		rjmp .L116
+ 841 03b8 00C0      		rjmp .L164
+ 842               	.L122:
+ 843 03ba 4330      		cpi r20,lo8(3)
+ 844 03bc 01F0      		breq .L120
+ 845 03be 4430      		cpi r20,lo8(4)
+ 846 03c0 01F0      		breq .+2
+ 847 03c2 00C0      		rjmp .L116
+ 848 03c4 00C0      		rjmp .L165
+ 849               	.L117:
+ 850               	.LM111:
+ 851 03c6 282F      		mov r18,r24
+ 852 03c8 3327      		clr r19
+ 853 03ca 322F      		mov r19,r18
+ 854 03cc 2227      		clr r18
+ 855 03ce 00C0      		rjmp .L172
+ 856               	.L164:
+ 857               	.LM112:
+ 858 03d0 282F      		mov r18,r24
+ 859 03d2 3327      		clr r19
+ 860               	.L172:
+ 861 03d4 8091 0000 		lds r24,right_data_buf
+ 862 03d8 9091 0000 		lds r25,(right_data_buf)+1
+ 863               	.LVL49:
+ 864 03dc 822B      		or r24,r18
+ 865 03de 932B      		or r25,r19
+ 866 03e0 9093 0000 		sts (right_data_buf)+1,r25
+ 867 03e4 8093 0000 		sts right_data_buf,r24
+ 868 03e8 00C0      		rjmp .L123
+ 869               	.LVL50:
+ 870               	.L119:
+ 871               	.LM113:
+ 872 03ea 282F      		mov r18,r24
+ 873 03ec 3327      		clr r19
+ 874 03ee 322F      		mov r19,r18
+ 875 03f0 2227      		clr r18
+ 876 03f2 330F      		lsl r19
+ 877 03f4 00C0      		rjmp .L171
+ 878               	.LVL51:
+ 879               	.L120:
+ 880               	.LM114:
+ 881 03f6 282F      		mov r18,r24
+ 882 03f8 3327      		clr r19
+ 883 03fa 220F      		lsl r18
+ 884 03fc 331F      		rol r19
+ 885               	.LVL52:
+ 886               	.L171:
+ 887 03fe 8091 0000 		lds r24,left_data_buf
+ 888 0402 9091 0000 		lds r25,(left_data_buf)+1
+ 889 0406 822B      		or r24,r18
+ 890 0408 932B      		or r25,r19
+ 891 040a 9093 0000 		sts (left_data_buf)+1,r25
+ 892 040e 8093 0000 		sts left_data_buf,r24
+ 893 0412 00C0      		rjmp .L123
+ 894               	.LVL53:
+ 895               	.L165:
+ 896               	.LM115:
+ 897 0414 881F      		rol r24
+ 898 0416 8827      		clr r24
+ 899 0418 881F      		rol r24
+ 900 041a 282F      		mov r18,r24
+ 901 041c 3327      		clr r19
+ 902 041e 8091 0000 		lds r24,left_data_buf
+ 903 0422 9091 0000 		lds r25,(left_data_buf)+1
+ 904               	.LVL54:
+ 905 0426 822B      		or r24,r18
+ 906 0428 932B      		or r25,r19
+ 907 042a 9093 0000 		sts (left_data_buf)+1,r25
+ 908 042e 8093 0000 		sts left_data_buf,r24
+ 909               	.LM116:
+ 910 0432 85E0      		ldi r24,lo8(5)
+ 911 0434 90E0      		ldi r25,hi8(5)
+ 912 0436 65E0      		ldi r22,lo8(5)
+ 913 0438 70E0      		ldi r23,hi8(5)
+ 914 043a 0E94 0000 		call __divmodhi4
+ 915 043e 8093 0000 		sts encoder_buf_index,r24
+ 916 0442 00C0      		rjmp .L124
+ 917               	.LVL55:
+ 918               	.L116:
+ 919 0444 842F      		mov r24,r20
+ 920 0446 9927      		clr r25
+ 921               	.LVL56:
+ 922 0448 0196      		adiw r24,1
+ 923 044a 65E0      		ldi r22,lo8(5)
+ 924 044c 70E0      		ldi r23,hi8(5)
+ 925 044e 0E94 0000 		call __divmodhi4
+ 926 0452 8093 0000 		sts encoder_buf_index,r24
+ 927               	.LM117:
+ 928 0456 8823      		tst r24
+ 929 0458 01F0      		breq .+2
+ 930 045a 00C0      		rjmp .L125
+ 931               	.L124:
+ 932               	.LM118:
+ 933 045c 2091 0000 		lds r18,left_data_buf
+ 934 0460 3091 0000 		lds r19,(left_data_buf)+1
+ 935 0464 24FD      		sbrc r18,4
+ 936 0466 00C0      		rjmp .L126
+ 937               	.LM119:
+ 938 0468 82E0      		ldi r24,lo8(1026)
+ 939 046a 94E0      		ldi r25,hi8(1026)
+ 940 046c 9093 0000 		sts (left_data)+1,r25
+ 941 0470 8093 0000 		sts left_data,r24
+ 942               	.L126:
+ 943               	.LM120:
+ 944 0474 C901      		movw r24,r18
+ 945 0476 8C70      		andi r24,lo8(12)
+ 946 0478 9070      		andi r25,hi8(12)
+ 947 047a 892B      		or r24,r25
+ 948 047c 01F0      		breq .L128
+ 949               	.LM121:
+ 950 047e 83E0      		ldi r24,lo8(1027)
+ 951 0480 94E0      		ldi r25,hi8(1027)
+ 952 0482 00C0      		rjmp .L166
+ 953               	.L128:
+ 954               	.LM122:
+ 955 0484 21FF      		sbrs r18,1
+ 956 0486 00C0      		rjmp .L131
+ 957 0488 20FF      		sbrs r18,0
+ 958 048a 00C0      		rjmp .L131
+ 959               	.LM123:
+ 960 048c 81E0      		ldi r24,lo8(1025)
+ 961 048e 94E0      		ldi r25,hi8(1025)
+ 962               	.L166:
+ 963 0490 9093 0000 		sts (left_data)+1,r25
+ 964 0494 8093 0000 		sts left_data,r24
+ 965 0498 00C0      		rjmp .L130
+ 966               	.L131:
+ 967               	.LM124:
+ 968 049a 75E0      		ldi r23,5
+ 969 049c 3695      	1:	lsr r19
+ 970 049e 2795      		ror r18
+ 971 04a0 7A95      		dec r23
+ 972 04a2 01F4      		brne 1b
+ 973 04a4 3370      		andi r19,hi8(1023)
+ 974 04a6 3093 0000 		sts (left_data)+1,r19
+ 975 04aa 2093 0000 		sts left_data,r18
+ 976               	.L130:
+ 977               	.LM125:
+ 978 04ae 2091 0000 		lds r18,right_data_buf
+ 979 04b2 3091 0000 		lds r19,(right_data_buf)+1
+ 980 04b6 24FD      		sbrc r18,4
+ 981 04b8 00C0      		rjmp .L134
+ 982               	.LM126:
+ 983 04ba 82E0      		ldi r24,lo8(1026)
+ 984 04bc 94E0      		ldi r25,hi8(1026)
+ 985 04be 9093 0000 		sts (right_data)+1,r25
+ 986 04c2 8093 0000 		sts right_data,r24
+ 987               	.L134:
+ 988               	.LM127:
+ 989 04c6 C901      		movw r24,r18
+ 990 04c8 8C70      		andi r24,lo8(12)
+ 991 04ca 9070      		andi r25,hi8(12)
+ 992 04cc 892B      		or r24,r25
+ 993 04ce 01F0      		breq .L136
+ 994               	.LM128:
+ 995 04d0 83E0      		ldi r24,lo8(1027)
+ 996 04d2 94E0      		ldi r25,hi8(1027)
+ 997 04d4 00C0      		rjmp .L167
+ 998               	.L136:
+ 999               	.LM129:
+ 1000 04d6 21FF      		sbrs r18,1
+ 1001 04d8 00C0      		rjmp .L139
+ 1002 04da 20FF      		sbrs r18,0
+ 1003 04dc 00C0      		rjmp .L139
+ 1004               	.LM130:
+ 1005 04de 81E0      		ldi r24,lo8(1025)
+ 1006 04e0 94E0      		ldi r25,hi8(1025)
+ 1007               	.L167:
+ 1008 04e2 9093 0000 		sts (right_data)+1,r25
+ 1009 04e6 8093 0000 		sts right_data,r24
+ 1010 04ea 00C0      		rjmp .L138
+ 1011               	.L139:
+ 1012               	.LM131:
+ 1013 04ec 65E0      		ldi r22,5
+ 1014 04ee 3695      	1:	lsr r19
+ 1015 04f0 2795      		ror r18
+ 1016 04f2 6A95      		dec r22
+ 1017 04f4 01F4      		brne 1b
+ 1018 04f6 3370      		andi r19,hi8(1023)
+ 1019 04f8 3093 0000 		sts (right_data)+1,r19
+ 1020 04fc 2093 0000 		sts right_data,r18
+ 1021               	.L138:
+ 1022               	.LM132:
+ 1023 0500 1092 0000 		sts (left_data_buf)+1,__zero_reg__
+ 1024 0504 1092 0000 		sts left_data_buf,__zero_reg__
+ 1025               	.LM133:
+ 1026 0508 1092 0000 		sts (right_data_buf)+1,__zero_reg__
+ 1027 050c 1092 0000 		sts right_data_buf,__zero_reg__
+ 1028               	.LM134:
+ 1029 0510 2091 0000 		lds r18,left_data
+ 1030 0514 3091 0000 		lds r19,(left_data)+1
+ 1031 0518 84E0      		ldi r24,hi8(1024)
+ 1032 051a 2030      		cpi r18,lo8(1024)
+ 1033 051c 3807      		cpc r19,r24
+ 1034 051e 00F0      		brlo .+2
+ 1035 0520 00C0      		rjmp .L142
+ 1036               	.LM135:
+ 1037 0522 8FEF      		ldi r24,lo8(1023)
+ 1038 0524 93E0      		ldi r25,hi8(1023)
+ 1039 0526 821B      		sub r24,r18
+ 1040 0528 930B      		sbc r25,r19
+ 1041 052a 9093 0000 		sts (left_data)+1,r25
+ 1042 052e 8093 0000 		sts left_data,r24
+ 1043               	.LM136:
+ 1044 0532 0E94 0000 		call left_data_array_put
+ 1045               	.LM137:
+ 1046 0536 2091 0000 		lds r18,left_data
+ 1047 053a 3091 0000 		lds r19,(left_data)+1
+ 1048               	.LBB26:
+ 1049               	.LBB27:
+ 1050               	.LM138:
+ 1051 053e E091 0000 		lds r30,left_data_idx
+ 1052 0542 F091 0000 		lds r31,(left_data_idx)+1
+ 1053 0546 3097      		sbiw r30,0
+ 1054 0548 01F4      		brne .L144
+ 1055               	.LM139:
+ 1056 054a 8091 0000 		lds r24,left_data_array+90
+ 1057 054e 9091 0000 		lds r25,(left_data_array+90)+1
+ 1058 0552 00C0      		rjmp .L168
+ 1059               	.L144:
+ 1060               	.LM140:
+ 1061 0554 EE0F      		lsl r30
+ 1062 0556 FF1F      		rol r31
+ 1063 0558 E050      		subi r30,lo8(-(left_data_array-2))
+ 1064 055a F040      		sbci r31,hi8(-(left_data_array-2))
+ 1065 055c 8081      		ld r24,Z
+ 1066 055e 9181      		ldd r25,Z+1
+ 1067               	.L168:
+ 1068               	.LBE27:
+ 1069               	.LBE26:
+ 1070               	.LM141:
+ 1071 0560 281B      		sub r18,r24
+ 1072 0562 390B      		sbc r19,r25
+ 1073               	.LVL57:
+ 1074               	.LM142:
+ 1075 0564 892B      		or r24,r25
+ 1076 0566 01F0      		breq .L147
+ 1077               	.LM143:
+ 1078 0568 82E0      		ldi r24,hi8(513)
+ 1079 056a 2130      		cpi r18,lo8(513)
+ 1080 056c 3807      		cpc r19,r24
+ 1081 056e 04F0      		brlt .L149
+ 1082 0570 8091 0000 		lds r24,left_dx
+ 1083 0574 9091 0000 		lds r25,(left_dx)+1
+ 1084 0578 280F      		add r18,r24
+ 1085 057a 391F      		adc r19,r25
+ 1086 057c 2F5F      		subi r18,lo8(-(-1023))
+ 1087 057e 3340      		sbci r19,hi8(-(-1023))
+ 1088 0580 00C0      		rjmp .L169
+ 1089               	.L149:
+ 1090               	.LM144:
+ 1091 0582 8EEF      		ldi r24,hi8(-512)
+ 1092 0584 2030      		cpi r18,lo8(-512)
+ 1093 0586 3807      		cpc r19,r24
+ 1094 0588 04F4      		brge .L151
+ 1095 058a 8091 0000 		lds r24,left_dx
+ 1096 058e 9091 0000 		lds r25,(left_dx)+1
+ 1097 0592 8150      		subi r24,lo8(-(1023))
+ 1098 0594 9C4F      		sbci r25,hi8(-(1023))
+ 1099 0596 280F      		add r18,r24
+ 1100 0598 391F      		adc r19,r25
+ 1101               	.L169:
+ 1102 059a 3093 0000 		sts (left_dx)+1,r19
+ 1103 059e 2093 0000 		sts left_dx,r18
+ 1104 05a2 00C0      		rjmp .L142
+ 1105               	.L147:
+ 1106 05a4 20E0      		ldi r18,lo8(0)
+ 1107 05a6 30E0      		ldi r19,hi8(0)
+ 1108               	.L151:
+ 1109               	.LM145:
+ 1110 05a8 8091 0000 		lds r24,left_dx
+ 1111 05ac 9091 0000 		lds r25,(left_dx)+1
+ 1112 05b0 820F      		add r24,r18
+ 1113 05b2 931F      		adc r25,r19
+ 1114 05b4 9093 0000 		sts (left_dx)+1,r25
+ 1115 05b8 8093 0000 		sts left_dx,r24
+ 1116               	.L142:
+ 1117               	.LM146:
+ 1118 05bc 8091 0000 		lds r24,right_data
+ 1119 05c0 9091 0000 		lds r25,(right_data)+1
+ 1120 05c4 24E0      		ldi r18,hi8(1024)
+ 1121 05c6 8030      		cpi r24,lo8(1024)
+ 1122 05c8 9207      		cpc r25,r18
+ 1123               	.LVL58:
+ 1124 05ca 00F0      		brlo .+2
+ 1125 05cc 00C0      		rjmp .L125
+ 1126               	.LM147:
+ 1127 05ce 0E94 0000 		call right_data_array_put
+ 1128               	.LM148:
+ 1129 05d2 2091 0000 		lds r18,right_data
+ 1130 05d6 3091 0000 		lds r19,(right_data)+1
+ 1131               	.LBB28:
+ 1132               	.LBB29:
+ 1133               	.LM149:
+ 1134 05da E091 0000 		lds r30,right_data_idx
+ 1135 05de F091 0000 		lds r31,(right_data_idx)+1
+ 1136 05e2 3097      		sbiw r30,0
+ 1137 05e4 01F4      		brne .L154
+ 1138               	.LM150:
+ 1139 05e6 8091 0000 		lds r24,right_data_array+90
+ 1140 05ea 9091 0000 		lds r25,(right_data_array+90)+1
+ 1141 05ee 00C0      		rjmp .L170
+ 1142               	.L154:
+ 1143               	.LM151:
+ 1144 05f0 EE0F      		lsl r30
+ 1145 05f2 FF1F      		rol r31
+ 1146 05f4 E050      		subi r30,lo8(-(right_data_array-2))
+ 1147 05f6 F040      		sbci r31,hi8(-(right_data_array-2))
+ 1148 05f8 8081      		ld r24,Z
+ 1149 05fa 9181      		ldd r25,Z+1
+ 1150               	.L170:
+ 1151               	.LBE29:
+ 1152               	.LBE28:
+ 1153               	.LM152:
+ 1154 05fc 281B      		sub r18,r24
+ 1155 05fe 390B      		sbc r19,r25
+ 1156               	.LVL59:
+ 1157               	.LM153:
+ 1158 0600 892B      		or r24,r25
+ 1159 0602 01F0      		breq .L157
+ 1160               	.LM154:
+ 1161 0604 82E0      		ldi r24,hi8(513)
+ 1162 0606 2130      		cpi r18,lo8(513)
+ 1163 0608 3807      		cpc r19,r24
+ 1164 060a 04F0      		brlt .L159
+ 1165 060c 8091 0000 		lds r24,right_dx
+ 1166 0610 9091 0000 		lds r25,(right_dx)+1
+ 1167 0614 280F      		add r18,r24
+ 1168 0616 391F      		adc r19,r25
+ 1169 0618 2F5F      		subi r18,lo8(-(-1023))
+ 1170 061a 3340      		sbci r19,hi8(-(-1023))
+ 1171 061c 00C0      		rjmp .L173
+ 1172               	.L159:
+ 1173               	.LM155:
+ 1174 061e 8EEF      		ldi r24,hi8(-512)
+ 1175 0620 2030      		cpi r18,lo8(-512)
+ 1176 0622 3807      		cpc r19,r24
+ 1177 0624 04F4      		brge .L161
+ 1178 0626 8091 0000 		lds r24,right_dx
+ 1179 062a 9091 0000 		lds r25,(right_dx)+1
+ 1180 062e 8150      		subi r24,lo8(-(1023))
+ 1181 0630 9C4F      		sbci r25,hi8(-(1023))
+ 1182 0632 280F      		add r18,r24
+ 1183 0634 391F      		adc r19,r25
+ 1184               	.L173:
+ 1185 0636 3093 0000 		sts (right_dx)+1,r19
+ 1186 063a 2093 0000 		sts right_dx,r18
+ 1187 063e 00C0      		rjmp .L125
+ 1188               	.L157:
+ 1189 0640 20E0      		ldi r18,lo8(0)
+ 1190 0642 30E0      		ldi r19,hi8(0)
+ 1191               	.L161:
+ 1192               	.LM156:
+ 1193 0644 8091 0000 		lds r24,right_dx
+ 1194 0648 9091 0000 		lds r25,(right_dx)+1
+ 1195 064c 820F      		add r24,r18
+ 1196 064e 931F      		adc r25,r19
+ 1197 0650 9093 0000 		sts (right_dx)+1,r25
+ 1198 0654 8093 0000 		sts right_dx,r24
+ 1199 0658 00C0      		rjmp .L125
+ 1200               	.LVL60:
+ 1201               	.L123:
+ 1202               	.LM157:
+ 1203 065a 842F      		mov r24,r20
+ 1204 065c 9927      		clr r25
+ 1205 065e 0196      		adiw r24,1
+ 1206 0660 65E0      		ldi r22,lo8(5)
+ 1207 0662 70E0      		ldi r23,hi8(5)
+ 1208 0664 0E94 0000 		call __divmodhi4
+ 1209 0668 8093 0000 		sts encoder_buf_index,r24
+ 1210               	.LVL61:
+ 1211               	.L125:
+ 1212               	.LM158:
+ 1213 066c 8091 0000 		lds r24,timecount
+ 1214 0670 9091 0000 		lds r25,(timecount)+1
+ 1215 0674 A091 0000 		lds r26,(timecount)+2
+ 1216 0678 B091 0000 		lds r27,(timecount)+3
+ 1217 067c 0196      		adiw r24,1
+ 1218 067e A11D      		adc r26,__zero_reg__
+ 1219 0680 B11D      		adc r27,__zero_reg__
+ 1220 0682 8093 0000 		sts timecount,r24
+ 1221 0686 9093 0000 		sts (timecount)+1,r25
+ 1222 068a A093 0000 		sts (timecount)+2,r26
+ 1223 068e B093 0000 		sts (timecount)+3,r27
+ 1224               	/* epilogue: frame size=0 */
+ 1225 0692 0895      		ret
+ 1226               	/* epilogue end (size=1) */
+ 1227               	/* function encoder_recv size 379 (378) */
+ 1228               	.LFE12:
+ 1230               	.global	encoder_get_x
+ 1232               	encoder_get_x:
+ 1233               	.LFB5:
+ 1234               	.LM159:
+ 1235               	/* prologue: frame size=0 */
+ 1236               	/* prologue end (size=0) */
+ 1237               	.LVL62:
+ 1238               	.LBB32:
+ 1239               	.LBB33:
+ 1240               	.LM160:
+ 1241 0694 8823      		tst r24
+ 1242 0696 01F4      		brne .L175
+ 1243               	.LM161:
+ 1244 0698 8091 0000 		lds r24,left_dx
+ 1245 069c 9091 0000 		lds r25,(left_dx)+1
+ 1246               	.LVL63:
+ 1247 06a0 0895      		ret
+ 1248               	.LVL64:
+ 1249               	.L175:
+ 1250               	.LM162:
+ 1251 06a2 8130      		cpi r24,lo8(1)
+ 1252 06a4 01F0      		breq .L178
+ 1253 06a6 8FEF      		ldi r24,lo8(-1)
+ 1254 06a8 9FEF      		ldi r25,hi8(-1)
+ 1255               	.LVL65:
+ 1256 06aa 0895      		ret
+ 1257               	.LVL66:
+ 1258               	.L178:
+ 1259 06ac 8091 0000 		lds r24,right_dx
+ 1260 06b0 9091 0000 		lds r25,(right_dx)+1
+ 1261               	.LVL67:
+ 1262               	.LBE33:
+ 1263               	.LBE32:
+ 1264               	.LM163:
+ 1265 06b4 0895      		ret
+ 1266               	/* epilogue: frame size=0 */
+ 1267               	/* epilogue: noreturn */
+ 1268               	/* epilogue end (size=0) */
+ 1269               	/* function encoder_get_x size 17 (17) */
+ 1270               	.LFE5:
+ 1272               		.comm left_data_buf,2,1
+ 1273               		.comm right_data_buf,2,1
+ 1274               		.comm encoder_buf_index,1,1
+ 1275               		.comm left_data,2,1
+ 1276               		.comm right_data,2,1
+ 1277               		.comm left_data_array,92,1
+ 1278               		.comm right_data_array,92,1
+ 1279               		.comm left_data_idx,2,1
+ 1280               		.comm right_data_idx,2,1
+ 1281               		.comm left_dx,2,1
+ 1282               		.comm right_dx,2,1
+ 1283               		.comm timecount,4,1
+ 1284               		.comm data_ready,2,1
+ 1477               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 encoders.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:20     .text:00000000 encoder_read
+                            *COM*:00000002 left_data
+                            *COM*:00000002 right_data
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:58     .text:00000022 encoder_get_dx
+                            *COM*:00000002 left_dx
+                            *COM*:00000002 right_dx
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:96     .text:00000044 encoder_rst_dx
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:125    .text:00000060 encoder_get_tc
+                            *COM*:00000004 timecount
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:141    .text:0000006a encoder_rst_tc
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:159    .text:0000007c encoder_wait
+                            *COM*:00000002 data_ready
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:185    .text:00000096 left_data_array_put
+                            *COM*:00000002 left_data_idx
+                            *COM*:0000005c left_data_array
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:225    .text:000000d0 left_data_array_top
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:247    .text:000000e6 left_data_array_prev
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:279    .text:0000010a left_data_array_bottom
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:312    .text:00000130 right_data_array_put
+                            *COM*:00000002 right_data_idx
+                            *COM*:0000005c right_data_array
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:352    .text:0000016a right_data_array_top
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:374    .text:00000180 right_data_array_prev
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:406    .text:000001a4 right_data_array_bottom
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:439    .text:000001ca left_data_at
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:472    .text:000001e8 right_data_at
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:505    .text:00000206 get_dx
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:659    .text:000002c2 encoder_get_v
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:730    .text:00000310 encoders_init
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:799    .text:00000384 encoder_recv_complete
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:823    .text:000003a2 encoder_recv
+                            *COM*:00000001 encoder_buf_index
+                            *COM*:00000002 left_data_buf
+                            *COM*:00000002 right_data_buf
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccI855Ko.s:1232   .text:00000694 encoder_get_x
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+spi_init
+spi_transfer
+__divmodhi4
Index: demos/hunter_prey_john/projects/libdragonfly/lcd.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/lcd.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/lcd.lst	(revision 1694)
@@ -0,0 +1,936 @@
+   1               		.file	"lcd.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	lcd_putc
+  20               	lcd_putc:
+  21               	.LFB4:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LVL0:
+  26               	.LBB13:
+  27               	.LM2:
+  28 0000 95E0      		ldi r25,lo8(5)
+  29 0002 899F      		mul r24,r25
+  30 0004 C001      		movw r24,r0
+  31 0006 1124      		clr r1
+  32               	.LVL1:
+  33               	.LM3:
+  34 0008 FC01      		movw r30,r24
+  35 000a E050      		subi r30,lo8(-(FontLookup-160))
+  36 000c F040      		sbci r31,hi8(-(FontLookup-160))
+  37 000e 9C01      		movw r18,r24
+  38 0010 2050      		subi r18,lo8(-(FontLookup-155))
+  39 0012 3040      		sbci r19,hi8(-(FontLookup-155))
+  40               	.LVL2:
+  41               	.L2:
+  42               	.LM4:
+  43               	/* #APP */
+  44 0014 8491      		lpm r24, Z
+  45               		
+  46               	/* #NOAPP */
+  47               	.LBE13:
+  48               	.LBB14:
+  49               	.LBB15:
+  50               	.LM5:
+  51 0016 8FB9      		out 47-0x20,r24
+  52               	.L3:
+  53               	.LM6:
+  54 0018 779B      		sbis 46-0x20,7
+  55 001a 00C0      		rjmp .L3
+  56 001c 3196      		adiw r30,1
+  57               	.LBE15:
+  58               	.LBE14:
+  59               	.LM7:
+  60 001e E217      		cp r30,r18
+  61 0020 F307      		cpc r31,r19
+  62 0022 01F4      		brne .L2
+  63               	.LBB16:
+  64               	.LBB17:
+  65               	.LM8:
+  66 0024 1FB8      		out 47-0x20,__zero_reg__
+  67               	.L6:
+  68               	.LM9:
+  69 0026 779B      		sbis 46-0x20,7
+  70 0028 00C0      		rjmp .L6
+  71               	.LBE17:
+  72               	.LBE16:
+  73               	/* epilogue: frame size=0 */
+  74 002a 0895      		ret
+  75               	/* epilogue end (size=1) */
+  76               	/* function lcd_putc size 25 (24) */
+  77               	.LFE4:
+  79               	.global	lcd_puts
+  81               	lcd_puts:
+  82               	.LFB5:
+  83               	.LM10:
+  84               	/* prologue: frame size=0 */
+  85 002c CF93      		push r28
+  86 002e DF93      		push r29
+  87               	/* prologue end (size=2) */
+  88               	.LVL3:
+  89 0030 EC01      		movw r28,r24
+  90               	.LVL4:
+  91 0032 00C0      		rjmp .L16
+  92               	.LVL5:
+  93               	.L17:
+  94               	.LM11:
+  95 0034 0E94 0000 		call lcd_putc
+  96               	.LM12:
+  97 0038 2196      		adiw r28,1
+  98               	.LVL6:
+  99               	.L16:
+ 100               	.LM13:
+ 101 003a 8881      		ld r24,Y
+ 102               	.LVL7:
+ 103 003c 8823      		tst r24
+ 104 003e 01F4      		brne .L17
+ 105               	/* epilogue: frame size=0 */
+ 106 0040 DF91      		pop r29
+ 107 0042 CF91      		pop r28
+ 108 0044 0895      		ret
+ 109               	/* epilogue end (size=3) */
+ 110               	/* function lcd_puts size 13 (8) */
+ 111               	.LFE5:
+ 113               	.global	lcd_gotoxy
+ 115               	lcd_gotoxy:
+ 116               	.LFB6:
+ 117               	.LM14:
+ 118               	/* prologue: frame size=0 */
+ 119               	/* prologue end (size=0) */
+ 120               	.LVL8:
+ 121               	.LM15:
+ 122 0046 9598      		cbi 50-0x20,5
+ 123               	.LM16:
+ 124 0048 6770      		andi r22,lo8(7)
+ 125               	.LVL9:
+ 126 004a 6064      		ori r22,lo8(64)
+ 127               	.LBB18:
+ 128               	.LBB19:
+ 129               	.LM17:
+ 130 004c 6FB9      		out 47-0x20,r22
+ 131               	.L21:
+ 132               	.LM18:
+ 133 004e 779B      		sbis 46-0x20,7
+ 134 0050 00C0      		rjmp .L21
+ 135               	.LBE19:
+ 136               	.LBE18:
+ 137               	.LM19:
+ 138 0052 8F77      		andi r24,lo8(127)
+ 139               	.LVL10:
+ 140 0054 8068      		ori r24,lo8(-128)
+ 141               	.LBB20:
+ 142               	.LBB21:
+ 143               	.LM20:
+ 144 0056 8FB9      		out 47-0x20,r24
+ 145               	.L23:
+ 146               	.LM21:
+ 147 0058 779B      		sbis 46-0x20,7
+ 148 005a 00C0      		rjmp .L23
+ 149               	.LBE21:
+ 150               	.LBE20:
+ 151               	.LM22:
+ 152 005c 959A      		sbi 50-0x20,5
+ 153               	/* epilogue: frame size=0 */
+ 154 005e 0895      		ret
+ 155               	/* epilogue end (size=1) */
+ 156               	/* function lcd_gotoxy size 13 (12) */
+ 157               	.LFE6:
+ 159               	.global	lcd_clear_screen
+ 161               	lcd_clear_screen:
+ 162               	.LFB3:
+ 163               	.LM23:
+ 164               	/* prologue: frame size=0 */
+ 165               	/* prologue end (size=0) */
+ 166 0060 80E0      		ldi r24,lo8(0)
+ 167 0062 90E0      		ldi r25,hi8(0)
+ 168               	.LVL11:
+ 169               	.L31:
+ 170               	.LBB22:
+ 171               	.LBB23:
+ 172               	.LM24:
+ 173 0064 1FB8      		out 47-0x20,__zero_reg__
+ 174               	.L32:
+ 175               	.LM25:
+ 176 0066 779B      		sbis 46-0x20,7
+ 177 0068 00C0      		rjmp .L32
+ 178               	.LBE23:
+ 179               	.LBE22:
+ 180               	.LM26:
+ 181 006a 0196      		adiw r24,1
+ 182 006c 21E0      		ldi r18,hi8(504)
+ 183 006e 883F      		cpi r24,lo8(504)
+ 184 0070 9207      		cpc r25,r18
+ 185 0072 01F4      		brne .L31
+ 186               	.LM27:
+ 187 0074 60E0      		ldi r22,lo8(0)
+ 188 0076 70E0      		ldi r23,hi8(0)
+ 189 0078 80E0      		ldi r24,lo8(0)
+ 190 007a 90E0      		ldi r25,hi8(0)
+ 191               	.LVL12:
+ 192 007c 0E94 0000 		call lcd_gotoxy
+ 193               	/* epilogue: frame size=0 */
+ 194 0080 0895      		ret
+ 195               	/* epilogue end (size=1) */
+ 196               	/* function lcd_clear_screen size 17 (16) */
+ 197               	.LFE3:
+ 199               	.global	lcd_puti
+ 201               	lcd_puti:
+ 202               	.LFB7:
+ 203               	.LM28:
+ 204               	/* prologue: frame size=6 */
+ 205 0082 FF92      		push r15
+ 206 0084 0F93      		push r16
+ 207 0086 1F93      		push r17
+ 208 0088 CF93      		push r28
+ 209 008a DF93      		push r29
+ 210 008c CDB7      		in r28,__SP_L__
+ 211 008e DEB7      		in r29,__SP_H__
+ 212 0090 2697      		sbiw r28,6
+ 213 0092 0FB6      		in __tmp_reg__,__SREG__
+ 214 0094 F894      		cli
+ 215 0096 DEBF      		out __SP_H__,r29
+ 216 0098 0FBE      		out __SREG__,__tmp_reg__
+ 217 009a CDBF      		out __SP_L__,r28
+ 218               	/* prologue end (size=13) */
+ 219               	.LVL13:
+ 220 009c 8C01      		movw r16,r24
+ 221               	.LM29:
+ 222 009e DE01      		movw r26,r28
+ 223 00a0 1196      		adiw r26,1
+ 224 00a2 E0E0      		ldi r30,lo8(C.1.1504)
+ 225 00a4 F0E0      		ldi r31,hi8(C.1.1504)
+ 226 00a6 86E0      		ldi r24,lo8(6)
+ 227               	.LVL14:
+ 228               	.L41:
+ 229               	.LM30:
+ 230 00a8 0190      		ld r0,Z+
+ 231 00aa 0D92      		st X+,r0
+ 232 00ac 8150      		subi r24,lo8(-(-1))
+ 233 00ae 01F4      		brne .L41
+ 234               	.LM31:
+ 235 00b0 17FF      		sbrs r17,7
+ 236 00b2 00C0      		rjmp .L42
+ 237               	.LM32:
+ 238 00b4 8DE2      		ldi r24,lo8(45)
+ 239 00b6 0E94 0000 		call lcd_putc
+ 240               	.LM33:
+ 241 00ba 1095      		com r17
+ 242 00bc 0195      		neg r16
+ 243 00be 1F4F      		sbci r17,lo8(-1)
+ 244               	.L42:
+ 245 00c0 86E0      		ldi r24,lo8(6)
+ 246 00c2 F82E      		mov r15,r24
+ 247               	.LVL15:
+ 248 00c4 9E01      		movw r18,r28
+ 249 00c6 2F5F      		subi r18,lo8(-(1))
+ 250 00c8 3F4F      		sbci r19,hi8(-(1))
+ 251               	.LVL16:
+ 252               	.L44:
+ 253               	.LM34:
+ 254 00ca FA94      		dec r15
+ 255               	.LM35:
+ 256 00cc F901      		movw r30,r18
+ 257 00ce EF0D      		add r30,r15
+ 258 00d0 F11D      		adc r31,__zero_reg__
+ 259 00d2 C801      		movw r24,r16
+ 260 00d4 6AE0      		ldi r22,lo8(10)
+ 261 00d6 70E0      		ldi r23,hi8(10)
+ 262 00d8 0E94 0000 		call __divmodhi4
+ 263 00dc 805D      		subi r24,lo8(-(48))
+ 264 00de 8083      		st Z,r24
+ 265               	.LM36:
+ 266 00e0 C801      		movw r24,r16
+ 267 00e2 6AE0      		ldi r22,lo8(10)
+ 268 00e4 70E0      		ldi r23,hi8(10)
+ 269 00e6 0E94 0000 		call __divmodhi4
+ 270 00ea 8B01      		movw r16,r22
+ 271               	.LM37:
+ 272 00ec 672B      		or r22,r23
+ 273 00ee 01F0      		breq .L52
+ 274               	.LVL17:
+ 275 00f0 00C0      		rjmp .L44
+ 276               	.L46:
+ 277               	.LM38:
+ 278 00f2 FE01      		movw r30,r28
+ 279 00f4 EF0D      		add r30,r15
+ 280 00f6 F11D      		adc r31,__zero_reg__
+ 281 00f8 8181      		ldd r24,Z+1
+ 282 00fa 0E94 0000 		call lcd_putc
+ 283               	.LVL18:
+ 284               	.LM39:
+ 285 00fe F394      		inc r15
+ 286               	.LVL19:
+ 287               	.L52:
+ 288 0100 85E0      		ldi r24,lo8(5)
+ 289 0102 8F15      		cp r24,r15
+ 290 0104 00F4      		brsh .L46
+ 291               	/* epilogue: frame size=6 */
+ 292 0106 2696      		adiw r28,6
+ 293 0108 0FB6      		in __tmp_reg__,__SREG__
+ 294 010a F894      		cli
+ 295 010c DEBF      		out __SP_H__,r29
+ 296 010e 0FBE      		out __SREG__,__tmp_reg__
+ 297 0110 CDBF      		out __SP_L__,r28
+ 298 0112 DF91      		pop r29
+ 299 0114 CF91      		pop r28
+ 300 0116 1F91      		pop r17
+ 301 0118 0F91      		pop r16
+ 302 011a FF90      		pop r15
+ 303 011c 0895      		ret
+ 304               	/* epilogue end (size=12) */
+ 305               	/* function lcd_puti size 79 (54) */
+ 306               	.LFE7:
+ 308               	.global	lcd_putbyte
+ 310               	lcd_putbyte:
+ 311               	.LFB8:
+ 312               	.LM40:
+ 313               	/* prologue: frame size=0 */
+ 314               	/* prologue end (size=0) */
+ 315               	.LVL20:
+ 316               	.LM41:
+ 317 011e 8FB9      		out 47-0x20,r24
+ 318               	.L54:
+ 319               	.LM42:
+ 320 0120 779B      		sbis 46-0x20,7
+ 321 0122 00C0      		rjmp .L54
+ 322               	/* epilogue: frame size=0 */
+ 323 0124 0895      		ret
+ 324               	/* epilogue end (size=1) */
+ 325               	/* function lcd_putbyte size 4 (3) */
+ 326               	.LFE8:
+ 328               	.global	lcd_init
+ 330               	lcd_init:
+ 331               	.LFB2:
+ 332               	.LM43:
+ 333               	/* prologue: frame size=0 */
+ 334               	/* prologue end (size=0) */
+ 335               	.LM44:
+ 336 0126 87B3      		in r24,55-0x20
+ 337 0128 8760      		ori r24,lo8(7)
+ 338 012a 87BB      		out 55-0x20,r24
+ 339               	.LM45:
+ 340 012c 81B3      		in r24,49-0x20
+ 341 012e 8063      		ori r24,lo8(48)
+ 342 0130 81BB      		out 49-0x20,r24
+ 343               	.LM46:
+ 344 0132 88B3      		in r24,56-0x20
+ 345 0134 887F      		andi r24,lo8(-8)
+ 346 0136 88BB      		out 56-0x20,r24
+ 347               	.LM47:
+ 348 0138 9598      		cbi 50-0x20,5
+ 349               	.LM48:
+ 350 013a 8DB1      		in r24,45-0x20
+ 351 013c 8065      		ori r24,lo8(80)
+ 352 013e 8DB9      		out 45-0x20,r24
+ 353               	.LM49:
+ 354 0140 709A      		sbi 46-0x20,0
+ 355               	.LM50:
+ 356 0142 949A      		sbi 50-0x20,4
+ 357               	.LM51:
+ 358 0144 8AE0      		ldi r24,lo8(10)
+ 359 0146 90E0      		ldi r25,hi8(10)
+ 360 0148 0E94 0000 		call delay_ms
+ 361               	.LM52:
+ 362 014c 9498      		cbi 50-0x20,4
+ 363               	.LM53:
+ 364 014e 84E6      		ldi r24,lo8(100)
+ 365 0150 90E0      		ldi r25,hi8(100)
+ 366 0152 0E94 0000 		call delay_ms
+ 367               	.LM54:
+ 368 0156 949A      		sbi 50-0x20,4
+ 369               	.LBB36:
+ 370               	.LBB37:
+ 371               	.LM55:
+ 372 0158 81E2      		ldi r24,lo8(33)
+ 373 015a 8FB9      		out 47-0x20,r24
+ 374               	.L60:
+ 375               	.LM56:
+ 376 015c 779B      		sbis 46-0x20,7
+ 377 015e 00C0      		rjmp .L60
+ 378               	.LBE37:
+ 379               	.LBE36:
+ 380               	.LBB38:
+ 381               	.LBB39:
+ 382               	.LM57:
+ 383 0160 88EC      		ldi r24,lo8(-56)
+ 384 0162 8FB9      		out 47-0x20,r24
+ 385               	.L62:
+ 386               	.LM58:
+ 387 0164 779B      		sbis 46-0x20,7
+ 388 0166 00C0      		rjmp .L62
+ 389               	.LBE39:
+ 390               	.LBE38:
+ 391               	.LBB40:
+ 392               	.LBB41:
+ 393               	.LM59:
+ 394 0168 86E0      		ldi r24,lo8(6)
+ 395 016a 8FB9      		out 47-0x20,r24
+ 396               	.L64:
+ 397               	.LM60:
+ 398 016c 779B      		sbis 46-0x20,7
+ 399 016e 00C0      		rjmp .L64
+ 400               	.LBE41:
+ 401               	.LBE40:
+ 402               	.LBB42:
+ 403               	.LBB43:
+ 404               	.LM61:
+ 405 0170 83E1      		ldi r24,lo8(19)
+ 406 0172 8FB9      		out 47-0x20,r24
+ 407               	.L66:
+ 408               	.LM62:
+ 409 0174 779B      		sbis 46-0x20,7
+ 410 0176 00C0      		rjmp .L66
+ 411               	.LBE43:
+ 412               	.LBE42:
+ 413               	.LBB44:
+ 414               	.LBB45:
+ 415               	.LM63:
+ 416 0178 80E2      		ldi r24,lo8(32)
+ 417 017a 8FB9      		out 47-0x20,r24
+ 418               	.L68:
+ 419               	.LM64:
+ 420 017c 779B      		sbis 46-0x20,7
+ 421 017e 00C0      		rjmp .L68
+ 422               	.LBE45:
+ 423               	.LBE44:
+ 424               	.LBB46:
+ 425               	.LBB47:
+ 426               	.LM65:
+ 427 0180 8CE0      		ldi r24,lo8(12)
+ 428 0182 8FB9      		out 47-0x20,r24
+ 429               	.L70:
+ 430               	.LM66:
+ 431 0184 779B      		sbis 46-0x20,7
+ 432 0186 00C0      		rjmp .L70
+ 433               	.LBE47:
+ 434               	.LBE46:
+ 435               	.LM67:
+ 436 0188 959A      		sbi 50-0x20,5
+ 437               	.LM68:
+ 438 018a 0E94 0000 		call lcd_clear_screen
+ 439               	/* epilogue: frame size=0 */
+ 440 018e 0895      		ret
+ 441               	/* epilogue end (size=1) */
+ 442               	/* function lcd_init size 53 (52) */
+ 443               	.LFE2:
+ 445               		.data
+ 448               	C.1.1504:
+ 449 0000 30        		.byte	48
+ 450 0001 30        		.byte	48
+ 451 0002 30        		.byte	48
+ 452 0003 30        		.byte	48
+ 453 0004 30        		.byte	48
+ 454 0005 30        		.byte	48
+ 455               		.section	.progmem.data,"a",@progbits
+ 458               	FontLookup:
+ 459 0000 00        		.byte	0
+ 460 0001 00        		.byte	0
+ 461 0002 00        		.byte	0
+ 462 0003 00        		.byte	0
+ 463 0004 00        		.byte	0
+ 464 0005 00        		.byte	0
+ 465 0006 00        		.byte	0
+ 466 0007 5F        		.byte	95
+ 467 0008 00        		.byte	0
+ 468 0009 00        		.byte	0
+ 469 000a 00        		.byte	0
+ 470 000b 07        		.byte	7
+ 471 000c 00        		.byte	0
+ 472 000d 07        		.byte	7
+ 473 000e 00        		.byte	0
+ 474 000f 14        		.byte	20
+ 475 0010 7F        		.byte	127
+ 476 0011 14        		.byte	20
+ 477 0012 7F        		.byte	127
+ 478 0013 14        		.byte	20
+ 479 0014 24        		.byte	36
+ 480 0015 2A        		.byte	42
+ 481 0016 7F        		.byte	127
+ 482 0017 2A        		.byte	42
+ 483 0018 12        		.byte	18
+ 484 0019 23        		.byte	35
+ 485 001a 13        		.byte	19
+ 486 001b 08        		.byte	8
+ 487 001c 64        		.byte	100
+ 488 001d 62        		.byte	98
+ 489 001e 36        		.byte	54
+ 490 001f 49        		.byte	73
+ 491 0020 55        		.byte	85
+ 492 0021 22        		.byte	34
+ 493 0022 50        		.byte	80
+ 494 0023 00        		.byte	0
+ 495 0024 05        		.byte	5
+ 496 0025 03        		.byte	3
+ 497 0026 00        		.byte	0
+ 498 0027 00        		.byte	0
+ 499 0028 00        		.byte	0
+ 500 0029 1C        		.byte	28
+ 501 002a 22        		.byte	34
+ 502 002b 41        		.byte	65
+ 503 002c 00        		.byte	0
+ 504 002d 00        		.byte	0
+ 505 002e 41        		.byte	65
+ 506 002f 22        		.byte	34
+ 507 0030 1C        		.byte	28
+ 508 0031 00        		.byte	0
+ 509 0032 14        		.byte	20
+ 510 0033 08        		.byte	8
+ 511 0034 3E        		.byte	62
+ 512 0035 08        		.byte	8
+ 513 0036 14        		.byte	20
+ 514 0037 08        		.byte	8
+ 515 0038 08        		.byte	8
+ 516 0039 3E        		.byte	62
+ 517 003a 08        		.byte	8
+ 518 003b 08        		.byte	8
+ 519 003c 00        		.byte	0
+ 520 003d 00        		.byte	0
+ 521 003e 50        		.byte	80
+ 522 003f 30        		.byte	48
+ 523 0040 00        		.byte	0
+ 524 0041 10        		.byte	16
+ 525 0042 10        		.byte	16
+ 526 0043 10        		.byte	16
+ 527 0044 10        		.byte	16
+ 528 0045 10        		.byte	16
+ 529 0046 00        		.byte	0
+ 530 0047 60        		.byte	96
+ 531 0048 60        		.byte	96
+ 532 0049 00        		.byte	0
+ 533 004a 00        		.byte	0
+ 534 004b 20        		.byte	32
+ 535 004c 10        		.byte	16
+ 536 004d 08        		.byte	8
+ 537 004e 04        		.byte	4
+ 538 004f 02        		.byte	2
+ 539 0050 3E        		.byte	62
+ 540 0051 51        		.byte	81
+ 541 0052 49        		.byte	73
+ 542 0053 45        		.byte	69
+ 543 0054 3E        		.byte	62
+ 544 0055 00        		.byte	0
+ 545 0056 42        		.byte	66
+ 546 0057 7F        		.byte	127
+ 547 0058 40        		.byte	64
+ 548 0059 00        		.byte	0
+ 549 005a 42        		.byte	66
+ 550 005b 61        		.byte	97
+ 551 005c 51        		.byte	81
+ 552 005d 49        		.byte	73
+ 553 005e 46        		.byte	70
+ 554 005f 21        		.byte	33
+ 555 0060 41        		.byte	65
+ 556 0061 45        		.byte	69
+ 557 0062 4B        		.byte	75
+ 558 0063 31        		.byte	49
+ 559 0064 18        		.byte	24
+ 560 0065 14        		.byte	20
+ 561 0066 12        		.byte	18
+ 562 0067 7F        		.byte	127
+ 563 0068 10        		.byte	16
+ 564 0069 27        		.byte	39
+ 565 006a 45        		.byte	69
+ 566 006b 45        		.byte	69
+ 567 006c 45        		.byte	69
+ 568 006d 39        		.byte	57
+ 569 006e 3C        		.byte	60
+ 570 006f 4A        		.byte	74
+ 571 0070 49        		.byte	73
+ 572 0071 49        		.byte	73
+ 573 0072 30        		.byte	48
+ 574 0073 01        		.byte	1
+ 575 0074 71        		.byte	113
+ 576 0075 09        		.byte	9
+ 577 0076 05        		.byte	5
+ 578 0077 03        		.byte	3
+ 579 0078 36        		.byte	54
+ 580 0079 49        		.byte	73
+ 581 007a 49        		.byte	73
+ 582 007b 49        		.byte	73
+ 583 007c 36        		.byte	54
+ 584 007d 06        		.byte	6
+ 585 007e 49        		.byte	73
+ 586 007f 49        		.byte	73
+ 587 0080 29        		.byte	41
+ 588 0081 1E        		.byte	30
+ 589 0082 00        		.byte	0
+ 590 0083 36        		.byte	54
+ 591 0084 36        		.byte	54
+ 592 0085 00        		.byte	0
+ 593 0086 00        		.byte	0
+ 594 0087 00        		.byte	0
+ 595 0088 56        		.byte	86
+ 596 0089 36        		.byte	54
+ 597 008a 00        		.byte	0
+ 598 008b 00        		.byte	0
+ 599 008c 08        		.byte	8
+ 600 008d 14        		.byte	20
+ 601 008e 22        		.byte	34
+ 602 008f 41        		.byte	65
+ 603 0090 00        		.byte	0
+ 604 0091 14        		.byte	20
+ 605 0092 14        		.byte	20
+ 606 0093 14        		.byte	20
+ 607 0094 14        		.byte	20
+ 608 0095 14        		.byte	20
+ 609 0096 00        		.byte	0
+ 610 0097 41        		.byte	65
+ 611 0098 22        		.byte	34
+ 612 0099 14        		.byte	20
+ 613 009a 08        		.byte	8
+ 614 009b 02        		.byte	2
+ 615 009c 01        		.byte	1
+ 616 009d 51        		.byte	81
+ 617 009e 09        		.byte	9
+ 618 009f 06        		.byte	6
+ 619 00a0 32        		.byte	50
+ 620 00a1 49        		.byte	73
+ 621 00a2 59        		.byte	89
+ 622 00a3 51        		.byte	81
+ 623 00a4 3E        		.byte	62
+ 624 00a5 7E        		.byte	126
+ 625 00a6 11        		.byte	17
+ 626 00a7 11        		.byte	17
+ 627 00a8 11        		.byte	17
+ 628 00a9 7E        		.byte	126
+ 629 00aa 7F        		.byte	127
+ 630 00ab 49        		.byte	73
+ 631 00ac 49        		.byte	73
+ 632 00ad 49        		.byte	73
+ 633 00ae 36        		.byte	54
+ 634 00af 3E        		.byte	62
+ 635 00b0 41        		.byte	65
+ 636 00b1 41        		.byte	65
+ 637 00b2 41        		.byte	65
+ 638 00b3 22        		.byte	34
+ 639 00b4 7F        		.byte	127
+ 640 00b5 41        		.byte	65
+ 641 00b6 41        		.byte	65
+ 642 00b7 22        		.byte	34
+ 643 00b8 1C        		.byte	28
+ 644 00b9 7F        		.byte	127
+ 645 00ba 49        		.byte	73
+ 646 00bb 49        		.byte	73
+ 647 00bc 49        		.byte	73
+ 648 00bd 41        		.byte	65
+ 649 00be 7F        		.byte	127
+ 650 00bf 09        		.byte	9
+ 651 00c0 09        		.byte	9
+ 652 00c1 09        		.byte	9
+ 653 00c2 01        		.byte	1
+ 654 00c3 3E        		.byte	62
+ 655 00c4 41        		.byte	65
+ 656 00c5 49        		.byte	73
+ 657 00c6 49        		.byte	73
+ 658 00c7 7A        		.byte	122
+ 659 00c8 7F        		.byte	127
+ 660 00c9 08        		.byte	8
+ 661 00ca 08        		.byte	8
+ 662 00cb 08        		.byte	8
+ 663 00cc 7F        		.byte	127
+ 664 00cd 00        		.byte	0
+ 665 00ce 41        		.byte	65
+ 666 00cf 7F        		.byte	127
+ 667 00d0 41        		.byte	65
+ 668 00d1 00        		.byte	0
+ 669 00d2 20        		.byte	32
+ 670 00d3 40        		.byte	64
+ 671 00d4 41        		.byte	65
+ 672 00d5 3F        		.byte	63
+ 673 00d6 01        		.byte	1
+ 674 00d7 7F        		.byte	127
+ 675 00d8 08        		.byte	8
+ 676 00d9 14        		.byte	20
+ 677 00da 22        		.byte	34
+ 678 00db 41        		.byte	65
+ 679 00dc 7F        		.byte	127
+ 680 00dd 40        		.byte	64
+ 681 00de 40        		.byte	64
+ 682 00df 40        		.byte	64
+ 683 00e0 40        		.byte	64
+ 684 00e1 7F        		.byte	127
+ 685 00e2 02        		.byte	2
+ 686 00e3 0C        		.byte	12
+ 687 00e4 02        		.byte	2
+ 688 00e5 7F        		.byte	127
+ 689 00e6 7F        		.byte	127
+ 690 00e7 04        		.byte	4
+ 691 00e8 08        		.byte	8
+ 692 00e9 10        		.byte	16
+ 693 00ea 7F        		.byte	127
+ 694 00eb 3E        		.byte	62
+ 695 00ec 41        		.byte	65
+ 696 00ed 41        		.byte	65
+ 697 00ee 41        		.byte	65
+ 698 00ef 3E        		.byte	62
+ 699 00f0 7F        		.byte	127
+ 700 00f1 09        		.byte	9
+ 701 00f2 09        		.byte	9
+ 702 00f3 09        		.byte	9
+ 703 00f4 06        		.byte	6
+ 704 00f5 3E        		.byte	62
+ 705 00f6 41        		.byte	65
+ 706 00f7 51        		.byte	81
+ 707 00f8 21        		.byte	33
+ 708 00f9 5E        		.byte	94
+ 709 00fa 7F        		.byte	127
+ 710 00fb 09        		.byte	9
+ 711 00fc 19        		.byte	25
+ 712 00fd 29        		.byte	41
+ 713 00fe 46        		.byte	70
+ 714 00ff 46        		.byte	70
+ 715 0100 49        		.byte	73
+ 716 0101 49        		.byte	73
+ 717 0102 49        		.byte	73
+ 718 0103 31        		.byte	49
+ 719 0104 01        		.byte	1
+ 720 0105 01        		.byte	1
+ 721 0106 7F        		.byte	127
+ 722 0107 01        		.byte	1
+ 723 0108 01        		.byte	1
+ 724 0109 3F        		.byte	63
+ 725 010a 40        		.byte	64
+ 726 010b 40        		.byte	64
+ 727 010c 40        		.byte	64
+ 728 010d 3F        		.byte	63
+ 729 010e 1F        		.byte	31
+ 730 010f 20        		.byte	32
+ 731 0110 40        		.byte	64
+ 732 0111 20        		.byte	32
+ 733 0112 1F        		.byte	31
+ 734 0113 3F        		.byte	63
+ 735 0114 40        		.byte	64
+ 736 0115 38        		.byte	56
+ 737 0116 40        		.byte	64
+ 738 0117 3F        		.byte	63
+ 739 0118 63        		.byte	99
+ 740 0119 14        		.byte	20
+ 741 011a 08        		.byte	8
+ 742 011b 14        		.byte	20
+ 743 011c 63        		.byte	99
+ 744 011d 07        		.byte	7
+ 745 011e 08        		.byte	8
+ 746 011f 70        		.byte	112
+ 747 0120 08        		.byte	8
+ 748 0121 07        		.byte	7
+ 749 0122 61        		.byte	97
+ 750 0123 51        		.byte	81
+ 751 0124 49        		.byte	73
+ 752 0125 45        		.byte	69
+ 753 0126 43        		.byte	67
+ 754 0127 00        		.byte	0
+ 755 0128 7F        		.byte	127
+ 756 0129 41        		.byte	65
+ 757 012a 41        		.byte	65
+ 758 012b 00        		.byte	0
+ 759 012c 02        		.byte	2
+ 760 012d 04        		.byte	4
+ 761 012e 08        		.byte	8
+ 762 012f 10        		.byte	16
+ 763 0130 20        		.byte	32
+ 764 0131 00        		.byte	0
+ 765 0132 41        		.byte	65
+ 766 0133 41        		.byte	65
+ 767 0134 7F        		.byte	127
+ 768 0135 00        		.byte	0
+ 769 0136 04        		.byte	4
+ 770 0137 02        		.byte	2
+ 771 0138 01        		.byte	1
+ 772 0139 02        		.byte	2
+ 773 013a 04        		.byte	4
+ 774 013b 40        		.byte	64
+ 775 013c 40        		.byte	64
+ 776 013d 40        		.byte	64
+ 777 013e 40        		.byte	64
+ 778 013f 40        		.byte	64
+ 779 0140 00        		.byte	0
+ 780 0141 01        		.byte	1
+ 781 0142 02        		.byte	2
+ 782 0143 04        		.byte	4
+ 783 0144 00        		.byte	0
+ 784 0145 20        		.byte	32
+ 785 0146 54        		.byte	84
+ 786 0147 54        		.byte	84
+ 787 0148 54        		.byte	84
+ 788 0149 78        		.byte	120
+ 789 014a 7F        		.byte	127
+ 790 014b 48        		.byte	72
+ 791 014c 44        		.byte	68
+ 792 014d 44        		.byte	68
+ 793 014e 38        		.byte	56
+ 794 014f 38        		.byte	56
+ 795 0150 44        		.byte	68
+ 796 0151 44        		.byte	68
+ 797 0152 44        		.byte	68
+ 798 0153 20        		.byte	32
+ 799 0154 38        		.byte	56
+ 800 0155 44        		.byte	68
+ 801 0156 44        		.byte	68
+ 802 0157 48        		.byte	72
+ 803 0158 7F        		.byte	127
+ 804 0159 38        		.byte	56
+ 805 015a 54        		.byte	84
+ 806 015b 54        		.byte	84
+ 807 015c 54        		.byte	84
+ 808 015d 18        		.byte	24
+ 809 015e 08        		.byte	8
+ 810 015f 7E        		.byte	126
+ 811 0160 09        		.byte	9
+ 812 0161 01        		.byte	1
+ 813 0162 02        		.byte	2
+ 814 0163 0C        		.byte	12
+ 815 0164 52        		.byte	82
+ 816 0165 52        		.byte	82
+ 817 0166 52        		.byte	82
+ 818 0167 3E        		.byte	62
+ 819 0168 7F        		.byte	127
+ 820 0169 08        		.byte	8
+ 821 016a 04        		.byte	4
+ 822 016b 04        		.byte	4
+ 823 016c 78        		.byte	120
+ 824 016d 00        		.byte	0
+ 825 016e 44        		.byte	68
+ 826 016f 7D        		.byte	125
+ 827 0170 40        		.byte	64
+ 828 0171 00        		.byte	0
+ 829 0172 20        		.byte	32
+ 830 0173 40        		.byte	64
+ 831 0174 44        		.byte	68
+ 832 0175 3D        		.byte	61
+ 833 0176 00        		.byte	0
+ 834 0177 7F        		.byte	127
+ 835 0178 10        		.byte	16
+ 836 0179 28        		.byte	40
+ 837 017a 44        		.byte	68
+ 838 017b 00        		.byte	0
+ 839 017c 00        		.byte	0
+ 840 017d 41        		.byte	65
+ 841 017e 7F        		.byte	127
+ 842 017f 40        		.byte	64
+ 843 0180 00        		.byte	0
+ 844 0181 7C        		.byte	124
+ 845 0182 04        		.byte	4
+ 846 0183 18        		.byte	24
+ 847 0184 04        		.byte	4
+ 848 0185 78        		.byte	120
+ 849 0186 7C        		.byte	124
+ 850 0187 08        		.byte	8
+ 851 0188 04        		.byte	4
+ 852 0189 04        		.byte	4
+ 853 018a 78        		.byte	120
+ 854 018b 38        		.byte	56
+ 855 018c 44        		.byte	68
+ 856 018d 44        		.byte	68
+ 857 018e 44        		.byte	68
+ 858 018f 38        		.byte	56
+ 859 0190 7C        		.byte	124
+ 860 0191 14        		.byte	20
+ 861 0192 14        		.byte	20
+ 862 0193 14        		.byte	20
+ 863 0194 08        		.byte	8
+ 864 0195 08        		.byte	8
+ 865 0196 14        		.byte	20
+ 866 0197 14        		.byte	20
+ 867 0198 18        		.byte	24
+ 868 0199 7C        		.byte	124
+ 869 019a 7C        		.byte	124
+ 870 019b 08        		.byte	8
+ 871 019c 04        		.byte	4
+ 872 019d 04        		.byte	4
+ 873 019e 08        		.byte	8
+ 874 019f 48        		.byte	72
+ 875 01a0 54        		.byte	84
+ 876 01a1 54        		.byte	84
+ 877 01a2 54        		.byte	84
+ 878 01a3 20        		.byte	32
+ 879 01a4 04        		.byte	4
+ 880 01a5 3F        		.byte	63
+ 881 01a6 44        		.byte	68
+ 882 01a7 40        		.byte	64
+ 883 01a8 20        		.byte	32
+ 884 01a9 3C        		.byte	60
+ 885 01aa 40        		.byte	64
+ 886 01ab 40        		.byte	64
+ 887 01ac 20        		.byte	32
+ 888 01ad 7C        		.byte	124
+ 889 01ae 1C        		.byte	28
+ 890 01af 20        		.byte	32
+ 891 01b0 40        		.byte	64
+ 892 01b1 20        		.byte	32
+ 893 01b2 1C        		.byte	28
+ 894 01b3 3C        		.byte	60
+ 895 01b4 40        		.byte	64
+ 896 01b5 30        		.byte	48
+ 897 01b6 40        		.byte	64
+ 898 01b7 3C        		.byte	60
+ 899 01b8 44        		.byte	68
+ 900 01b9 28        		.byte	40
+ 901 01ba 10        		.byte	16
+ 902 01bb 28        		.byte	40
+ 903 01bc 44        		.byte	68
+ 904 01bd 0C        		.byte	12
+ 905 01be 50        		.byte	80
+ 906 01bf 50        		.byte	80
+ 907 01c0 50        		.byte	80
+ 908 01c1 3C        		.byte	60
+ 909 01c2 44        		.byte	68
+ 910 01c3 64        		.byte	100
+ 911 01c4 54        		.byte	84
+ 912 01c5 4C        		.byte	76
+ 913 01c6 44        		.byte	68
+ 914 01c7 00        		.byte	0
+ 915 01c8 08        		.byte	8
+ 916 01c9 36        		.byte	54
+ 917 01ca 41        		.byte	65
+ 918 01cb 41        		.byte	65
+ 919 01cc 00        		.byte	0
+ 920 01cd 00        		.byte	0
+ 921 01ce 7F        		.byte	127
+ 922 01cf 00        		.byte	0
+ 923 01d0 00        		.byte	0
+ 924 01d1 41        		.byte	65
+ 925 01d2 41        		.byte	65
+ 926 01d3 36        		.byte	54
+ 927 01d4 08        		.byte	8
+ 928 01d5 00        		.byte	0
+ 929 01d6 02        		.byte	2
+ 930 01d7 01        		.byte	1
+ 931 01d8 01        		.byte	1
+ 932 01d9 02        		.byte	2
+ 933 01da 01        		.byte	1
+ 934 01db 55        		.byte	85
+ 935 01dc 2A        		.byte	42
+ 936 01dd 55        		.byte	85
+ 937 01de 2A        		.byte	42
+ 938 01df 55        		.byte	85
+ 1011               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 lcd.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:20     .text:00000000 lcd_putc
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:458    .progmem.data:00000000 FontLookup
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:81     .text:0000002c lcd_puts
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:115    .text:00000046 lcd_gotoxy
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:161    .text:00000060 lcd_clear_screen
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:201    .text:00000082 lcd_puti
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:448    .data:00000000 C.1.1504
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:310    .text:0000011e lcd_putbyte
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cccomfIa.s:330    .text:00000126 lcd_init
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+__divmodhi4
+delay_ms
Index: demos/hunter_prey_john/projects/libdragonfly/odometry.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/odometry.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/odometry.lst	(revision 1694)
@@ -0,0 +1,804 @@
+   1               		.file	"odometry.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	odometry_dx
+  20               	odometry_dx:
+  21               	.LFB3:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25 0000 6091 0000 		lds r22,diff_x
+  26 0004 7091 0000 		lds r23,(diff_x)+1
+  27 0008 8091 0000 		lds r24,(diff_x)+2
+  28 000c 9091 0000 		lds r25,(diff_x)+3
+  29               	/* epilogue: frame size=0 */
+  30 0010 0895      		ret
+  31               	/* epilogue end (size=1) */
+  32               	/* function odometry_dx size 9 (8) */
+  33               	.LFE3:
+  35               	.global	odometry_dy
+  37               	odometry_dy:
+  38               	.LFB4:
+  39               	.LM2:
+  40               	/* prologue: frame size=0 */
+  41               	/* prologue end (size=0) */
+  42 0012 6091 0000 		lds r22,diff_y
+  43 0016 7091 0000 		lds r23,(diff_y)+1
+  44 001a 8091 0000 		lds r24,(diff_y)+2
+  45 001e 9091 0000 		lds r25,(diff_y)+3
+  46               	/* epilogue: frame size=0 */
+  47 0022 0895      		ret
+  48               	/* epilogue end (size=1) */
+  49               	/* function odometry_dy size 9 (8) */
+  50               	.LFE4:
+  52               	.global	odometry_angle
+  54               	odometry_angle:
+  55               	.LFB5:
+  56               	.LM3:
+  57               	/* prologue: frame size=0 */
+  58               	/* prologue end (size=0) */
+  59 0024 6091 0000 		lds r22,angle
+  60 0028 7091 0000 		lds r23,(angle)+1
+  61 002c 8091 0000 		lds r24,(angle)+2
+  62 0030 9091 0000 		lds r25,(angle)+3
+  63               	/* epilogue: frame size=0 */
+  64 0034 0895      		ret
+  65               	/* epilogue end (size=1) */
+  66               	/* function odometry_angle size 9 (8) */
+  67               	.LFE5:
+  69               	.global	odometry_velocity
+  71               	odometry_velocity:
+  72               	.LFB6:
+  73               	.LM4:
+  74               	/* prologue: frame size=0 */
+  75               	/* prologue end (size=0) */
+  76 0036 6091 0000 		lds r22,velocity
+  77 003a 7091 0000 		lds r23,(velocity)+1
+  78 003e 8091 0000 		lds r24,(velocity)+2
+  79 0042 9091 0000 		lds r25,(velocity)+3
+  80               	/* epilogue: frame size=0 */
+  81 0046 0895      		ret
+  82               	/* epilogue end (size=1) */
+  83               	/* function odometry_velocity size 9 (8) */
+  84               	.LFE6:
+  86               	.global	lround
+  88               	lround:
+  89               	.LFB11:
+  90               	.LM5:
+  91               	/* prologue: frame size=0 */
+  92 0048 AF92      		push r10
+  93 004a BF92      		push r11
+  94 004c CF92      		push r12
+  95 004e DF92      		push r13
+  96 0050 EF92      		push r14
+  97 0052 FF92      		push r15
+  98 0054 0F93      		push r16
+  99 0056 1F93      		push r17
+ 100               	/* prologue end (size=8) */
+ 101               	.LVL0:
+ 102 0058 7B01      		movw r14,r22
+ 103 005a 8C01      		movw r16,r24
+ 104               	.LM6:
+ 105 005c 0E94 0000 		call floor
+ 106               	.LVL1:
+ 107 0060 5B01      		movw r10,r22
+ 108 0062 6C01      		movw r12,r24
+ 109               	.LVL2:
+ 110               	.LM7:
+ 111 0064 9B01      		movw r18,r22
+ 112 0066 AC01      		movw r20,r24
+ 113 0068 C801      		movw r24,r16
+ 114 006a B701      		movw r22,r14
+ 115 006c 0E94 0000 		call __subsf3
+ 116 0070 20E0      		ldi r18,lo8(0x3f000000)
+ 117 0072 30E0      		ldi r19,hi8(0x3f000000)
+ 118 0074 40E0      		ldi r20,hlo8(0x3f000000)
+ 119 0076 5FE3      		ldi r21,hhi8(0x3f000000)
+ 120 0078 0E94 0000 		call __gtsf2
+ 121 007c 1816      		cp __zero_reg__,r24
+ 122 007e 04F4      		brge .L10
+ 123               	.LM8:
+ 124 0080 20E0      		ldi r18,lo8(0x3f800000)
+ 125 0082 30E0      		ldi r19,hi8(0x3f800000)
+ 126 0084 40E8      		ldi r20,hlo8(0x3f800000)
+ 127 0086 5FE3      		ldi r21,hhi8(0x3f800000)
+ 128 0088 C601      		movw r24,r12
+ 129 008a B501      		movw r22,r10
+ 130 008c 0E94 0000 		call __addsf3
+ 131 0090 00C0      		rjmp .L15
+ 132               	.L10:
+ 133 0092 C601      		movw r24,r12
+ 134 0094 B501      		movw r22,r10
+ 135               	.L15:
+ 136 0096 0E94 0000 		call __fixsfsi
+ 137               	/* epilogue: frame size=0 */
+ 138 009a 1F91      		pop r17
+ 139 009c 0F91      		pop r16
+ 140 009e FF90      		pop r15
+ 141 00a0 EF90      		pop r14
+ 142 00a2 DF90      		pop r13
+ 143 00a4 CF90      		pop r12
+ 144 00a6 BF90      		pop r11
+ 145 00a8 AF90      		pop r10
+ 146 00aa 0895      		ret
+ 147               	/* epilogue end (size=9) */
+ 148               	/* function lround size 51 (34) */
+ 149               	.LFE11:
+ 151               	.global	odometry_reset
+ 153               	odometry_reset:
+ 154               	.LFB8:
+ 155               	.LM9:
+ 156               	/* prologue: frame size=0 */
+ 157               	/* prologue end (size=0) */
+ 158               	.LM10:
+ 159 00ac 1092 0000 		sts diff_x,__zero_reg__
+ 160 00b0 1092 0000 		sts (diff_x)+1,__zero_reg__
+ 161 00b4 1092 0000 		sts (diff_x)+2,__zero_reg__
+ 162 00b8 1092 0000 		sts (diff_x)+3,__zero_reg__
+ 163               	.LM11:
+ 164 00bc 1092 0000 		sts diff_y,__zero_reg__
+ 165 00c0 1092 0000 		sts (diff_y)+1,__zero_reg__
+ 166 00c4 1092 0000 		sts (diff_y)+2,__zero_reg__
+ 167 00c8 1092 0000 		sts (diff_y)+3,__zero_reg__
+ 168               	.LM12:
+ 169 00cc 80E0      		ldi r24,lo8(0)
+ 170 00ce 0E94 0000 		call encoder_read
+ 171 00d2 9093 0000 		sts (encoder_ltm1)+1,r25
+ 172 00d6 8093 0000 		sts encoder_ltm1,r24
+ 173               	.LM13:
+ 174 00da 81E0      		ldi r24,lo8(1)
+ 175 00dc 0E94 0000 		call encoder_read
+ 176 00e0 9093 0000 		sts (encoder_rtm1)+1,r25
+ 177 00e4 8093 0000 		sts encoder_rtm1,r24
+ 178               	.LM14:
+ 179 00e8 80E0      		ldi r24,lo8(0x0)
+ 180 00ea 90E0      		ldi r25,hi8(0x0)
+ 181 00ec A0E0      		ldi r26,hlo8(0x0)
+ 182 00ee B0E0      		ldi r27,hhi8(0x0)
+ 183 00f0 8093 0000 		sts angle,r24
+ 184 00f4 9093 0000 		sts (angle)+1,r25
+ 185 00f8 A093 0000 		sts (angle)+2,r26
+ 186 00fc B093 0000 		sts (angle)+3,r27
+ 187               	/* epilogue: frame size=0 */
+ 188 0100 0895      		ret
+ 189               	/* epilogue end (size=1) */
+ 190               	/* function odometry_reset size 43 (42) */
+ 191               	.LFE8:
+ 193               		.data
+ 194               	.LC0:
+ 195 0000 6463 3A20 		.string	"dc: "
+ 195      00
+ 196               	.LC1:
+ 197 0005 756D 2C20 		.string	"um, velocity: "
+ 197      7665 6C6F 
+ 197      6369 7479 
+ 197      3A20 00
+ 198               	.LC2:
+ 199 0014 0D0A 206D 		.string	"\r\n mm/s"
+ 199      6D2F 7300 
+ 200               		.text
+ 201               	.global	odometry_run
+ 203               	odometry_run:
+ 204               	.LFB9:
+ 205               	.LM15:
+ 206               	/* prologue: frame size=0 */
+ 207 0102 2F92      		push r2
+ 208 0104 3F92      		push r3
+ 209 0106 4F92      		push r4
+ 210 0108 5F92      		push r5
+ 211 010a 6F92      		push r6
+ 212 010c 7F92      		push r7
+ 213 010e 8F92      		push r8
+ 214 0110 9F92      		push r9
+ 215 0112 AF92      		push r10
+ 216 0114 BF92      		push r11
+ 217 0116 CF92      		push r12
+ 218 0118 DF92      		push r13
+ 219 011a EF92      		push r14
+ 220 011c FF92      		push r15
+ 221 011e 0F93      		push r16
+ 222 0120 1F93      		push r17
+ 223               	/* prologue end (size=16) */
+ 224               	.LBB2:
+ 225               	.LM16:
+ 226 0122 81E0      		ldi r24,lo8(1)
+ 227 0124 0E94 0000 		call encoder_read
+ 228 0128 8C01      		movw r16,r24
+ 229               	.LVL3:
+ 230               	.LM17:
+ 231 012a 80E0      		ldi r24,lo8(0)
+ 232 012c 0E94 0000 		call encoder_read
+ 233 0130 9C01      		movw r18,r24
+ 234               	.LVL4:
+ 235               	.LM18:
+ 236 0132 8091 0000 		lds r24,encoder_ltm1
+ 237 0136 9091 0000 		lds r25,(encoder_ltm1)+1
+ 238 013a B901      		movw r22,r18
+ 239 013c 681B      		sub r22,r24
+ 240 013e 790B      		sbc r23,r25
+ 241               	.LM19:
+ 242 0140 8091 0000 		lds r24,encoder_rtm1
+ 243 0144 9091 0000 		lds r25,(encoder_rtm1)+1
+ 244 0148 A801      		movw r20,r16
+ 245 014a 481B      		sub r20,r24
+ 246 014c 590B      		sbc r21,r25
+ 247               	.LM20:
+ 248 014e 6115      		cp r22,__zero_reg__
+ 249 0150 7105      		cpc r23,__zero_reg__
+ 250 0152 01F4      		brne .L19
+ 251               	.LM21:
+ 252 0154 4115      		cp r20,__zero_reg__
+ 253 0156 5105      		cpc r21,__zero_reg__
+ 254 0158 01F0      		breq .+2
+ 255 015a 00C0      		rjmp .L34
+ 256 015c 00C0      		rjmp .L33
+ 257               	.L19:
+ 258               	.LM22:
+ 259 015e 8827      		clr r24
+ 260 0160 77FD      		sbrc r23,7
+ 261 0162 8095      		com r24
+ 262 0164 982F      		mov r25,r24
+ 263               	.LVL5:
+ 264               	.LM23:
+ 265 0166 3093 0000 		sts (encoder_ltm1)+1,r19
+ 266 016a 2093 0000 		sts encoder_ltm1,r18
+ 267               	.LM24:
+ 268 016e 1093 0000 		sts (encoder_rtm1)+1,r17
+ 269 0172 0093 0000 		sts encoder_rtm1,r16
+ 270               	.LM25:
+ 271 0176 6130      		cpi r22,lo8(513)
+ 272 0178 22E0      		ldi r18,hi8(513)
+ 273 017a 7207      		cpc r23,r18
+ 274 017c 20E0      		ldi r18,hlo8(513)
+ 275 017e 8207      		cpc r24,r18
+ 276 0180 20E0      		ldi r18,hhi8(513)
+ 277 0182 9207      		cpc r25,r18
+ 278               	.LVL6:
+ 279 0184 04F0      		brlt .L23
+ 280 0186 6050      		subi r22,lo8(-(-1024))
+ 281 0188 7440      		sbci r23,hi8(-(-1024))
+ 282 018a 8040      		sbci r24,hlo8(-(-1024))
+ 283 018c 9040      		sbci r25,hhi8(-(-1024))
+ 284               	.LVL7:
+ 285               	.L23:
+ 286               	.LM26:
+ 287 018e 6030      		cpi r22,lo8(-512)
+ 288 0190 3EEF      		ldi r19,hi8(-512)
+ 289 0192 7307      		cpc r23,r19
+ 290 0194 3FEF      		ldi r19,hlo8(-512)
+ 291 0196 8307      		cpc r24,r19
+ 292 0198 3FEF      		ldi r19,hhi8(-512)
+ 293 019a 9307      		cpc r25,r19
+ 294 019c 04F4      		brge .L25
+ 295 019e 6050      		subi r22,lo8(-(1024))
+ 296 01a0 7C4F      		sbci r23,hi8(-(1024))
+ 297 01a2 8F4F      		sbci r24,hlo8(-(1024))
+ 298 01a4 9F4F      		sbci r25,hhi8(-(1024))
+ 299               	.L25:
+ 300               	.LM27:
+ 301 01a6 7A01      		movw r14,r20
+ 302 01a8 0027      		clr r16
+ 303 01aa F7FC      		sbrc r15,7
+ 304 01ac 0095      		com r16
+ 305 01ae 102F      		mov r17,r16
+ 306               	.LVL8:
+ 307               	.LM28:
+ 308 01b0 41E0      		ldi r20,lo8(513)
+ 309 01b2 E416      		cp r14,r20
+ 310 01b4 42E0      		ldi r20,hi8(513)
+ 311 01b6 F406      		cpc r15,r20
+ 312 01b8 40E0      		ldi r20,hlo8(513)
+ 313 01ba 0407      		cpc r16,r20
+ 314 01bc 40E0      		ldi r20,hhi8(513)
+ 315 01be 1407      		cpc r17,r20
+ 316 01c0 04F0      		brlt .L27
+ 317 01c2 20E0      		ldi r18,lo8(-1024)
+ 318 01c4 3CEF      		ldi r19,hi8(-1024)
+ 319 01c6 4FEF      		ldi r20,hlo8(-1024)
+ 320 01c8 5FEF      		ldi r21,hhi8(-1024)
+ 321               	.LVL9:
+ 322 01ca E20E      		add r14,r18
+ 323 01cc F31E      		adc r15,r19
+ 324 01ce 041F      		adc r16,r20
+ 325 01d0 151F      		adc r17,r21
+ 326               	.LVL10:
+ 327               	.L27:
+ 328               	.LM29:
+ 329 01d2 30E0      		ldi r19,lo8(-512)
+ 330 01d4 E316      		cp r14,r19
+ 331 01d6 3EEF      		ldi r19,hi8(-512)
+ 332 01d8 F306      		cpc r15,r19
+ 333 01da 3FEF      		ldi r19,hlo8(-512)
+ 334 01dc 0307      		cpc r16,r19
+ 335 01de 3FEF      		ldi r19,hhi8(-512)
+ 336 01e0 1307      		cpc r17,r19
+ 337 01e2 04F4      		brge .L29
+ 338 01e4 20E0      		ldi r18,lo8(1024)
+ 339 01e6 34E0      		ldi r19,hi8(1024)
+ 340 01e8 40E0      		ldi r20,hlo8(1024)
+ 341 01ea 50E0      		ldi r21,hhi8(1024)
+ 342               	.LVL11:
+ 343 01ec E20E      		add r14,r18
+ 344 01ee F31E      		adc r15,r19
+ 345 01f0 041F      		adc r16,r20
+ 346 01f2 151F      		adc r17,r21
+ 347               	.LVL12:
+ 348               	.L29:
+ 349               	.LM30:
+ 350 01f4 2CEC      		ldi r18,lo8(204)
+ 351 01f6 30E0      		ldi r19,hi8(204)
+ 352 01f8 40E0      		ldi r20,hlo8(204)
+ 353 01fa 50E0      		ldi r21,hhi8(204)
+ 354               	.LVL13:
+ 355 01fc 0E94 0000 		call __mulsi3
+ 356 0200 1B01      		movw r2,r22
+ 357 0202 2C01      		movw r4,r24
+ 358               	.LVL14:
+ 359               	.LM31:
+ 360 0204 C801      		movw r24,r16
+ 361 0206 B701      		movw r22,r14
+ 362 0208 0E94 0000 		call __mulsi3
+ 363               	.LVL15:
+ 364               	.LBE2:
+ 365               	.LM32:
+ 366 020c 2616      		cp r2,r22
+ 367 020e 3706      		cpc r3,r23
+ 368 0210 4806      		cpc r4,r24
+ 369 0212 5906      		cpc r5,r25
+ 370 0214 01F0      		breq .+2
+ 371 0216 00C0      		rjmp .L31
+ 372               	.LM33:
+ 373 0218 E090 0000 		lds r14,diff_x
+ 374 021c F090 0000 		lds r15,(diff_x)+1
+ 375 0220 0091 0000 		lds r16,(diff_x)+2
+ 376 0224 1091 0000 		lds r17,(diff_x)+3
+ 377               	.LVL16:
+ 378 0228 C201      		movw r24,r4
+ 379 022a B101      		movw r22,r2
+ 380               	.LVL17:
+ 381 022c 0E94 0000 		call __floatsisf
+ 382 0230 5B01      		movw r10,r22
+ 383 0232 6C01      		movw r12,r24
+ 384 0234 6091 0000 		lds r22,angle
+ 385 0238 7091 0000 		lds r23,(angle)+1
+ 386 023c 8091 0000 		lds r24,(angle)+2
+ 387 0240 9091 0000 		lds r25,(angle)+3
+ 388 0244 0E94 0000 		call cos
+ 389 0248 9B01      		movw r18,r22
+ 390 024a AC01      		movw r20,r24
+ 391 024c C601      		movw r24,r12
+ 392 024e B501      		movw r22,r10
+ 393 0250 0E94 0000 		call __mulsf3
+ 394 0254 20E0      		ldi r18,lo8(0x447a0000)
+ 395 0256 30E0      		ldi r19,hi8(0x447a0000)
+ 396 0258 4AE7      		ldi r20,hlo8(0x447a0000)
+ 397 025a 54E4      		ldi r21,hhi8(0x447a0000)
+ 398 025c 0E94 0000 		call __divsf3
+ 399 0260 0E94 0000 		call lround
+ 400 0264 E60E      		add r14,r22
+ 401 0266 F71E      		adc r15,r23
+ 402 0268 081F      		adc r16,r24
+ 403 026a 191F      		adc r17,r25
+ 404 026c E092 0000 		sts diff_x,r14
+ 405 0270 F092 0000 		sts (diff_x)+1,r15
+ 406 0274 0093 0000 		sts (diff_x)+2,r16
+ 407 0278 1093 0000 		sts (diff_x)+3,r17
+ 408               	.LM34:
+ 409 027c E090 0000 		lds r14,diff_y
+ 410 0280 F090 0000 		lds r15,(diff_y)+1
+ 411 0284 0091 0000 		lds r16,(diff_y)+2
+ 412 0288 1091 0000 		lds r17,(diff_y)+3
+ 413 028c 6091 0000 		lds r22,angle
+ 414 0290 7091 0000 		lds r23,(angle)+1
+ 415 0294 8091 0000 		lds r24,(angle)+2
+ 416 0298 9091 0000 		lds r25,(angle)+3
+ 417 029c 0E94 0000 		call sin
+ 418 02a0 9B01      		movw r18,r22
+ 419 02a2 AC01      		movw r20,r24
+ 420 02a4 C601      		movw r24,r12
+ 421 02a6 B501      		movw r22,r10
+ 422 02a8 0E94 0000 		call __mulsf3
+ 423 02ac 20E0      		ldi r18,lo8(0x447a0000)
+ 424 02ae 30E0      		ldi r19,hi8(0x447a0000)
+ 425 02b0 4AE7      		ldi r20,hlo8(0x447a0000)
+ 426 02b2 54E4      		ldi r21,hhi8(0x447a0000)
+ 427 02b4 0E94 0000 		call __divsf3
+ 428 02b8 0E94 0000 		call lround
+ 429 02bc E60E      		add r14,r22
+ 430 02be F71E      		adc r15,r23
+ 431 02c0 081F      		adc r16,r24
+ 432 02c2 191F      		adc r17,r25
+ 433 02c4 E092 0000 		sts diff_y,r14
+ 434 02c8 F092 0000 		sts (diff_y)+1,r15
+ 435 02cc 0093 0000 		sts (diff_y)+2,r16
+ 436 02d0 1093 0000 		sts (diff_y)+3,r17
+ 437               	.LM35:
+ 438 02d4 20E0      		ldi r18,lo8(0x447a0000)
+ 439 02d6 30E0      		ldi r19,hi8(0x447a0000)
+ 440 02d8 4AE7      		ldi r20,hlo8(0x447a0000)
+ 441 02da 54E4      		ldi r21,hhi8(0x447a0000)
+ 442 02dc C601      		movw r24,r12
+ 443 02de B501      		movw r22,r10
+ 444 02e0 0E94 0000 		call __mulsf3
+ 445 02e4 20E0      		ldi r18,lo8(0x467f0000)
+ 446 02e6 30E0      		ldi r19,hi8(0x467f0000)
+ 447 02e8 4FE7      		ldi r20,hlo8(0x467f0000)
+ 448 02ea 56E4      		ldi r21,hhi8(0x467f0000)
+ 449 02ec 0E94 0000 		call __divsf3
+ 450 02f0 0E94 0000 		call lround
+ 451 02f4 6093 0000 		sts velocity,r22
+ 452 02f8 7093 0000 		sts (velocity)+1,r23
+ 453 02fc 8093 0000 		sts (velocity)+2,r24
+ 454 0300 9093 0000 		sts (velocity)+3,r25
+ 455               	.LM36:
+ 456 0304 80E0      		ldi r24,lo8(.LC0)
+ 457 0306 90E0      		ldi r25,hi8(.LC0)
+ 458 0308 0E94 0000 		call usb_puts
+ 459               	.LM37:
+ 460 030c C101      		movw r24,r2
+ 461 030e 0E94 0000 		call usb_puti
+ 462               	.LM38:
+ 463 0312 80E0      		ldi r24,lo8(.LC1)
+ 464 0314 90E0      		ldi r25,hi8(.LC1)
+ 465 0316 0E94 0000 		call usb_puts
+ 466               	.LM39:
+ 467 031a 8091 0000 		lds r24,velocity
+ 468 031e 9091 0000 		lds r25,(velocity)+1
+ 469 0322 0E94 0000 		call usb_puti
+ 470               	.LM40:
+ 471 0326 80E0      		ldi r24,lo8(.LC2)
+ 472 0328 90E0      		ldi r25,hi8(.LC2)
+ 473 032a 0E94 0000 		call usb_puts
+ 474 032e 00C0      		rjmp .L33
+ 475               	.LVL18:
+ 476               	.L31:
+ 477               	.LM41:
+ 478 0330 A201      		movw r20,r4
+ 479 0332 9101      		movw r18,r2
+ 480 0334 261B      		sub r18,r22
+ 481 0336 370B      		sbc r19,r23
+ 482 0338 480B      		sbc r20,r24
+ 483 033a 590B      		sbc r21,r25
+ 484 033c CA01      		movw r24,r20
+ 485 033e B901      		movw r22,r18
+ 486               	.LVL19:
+ 487 0340 0E94 0000 		call __floatsisf
+ 488 0344 7B01      		movw r14,r22
+ 489 0346 8C01      		movw r16,r24
+ 490               	.LVL20:
+ 491               	.LM42:
+ 492 0348 20E0      		ldi r18,lo8(0x4805ca00)
+ 493 034a 3AEC      		ldi r19,hi8(0x4805ca00)
+ 494 034c 45E0      		ldi r20,hlo8(0x4805ca00)
+ 495 034e 58E4      		ldi r21,hhi8(0x4805ca00)
+ 496 0350 0E94 0000 		call __divsf3
+ 497 0354 5B01      		movw r10,r22
+ 498 0356 6C01      		movw r12,r24
+ 499               	.LM43:
+ 500 0358 C201      		movw r24,r4
+ 501 035a B101      		movw r22,r2
+ 502 035c 28E2      		ldi r18,lo8(137000)
+ 503 035e 37E1      		ldi r19,hi8(137000)
+ 504 0360 42E0      		ldi r20,hlo8(137000)
+ 505 0362 50E0      		ldi r21,hhi8(137000)
+ 506 0364 0E94 0000 		call __mulsi3
+ 507 0368 0E94 0000 		call __floatsisf
+ 508 036c A801      		movw r20,r16
+ 509 036e 9701      		movw r18,r14
+ 510 0370 0E94 0000 		call __divsf3
+ 511 0374 20E0      		ldi r18,lo8(0x4805ca00)
+ 512 0376 3AEC      		ldi r19,hi8(0x4805ca00)
+ 513 0378 45E0      		ldi r20,hlo8(0x4805ca00)
+ 514 037a 58E4      		ldi r21,hhi8(0x4805ca00)
+ 515 037c 0E94 0000 		call __subsf3
+ 516 0380 9B01      		movw r18,r22
+ 517 0382 AC01      		movw r20,r24
+ 518 0384 C601      		movw r24,r12
+ 519 0386 B501      		movw r22,r10
+ 520               	.LVL21:
+ 521 0388 0E94 0000 		call __mulsf3
+ 522               	.LVL22:
+ 523 038c 20E0      		ldi r18,lo8(0x3f000000)
+ 524 038e 30E0      		ldi r19,hi8(0x3f000000)
+ 525 0390 40E0      		ldi r20,hlo8(0x3f000000)
+ 526 0392 5FE3      		ldi r21,hhi8(0x3f000000)
+ 527 0394 0E94 0000 		call __mulsf3
+ 528 0398 3B01      		movw r6,r22
+ 529 039a 4C01      		movw r8,r24
+ 530               	.LM44:
+ 531 039c 20E0      		ldi r18,lo8(0x447a0000)
+ 532 039e 30E0      		ldi r19,hi8(0x447a0000)
+ 533 03a0 4AE7      		ldi r20,hlo8(0x447a0000)
+ 534 03a2 54E4      		ldi r21,hhi8(0x447a0000)
+ 535 03a4 0E94 0000 		call __mulsf3
+ 536 03a8 20E0      		ldi r18,lo8(0x467f0000)
+ 537 03aa 30E0      		ldi r19,hi8(0x467f0000)
+ 538 03ac 4FE7      		ldi r20,hlo8(0x467f0000)
+ 539 03ae 56E4      		ldi r21,hhi8(0x467f0000)
+ 540 03b0 0E94 0000 		call __divsf3
+ 541 03b4 0E94 0000 		call lround
+ 542 03b8 6093 0000 		sts velocity,r22
+ 543 03bc 7093 0000 		sts (velocity)+1,r23
+ 544 03c0 8093 0000 		sts (velocity)+2,r24
+ 545 03c4 9093 0000 		sts (velocity)+3,r25
+ 546               	.LM45:
+ 547 03c8 80E0      		ldi r24,lo8(.LC0)
+ 548 03ca 90E0      		ldi r25,hi8(.LC0)
+ 549 03cc 0E94 0000 		call usb_puts
+ 550               	.LM46:
+ 551 03d0 C101      		movw r24,r2
+ 552 03d2 0E94 0000 		call usb_puti
+ 553               	.LM47:
+ 554 03d6 80E0      		ldi r24,lo8(.LC1)
+ 555 03d8 90E0      		ldi r25,hi8(.LC1)
+ 556 03da 0E94 0000 		call usb_puts
+ 557               	.LM48:
+ 558 03de 8091 0000 		lds r24,velocity
+ 559 03e2 9091 0000 		lds r25,(velocity)+1
+ 560 03e6 0E94 0000 		call usb_puti
+ 561               	.LM49:
+ 562 03ea 80E0      		ldi r24,lo8(.LC2)
+ 563 03ec 90E0      		ldi r25,hi8(.LC2)
+ 564 03ee 0E94 0000 		call usb_puts
+ 565               	.LM50:
+ 566 03f2 29EE      		ldi r18,lo8(0xbf9069e9)
+ 567 03f4 39E6      		ldi r19,hi8(0xbf9069e9)
+ 568 03f6 40E9      		ldi r20,hlo8(0xbf9069e9)
+ 569 03f8 5FEB      		ldi r21,hhi8(0xbf9069e9)
+ 570 03fa C601      		movw r24,r12
+ 571 03fc B501      		movw r22,r10
+ 572               	.LVL23:
+ 573 03fe 0E94 0000 		call __mulsf3
+ 574               	.LVL24:
+ 575 0402 2091 0000 		lds r18,angle
+ 576 0406 3091 0000 		lds r19,(angle)+1
+ 577 040a 4091 0000 		lds r20,(angle)+2
+ 578 040e 5091 0000 		lds r21,(angle)+3
+ 579 0412 0E94 0000 		call __addsf3
+ 580 0416 7B01      		movw r14,r22
+ 581 0418 8C01      		movw r16,r24
+ 582 041a 6093 0000 		sts angle,r22
+ 583 041e 7093 0000 		sts (angle)+1,r23
+ 584 0422 8093 0000 		sts (angle)+2,r24
+ 585 0426 9093 0000 		sts (angle)+3,r25
+ 586               	.LM51:
+ 587 042a A090 0000 		lds r10,diff_x
+ 588 042e B090 0000 		lds r11,(diff_x)+1
+ 589 0432 C090 0000 		lds r12,(diff_x)+2
+ 590 0436 D090 0000 		lds r13,(diff_x)+3
+ 591 043a 22EA      		ldi r18,lo8(0x4006bca2)
+ 592 043c 3CEB      		ldi r19,hi8(0x4006bca2)
+ 593 043e 46E0      		ldi r20,hlo8(0x4006bca2)
+ 594 0440 50E4      		ldi r21,hhi8(0x4006bca2)
+ 595 0442 C401      		movw r24,r8
+ 596 0444 B301      		movw r22,r6
+ 597               	.LVL25:
+ 598 0446 0E94 0000 		call __mulsf3
+ 599               	.LVL26:
+ 600 044a 3B01      		movw r6,r22
+ 601 044c 4C01      		movw r8,r24
+ 602 044e C801      		movw r24,r16
+ 603 0450 B701      		movw r22,r14
+ 604 0452 0E94 0000 		call cos
+ 605 0456 9B01      		movw r18,r22
+ 606 0458 AC01      		movw r20,r24
+ 607 045a C401      		movw r24,r8
+ 608 045c B301      		movw r22,r6
+ 609 045e 0E94 0000 		call __mulsf3
+ 610 0462 20E0      		ldi r18,lo8(0x447a0000)
+ 611 0464 30E0      		ldi r19,hi8(0x447a0000)
+ 612 0466 4AE7      		ldi r20,hlo8(0x447a0000)
+ 613 0468 54E4      		ldi r21,hhi8(0x447a0000)
+ 614 046a 0E94 0000 		call __divsf3
+ 615 046e 0E94 0000 		call lround
+ 616 0472 A60E      		add r10,r22
+ 617 0474 B71E      		adc r11,r23
+ 618 0476 C81E      		adc r12,r24
+ 619 0478 D91E      		adc r13,r25
+ 620 047a A092 0000 		sts diff_x,r10
+ 621 047e B092 0000 		sts (diff_x)+1,r11
+ 622 0482 C092 0000 		sts (diff_x)+2,r12
+ 623 0486 D092 0000 		sts (diff_x)+3,r13
+ 624               	.LM52:
+ 625 048a E090 0000 		lds r14,diff_y
+ 626 048e F090 0000 		lds r15,(diff_y)+1
+ 627 0492 0091 0000 		lds r16,(diff_y)+2
+ 628 0496 1091 0000 		lds r17,(diff_y)+3
+ 629 049a 6091 0000 		lds r22,angle
+ 630 049e 7091 0000 		lds r23,(angle)+1
+ 631 04a2 8091 0000 		lds r24,(angle)+2
+ 632 04a6 9091 0000 		lds r25,(angle)+3
+ 633 04aa 0E94 0000 		call sin
+ 634 04ae 9B01      		movw r18,r22
+ 635 04b0 AC01      		movw r20,r24
+ 636 04b2 C401      		movw r24,r8
+ 637 04b4 B301      		movw r22,r6
+ 638 04b6 0E94 0000 		call __mulsf3
+ 639 04ba 20E0      		ldi r18,lo8(0x447a0000)
+ 640 04bc 30E0      		ldi r19,hi8(0x447a0000)
+ 641 04be 4AE7      		ldi r20,hlo8(0x447a0000)
+ 642 04c0 54E4      		ldi r21,hhi8(0x447a0000)
+ 643 04c2 0E94 0000 		call __divsf3
+ 644 04c6 0E94 0000 		call lround
+ 645 04ca E60E      		add r14,r22
+ 646 04cc F71E      		adc r15,r23
+ 647 04ce 081F      		adc r16,r24
+ 648 04d0 191F      		adc r17,r25
+ 649 04d2 E092 0000 		sts diff_y,r14
+ 650 04d6 F092 0000 		sts (diff_y)+1,r15
+ 651 04da 0093 0000 		sts (diff_y)+2,r16
+ 652 04de 1093 0000 		sts (diff_y)+3,r17
+ 653 04e2 00C0      		rjmp .L33
+ 654               	.LVL27:
+ 655               	.L34:
+ 656               	.LBB3:
+ 657               	.LM53:
+ 658 04e4 60E0      		ldi r22,lo8(0)
+ 659 04e6 70E0      		ldi r23,hi8(0)
+ 660 04e8 80E0      		ldi r24,hlo8(0)
+ 661 04ea 90E0      		ldi r25,hhi8(0)
+ 662               	.LVL28:
+ 663               	.LM54:
+ 664 04ec 3093 0000 		sts (encoder_ltm1)+1,r19
+ 665 04f0 2093 0000 		sts encoder_ltm1,r18
+ 666               	.LM55:
+ 667 04f4 1093 0000 		sts (encoder_rtm1)+1,r17
+ 668 04f8 0093 0000 		sts encoder_rtm1,r16
+ 669 04fc 00C0      		rjmp .L23
+ 670               	.LVL29:
+ 671               	.L33:
+ 672               	.LBE3:
+ 673               	/* epilogue: frame size=0 */
+ 674 04fe 1F91      		pop r17
+ 675 0500 0F91      		pop r16
+ 676 0502 FF90      		pop r15
+ 677 0504 EF90      		pop r14
+ 678 0506 DF90      		pop r13
+ 679 0508 CF90      		pop r12
+ 680 050a BF90      		pop r11
+ 681 050c AF90      		pop r10
+ 682 050e 9F90      		pop r9
+ 683 0510 8F90      		pop r8
+ 684 0512 7F90      		pop r7
+ 685 0514 6F90      		pop r6
+ 686 0516 5F90      		pop r5
+ 687 0518 4F90      		pop r4
+ 688 051a 3F90      		pop r3
+ 689 051c 2F90      		pop r2
+ 690 051e 0895      		ret
+ 691               	/* epilogue end (size=17) */
+ 692               	/* function odometry_run size 527 (494) */
+ 693               	.LFE9:
+ 695               	.global	__vector_9
+ 697               	__vector_9:
+ 698               	.LFB10:
+ 699               	.LM56:
+ 700               	/* prologue: frame size=0 */
+ 701 0520 1F92      		push __zero_reg__
+ 702 0522 0F92      		push __tmp_reg__
+ 703 0524 0FB6      		in __tmp_reg__,__SREG__
+ 704 0526 0F92      		push __tmp_reg__
+ 705 0528 1124      		clr __zero_reg__
+ 706 052a 2F93      		push r18
+ 707 052c 3F93      		push r19
+ 708 052e 4F93      		push r20
+ 709 0530 5F93      		push r21
+ 710 0532 6F93      		push r22
+ 711 0534 7F93      		push r23
+ 712 0536 8F93      		push r24
+ 713 0538 9F93      		push r25
+ 714 053a AF93      		push r26
+ 715 053c BF93      		push r27
+ 716 053e EF93      		push r30
+ 717 0540 FF93      		push r31
+ 718               	/* prologue end (size=17) */
+ 719               	.LM57:
+ 720 0542 0E94 0000 		call odometry_run
+ 721               	/* epilogue: frame size=0 */
+ 722 0546 FF91      		pop r31
+ 723 0548 EF91      		pop r30
+ 724 054a BF91      		pop r27
+ 725 054c AF91      		pop r26
+ 726 054e 9F91      		pop r25
+ 727 0550 8F91      		pop r24
+ 728 0552 7F91      		pop r23
+ 729 0554 6F91      		pop r22
+ 730 0556 5F91      		pop r21
+ 731 0558 4F91      		pop r20
+ 732 055a 3F91      		pop r19
+ 733 055c 2F91      		pop r18
+ 734 055e 0F90      		pop __tmp_reg__
+ 735 0560 0FBE      		out __SREG__,__tmp_reg__
+ 736 0562 0F90      		pop __tmp_reg__
+ 737 0564 1F90      		pop __zero_reg__
+ 738 0566 1895      		reti
+ 739               	/* epilogue end (size=17) */
+ 740               	/* function __vector_9 size 36 (2) */
+ 741               	.LFE10:
+ 743               	.global	odometry_init
+ 745               	odometry_init:
+ 746               	.LFB7:
+ 747               	.LM58:
+ 748               	/* prologue: frame size=0 */
+ 749               	/* prologue end (size=0) */
+ 750               	.LM59:
+ 751 0568 0E94 0000 		call encoders_init
+ 752               	.LM60:
+ 753 056c 84E6      		ldi r24,lo8(100)
+ 754 056e 90E0      		ldi r25,hi8(100)
+ 755 0570 0E94 0000 		call delay_ms
+ 756               	.LM61:
+ 757 0574 0E94 0000 		call odometry_reset
+ 758               	.LM62:
+ 759 0578 15BC      		out 69-0x20,__zero_reg__
+ 760               	.LM63:
+ 761 057a 8DE0      		ldi r24,lo8(13)
+ 762 057c 85BD      		out 69-0x20,r24
+ 763               	.LM64:
+ 764 057e 87B7      		in r24,87-0x20
+ 765 0580 8068      		ori r24,lo8(-128)
+ 766 0582 87BF      		out 87-0x20,r24
+ 767               	.LM65:
+ 768 0584 8FEF      		ldi r24,lo8(-1)
+ 769 0586 83BD      		out 67-0x20,r24
+ 770               	/* epilogue: frame size=0 */
+ 771 0588 0895      		ret
+ 772               	/* epilogue end (size=1) */
+ 773               	/* function odometry_init size 17 (16) */
+ 774               	.LFE7:
+ 776               		.comm encoder_ltm1,2,1
+ 777               		.comm encoder_rtm1,2,1
+ 778               		.comm diff_x,4,1
+ 779               		.comm diff_y,4,1
+ 780               		.comm velocity,4,1
+ 781               		.comm angle,4,1
+ 870               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 odometry.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:20     .text:00000000 odometry_dx
+                            *COM*:00000004 diff_x
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:37     .text:00000012 odometry_dy
+                            *COM*:00000004 diff_y
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:54     .text:00000024 odometry_angle
+                            *COM*:00000004 angle
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:71     .text:00000036 odometry_velocity
+                            *COM*:00000004 velocity
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:88     .text:00000048 lround
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:153    .text:000000ac odometry_reset
+                            *COM*:00000002 encoder_ltm1
+                            *COM*:00000002 encoder_rtm1
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:203    .text:00000102 odometry_run
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:697    .text:00000520 __vector_9
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc0yS4xv.s:745    .text:00000568 odometry_init
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+floor
+__subsf3
+__gtsf2
+__addsf3
+__fixsfsi
+encoder_read
+__mulsi3
+__floatsisf
+cos
+__mulsf3
+__divsf3
+sin
+usb_puts
+usb_puti
+encoders_init
+delay_ms
Index: demos/hunter_prey_john/projects/libdragonfly/move.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/move.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/move.lst	(revision 1694)
@@ -0,0 +1,560 @@
+   1               		.file	"move.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	translateAngulartoLinear
+  20               	translateAngulartoLinear:
+  21               	.LFB4:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24 0000 8F92      		push r8
+  25 0002 9F92      		push r9
+  26 0004 AF92      		push r10
+  27 0006 BF92      		push r11
+  28 0008 CF92      		push r12
+  29 000a DF92      		push r13
+  30 000c EF92      		push r14
+  31 000e FF92      		push r15
+  32 0010 0F93      		push r16
+  33 0012 1F93      		push r17
+  34 0014 CF93      		push r28
+  35 0016 DF93      		push r29
+  36               	/* prologue end (size=12) */
+  37               	.LVL0:
+  38 0018 FC01      		movw r30,r24
+  39 001a 4A01      		movw r8,r20
+  40 001c E901      		movw r28,r18
+  41               	.LVL1:
+  42               	.LM2:
+  43 001e 8150      		subi r24,lo8(-(255))
+  44 0020 9F4F      		sbci r25,hi8(-(255))
+  45 0022 8F5F      		subi r24,lo8(511)
+  46 0024 9140      		sbci r25,hi8(511)
+  47               	.LVL2:
+  48 0026 00F0      		brlo .+2
+  49 0028 00C0      		rjmp .L14
+  50               	.LVL3:
+  51               	.LM3:
+  52 002a 8FEF      		ldi r24,hi8(-255)
+  53 002c 6130      		cpi r22,lo8(-255)
+  54 002e 7807      		cpc r23,r24
+  55 0030 04F4      		brge .+2
+  56 0032 00C0      		rjmp .L14
+  57 0034 6F3F      		cpi r22,255
+  58 0036 7105      		cpc r23,__zero_reg__
+  59 0038 01F0      		breq .+4
+  60 003a 04F0      		brlt .+2
+  61 003c 00C0      		rjmp .L14
+  62               	.LM4:
+  63 003e CB01      		movw r24,r22
+  64 0040 880F      		lsl r24
+  65 0042 991F      		rol r25
+  66 0044 860F      		add r24,r22
+  67 0046 971F      		adc r25,r23
+  68 0048 9F01      		movw r18,r30
+  69 004a 280F      		add r18,r24
+  70 004c 391F      		adc r19,r25
+  71 004e 5901      		movw r10,r18
+  72 0050 CC24      		clr r12
+  73 0052 B7FC      		sbrc r11,7
+  74 0054 C094      		com r12
+  75 0056 DC2C      		mov r13,r12
+  76               	.LVL4:
+  77               	.LM5:
+  78 0058 E81B      		sub r30,r24
+  79 005a F90B      		sbc r31,r25
+  80 005c 7F01      		movw r14,r30
+  81 005e 0027      		clr r16
+  82 0060 F7FC      		sbrc r15,7
+  83 0062 0095      		com r16
+  84 0064 102F      		mov r17,r16
+  85               	.LVL5:
+  86               	.LM6:
+  87 0066 EFEF      		ldi r30,lo8(255)
+  88 0068 AE16      		cp r10,r30
+  89 006a B104      		cpc r11,__zero_reg__
+  90 006c C104      		cpc r12,__zero_reg__
+  91 006e D104      		cpc r13,__zero_reg__
+  92               	.LVL6:
+  93 0070 01F0      		breq .L6
+  94 0072 04F0      		brlt .L6
+  95               	.LM7:
+  96 0074 C801      		movw r24,r16
+  97 0076 B701      		movw r22,r14
+  98               	.LVL7:
+  99 0078 2FEF      		ldi r18,lo8(255)
+ 100 007a 30E0      		ldi r19,hi8(255)
+ 101 007c 40E0      		ldi r20,hlo8(255)
+ 102 007e 50E0      		ldi r21,hhi8(255)
+ 103 0080 0E94 0000 		call __mulsi3
+ 104 0084 A601      		movw r20,r12
+ 105 0086 9501      		movw r18,r10
+ 106 0088 0E94 0000 		call __divmodsi4
+ 107 008c 7901      		movw r14,r18
+ 108 008e 8A01      		movw r16,r20
+ 109 0090 3FEF      		ldi r19,lo8(255)
+ 110 0092 A32E      		mov r10,r19
+ 111 0094 B12C      		mov r11,__zero_reg__
+ 112 0096 C12C      		mov r12,__zero_reg__
+ 113 0098 D12C      		mov r13,__zero_reg__
+ 114               	.LVL8:
+ 115               	.L6:
+ 116               	.LM8:
+ 117 009a FFEF      		ldi r31,lo8(255)
+ 118 009c EF16      		cp r14,r31
+ 119 009e F104      		cpc r15,__zero_reg__
+ 120 00a0 0105      		cpc r16,__zero_reg__
+ 121 00a2 1105      		cpc r17,__zero_reg__
+ 122 00a4 01F0      		breq .L8
+ 123 00a6 04F0      		brlt .L8
+ 124               	.LM9:
+ 125 00a8 C601      		movw r24,r12
+ 126 00aa B501      		movw r22,r10
+ 127               	.LVL9:
+ 128 00ac 2FEF      		ldi r18,lo8(255)
+ 129 00ae 30E0      		ldi r19,hi8(255)
+ 130 00b0 40E0      		ldi r20,hlo8(255)
+ 131 00b2 50E0      		ldi r21,hhi8(255)
+ 132 00b4 0E94 0000 		call __mulsi3
+ 133 00b8 A801      		movw r20,r16
+ 134 00ba 9701      		movw r18,r14
+ 135 00bc 0E94 0000 		call __divmodsi4
+ 136 00c0 5901      		movw r10,r18
+ 137 00c2 6A01      		movw r12,r20
+ 138 00c4 2FEF      		ldi r18,lo8(255)
+ 139 00c6 E22E      		mov r14,r18
+ 140 00c8 F12C      		mov r15,__zero_reg__
+ 141 00ca 012D      		mov r16,__zero_reg__
+ 142 00cc 112D      		mov r17,__zero_reg__
+ 143               	.LVL10:
+ 144               	.L8:
+ 145               	.LM10:
+ 146 00ce 21E0      		ldi r18,lo8(-255)
+ 147 00d0 A216      		cp r10,r18
+ 148 00d2 2FEF      		ldi r18,hi8(-255)
+ 149 00d4 B206      		cpc r11,r18
+ 150 00d6 2FEF      		ldi r18,hlo8(-255)
+ 151 00d8 C206      		cpc r12,r18
+ 152 00da 2FEF      		ldi r18,hhi8(-255)
+ 153 00dc D206      		cpc r13,r18
+ 154 00de 04F4      		brge .L10
+ 155               	.LM11:
+ 156 00e0 C801      		movw r24,r16
+ 157 00e2 B701      		movw r22,r14
+ 158               	.LVL11:
+ 159 00e4 21E0      		ldi r18,lo8(-255)
+ 160 00e6 3FEF      		ldi r19,hi8(-255)
+ 161 00e8 4FEF      		ldi r20,hlo8(-255)
+ 162 00ea 5FEF      		ldi r21,hhi8(-255)
+ 163 00ec 0E94 0000 		call __mulsi3
+ 164 00f0 A601      		movw r20,r12
+ 165 00f2 9501      		movw r18,r10
+ 166 00f4 0E94 0000 		call __divmodsi4
+ 167 00f8 7901      		movw r14,r18
+ 168 00fa 8A01      		movw r16,r20
+ 169 00fc 91E0      		ldi r25,lo8(-255)
+ 170 00fe A92E      		mov r10,r25
+ 171 0100 9FEF      		ldi r25,hi8(-255)
+ 172 0102 B92E      		mov r11,r25
+ 173 0104 9FEF      		ldi r25,hlo8(-255)
+ 174 0106 C92E      		mov r12,r25
+ 175 0108 9FEF      		ldi r25,hhi8(-255)
+ 176 010a D92E      		mov r13,r25
+ 177               	.LVL12:
+ 178               	.L10:
+ 179               	.LM12:
+ 180 010c 81E0      		ldi r24,lo8(-255)
+ 181 010e E816      		cp r14,r24
+ 182 0110 8FEF      		ldi r24,hi8(-255)
+ 183 0112 F806      		cpc r15,r24
+ 184 0114 8FEF      		ldi r24,hlo8(-255)
+ 185 0116 0807      		cpc r16,r24
+ 186 0118 8FEF      		ldi r24,hhi8(-255)
+ 187 011a 1807      		cpc r17,r24
+ 188 011c 04F4      		brge .L12
+ 189               	.LM13:
+ 190 011e C601      		movw r24,r12
+ 191 0120 B501      		movw r22,r10
+ 192               	.LVL13:
+ 193 0122 21E0      		ldi r18,lo8(-255)
+ 194 0124 3FEF      		ldi r19,hi8(-255)
+ 195 0126 4FEF      		ldi r20,hlo8(-255)
+ 196 0128 5FEF      		ldi r21,hhi8(-255)
+ 197 012a 0E94 0000 		call __mulsi3
+ 198 012e A801      		movw r20,r16
+ 199 0130 9701      		movw r18,r14
+ 200 0132 0E94 0000 		call __divmodsi4
+ 201 0136 5901      		movw r10,r18
+ 202 0138 6A01      		movw r12,r20
+ 203 013a 81E0      		ldi r24,lo8(-255)
+ 204 013c E82E      		mov r14,r24
+ 205 013e 8FEF      		ldi r24,hi8(-255)
+ 206 0140 F82E      		mov r15,r24
+ 207 0142 8FEF      		ldi r24,hlo8(-255)
+ 208 0144 082F      		mov r16,r24
+ 209 0146 8FEF      		ldi r24,hhi8(-255)
+ 210 0148 182F      		mov r17,r24
+ 211               	.LVL14:
+ 212               	.L12:
+ 213               	.LM14:
+ 214 014a B982      		std Y+1,r11
+ 215 014c A882      		st Y,r10
+ 216               	.LM15:
+ 217 014e F401      		movw r30,r8
+ 218 0150 F182      		std Z+1,r15
+ 219 0152 E082      		st Z,r14
+ 220               	.LVL15:
+ 221               	.L14:
+ 222               	/* epilogue: frame size=0 */
+ 223 0154 DF91      		pop r29
+ 224 0156 CF91      		pop r28
+ 225 0158 1F91      		pop r17
+ 226 015a 0F91      		pop r16
+ 227 015c FF90      		pop r15
+ 228 015e EF90      		pop r14
+ 229 0160 DF90      		pop r13
+ 230 0162 CF90      		pop r12
+ 231 0164 BF90      		pop r11
+ 232 0166 AF90      		pop r10
+ 233 0168 9F90      		pop r9
+ 234 016a 8F90      		pop r8
+ 235 016c 0895      		ret
+ 236               	/* epilogue end (size=13) */
+ 237               	/* function translateAngulartoLinear size 184 (159) */
+ 238               	.LFE4:
+ 240               	.global	move_avoid
+ 242               	move_avoid:
+ 243               	.LFB3:
+ 244               	.LM16:
+ 245               	/* prologue: frame size=4 */
+ 246 016e CF92      		push r12
+ 247 0170 DF92      		push r13
+ 248 0172 EF92      		push r14
+ 249 0174 FF92      		push r15
+ 250 0176 0F93      		push r16
+ 251 0178 1F93      		push r17
+ 252 017a CF93      		push r28
+ 253 017c DF93      		push r29
+ 254 017e CDB7      		in r28,__SP_L__
+ 255 0180 DEB7      		in r29,__SP_H__
+ 256 0182 2497      		sbiw r28,4
+ 257 0184 0FB6      		in __tmp_reg__,__SREG__
+ 258 0186 F894      		cli
+ 259 0188 DEBF      		out __SP_H__,r29
+ 260 018a 0FBE      		out __SREG__,__tmp_reg__
+ 261 018c CDBF      		out __SP_L__,r28
+ 262               	/* prologue end (size=16) */
+ 263               	.LVL16:
+ 264 018e 6C01      		movw r12,r24
+ 265 0190 7B01      		movw r14,r22
+ 266 0192 8A01      		movw r16,r20
+ 267               	.LM17:
+ 268 0194 1C82      		std Y+4,__zero_reg__
+ 269 0196 1B82      		std Y+3,__zero_reg__
+ 270               	.LVL17:
+ 271               	.LM18:
+ 272 0198 1A82      		std Y+2,__zero_reg__
+ 273 019a 1982      		std Y+1,__zero_reg__
+ 274               	.LVL18:
+ 275               	.LM19:
+ 276 019c 86E0      		ldi r24,lo8(6)
+ 277 019e 90E0      		ldi r25,hi8(6)
+ 278               	.LVL19:
+ 279 01a0 0E94 0000 		call range_read_distance
+ 280               	.LVL20:
+ 281               	.LVL21:
+ 282               	.LM20:
+ 283 01a4 2FEF      		ldi r18,hi8(-1)
+ 284 01a6 8F3F      		cpi r24,lo8(-1)
+ 285 01a8 9207      		cpc r25,r18
+ 286 01aa 01F4      		brne .L16
+ 287               	.LM21:
+ 288 01ac 8091 0000 		lds r24,d1
+ 289 01b0 9091 0000 		lds r25,(d1)+1
+ 290               	.L16:
+ 291 01b4 9093 0000 		sts (d1)+1,r25
+ 292 01b8 8093 0000 		sts d1,r24
+ 293               	.LM22:
+ 294 01bc 85E0      		ldi r24,lo8(5)
+ 295 01be 90E0      		ldi r25,hi8(5)
+ 296               	.LVL22:
+ 297 01c0 0E94 0000 		call range_read_distance
+ 298               	.LVL23:
+ 299               	.LM23:
+ 300 01c4 4FEF      		ldi r20,hi8(-1)
+ 301 01c6 8F3F      		cpi r24,lo8(-1)
+ 302 01c8 9407      		cpc r25,r20
+ 303 01ca 01F4      		brne .L18
+ 304 01cc 8091 0000 		lds r24,d2
+ 305 01d0 9091 0000 		lds r25,(d2)+1
+ 306               	.L18:
+ 307 01d4 9093 0000 		sts (d2)+1,r25
+ 308 01d8 8093 0000 		sts d2,r24
+ 309               	.LM24:
+ 310 01dc 84E0      		ldi r24,lo8(4)
+ 311 01de 90E0      		ldi r25,hi8(4)
+ 312               	.LVL24:
+ 313 01e0 0E94 0000 		call range_read_distance
+ 314               	.LVL25:
+ 315               	.LM25:
+ 316 01e4 5FEF      		ldi r21,hi8(-1)
+ 317 01e6 8F3F      		cpi r24,lo8(-1)
+ 318 01e8 9507      		cpc r25,r21
+ 319 01ea 01F4      		brne .L20
+ 320 01ec 8091 0000 		lds r24,d3
+ 321 01f0 9091 0000 		lds r25,(d3)+1
+ 322               	.L20:
+ 323 01f4 9093 0000 		sts (d3)+1,r25
+ 324 01f8 8093 0000 		sts d3,r24
+ 325               	.LM26:
+ 326 01fc 83E0      		ldi r24,lo8(3)
+ 327 01fe 90E0      		ldi r25,hi8(3)
+ 328               	.LVL26:
+ 329 0200 0E94 0000 		call range_read_distance
+ 330               	.LVL27:
+ 331               	.LM27:
+ 332 0204 2FEF      		ldi r18,hi8(-1)
+ 333 0206 8F3F      		cpi r24,lo8(-1)
+ 334 0208 9207      		cpc r25,r18
+ 335 020a 01F4      		brne .L22
+ 336 020c 8091 0000 		lds r24,d4
+ 337 0210 9091 0000 		lds r25,(d4)+1
+ 338               	.L22:
+ 339 0214 9093 0000 		sts (d4)+1,r25
+ 340 0218 8093 0000 		sts d4,r24
+ 341               	.LM28:
+ 342 021c 82E0      		ldi r24,lo8(2)
+ 343 021e 90E0      		ldi r25,hi8(2)
+ 344               	.LVL28:
+ 345 0220 0E94 0000 		call range_read_distance
+ 346 0224 9C01      		movw r18,r24
+ 347               	.LVL29:
+ 348               	.LM29:
+ 349 0226 8F5F      		subi r24,lo8(-1)
+ 350 0228 9F4F      		sbci r25,hi8(-1)
+ 351 022a 01F4      		brne .L24
+ 352               	.LVL30:
+ 353 022c 2091 0000 		lds r18,d5
+ 354 0230 3091 0000 		lds r19,(d5)+1
+ 355               	.L24:
+ 356 0234 3093 0000 		sts (d5)+1,r19
+ 357 0238 2093 0000 		sts d5,r18
+ 358               	.LM30:
+ 359 023c 84E6      		ldi r24,lo8(100)
+ 360 023e 90E0      		ldi r25,hi8(100)
+ 361               	.LVL31:
+ 362 0240 801B      		sub r24,r16
+ 363 0242 910B      		sbc r25,r17
+ 364 0244 AC01      		movw r20,r24
+ 365 0246 E49E      		mul r14,r20
+ 366 0248 C001      		movw r24,r0
+ 367 024a E59E      		mul r14,r21
+ 368 024c 900D      		add r25,r0
+ 369 024e F49E      		mul r15,r20
+ 370 0250 900D      		add r25,r0
+ 371 0252 1124      		clr r1
+ 372 0254 64E6      		ldi r22,lo8(100)
+ 373 0256 70E0      		ldi r23,hi8(100)
+ 374 0258 0E94 0000 		call __divmodhi4
+ 375 025c FB01      		movw r30,r22
+ 376 025e 8091 0000 		lds r24,d4
+ 377 0262 9091 0000 		lds r25,(d4)+1
+ 378 0266 281B      		sub r18,r24
+ 379 0268 390B      		sbc r19,r25
+ 380 026a 209F      		mul r18,r16
+ 381 026c C001      		movw r24,r0
+ 382 026e 219F      		mul r18,r17
+ 383 0270 900D      		add r25,r0
+ 384 0272 309F      		mul r19,r16
+ 385 0274 900D      		add r25,r0
+ 386 0276 1124      		clr r1
+ 387 0278 64E6      		ldi r22,lo8(100)
+ 388 027a 70E0      		ldi r23,hi8(100)
+ 389 027c 0E94 0000 		call __divmodhi4
+ 390 0280 E60F      		add r30,r22
+ 391 0282 F71F      		adc r31,r23
+ 392 0284 9E01      		movw r18,r28
+ 393               	.LVL32:
+ 394 0286 2F5F      		subi r18,lo8(-(1))
+ 395 0288 3F4F      		sbci r19,hi8(-(1))
+ 396 028a AE01      		movw r20,r28
+ 397 028c 4D5F      		subi r20,lo8(-(3))
+ 398 028e 5F4F      		sbci r21,hi8(-(3))
+ 399 0290 BF01      		movw r22,r30
+ 400 0292 C601      		movw r24,r12
+ 401 0294 0E94 0000 		call translateAngulartoLinear
+ 402               	.LM31:
+ 403 0298 6B81      		ldd r22,Y+3
+ 404 029a 7C81      		ldd r23,Y+4
+ 405 029c 77FF      		sbrs r23,7
+ 406 029e 00C0      		rjmp .L26
+ 407               	.LM32:
+ 408 02a0 7095      		com r23
+ 409 02a2 6195      		neg r22
+ 410 02a4 7F4F      		sbci r23,lo8(-1)
+ 411 02a6 80E0      		ldi r24,lo8(0)
+ 412 02a8 90E0      		ldi r25,hi8(0)
+ 413 02aa 00C0      		rjmp .L33
+ 414               	.L26:
+ 415               	.LM33:
+ 416 02ac 81E0      		ldi r24,lo8(1)
+ 417 02ae 90E0      		ldi r25,hi8(1)
+ 418               	.L33:
+ 419 02b0 0E94 0000 		call motor1_set
+ 420               	.LM34:
+ 421 02b4 6981      		ldd r22,Y+1
+ 422 02b6 7A81      		ldd r23,Y+2
+ 423 02b8 77FF      		sbrs r23,7
+ 424 02ba 00C0      		rjmp .L29
+ 425               	.LM35:
+ 426 02bc 7095      		com r23
+ 427 02be 6195      		neg r22
+ 428 02c0 7F4F      		sbci r23,lo8(-1)
+ 429 02c2 80E0      		ldi r24,lo8(0)
+ 430 02c4 90E0      		ldi r25,hi8(0)
+ 431 02c6 00C0      		rjmp .L34
+ 432               	.L29:
+ 433               	.LM36:
+ 434 02c8 81E0      		ldi r24,lo8(1)
+ 435 02ca 90E0      		ldi r25,hi8(1)
+ 436               	.L34:
+ 437 02cc 0E94 0000 		call motor2_set
+ 438               	/* epilogue: frame size=4 */
+ 439 02d0 2496      		adiw r28,4
+ 440 02d2 0FB6      		in __tmp_reg__,__SREG__
+ 441 02d4 F894      		cli
+ 442 02d6 DEBF      		out __SP_H__,r29
+ 443 02d8 0FBE      		out __SREG__,__tmp_reg__
+ 444 02da CDBF      		out __SP_L__,r28
+ 445 02dc DF91      		pop r29
+ 446 02de CF91      		pop r28
+ 447 02e0 1F91      		pop r17
+ 448 02e2 0F91      		pop r16
+ 449 02e4 FF90      		pop r15
+ 450 02e6 EF90      		pop r14
+ 451 02e8 DF90      		pop r13
+ 452 02ea CF90      		pop r12
+ 453 02ec 0895      		ret
+ 454               	/* epilogue end (size=15) */
+ 455               	/* function move_avoid size 193 (162) */
+ 456               	.LFE3:
+ 458               	.global	move
+ 460               	move:
+ 461               	.LFB2:
+ 462               	.LM37:
+ 463               	/* prologue: frame size=4 */
+ 464 02ee CF93      		push r28
+ 465 02f0 DF93      		push r29
+ 466 02f2 CDB7      		in r28,__SP_L__
+ 467 02f4 DEB7      		in r29,__SP_H__
+ 468 02f6 2497      		sbiw r28,4
+ 469 02f8 0FB6      		in __tmp_reg__,__SREG__
+ 470 02fa F894      		cli
+ 471 02fc DEBF      		out __SP_H__,r29
+ 472 02fe 0FBE      		out __SREG__,__tmp_reg__
+ 473 0300 CDBF      		out __SP_L__,r28
+ 474               	/* prologue end (size=10) */
+ 475               	.LVL33:
+ 476               	.LM38:
+ 477 0302 1C82      		std Y+4,__zero_reg__
+ 478 0304 1B82      		std Y+3,__zero_reg__
+ 479               	.LVL34:
+ 480               	.LM39:
+ 481 0306 1A82      		std Y+2,__zero_reg__
+ 482 0308 1982      		std Y+1,__zero_reg__
+ 483               	.LVL35:
+ 484               	.LM40:
+ 485 030a 9E01      		movw r18,r28
+ 486 030c 2F5F      		subi r18,lo8(-(1))
+ 487 030e 3F4F      		sbci r19,hi8(-(1))
+ 488 0310 AE01      		movw r20,r28
+ 489 0312 4D5F      		subi r20,lo8(-(3))
+ 490 0314 5F4F      		sbci r21,hi8(-(3))
+ 491 0316 0E94 0000 		call translateAngulartoLinear
+ 492               	.LVL36:
+ 493               	.LM41:
+ 494 031a 6B81      		ldd r22,Y+3
+ 495 031c 7C81      		ldd r23,Y+4
+ 496 031e 77FF      		sbrs r23,7
+ 497 0320 00C0      		rjmp .L36
+ 498               	.LM42:
+ 499 0322 7095      		com r23
+ 500 0324 6195      		neg r22
+ 501 0326 7F4F      		sbci r23,lo8(-1)
+ 502 0328 80E0      		ldi r24,lo8(0)
+ 503 032a 90E0      		ldi r25,hi8(0)
+ 504 032c 00C0      		rjmp .L43
+ 505               	.L36:
+ 506               	.LM43:
+ 507 032e 81E0      		ldi r24,lo8(1)
+ 508 0330 90E0      		ldi r25,hi8(1)
+ 509               	.L43:
+ 510 0332 0E94 0000 		call motor1_set
+ 511               	.LM44:
+ 512 0336 6981      		ldd r22,Y+1
+ 513 0338 7A81      		ldd r23,Y+2
+ 514 033a 77FF      		sbrs r23,7
+ 515 033c 00C0      		rjmp .L39
+ 516               	.LM45:
+ 517 033e 7095      		com r23
+ 518 0340 6195      		neg r22
+ 519 0342 7F4F      		sbci r23,lo8(-1)
+ 520 0344 80E0      		ldi r24,lo8(0)
+ 521 0346 90E0      		ldi r25,hi8(0)
+ 522 0348 00C0      		rjmp .L44
+ 523               	.L39:
+ 524               	.LM46:
+ 525 034a 81E0      		ldi r24,lo8(1)
+ 526 034c 90E0      		ldi r25,hi8(1)
+ 527               	.L44:
+ 528 034e 0E94 0000 		call motor2_set
+ 529               	/* epilogue: frame size=4 */
+ 530 0352 2496      		adiw r28,4
+ 531 0354 0FB6      		in __tmp_reg__,__SREG__
+ 532 0356 F894      		cli
+ 533 0358 DEBF      		out __SP_H__,r29
+ 534 035a 0FBE      		out __SREG__,__tmp_reg__
+ 535 035c CDBF      		out __SP_L__,r28
+ 536 035e DF91      		pop r29
+ 537 0360 CF91      		pop r28
+ 538 0362 0895      		ret
+ 539               	/* epilogue end (size=9) */
+ 540               	/* function move size 59 (40) */
+ 541               	.LFE2:
+ 543               		.comm d1,2,1
+ 544               		.comm d2,2,1
+ 545               		.comm d3,2,1
+ 546               		.comm d4,2,1
+ 547               		.comm d5,2,1
+ 588               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 move.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cclqaS86.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cclqaS86.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cclqaS86.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cclqaS86.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cclqaS86.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cclqaS86.s:20     .text:00000000 translateAngulartoLinear
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cclqaS86.s:242    .text:0000016e move_avoid
+                            *COM*:00000002 d1
+                            *COM*:00000002 d2
+                            *COM*:00000002 d3
+                            *COM*:00000002 d4
+                            *COM*:00000002 d5
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cclqaS86.s:460    .text:000002ee move
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+__mulsi3
+__divmodsi4
+range_read_distance
+__divmodhi4
+motor1_set
+motor2_set
Index: demos/hunter_prey_john/projects/libdragonfly/battery.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/battery.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/battery.lst	(revision 1694)
@@ -0,0 +1,204 @@
+   1               		.file	"battery.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	battery
+  20               	battery:
+  21               	.LFB3:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LM2:
+  26 0000 8BE0      		ldi r24,lo8(11)
+  27 0002 90E0      		ldi r25,hi8(11)
+  28 0004 0E94 0000 		call analog8
+  29 0008 24EF      		ldi r18,lo8(500)
+  30 000a 31E0      		ldi r19,hi8(500)
+  31 000c AC01      		movw r20,r24
+  32 000e 429F      		mul r20,r18
+  33 0010 C001      		movw r24,r0
+  34 0012 439F      		mul r20,r19
+  35 0014 900D      		add r25,r0
+  36 0016 529F      		mul r21,r18
+  37 0018 900D      		add r25,r0
+  38 001a 1124      		clr r1
+  39               	.LM3:
+  40 001c 880F      		lsl r24
+  41 001e 892F      		mov r24,r25
+  42 0020 881F      		rol r24
+  43 0022 990B      		sbc r25,r25
+  44 0024 9195      		neg r25
+  45               	/* epilogue: frame size=0 */
+  46 0026 0895      		ret
+  47               	/* epilogue end (size=1) */
+  48               	/* function battery size 20 (19) */
+  49               	.LFE3:
+  51               	.global	battery8
+  53               	battery8:
+  54               	.LFB2:
+  55               	.LM4:
+  56               	/* prologue: frame size=0 */
+  57               	/* prologue end (size=0) */
+  58               	.LM5:
+  59 0028 8BE0      		ldi r24,lo8(11)
+  60 002a 90E0      		ldi r25,hi8(11)
+  61 002c 0E94 0000 		call analog8
+  62               	/* epilogue: frame size=0 */
+  63 0030 0895      		ret
+  64               	/* epilogue end (size=1) */
+  65               	/* function battery8 size 5 (4) */
+  66               	.LFE2:
+  68               	.global	battery8_avg
+  70               	battery8_avg:
+  71               	.LFB5:
+  72               	.LM6:
+  73               	/* prologue: frame size=0 */
+  74 0032 CF92      		push r12
+  75 0034 DF92      		push r13
+  76 0036 EF92      		push r14
+  77 0038 FF92      		push r15
+  78 003a 0F93      		push r16
+  79 003c 1F93      		push r17
+  80 003e CF93      		push r28
+  81 0040 DF93      		push r29
+  82               	/* prologue end (size=8) */
+  83               	.LVL0:
+  84 0042 6C01      		movw r12,r24
+  85 0044 C0E0      		ldi r28,lo8(0)
+  86 0046 D0E0      		ldi r29,hi8(0)
+  87               	.LVL1:
+  88 0048 EE24      		clr r14
+  89 004a FF24      		clr r15
+  90 004c 8701      		movw r16,r14
+  91               	.LVL2:
+  92 004e 00C0      		rjmp .L6
+  93               	.LVL3:
+  94               	.L7:
+  95               	.LM7:
+  96 0050 0E94 0000 		call battery8
+  97 0054 AA27      		clr r26
+  98 0056 97FD      		sbrc r25,7
+  99 0058 A095      		com r26
+ 100 005a BA2F      		mov r27,r26
+ 101 005c E80E      		add r14,r24
+ 102 005e F91E      		adc r15,r25
+ 103 0060 0A1F      		adc r16,r26
+ 104 0062 1B1F      		adc r17,r27
+ 105               	.LM8:
+ 106 0064 2196      		adiw r28,1
+ 107               	.LVL4:
+ 108               	.L6:
+ 109 0066 CC15      		cp r28,r12
+ 110 0068 DD05      		cpc r29,r13
+ 111 006a 04F0      		brlt .L7
+ 112 006c 9601      		movw r18,r12
+ 113 006e 4427      		clr r20
+ 114 0070 37FD      		sbrc r19,7
+ 115 0072 4095      		com r20
+ 116 0074 542F      		mov r21,r20
+ 117 0076 C801      		movw r24,r16
+ 118 0078 B701      		movw r22,r14
+ 119 007a 0E94 0000 		call __divmodsi4
+ 120 007e DA01      		movw r26,r20
+ 121 0080 C901      		movw r24,r18
+ 122               	/* epilogue: frame size=0 */
+ 123 0082 DF91      		pop r29
+ 124 0084 CF91      		pop r28
+ 125 0086 1F91      		pop r17
+ 126 0088 0F91      		pop r16
+ 127 008a FF90      		pop r15
+ 128 008c EF90      		pop r14
+ 129 008e DF90      		pop r13
+ 130 0090 CF90      		pop r12
+ 131 0092 0895      		ret
+ 132               	/* epilogue end (size=9) */
+ 133               	/* function battery8_avg size 49 (32) */
+ 134               	.LFE5:
+ 136               	.global	battery_low
+ 138               	battery_low:
+ 139               	.LFB4:
+ 140               	.LM9:
+ 141               	/* prologue: frame size=0 */
+ 142               	/* prologue end (size=0) */
+ 143               	.LM10:
+ 144 0094 0E94 0000 		call battery8
+ 145               	.LM11:
+ 146 0098 2091 0000 		lds r18,next_read.1332
+ 147 009c 2223      		tst r18
+ 148 009e 01F4      		brne .L11
+ 149               	.LVL5:
+ 150               	.LM12:
+ 151 00a0 8939      		cpi r24,153
+ 152 00a2 9105      		cpc r25,__zero_reg__
+ 153 00a4 04F0      		brlt .L13
+ 154               	.LM13:
+ 155 00a6 1092 0000 		sts ret.1333,__zero_reg__
+ 156 00aa 00C0      		rjmp .L19
+ 157               	.L13:
+ 158               	.LM14:
+ 159 00ac 8091 0000 		lds r24,battery_low_count
+ 160 00b0 9091 0000 		lds r25,(battery_low_count)+1
+ 161               	.LVL6:
+ 162 00b4 0196      		adiw r24,1
+ 163 00b6 9093 0000 		sts (battery_low_count)+1,r25
+ 164 00ba 8093 0000 		sts battery_low_count,r24
+ 165               	.LM15:
+ 166 00be 0597      		sbiw r24,5
+ 167 00c0 04F0      		brlt .L15
+ 168               	.LM16:
+ 169 00c2 81E0      		ldi r24,lo8(1)
+ 170 00c4 8093 0000 		sts ret.1333,r24
+ 171               	.LVL7:
+ 172               	.L19:
+ 173               	.LM17:
+ 174 00c8 1092 0000 		sts (battery_low_count)+1,__zero_reg__
+ 175 00cc 1092 0000 		sts battery_low_count,__zero_reg__
+ 176               	.L15:
+ 177               	.LM18:
+ 178 00d0 85E0      		ldi r24,lo8(5)
+ 179               	.LVL8:
+ 180 00d2 8093 0000 		sts next_read.1332,r24
+ 181 00d6 00C0      		rjmp .L17
+ 182               	.L11:
+ 183               	.LM19:
+ 184 00d8 2150      		subi r18,lo8(-(-1))
+ 185 00da 2093 0000 		sts next_read.1332,r18
+ 186               	.L17:
+ 187 00de 8091 0000 		lds r24,ret.1333
+ 188               	.LM20:
+ 189 00e2 9927      		clr r25
+ 190               	/* epilogue: frame size=0 */
+ 191 00e4 0895      		ret
+ 192               	/* epilogue end (size=1) */
+ 193               	/* function battery_low size 42 (41) */
+ 194               	.LFE4:
+ 196               		.lcomm ret.1333,1
+ 197               		.lcomm next_read.1332,1
+ 198               		.comm battery_low_count,2,1
+ 247               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 battery.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccIpUUgL.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccIpUUgL.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccIpUUgL.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccIpUUgL.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccIpUUgL.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccIpUUgL.s:20     .text:00000000 battery
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccIpUUgL.s:53     .text:00000028 battery8
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccIpUUgL.s:70     .text:00000032 battery8_avg
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccIpUUgL.s:138    .text:00000094 battery_low
+F:\DOCUME~1\Evan\LOCALS~1\Temp/ccIpUUgL.s:196    .bss:00000001 next_read.1332
+                             .bss:00000000 ret.1333
+                            *COM*:00000002 battery_low_count
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+analog8
+__divmodsi4
Index: demos/hunter_prey_john/projects/libdragonfly/dio.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/dio.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/dio.lst	(revision 1694)
@@ -0,0 +1,929 @@
+   1               		.file	"dio.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  18               	.global	digital_input
+  20               	digital_input:
+  21               	.LFB2:
+  22               	.LM1:
+  23               	/* prologue: frame size=0 */
+  24               	/* prologue end (size=0) */
+  25               	.LVL0:
+  26               	.LM2:
+  27 0000 AC01      		movw r20,r24
+  28               	.LVL1:
+  29 0002 4770      		andi r20,lo8(7)
+  30 0004 5070      		andi r21,hi8(7)
+  31               	.LM3:
+  32 0006 9C01      		movw r18,r24
+  33 0008 83E0      		ldi r24,3
+  34 000a 3595      	1:	asr r19
+  35 000c 2795      		ror r18
+  36 000e 8A95      		dec r24
+  37 0010 01F4      		brne 1b
+  38               	.LVL2:
+  39 0012 2430      		cpi r18,4
+  40 0014 3105      		cpc r19,__zero_reg__
+  41 0016 01F4      		brne .+2
+  42 0018 00C0      		rjmp .L6
+  43               	.LM4:
+  44 001a 2530      		cpi r18,5
+  45 001c 3105      		cpc r19,__zero_reg__
+  46 001e 04F4      		brge .L10
+  47 0020 2230      		cpi r18,2
+  48 0022 3105      		cpc r19,__zero_reg__
+  49 0024 01F0      		breq .L4
+  50 0026 2330      		cpi r18,3
+  51 0028 3105      		cpc r19,__zero_reg__
+  52 002a 04F4      		brge .L5
+  53 002c 2130      		cpi r18,1
+  54 002e 3105      		cpc r19,__zero_reg__
+  55 0030 01F4      		brne .L2
+  56 0032 00C0      		rjmp .L3
+  57               	.L10:
+  58 0034 2630      		cpi r18,6
+  59 0036 3105      		cpc r19,__zero_reg__
+  60 0038 01F4      		brne .+2
+  61 003a 00C0      		rjmp .L8
+  62 003c 2630      		cpi r18,6
+  63 003e 3105      		cpc r19,__zero_reg__
+  64 0040 04F0      		brlt .L7
+  65 0042 2730      		cpi r18,7
+  66 0044 3105      		cpc r19,__zero_reg__
+  67 0046 01F4      		brne .+2
+  68 0048 00C0      		rjmp .L9
+  69               	.L2:
+  70 004a 8FEF      		ldi r24,lo8(-1)
+  71 004c 9FEF      		ldi r25,hi8(-1)
+  72 004e 0895      		ret
+  73               	.L3:
+  74               	.LM5:
+  75 0050 8AB3      		in r24,58-0x20
+  76 0052 042E      		mov r0,r20
+  77 0054 00C0      		rjmp 2f
+  78 0056 220F      	1:	lsl r18
+  79 0058 331F      		rol r19
+  80 005a 0A94      	2:	dec r0
+  81 005c 02F4      		brpl 1b
+  82 005e 922F      		mov r25,r18
+  83 0060 9095      		com r25
+  84 0062 8923      		and r24,r25
+  85 0064 8ABB      		out 58-0x20,r24
+  86               	.LM6:
+  87 0066 89B3      		in r24,57-0x20
+  88 0068 00C0      		rjmp .L15
+  89               	.L4:
+  90               	.LM7:
+  91 006a 87B3      		in r24,55-0x20
+  92 006c 21E0      		ldi r18,lo8(1)
+  93 006e 30E0      		ldi r19,hi8(1)
+  94 0070 042E      		mov r0,r20
+  95 0072 00C0      		rjmp 2f
+  96 0074 220F      	1:	lsl r18
+  97 0076 331F      		rol r19
+  98 0078 0A94      	2:	dec r0
+  99 007a 02F4      		brpl 1b
+ 100 007c 2095      		com r18
+ 101 007e 8223      		and r24,r18
+ 102 0080 87BB      		out 55-0x20,r24
+ 103               	.LM8:
+ 104 0082 86B3      		in r24,54-0x20
+ 105 0084 00C0      		rjmp .L15
+ 106               	.L5:
+ 107               	.LM9:
+ 108 0086 84B3      		in r24,52-0x20
+ 109 0088 21E0      		ldi r18,lo8(1)
+ 110 008a 30E0      		ldi r19,hi8(1)
+ 111 008c 042E      		mov r0,r20
+ 112 008e 00C0      		rjmp 2f
+ 113 0090 220F      	1:	lsl r18
+ 114 0092 331F      		rol r19
+ 115 0094 0A94      	2:	dec r0
+ 116 0096 02F4      		brpl 1b
+ 117 0098 2095      		com r18
+ 118 009a 8223      		and r24,r18
+ 119 009c 84BB      		out 52-0x20,r24
+ 120               	.LM10:
+ 121 009e 83B3      		in r24,51-0x20
+ 122 00a0 00C0      		rjmp .L15
+ 123               	.L6:
+ 124               	.LM11:
+ 125 00a2 81B3      		in r24,49-0x20
+ 126 00a4 21E0      		ldi r18,lo8(1)
+ 127 00a6 30E0      		ldi r19,hi8(1)
+ 128 00a8 042E      		mov r0,r20
+ 129 00aa 00C0      		rjmp 2f
+ 130 00ac 220F      	1:	lsl r18
+ 131 00ae 331F      		rol r19
+ 132 00b0 0A94      	2:	dec r0
+ 133 00b2 02F4      		brpl 1b
+ 134 00b4 2095      		com r18
+ 135 00b6 8223      		and r24,r18
+ 136 00b8 81BB      		out 49-0x20,r24
+ 137               	.LM12:
+ 138 00ba 80B3      		in r24,48-0x20
+ 139 00bc 00C0      		rjmp .L15
+ 140               	.L7:
+ 141               	.LM13:
+ 142 00be 82B1      		in r24,34-0x20
+ 143 00c0 21E0      		ldi r18,lo8(1)
+ 144 00c2 30E0      		ldi r19,hi8(1)
+ 145 00c4 042E      		mov r0,r20
+ 146 00c6 00C0      		rjmp 2f
+ 147 00c8 220F      	1:	lsl r18
+ 148 00ca 331F      		rol r19
+ 149 00cc 0A94      	2:	dec r0
+ 150 00ce 02F4      		brpl 1b
+ 151 00d0 2095      		com r18
+ 152 00d2 8223      		and r24,r18
+ 153 00d4 82B9      		out 34-0x20,r24
+ 154               	.LM14:
+ 155 00d6 81B1      		in r24,33-0x20
+ 156 00d8 00C0      		rjmp .L15
+ 157               	.L8:
+ 158               	.LM15:
+ 159 00da 4430      		cpi r20,4
+ 160 00dc 5105      		cpc r21,__zero_reg__
+ 161 00de 04F0      		brlt .L12
+ 162               	.LM16:
+ 163 00e0 84B7      		in r24,84-0x20
+ 164 00e2 8068      		ori r24,lo8(-128)
+ 165 00e4 84BF      		out 84-0x20,r24
+ 166               	.LM17:
+ 167 00e6 84B7      		in r24,84-0x20
+ 168 00e8 8068      		ori r24,lo8(-128)
+ 169 00ea 84BF      		out 84-0x20,r24
+ 170               	.L12:
+ 171               	.LM18:
+ 172 00ec 8091 6100 		lds r24,97
+ 173 00f0 21E0      		ldi r18,lo8(1)
+ 174 00f2 30E0      		ldi r19,hi8(1)
+ 175 00f4 042E      		mov r0,r20
+ 176 00f6 00C0      		rjmp 2f
+ 177 00f8 220F      	1:	lsl r18
+ 178 00fa 331F      		rol r19
+ 179 00fc 0A94      	2:	dec r0
+ 180 00fe 02F4      		brpl 1b
+ 181 0100 2095      		com r18
+ 182 0102 8223      		and r24,r18
+ 183 0104 8093 6100 		sts 97,r24
+ 184               	.LM19:
+ 185 0108 80B1      		in r24,32-0x20
+ 186               	.L15:
+ 187               	.LM20:
+ 188 010a 9927      		clr r25
+ 189 010c 00C0      		rjmp 2f
+ 190 010e 9595      	1:	asr r25
+ 191 0110 8795      		ror r24
+ 192 0112 4A95      	2:	dec r20
+ 193 0114 02F4      		brpl 1b
+ 194 0116 8170      		andi r24,lo8(1)
+ 195 0118 9070      		andi r25,hi8(1)
+ 196 011a 0895      		ret
+ 197               	.L9:
+ 198               	.LM21:
+ 199 011c 8091 6400 		lds r24,100
+ 200 0120 21E0      		ldi r18,lo8(1)
+ 201 0122 30E0      		ldi r19,hi8(1)
+ 202 0124 042E      		mov r0,r20
+ 203 0126 00C0      		rjmp 2f
+ 204 0128 220F      	1:	lsl r18
+ 205 012a 331F      		rol r19
+ 206 012c 0A94      	2:	dec r0
+ 207 012e 02F4      		brpl 1b
+ 208 0130 2095      		com r18
+ 209 0132 8223      		and r24,r18
+ 210 0134 8093 6400 		sts 100,r24
+ 211               	.LM22:
+ 212 0138 8091 6300 		lds r24,99
+ 213               	.LM23:
+ 214 013c 9927      		clr r25
+ 215 013e 00C0      		rjmp 2f
+ 216 0140 9595      	1:	asr r25
+ 217 0142 8795      		ror r24
+ 218 0144 4A95      	2:	dec r20
+ 219 0146 02F4      		brpl 1b
+ 220 0148 8170      		andi r24,lo8(1)
+ 221 014a 9070      		andi r25,hi8(1)
+ 222               	.LM24:
+ 223 014c 0895      		ret
+ 224               	/* epilogue: frame size=0 */
+ 225               	/* epilogue: noreturn */
+ 226               	/* epilogue end (size=0) */
+ 227               	/* function digital_input size 169 (169) */
+ 228               	.LFE2:
+ 230               	.global	digital_pull_up
+ 232               	digital_pull_up:
+ 233               	.LFB3:
+ 234               	.LM25:
+ 235               	/* prologue: frame size=0 */
+ 236               	/* prologue end (size=0) */
+ 237               	.LVL3:
+ 238               	.LM26:
+ 239 014e AC01      		movw r20,r24
+ 240               	.LVL4:
+ 241 0150 4770      		andi r20,lo8(7)
+ 242 0152 5070      		andi r21,hi8(7)
+ 243               	.LM27:
+ 244 0154 9C01      		movw r18,r24
+ 245 0156 93E0      		ldi r25,3
+ 246 0158 3595      	1:	asr r19
+ 247 015a 2795      		ror r18
+ 248 015c 9A95      		dec r25
+ 249 015e 01F4      		brne 1b
+ 250 0160 2430      		cpi r18,4
+ 251 0162 3105      		cpc r19,__zero_reg__
+ 252 0164 01F0      		breq .L21
+ 253               	.LM28:
+ 254 0166 2530      		cpi r18,5
+ 255 0168 3105      		cpc r19,__zero_reg__
+ 256 016a 04F4      		brge .L25
+ 257 016c 2230      		cpi r18,2
+ 258 016e 3105      		cpc r19,__zero_reg__
+ 259 0170 01F0      		breq .L19
+ 260 0172 2330      		cpi r18,3
+ 261 0174 3105      		cpc r19,__zero_reg__
+ 262 0176 04F4      		brge .L20
+ 263 0178 2130      		cpi r18,1
+ 264 017a 3105      		cpc r19,__zero_reg__
+ 265 017c 01F0      		breq .+2
+ 266 017e 00C0      		rjmp .L26
+ 267 0180 00C0      		rjmp .L18
+ 268               	.L25:
+ 269 0182 2630      		cpi r18,6
+ 270 0184 3105      		cpc r19,__zero_reg__
+ 271 0186 01F4      		brne .+2
+ 272 0188 00C0      		rjmp .L23
+ 273 018a 2630      		cpi r18,6
+ 274 018c 3105      		cpc r19,__zero_reg__
+ 275 018e 04F0      		brlt .L22
+ 276 0190 2730      		cpi r18,7
+ 277 0192 3105      		cpc r19,__zero_reg__
+ 278 0194 01F0      		breq .+2
+ 279 0196 00C0      		rjmp .L26
+ 280 0198 00C0      		rjmp .L24
+ 281               	.L18:
+ 282               	.LM29:
+ 283 019a 8BB3      		in r24,59-0x20
+ 284               	.LVL5:
+ 285 019c 00C0      		rjmp 2f
+ 286 019e 220F      	1:	lsl r18
+ 287 01a0 331F      		rol r19
+ 288 01a2 4A95      	2:	dec r20
+ 289 01a4 02F4      		brpl 1b
+ 290 01a6 822B      		or r24,r18
+ 291 01a8 8BBB      		out 59-0x20,r24
+ 292 01aa 0895      		ret
+ 293               	.LVL6:
+ 294               	.L19:
+ 295               	.LM30:
+ 296 01ac 28B3      		in r18,56-0x20
+ 297 01ae 81E0      		ldi r24,lo8(1)
+ 298 01b0 90E0      		ldi r25,hi8(1)
+ 299               	.LVL7:
+ 300 01b2 00C0      		rjmp 2f
+ 301 01b4 880F      	1:	lsl r24
+ 302 01b6 991F      		rol r25
+ 303 01b8 4A95      	2:	dec r20
+ 304 01ba 02F4      		brpl 1b
+ 305 01bc 282B      		or r18,r24
+ 306 01be 28BB      		out 56-0x20,r18
+ 307 01c0 0895      		ret
+ 308               	.LVL8:
+ 309               	.L20:
+ 310               	.LM31:
+ 311 01c2 25B3      		in r18,53-0x20
+ 312 01c4 81E0      		ldi r24,lo8(1)
+ 313 01c6 90E0      		ldi r25,hi8(1)
+ 314               	.LVL9:
+ 315 01c8 00C0      		rjmp 2f
+ 316 01ca 880F      	1:	lsl r24
+ 317 01cc 991F      		rol r25
+ 318 01ce 4A95      	2:	dec r20
+ 319 01d0 02F4      		brpl 1b
+ 320 01d2 282B      		or r18,r24
+ 321 01d4 25BB      		out 53-0x20,r18
+ 322 01d6 0895      		ret
+ 323               	.LVL10:
+ 324               	.L21:
+ 325               	.LM32:
+ 326 01d8 22B3      		in r18,50-0x20
+ 327 01da 81E0      		ldi r24,lo8(1)
+ 328 01dc 90E0      		ldi r25,hi8(1)
+ 329               	.LVL11:
+ 330 01de 00C0      		rjmp 2f
+ 331 01e0 880F      	1:	lsl r24
+ 332 01e2 991F      		rol r25
+ 333 01e4 4A95      	2:	dec r20
+ 334 01e6 02F4      		brpl 1b
+ 335 01e8 282B      		or r18,r24
+ 336 01ea 22BB      		out 50-0x20,r18
+ 337 01ec 0895      		ret
+ 338               	.LVL12:
+ 339               	.L22:
+ 340               	.LM33:
+ 341 01ee 23B1      		in r18,35-0x20
+ 342 01f0 81E0      		ldi r24,lo8(1)
+ 343 01f2 90E0      		ldi r25,hi8(1)
+ 344               	.LVL13:
+ 345 01f4 00C0      		rjmp 2f
+ 346 01f6 880F      	1:	lsl r24
+ 347 01f8 991F      		rol r25
+ 348 01fa 4A95      	2:	dec r20
+ 349 01fc 02F4      		brpl 1b
+ 350 01fe 282B      		or r18,r24
+ 351 0200 23B9      		out 35-0x20,r18
+ 352 0202 0895      		ret
+ 353               	.LVL14:
+ 354               	.L23:
+ 355               	.LM34:
+ 356 0204 2091 6200 		lds r18,98
+ 357 0208 81E0      		ldi r24,lo8(1)
+ 358 020a 90E0      		ldi r25,hi8(1)
+ 359               	.LVL15:
+ 360 020c 00C0      		rjmp 2f
+ 361 020e 880F      	1:	lsl r24
+ 362 0210 991F      		rol r25
+ 363 0212 4A95      	2:	dec r20
+ 364 0214 02F4      		brpl 1b
+ 365 0216 282B      		or r18,r24
+ 366 0218 2093 6200 		sts 98,r18
+ 367 021c 0895      		ret
+ 368               	.LVL16:
+ 369               	.L24:
+ 370               	.LM35:
+ 371 021e 2091 6500 		lds r18,101
+ 372 0222 81E0      		ldi r24,lo8(1)
+ 373 0224 90E0      		ldi r25,hi8(1)
+ 374               	.LVL17:
+ 375 0226 00C0      		rjmp 2f
+ 376 0228 880F      	1:	lsl r24
+ 377 022a 991F      		rol r25
+ 378 022c 4A95      	2:	dec r20
+ 379 022e 02F4      		brpl 1b
+ 380 0230 282B      		or r18,r24
+ 381 0232 2093 6500 		sts 101,r18
+ 382               	.LVL18:
+ 383               	.L26:
+ 384 0236 0895      		ret
+ 385               	/* epilogue: frame size=0 */
+ 386               	/* epilogue: noreturn */
+ 387               	/* epilogue end (size=0) */
+ 388               	/* function digital_pull_up size 124 (124) */
+ 389               	.LFE3:
+ 391               	.global	digital_output
+ 393               	digital_output:
+ 394               	.LFB4:
+ 395               	.LM36:
+ 396               	/* prologue: frame size=0 */
+ 397               	/* prologue end (size=0) */
+ 398               	.LVL19:
+ 399               	.LM37:
+ 400 0238 AC01      		movw r20,r24
+ 401               	.LVL20:
+ 402 023a 4770      		andi r20,lo8(7)
+ 403 023c 5070      		andi r21,hi8(7)
+ 404 023e 9C01      		movw r18,r24
+ 405 0240 53E0      		ldi r21,3
+ 406 0242 3595      	1:	asr r19
+ 407 0244 2795      		ror r18
+ 408 0246 5A95      		dec r21
+ 409 0248 01F4      		brne 1b
+ 410               	.LM38:
+ 411 024a 672B      		or r22,r23
+ 412 024c 01F0      		breq .+2
+ 413 024e 00C0      		rjmp .L28
+ 414               	.LM39:
+ 415 0250 2430      		cpi r18,4
+ 416 0252 3105      		cpc r19,__zero_reg__
+ 417 0254 01F4      		brne .+2
+ 418 0256 00C0      		rjmp .L34
+ 419 0258 2530      		cpi r18,5
+ 420 025a 3105      		cpc r19,__zero_reg__
+ 421 025c 04F4      		brge .L38
+ 422 025e 2230      		cpi r18,2
+ 423 0260 3105      		cpc r19,__zero_reg__
+ 424 0262 01F0      		breq .L32
+ 425 0264 2330      		cpi r18,3
+ 426 0266 3105      		cpc r19,__zero_reg__
+ 427 0268 04F4      		brge .L33
+ 428 026a 2130      		cpi r18,1
+ 429 026c 3105      		cpc r19,__zero_reg__
+ 430 026e 01F0      		breq .+2
+ 431 0270 00C0      		rjmp .L47
+ 432 0272 00C0      		rjmp .L31
+ 433               	.L38:
+ 434 0274 2630      		cpi r18,6
+ 435 0276 3105      		cpc r19,__zero_reg__
+ 436 0278 01F4      		brne .+2
+ 437 027a 00C0      		rjmp .L36
+ 438 027c 2630      		cpi r18,6
+ 439 027e 3105      		cpc r19,__zero_reg__
+ 440 0280 04F4      		brge .+2
+ 441 0282 00C0      		rjmp .L35
+ 442 0284 2730      		cpi r18,7
+ 443 0286 3105      		cpc r19,__zero_reg__
+ 444 0288 01F0      		breq .+2
+ 445 028a 00C0      		rjmp .L47
+ 446 028c 00C0      		rjmp .L37
+ 447               	.L31:
+ 448               	.LM40:
+ 449 028e 8AB3      		in r24,58-0x20
+ 450               	.LVL21:
+ 451 0290 00C0      		rjmp 2f
+ 452 0292 220F      	1:	lsl r18
+ 453 0294 331F      		rol r19
+ 454 0296 4A95      	2:	dec r20
+ 455 0298 02F4      		brpl 1b
+ 456 029a 822B      		or r24,r18
+ 457 029c 8ABB      		out 58-0x20,r24
+ 458               	.LM41:
+ 459 029e 8BB3      		in r24,59-0x20
+ 460 02a0 2095      		com r18
+ 461 02a2 8223      		and r24,r18
+ 462 02a4 00C0      		rjmp .L48
+ 463               	.LVL22:
+ 464               	.L32:
+ 465               	.LM42:
+ 466 02a6 87B3      		in r24,55-0x20
+ 467               	.LVL23:
+ 468 02a8 21E0      		ldi r18,lo8(1)
+ 469 02aa 30E0      		ldi r19,hi8(1)
+ 470 02ac 00C0      		rjmp 2f
+ 471 02ae 220F      	1:	lsl r18
+ 472 02b0 331F      		rol r19
+ 473 02b2 4A95      	2:	dec r20
+ 474 02b4 02F4      		brpl 1b
+ 475 02b6 822B      		or r24,r18
+ 476 02b8 87BB      		out 55-0x20,r24
+ 477               	.LM43:
+ 478 02ba 88B3      		in r24,56-0x20
+ 479 02bc 2095      		com r18
+ 480 02be 8223      		and r24,r18
+ 481 02c0 00C0      		rjmp .L53
+ 482               	.LVL24:
+ 483               	.L33:
+ 484               	.LM44:
+ 485 02c2 84B3      		in r24,52-0x20
+ 486               	.LVL25:
+ 487 02c4 21E0      		ldi r18,lo8(1)
+ 488 02c6 30E0      		ldi r19,hi8(1)
+ 489 02c8 00C0      		rjmp 2f
+ 490 02ca 220F      	1:	lsl r18
+ 491 02cc 331F      		rol r19
+ 492 02ce 4A95      	2:	dec r20
+ 493 02d0 02F4      		brpl 1b
+ 494 02d2 822B      		or r24,r18
+ 495 02d4 84BB      		out 52-0x20,r24
+ 496               	.LM45:
+ 497 02d6 85B3      		in r24,53-0x20
+ 498 02d8 2095      		com r18
+ 499 02da 8223      		and r24,r18
+ 500 02dc 00C0      		rjmp .L52
+ 501               	.LVL26:
+ 502               	.L34:
+ 503               	.LM46:
+ 504 02de 81B3      		in r24,49-0x20
+ 505               	.LVL27:
+ 506 02e0 21E0      		ldi r18,lo8(1)
+ 507 02e2 30E0      		ldi r19,hi8(1)
+ 508 02e4 00C0      		rjmp 2f
+ 509 02e6 220F      	1:	lsl r18
+ 510 02e8 331F      		rol r19
+ 511 02ea 4A95      	2:	dec r20
+ 512 02ec 02F4      		brpl 1b
+ 513 02ee 822B      		or r24,r18
+ 514 02f0 81BB      		out 49-0x20,r24
+ 515               	.LM47:
+ 516 02f2 82B3      		in r24,50-0x20
+ 517 02f4 2095      		com r18
+ 518 02f6 8223      		and r24,r18
+ 519 02f8 00C0      		rjmp .L49
+ 520               	.LVL28:
+ 521               	.L35:
+ 522               	.LM48:
+ 523 02fa 82B1      		in r24,34-0x20
+ 524               	.LVL29:
+ 525 02fc 21E0      		ldi r18,lo8(1)
+ 526 02fe 30E0      		ldi r19,hi8(1)
+ 527 0300 00C0      		rjmp 2f
+ 528 0302 220F      	1:	lsl r18
+ 529 0304 331F      		rol r19
+ 530 0306 4A95      	2:	dec r20
+ 531 0308 02F4      		brpl 1b
+ 532 030a 822B      		or r24,r18
+ 533 030c 82B9      		out 34-0x20,r24
+ 534               	.LM49:
+ 535 030e 83B1      		in r24,35-0x20
+ 536 0310 2095      		com r18
+ 537 0312 8223      		and r24,r18
+ 538 0314 00C0      		rjmp .L50
+ 539               	.LVL30:
+ 540               	.L36:
+ 541               	.LM50:
+ 542 0316 8091 6100 		lds r24,97
+ 543               	.LVL31:
+ 544 031a 21E0      		ldi r18,lo8(1)
+ 545 031c 30E0      		ldi r19,hi8(1)
+ 546 031e 00C0      		rjmp 2f
+ 547 0320 220F      	1:	lsl r18
+ 548 0322 331F      		rol r19
+ 549 0324 4A95      	2:	dec r20
+ 550 0326 02F4      		brpl 1b
+ 551 0328 822B      		or r24,r18
+ 552 032a 8093 6100 		sts 97,r24
+ 553               	.LM51:
+ 554 032e 8091 6200 		lds r24,98
+ 555 0332 2095      		com r18
+ 556 0334 8223      		and r24,r18
+ 557 0336 00C0      		rjmp .L51
+ 558               	.LVL32:
+ 559               	.L37:
+ 560               	.LM52:
+ 561 0338 8091 6400 		lds r24,100
+ 562               	.LVL33:
+ 563 033c 21E0      		ldi r18,lo8(1)
+ 564 033e 30E0      		ldi r19,hi8(1)
+ 565 0340 00C0      		rjmp 2f
+ 566 0342 220F      	1:	lsl r18
+ 567 0344 331F      		rol r19
+ 568 0346 4A95      	2:	dec r20
+ 569 0348 02F4      		brpl 1b
+ 570 034a 822B      		or r24,r18
+ 571 034c 8093 6400 		sts 100,r24
+ 572               	.LM53:
+ 573 0350 8091 6500 		lds r24,101
+ 574 0354 2095      		com r18
+ 575 0356 8223      		and r24,r18
+ 576 0358 8093 6500 		sts 101,r24
+ 577 035c 0895      		ret
+ 578               	.LVL34:
+ 579               	.L28:
+ 580               	.LM54:
+ 581 035e 2430      		cpi r18,4
+ 582 0360 3105      		cpc r19,__zero_reg__
+ 583 0362 01F4      		brne .+2
+ 584 0364 00C0      		rjmp .L42
+ 585 0366 2530      		cpi r18,5
+ 586 0368 3105      		cpc r19,__zero_reg__
+ 587 036a 04F4      		brge .L46
+ 588 036c 2230      		cpi r18,2
+ 589 036e 3105      		cpc r19,__zero_reg__
+ 590 0370 01F0      		breq .L40
+ 591 0372 2330      		cpi r18,3
+ 592 0374 3105      		cpc r19,__zero_reg__
+ 593 0376 04F4      		brge .L41
+ 594 0378 2130      		cpi r18,1
+ 595 037a 3105      		cpc r19,__zero_reg__
+ 596 037c 01F0      		breq .+2
+ 597 037e 00C0      		rjmp .L47
+ 598 0380 00C0      		rjmp .L39
+ 599               	.L46:
+ 600 0382 2630      		cpi r18,6
+ 601 0384 3105      		cpc r19,__zero_reg__
+ 602 0386 01F4      		brne .+2
+ 603 0388 00C0      		rjmp .L44
+ 604 038a 2630      		cpi r18,6
+ 605 038c 3105      		cpc r19,__zero_reg__
+ 606 038e 04F4      		brge .+2
+ 607 0390 00C0      		rjmp .L43
+ 608 0392 2730      		cpi r18,7
+ 609 0394 3105      		cpc r19,__zero_reg__
+ 610 0396 01F0      		breq .+2
+ 611 0398 00C0      		rjmp .L47
+ 612 039a 00C0      		rjmp .L45
+ 613               	.L39:
+ 614               	.LM55:
+ 615 039c 8AB3      		in r24,58-0x20
+ 616               	.LVL35:
+ 617 039e 00C0      		rjmp 2f
+ 618 03a0 220F      	1:	lsl r18
+ 619 03a2 331F      		rol r19
+ 620 03a4 4A95      	2:	dec r20
+ 621 03a6 02F4      		brpl 1b
+ 622 03a8 822B      		or r24,r18
+ 623 03aa 8ABB      		out 58-0x20,r24
+ 624               	.LM56:
+ 625 03ac 8BB3      		in r24,59-0x20
+ 626 03ae 822B      		or r24,r18
+ 627               	.L48:
+ 628 03b0 8BBB      		out 59-0x20,r24
+ 629 03b2 0895      		ret
+ 630               	.LVL36:
+ 631               	.L40:
+ 632               	.LM57:
+ 633 03b4 87B3      		in r24,55-0x20
+ 634               	.LVL37:
+ 635 03b6 21E0      		ldi r18,lo8(1)
+ 636 03b8 30E0      		ldi r19,hi8(1)
+ 637 03ba 00C0      		rjmp 2f
+ 638 03bc 220F      	1:	lsl r18
+ 639 03be 331F      		rol r19
+ 640 03c0 4A95      	2:	dec r20
+ 641 03c2 02F4      		brpl 1b
+ 642 03c4 822B      		or r24,r18
+ 643 03c6 87BB      		out 55-0x20,r24
+ 644               	.LM58:
+ 645 03c8 88B3      		in r24,56-0x20
+ 646 03ca 822B      		or r24,r18
+ 647               	.L53:
+ 648 03cc 88BB      		out 56-0x20,r24
+ 649 03ce 0895      		ret
+ 650               	.LVL38:
+ 651               	.L41:
+ 652               	.LM59:
+ 653 03d0 84B3      		in r24,52-0x20
+ 654               	.LVL39:
+ 655 03d2 21E0      		ldi r18,lo8(1)
+ 656 03d4 30E0      		ldi r19,hi8(1)
+ 657 03d6 00C0      		rjmp 2f
+ 658 03d8 220F      	1:	lsl r18
+ 659 03da 331F      		rol r19
+ 660 03dc 4A95      	2:	dec r20
+ 661 03de 02F4      		brpl 1b
+ 662 03e0 822B      		or r24,r18
+ 663 03e2 84BB      		out 52-0x20,r24
+ 664               	.LM60:
+ 665 03e4 85B3      		in r24,53-0x20
+ 666 03e6 822B      		or r24,r18
+ 667               	.L52:
+ 668 03e8 85BB      		out 53-0x20,r24
+ 669 03ea 0895      		ret
+ 670               	.LVL40:
+ 671               	.L42:
+ 672               	.LM61:
+ 673 03ec 81B3      		in r24,49-0x20
+ 674               	.LVL41:
+ 675 03ee 21E0      		ldi r18,lo8(1)
+ 676 03f0 30E0      		ldi r19,hi8(1)
+ 677 03f2 00C0      		rjmp 2f
+ 678 03f4 220F      	1:	lsl r18
+ 679 03f6 331F      		rol r19
+ 680 03f8 4A95      	2:	dec r20
+ 681 03fa 02F4      		brpl 1b
+ 682 03fc 822B      		or r24,r18
+ 683 03fe 81BB      		out 49-0x20,r24
+ 684               	.LM62:
+ 685 0400 82B3      		in r24,50-0x20
+ 686 0402 822B      		or r24,r18
+ 687               	.L49:
+ 688 0404 82BB      		out 50-0x20,r24
+ 689 0406 0895      		ret
+ 690               	.LVL42:
+ 691               	.L43:
+ 692               	.LM63:
+ 693 0408 82B1      		in r24,34-0x20
+ 694               	.LVL43:
+ 695 040a 21E0      		ldi r18,lo8(1)
+ 696 040c 30E0      		ldi r19,hi8(1)
+ 697 040e 00C0      		rjmp 2f
+ 698 0410 220F      	1:	lsl r18
+ 699 0412 331F      		rol r19
+ 700 0414 4A95      	2:	dec r20
+ 701 0416 02F4      		brpl 1b
+ 702 0418 822B      		or r24,r18
+ 703 041a 82B9      		out 34-0x20,r24
+ 704               	.LM64:
+ 705 041c 83B1      		in r24,35-0x20
+ 706 041e 822B      		or r24,r18
+ 707               	.L50:
+ 708 0420 83B9      		out 35-0x20,r24
+ 709 0422 0895      		ret
+ 710               	.LVL44:
+ 711               	.L44:
+ 712               	.LM65:
+ 713 0424 8091 6100 		lds r24,97
+ 714               	.LVL45:
+ 715 0428 21E0      		ldi r18,lo8(1)
+ 716 042a 30E0      		ldi r19,hi8(1)
+ 717 042c 00C0      		rjmp 2f
+ 718 042e 220F      	1:	lsl r18
+ 719 0430 331F      		rol r19
+ 720 0432 4A95      	2:	dec r20
+ 721 0434 02F4      		brpl 1b
+ 722 0436 822B      		or r24,r18
+ 723 0438 8093 6100 		sts 97,r24
+ 724               	.LM66:
+ 725 043c 8091 6200 		lds r24,98
+ 726 0440 822B      		or r24,r18
+ 727               	.L51:
+ 728 0442 8093 6200 		sts 98,r24
+ 729 0446 0895      		ret
+ 730               	.LVL46:
+ 731               	.L45:
+ 732               	.LM67:
+ 733 0448 8091 6400 		lds r24,100
+ 734               	.LVL47:
+ 735 044c 21E0      		ldi r18,lo8(1)
+ 736 044e 30E0      		ldi r19,hi8(1)
+ 737 0450 00C0      		rjmp 2f
+ 738 0452 220F      	1:	lsl r18
+ 739 0454 331F      		rol r19
+ 740 0456 4A95      	2:	dec r20
+ 741 0458 02F4      		brpl 1b
+ 742 045a 822B      		or r24,r18
+ 743 045c 8093 6400 		sts 100,r24
+ 744               	.LM68:
+ 745 0460 8091 6500 		lds r24,101
+ 746 0464 822B      		or r24,r18
+ 747 0466 8093 6500 		sts 101,r24
+ 748               	.LVL48:
+ 749               	.L47:
+ 750 046a 0895      		ret
+ 751               	/* epilogue: frame size=0 */
+ 752               	/* epilogue: noreturn */
+ 753               	/* epilogue end (size=0) */
+ 754               	/* function digital_output size 294 (294) */
+ 755               	.LFE4:
+ 757               	.global	button1_read
+ 759               	button1_read:
+ 760               	.LFB5:
+ 761               	.LM69:
+ 762               	/* prologue: frame size=0 */
+ 763               	/* prologue end (size=0) */
+ 764               	.LM70:
+ 765 046c E4E6      		ldi r30,lo8(100)
+ 766 046e F0E0      		ldi r31,hi8(100)
+ 767 0470 8081      		ld r24,Z
+ 768 0472 8E7F      		andi r24,lo8(-2)
+ 769 0474 8083      		st Z,r24
+ 770               	.LM71:
+ 771 0476 E5E6      		ldi r30,lo8(101)
+ 772 0478 F0E0      		ldi r31,hi8(101)
+ 773 047a 8081      		ld r24,Z
+ 774 047c 8160      		ori r24,lo8(1)
+ 775 047e 8083      		st Z,r24
+ 776               	.LM72:
+ 777 0480 8091 6300 		lds r24,99
+ 778 0484 9927      		clr r25
+ 779 0486 8095      		com r24
+ 780 0488 9095      		com r25
+ 781               	.LM73:
+ 782 048a 8170      		andi r24,lo8(1)
+ 783 048c 9070      		andi r25,hi8(1)
+ 784               	/* epilogue: frame size=0 */
+ 785 048e 0895      		ret
+ 786               	/* epilogue end (size=1) */
+ 787               	/* function button1_read size 18 (17) */
+ 788               	.LFE5:
+ 790               	.global	button1_click
+ 792               	button1_click:
+ 793               	.LFB7:
+ 794               	.LM74:
+ 795               	/* prologue: frame size=0 */
+ 796               	/* prologue end (size=0) */
+ 797               	.LM75:
+ 798 0490 0E94 0000 		call button1_read
+ 799 0494 892B      		or r24,r25
+ 800 0496 01F4      		brne .L62
+ 801               	.LM76:
+ 802 0498 80E0      		ldi r24,lo8(0)
+ 803 049a 90E0      		ldi r25,hi8(0)
+ 804 049c 0895      		ret
+ 805               	.L62:
+ 806               	.LM77:
+ 807 049e 0E94 0000 		call button1_read
+ 808 04a2 892B      		or r24,r25
+ 809 04a4 01F4      		brne .L62
+ 810 04a6 81E0      		ldi r24,lo8(1)
+ 811 04a8 90E0      		ldi r25,hi8(1)
+ 812               	.LM78:
+ 813 04aa 0895      		ret
+ 814               	/* epilogue: frame size=0 */
+ 815               	/* epilogue: noreturn */
+ 816               	/* epilogue end (size=0) */
+ 817               	/* function button1_click size 14 (14) */
+ 818               	.LFE7:
+ 820               	.global	button2_read
+ 822               	button2_read:
+ 823               	.LFB8:
+ 824               	.LM79:
+ 825               	/* prologue: frame size=0 */
+ 826               	/* prologue end (size=0) */
+ 827               	.LM80:
+ 828 04ac E4E6      		ldi r30,lo8(100)
+ 829 04ae F0E0      		ldi r31,hi8(100)
+ 830 04b0 8081      		ld r24,Z
+ 831 04b2 8D7F      		andi r24,lo8(-3)
+ 832 04b4 8083      		st Z,r24
+ 833               	.LM81:
+ 834 04b6 E5E6      		ldi r30,lo8(101)
+ 835 04b8 F0E0      		ldi r31,hi8(101)
+ 836 04ba 8081      		ld r24,Z
+ 837 04bc 8260      		ori r24,lo8(2)
+ 838 04be 8083      		st Z,r24
+ 839               	.LM82:
+ 840 04c0 8091 6300 		lds r24,99
+ 841 04c4 9927      		clr r25
+ 842 04c6 9695      		lsr r25
+ 843 04c8 8795      		ror r24
+ 844 04ca 8095      		com r24
+ 845 04cc 9095      		com r25
+ 846               	.LM83:
+ 847 04ce 8170      		andi r24,lo8(1)
+ 848 04d0 9070      		andi r25,hi8(1)
+ 849               	/* epilogue: frame size=0 */
+ 850 04d2 0895      		ret
+ 851               	/* epilogue end (size=1) */
+ 852               	/* function button2_read size 20 (19) */
+ 853               	.LFE8:
+ 855               	.global	button2_click
+ 857               	button2_click:
+ 858               	.LFB10:
+ 859               	.LM84:
+ 860               	/* prologue: frame size=0 */
+ 861               	/* prologue end (size=0) */
+ 862               	.LM85:
+ 863 04d4 0E94 0000 		call button2_read
+ 864 04d8 892B      		or r24,r25
+ 865 04da 01F4      		brne .L73
+ 866               	.LM86:
+ 867 04dc 80E0      		ldi r24,lo8(0)
+ 868 04de 90E0      		ldi r25,hi8(0)
+ 869 04e0 0895      		ret
+ 870               	.L73:
+ 871               	.LM87:
+ 872 04e2 0E94 0000 		call button2_read
+ 873 04e6 892B      		or r24,r25
+ 874 04e8 01F4      		brne .L73
+ 875 04ea 81E0      		ldi r24,lo8(1)
+ 876 04ec 90E0      		ldi r25,hi8(1)
+ 877               	.LM88:
+ 878 04ee 0895      		ret
+ 879               	/* epilogue: frame size=0 */
+ 880               	/* epilogue: noreturn */
+ 881               	/* epilogue end (size=0) */
+ 882               	/* function button2_click size 14 (14) */
+ 883               	.LFE10:
+ 885               	.global	button2_wait
+ 887               	button2_wait:
+ 888               	.LFB9:
+ 889               	.LM89:
+ 890               	/* prologue: frame size=0 */
+ 891               	/* prologue end (size=0) */
+ 892 04f0 00C0      		rjmp .L77
+ 893               	.L78:
+ 894               	.LM90:
+ 895 04f2 8FE0      		ldi r24,lo8(15)
+ 896 04f4 90E0      		ldi r25,hi8(15)
+ 897 04f6 0E94 0000 		call delay_ms
+ 898               	.L77:
+ 899               	.LM91:
+ 900 04fa 0E94 0000 		call button2_read
+ 901 04fe 892B      		or r24,r25
+ 902 0500 01F0      		breq .L78
+ 903               	/* epilogue: frame size=0 */
+ 904 0502 0895      		ret
+ 905               	/* epilogue end (size=1) */
+ 906               	/* function button2_wait size 10 (9) */
+ 907               	.LFE9:
+ 909               	.global	button1_wait
+ 911               	button1_wait:
+ 912               	.LFB6:
+ 913               	.LM92:
+ 914               	/* prologue: frame size=0 */
+ 915               	/* prologue end (size=0) */
+ 916 0504 00C0      		rjmp .L82
+ 917               	.L83:
+ 918               	.LM93:
+ 919 0506 8FE0      		ldi r24,lo8(15)
+ 920 0508 90E0      		ldi r25,hi8(15)
+ 921 050a 0E94 0000 		call delay_ms
+ 922               	.L82:
+ 923               	.LM94:
+ 924 050e 0E94 0000 		call button1_read
+ 925 0512 892B      		or r24,r25
+ 926 0514 01F0      		breq .L83
+ 927               	/* epilogue: frame size=0 */
+ 928 0516 0895      		ret
+ 929               	/* epilogue end (size=1) */
+ 930               	/* function button1_wait size 10 (9) */
+ 931               	.LFE6:
+ 1021               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 dio.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:20     .text:00000000 digital_input
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:232    .text:0000014e digital_pull_up
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:393    .text:00000238 digital_output
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:759    .text:0000046c button1_read
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:792    .text:00000490 button1_click
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:822    .text:000004ac button2_read
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:857    .text:000004d4 button2_click
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:887    .text:000004f0 button2_wait
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cczALWWs.s:911    .text:00000504 button1_wait
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+delay_ms
Index: demos/hunter_prey_john/projects/libdragonfly/bom.lst
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/bom.lst	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/bom.lst	(revision 1694)
@@ -0,0 +1,2081 @@
+   1               		.file	"bom.c"
+   2               		.arch atmega128
+   3               	__SREG__ = 0x3f
+   4               	__SP_H__ = 0x3e
+   5               	__SP_L__ = 0x3d
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.global __do_copy_data
+   9               		.global __do_clear_bss
+  17               	.Ltext0:
+  19               	bom_select:
+  20               	.LFB15:
+  21               	.LM1:
+  22               	/* prologue: frame size=0 */
+  23 0000 CF93      		push r28
+  24 0002 DF93      		push r29
+  25               	/* prologue end (size=2) */
+  26               	.LVL0:
+  27 0004 E82F      		mov r30,r24
+  28               	.LM2:
+  29 0006 8091 0000 		lds r24,bom_type
+  30               	.LVL1:
+  31 000a 8823      		tst r24
+  32 000c 01F4      		brne .L2
+  33               	.LM3:
+  34 000e FF27      		clr r31
+  35 0010 E050      		subi r30,lo8(-(lookup))
+  36 0012 F040      		sbci r31,hi8(-(lookup))
+  37 0014 E081      		ld r30,Z
+  38               	.L2:
+  39               	.LM4:
+  40 0016 CE2F      		mov r28,r30
+  41 0018 DD27      		clr r29
+  42 001a 8091 0000 		lds r24,select_pins+6
+  43 001e 9091 0000 		lds r25,(select_pins+6)+1
+  44 0022 C3FF      		sbrs r28,3
+  45 0024 00C0      		rjmp .L4
+  46               	.LM5:
+  47 0026 61E0      		ldi r22,lo8(1)
+  48 0028 70E0      		ldi r23,hi8(1)
+  49 002a 00C0      		rjmp .L17
+  50               	.L4:
+  51               	.LM6:
+  52 002c 60E0      		ldi r22,lo8(0)
+  53 002e 70E0      		ldi r23,hi8(0)
+  54               	.L17:
+  55 0030 0E94 0000 		call digital_output
+  56               	.LVL2:
+  57 0034 8091 0000 		lds r24,select_pins+4
+  58 0038 9091 0000 		lds r25,(select_pins+4)+1
+  59               	.LM7:
+  60 003c C2FF      		sbrs r28,2
+  61 003e 00C0      		rjmp .L7
+  62               	.LM8:
+  63 0040 61E0      		ldi r22,lo8(1)
+  64 0042 70E0      		ldi r23,hi8(1)
+  65 0044 00C0      		rjmp .L18
+  66               	.L7:
+  67               	.LM9:
+  68 0046 60E0      		ldi r22,lo8(0)
+  69 0048 70E0      		ldi r23,hi8(0)
+  70               	.L18:
+  71 004a 0E94 0000 		call digital_output
+  72 004e 8091 0000 		lds r24,select_pins+2
+  73 0052 9091 0000 		lds r25,(select_pins+2)+1
+  74               	.LM10:
+  75 0056 C1FF      		sbrs r28,1
+  76 0058 00C0      		rjmp .L10
+  77               	.LM11:
+  78 005a 61E0      		ldi r22,lo8(1)
+  79 005c 70E0      		ldi r23,hi8(1)
+  80 005e 00C0      		rjmp .L19
+  81               	.L10:
+  82               	.LM12:
+  83 0060 60E0      		ldi r22,lo8(0)
+  84 0062 70E0      		ldi r23,hi8(0)
+  85               	.L19:
+  86 0064 0E94 0000 		call digital_output
+  87 0068 8091 0000 		lds r24,select_pins
+  88 006c 9091 0000 		lds r25,(select_pins)+1
+  89               	.LM13:
+  90 0070 C0FF      		sbrs r28,0
+  91 0072 00C0      		rjmp .L13
+  92               	.LM14:
+  93 0074 61E0      		ldi r22,lo8(1)
+  94 0076 70E0      		ldi r23,hi8(1)
+  95 0078 00C0      		rjmp .L20
+  96               	.L13:
+  97               	.LM15:
+  98 007a 60E0      		ldi r22,lo8(0)
+  99 007c 70E0      		ldi r23,hi8(0)
+ 100               	.L20:
+ 101 007e 0E94 0000 		call digital_output
+ 102               	/* epilogue: frame size=0 */
+ 103 0082 DF91      		pop r29
+ 104 0084 CF91      		pop r28
+ 105 0086 0895      		ret
+ 106               	/* epilogue end (size=3) */
+ 107               	/* function bom_select size 68 (63) */
+ 108               	.LFE15:
+ 110               	.global	bom_off
+ 112               	bom_off:
+ 113               	.LFB14:
+ 114               	.LM16:
+ 115               	/* prologue: frame size=0 */
+ 116               	/* prologue end (size=0) */
+ 117               	.LM17:
+ 118 0088 8091 0000 		lds r24,bom_type
+ 119 008c 8823      		tst r24
+ 120 008e 01F0      		breq .L23
+ 121               	.LM18:
+ 122 0090 8130      		cpi r24,lo8(1)
+ 123 0092 01F4      		brne .L25
+ 124 0094 00C0      		rjmp .L24
+ 125               	.L23:
+ 126               	.LM19:
+ 127 0096 60E0      		ldi r22,lo8(0)
+ 128 0098 70E0      		ldi r23,hi8(0)
+ 129 009a 8AE2      		ldi r24,lo8(42)
+ 130 009c 90E0      		ldi r25,hi8(42)
+ 131 009e 0E94 0000 		call digital_output
+ 132 00a2 0895      		ret
+ 133               	.L24:
+ 134               	.LM20:
+ 135 00a4 60E0      		ldi r22,lo8(0)
+ 136 00a6 70E0      		ldi r23,hi8(0)
+ 137 00a8 8BE2      		ldi r24,lo8(43)
+ 138 00aa 90E0      		ldi r25,hi8(43)
+ 139 00ac 0E94 0000 		call digital_output
+ 140               	.L25:
+ 141 00b0 0895      		ret
+ 142               	/* epilogue: frame size=0 */
+ 143               	/* epilogue: noreturn */
+ 144               	/* epilogue end (size=0) */
+ 145               	/* function bom_off size 21 (21) */
+ 146               	.LFE14:
+ 148               	.global	bom_on
+ 150               	bom_on:
+ 151               	.LFB13:
+ 152               	.LM21:
+ 153               	/* prologue: frame size=0 */
+ 154               	/* prologue end (size=0) */
+ 155               	.LM22:
+ 156 00b2 8091 0000 		lds r24,bom_type
+ 157 00b6 8823      		tst r24
+ 158 00b8 01F0      		breq .L28
+ 159               	.LM23:
+ 160 00ba 8130      		cpi r24,lo8(1)
+ 161 00bc 01F4      		brne .L30
+ 162 00be 00C0      		rjmp .L29
+ 163               	.L28:
+ 164               	.LM24:
+ 165 00c0 61E0      		ldi r22,lo8(1)
+ 166 00c2 70E0      		ldi r23,hi8(1)
+ 167 00c4 8AE2      		ldi r24,lo8(42)
+ 168 00c6 90E0      		ldi r25,hi8(42)
+ 169 00c8 0E94 0000 		call digital_output
+ 170 00cc 0895      		ret
+ 171               	.L29:
+ 172               	.LM25:
+ 173 00ce 61E0      		ldi r22,lo8(1)
+ 174 00d0 70E0      		ldi r23,hi8(1)
+ 175 00d2 8BE2      		ldi r24,lo8(43)
+ 176 00d4 90E0      		ldi r25,hi8(43)
+ 177 00d6 0E94 0000 		call digital_output
+ 178               	.L30:
+ 179 00da 0895      		ret
+ 180               	/* epilogue: frame size=0 */
+ 181               	/* epilogue: noreturn */
+ 182               	/* epilogue end (size=0) */
+ 183               	/* function bom_on size 21 (21) */
+ 184               	.LFE13:
+ 186               	.global	bom_set_leds
+ 188               	bom_set_leds:
+ 189               	.LFB11:
+ 190               	.LM26:
+ 191               	/* prologue: frame size=0 */
+ 192 00dc EF92      		push r14
+ 193 00de FF92      		push r15
+ 194 00e0 0F93      		push r16
+ 195 00e2 1F93      		push r17
+ 196 00e4 CF93      		push r28
+ 197 00e6 DF93      		push r29
+ 198               	/* prologue end (size=6) */
+ 199               	.LVL3:
+ 200 00e8 7C01      		movw r14,r24
+ 201               	.LM27:
+ 202 00ea 8091 0000 		lds r24,bom_type
+ 203               	.LVL4:
+ 204 00ee 8130      		cpi r24,lo8(1)
+ 205 00f0 01F4      		brne .L35
+ 206               	.LM28:
+ 207 00f2 00E1      		ldi r16,lo8(16)
+ 208 00f4 10E0      		ldi r17,hi8(16)
+ 209               	.LVL5:
+ 210 00f6 C0E0      		ldi r28,lo8(-32768)
+ 211 00f8 D0E8      		ldi r29,hi8(-32768)
+ 212               	.LVL6:
+ 213               	.L34:
+ 214               	.LM29:
+ 215 00fa B701      		movw r22,r14
+ 216 00fc 6C23      		and r22,r28
+ 217 00fe 7D23      		and r23,r29
+ 218 0100 88E0      		ldi r24,lo8(8)
+ 219 0102 90E0      		ldi r25,hi8(8)
+ 220 0104 0E94 0000 		call digital_output
+ 221               	.LM30:
+ 222 0108 61E0      		ldi r22,lo8(1)
+ 223 010a 70E0      		ldi r23,hi8(1)
+ 224 010c 89E0      		ldi r24,lo8(9)
+ 225 010e 90E0      		ldi r25,hi8(9)
+ 226 0110 0E94 0000 		call digital_output
+ 227               	.LM31:
+ 228 0114 60E0      		ldi r22,lo8(0)
+ 229 0116 70E0      		ldi r23,hi8(0)
+ 230 0118 89E0      		ldi r24,lo8(9)
+ 231 011a 90E0      		ldi r25,hi8(9)
+ 232 011c 0E94 0000 		call digital_output
+ 233               	.LM32:
+ 234 0120 D695      		lsr r29
+ 235 0122 C795      		ror r28
+ 236               	.LM33:
+ 237 0124 0150      		subi r16,lo8(-(-1))
+ 238 0126 1040      		sbci r17,hi8(-(-1))
+ 239 0128 01F4      		brne .L34
+ 240               	.L35:
+ 241               	/* epilogue: frame size=0 */
+ 242 012a DF91      		pop r29
+ 243 012c CF91      		pop r28
+ 244 012e 1F91      		pop r17
+ 245 0130 0F91      		pop r16
+ 246 0132 FF90      		pop r15
+ 247 0134 EF90      		pop r14
+ 248 0136 0895      		ret
+ 249               	/* epilogue end (size=7) */
+ 250               	/* function bom_set_leds size 48 (35) */
+ 251               	.LFE11:
+ 253               	.global	bom_init
+ 255               	bom_init:
+ 256               	.LFB3:
+ 257               	.LM34:
+ 258               	/* prologue: frame size=0 */
+ 259               	/* prologue end (size=0) */
+ 260               	.LVL7:
+ 261               	.LM35:
+ 262 0138 8093 0000 		sts bom_type,r24
+ 263               	.LM36:
+ 264 013c 8091 0000 		lds r24,bom_type
+ 265               	.LVL8:
+ 266 0140 8823      		tst r24
+ 267 0142 01F0      		breq .L39
+ 268               	.LM37:
+ 269 0144 8130      		cpi r24,lo8(1)
+ 270 0146 01F0      		breq .+2
+ 271 0148 00C0      		rjmp .L41
+ 272 014a 00C0      		rjmp .L40
+ 273               	.L39:
+ 274               	.LM38:
+ 275 014c 8CE2      		ldi r24,lo8(44)
+ 276 014e 90E0      		ldi r25,hi8(44)
+ 277 0150 9093 0000 		sts (select_pins)+1,r25
+ 278 0154 8093 0000 		sts select_pins,r24
+ 279               	.LM39:
+ 280 0158 8BE2      		ldi r24,lo8(43)
+ 281 015a 90E0      		ldi r25,hi8(43)
+ 282 015c 9093 0000 		sts (select_pins+2)+1,r25
+ 283 0160 8093 0000 		sts select_pins+2,r24
+ 284               	.LM40:
+ 285 0164 8FE2      		ldi r24,lo8(47)
+ 286 0166 90E0      		ldi r25,hi8(47)
+ 287 0168 9093 0000 		sts (select_pins+4)+1,r25
+ 288 016c 8093 0000 		sts select_pins+4,r24
+ 289               	.LM41:
+ 290 0170 8EE2      		ldi r24,lo8(46)
+ 291 0172 90E0      		ldi r25,hi8(46)
+ 292 0174 9093 0000 		sts (select_pins+6)+1,r25
+ 293 0178 8093 0000 		sts select_pins+6,r24
+ 294               	.LM42:
+ 295 017c 1092 0000 		sts (analog_pin)+1,__zero_reg__
+ 296 0180 1092 0000 		sts analog_pin,__zero_reg__
+ 297 0184 0895      		ret
+ 298               	.L40:
+ 299               	.LM43:
+ 300 0186 60E0      		ldi r22,lo8(0)
+ 301 0188 70E0      		ldi r23,hi8(0)
+ 302 018a 8AE2      		ldi r24,lo8(42)
+ 303 018c 90E0      		ldi r25,hi8(42)
+ 304 018e 0E94 0000 		call digital_output
+ 305               	.LM44:
+ 306 0192 8DE2      		ldi r24,lo8(45)
+ 307 0194 90E0      		ldi r25,hi8(45)
+ 308 0196 9093 0000 		sts (select_pins)+1,r25
+ 309 019a 8093 0000 		sts select_pins,r24
+ 310               	.LM45:
+ 311 019e 8CE2      		ldi r24,lo8(44)
+ 312 01a0 90E0      		ldi r25,hi8(44)
+ 313 01a2 9093 0000 		sts (select_pins+2)+1,r25
+ 314 01a6 8093 0000 		sts select_pins+2,r24
+ 315               	.LM46:
+ 316 01aa 8FE2      		ldi r24,lo8(47)
+ 317 01ac 90E0      		ldi r25,hi8(47)
+ 318 01ae 9093 0000 		sts (select_pins+4)+1,r25
+ 319 01b2 8093 0000 		sts select_pins+4,r24
+ 320               	.LM47:
+ 321 01b6 8EE2      		ldi r24,lo8(46)
+ 322 01b8 90E0      		ldi r25,hi8(46)
+ 323 01ba 9093 0000 		sts (select_pins+6)+1,r25
+ 324 01be 8093 0000 		sts select_pins+6,r24
+ 325               	.LM48:
+ 326 01c2 8FEF      		ldi r24,lo8(-1)
+ 327 01c4 9FEF      		ldi r25,hi8(-1)
+ 328 01c6 0E94 0000 		call bom_set_leds
+ 329               	.LM49:
+ 330 01ca 1092 0000 		sts (analog_pin)+1,__zero_reg__
+ 331 01ce 1092 0000 		sts analog_pin,__zero_reg__
+ 332               	.L41:
+ 333 01d2 0895      		ret
+ 334               	/* epilogue: frame size=0 */
+ 335               	/* epilogue: noreturn */
+ 336               	/* epilogue end (size=0) */
+ 337               	/* function bom_init size 78 (78) */
+ 338               	.LFE3:
+ 340               	.global	bom_get
+ 342               	bom_get:
+ 343               	.LFB5:
+ 344               	.LM50:
+ 345               	/* prologue: frame size=0 */
+ 346               	/* prologue end (size=0) */
+ 347               	.LVL9:
+ 348               	.LM51:
+ 349 01d4 0E94 0000 		call bom_select
+ 350               	.LVL10:
+ 351               	.LM52:
+ 352 01d8 8091 0000 		lds r24,analog_pin
+ 353 01dc 9091 0000 		lds r25,(analog_pin)+1
+ 354 01e0 0E94 0000 		call analog_get8
+ 355               	/* epilogue: frame size=0 */
+ 356 01e4 0895      		ret
+ 357               	/* epilogue end (size=1) */
+ 358               	/* function bom_get size 9 (8) */
+ 359               	.LFE5:
+ 361               	.global	bom_get_max
+ 363               	bom_get_max:
+ 364               	.LFB6:
+ 365               	.LM53:
+ 366               	/* prologue: frame size=0 */
+ 367 01e6 EF92      		push r14
+ 368 01e8 FF92      		push r15
+ 369 01ea 0F93      		push r16
+ 370 01ec 1F93      		push r17
+ 371 01ee CF93      		push r28
+ 372 01f0 DF93      		push r29
+ 373               	/* prologue end (size=6) */
+ 374 01f2 C0E0      		ldi r28,lo8(0)
+ 375 01f4 D0E0      		ldi r29,hi8(0)
+ 376               	.LVL11:
+ 377 01f6 0FEF      		ldi r16,lo8(255)
+ 378 01f8 10E0      		ldi r17,hi8(255)
+ 379               	.LVL12:
+ 380 01fa 2FEF      		ldi r18,lo8(-1)
+ 381 01fc E22E      		mov r14,r18
+ 382 01fe F22E      		mov r15,r18
+ 383               	.LVL13:
+ 384               	.LVL14:
+ 385               	.L45:
+ 386               	.LM54:
+ 387 0200 CE01      		movw r24,r28
+ 388               	.LVL15:
+ 389 0202 0E94 0000 		call bom_get
+ 390               	.LVL16:
+ 391               	.LM55:
+ 392 0206 8017      		cp r24,r16
+ 393 0208 9107      		cpc r25,r17
+ 394 020a 04F4      		brge .L46
+ 395 020c 8C01      		movw r16,r24
+ 396 020e 7E01      		movw r14,r28
+ 397               	.L46:
+ 398               	.LM56:
+ 399 0210 2196      		adiw r28,1
+ 400 0212 C031      		cpi r28,16
+ 401 0214 D105      		cpc r29,__zero_reg__
+ 402 0216 01F4      		brne .L45
+ 403               	.LM57:
+ 404 0218 0639      		cpi r16,150
+ 405 021a 1105      		cpc r17,__zero_reg__
+ 406 021c 04F0      		brlt .L49
+ 407 021e 9FEF      		ldi r25,lo8(-1)
+ 408 0220 E92E      		mov r14,r25
+ 409 0222 F92E      		mov r15,r25
+ 410               	.L49:
+ 411               	.LM58:
+ 412 0224 C701      		movw r24,r14
+ 413               	.LVL17:
+ 414               	/* epilogue: frame size=0 */
+ 415 0226 DF91      		pop r29
+ 416 0228 CF91      		pop r28
+ 417 022a 1F91      		pop r17
+ 418 022c 0F91      		pop r16
+ 419 022e FF90      		pop r15
+ 420 0230 EF90      		pop r14
+ 421 0232 0895      		ret
+ 422               	/* epilogue end (size=7) */
+ 423               	/* function bom_get_max size 39 (26) */
+ 424               	.LFE6:
+ 426               	.global	bom_get_max10
+ 428               	bom_get_max10:
+ 429               	.LFB10:
+ 430               	.LM59:
+ 431               	/* prologue: frame size=36 */
+ 432 0234 2F92      		push r2
+ 433 0236 3F92      		push r3
+ 434 0238 4F92      		push r4
+ 435 023a 5F92      		push r5
+ 436 023c 6F92      		push r6
+ 437 023e 7F92      		push r7
+ 438 0240 8F92      		push r8
+ 439 0242 9F92      		push r9
+ 440 0244 AF92      		push r10
+ 441 0246 BF92      		push r11
+ 442 0248 CF92      		push r12
+ 443 024a DF92      		push r13
+ 444 024c EF92      		push r14
+ 445 024e FF92      		push r15
+ 446 0250 0F93      		push r16
+ 447 0252 1F93      		push r17
+ 448 0254 CF93      		push r28
+ 449 0256 DF93      		push r29
+ 450 0258 CDB7      		in r28,__SP_L__
+ 451 025a DEB7      		in r29,__SP_H__
+ 452 025c A497      		sbiw r28,36
+ 453 025e 0FB6      		in __tmp_reg__,__SREG__
+ 454 0260 F894      		cli
+ 455 0262 DEBF      		out __SP_H__,r29
+ 456 0264 0FBE      		out __SREG__,__tmp_reg__
+ 457 0266 CDBF      		out __SP_L__,r28
+ 458               	/* prologue end (size=26) */
+ 459               	.LVL18:
+ 460 0268 3C01      		movw r6,r24
+ 461               	.LM60:
+ 462 026a 0E94 0000 		call bom_get_max
+ 463               	.LVL19:
+ 464 026e 2C01      		movw r4,r24
+ 465               	.LVL20:
+ 466               	.LM61:
+ 467 0270 97FF      		sbrs r25,7
+ 468 0272 00C0      		rjmp .L55
+ 469               	.LVL21:
+ 470               	.LM62:
+ 471 0274 6114      		cp r6,__zero_reg__
+ 472 0276 7104      		cpc r7,__zero_reg__
+ 473 0278 01F4      		brne .L57
+ 474 027a 8FEF      		ldi r24,lo8(-1)
+ 475 027c 9FEF      		ldi r25,hi8(-1)
+ 476               	.LVL22:
+ 477 027e 00C0      		rjmp .L59
+ 478               	.LVL23:
+ 479               	.L57:
+ 480               	.LM63:
+ 481 0280 8FEF      		ldi r24,lo8(-1)
+ 482 0282 9FEF      		ldi r25,hi8(-1)
+ 483               	.LVL24:
+ 484 0284 F301      		movw r30,r6
+ 485 0286 9183      		std Z+1,r25
+ 486 0288 8083      		st Z,r24
+ 487 028a 00C0      		rjmp .L59
+ 488               	.LVL25:
+ 489               	.L55:
+ 490 028c E8E1      		ldi r30,lo8(24)
+ 491 028e 2E2E      		mov r2,r30
+ 492 0290 312C      		mov r3,__zero_reg__
+ 493 0292 281A      		sub r2,r24
+ 494 0294 390A      		sbc r3,r25
+ 495 0296 1A8A      		std Y+18,__zero_reg__
+ 496 0298 198A      		std Y+17,__zero_reg__
+ 497               	.LVL26:
+ 498 029a 1982      		std Y+1,__zero_reg__
+ 499               	.LVL27:
+ 500 029c 1A82      		std Y+2,__zero_reg__
+ 501               	.LVL28:
+ 502 029e 1B82      		std Y+3,__zero_reg__
+ 503               	.LVL29:
+ 504 02a0 1C82      		std Y+4,__zero_reg__
+ 505               	.LVL30:
+ 506 02a2 1D82      		std Y+5,__zero_reg__
+ 507               	.LVL31:
+ 508 02a4 1E82      		std Y+6,__zero_reg__
+ 509               	.LVL32:
+ 510 02a6 1F82      		std Y+7,__zero_reg__
+ 511               	.LVL33:
+ 512 02a8 1886      		std Y+8,__zero_reg__
+ 513               	.LVL34:
+ 514 02aa 1986      		std Y+9,__zero_reg__
+ 515               	.LVL35:
+ 516 02ac 1A86      		std Y+10,__zero_reg__
+ 517               	.LVL36:
+ 518 02ae 1B86      		std Y+11,__zero_reg__
+ 519               	.LVL37:
+ 520 02b0 1C86      		std Y+12,__zero_reg__
+ 521               	.LVL38:
+ 522 02b2 1D86      		std Y+13,__zero_reg__
+ 523               	.LVL39:
+ 524 02b4 1E86      		std Y+14,__zero_reg__
+ 525               	.LVL40:
+ 526 02b6 1F86      		std Y+15,__zero_reg__
+ 527               	.LVL41:
+ 528 02b8 188A      		std Y+16,__zero_reg__
+ 529               	.LVL42:
+ 530               	.LVL43:
+ 531               	.L60:
+ 532               	.LBB2:
+ 533               	.LM64:
+ 534 02ba 8989      		ldd r24,Y+17
+ 535 02bc 9A89      		ldd r25,Y+18
+ 536 02be 0E94 0000 		call bom_get
+ 537 02c2 2FEF      		ldi r18,lo8(255)
+ 538 02c4 30E0      		ldi r19,hi8(255)
+ 539 02c6 281B      		sub r18,r24
+ 540 02c8 390B      		sbc r19,r25
+ 541 02ca 3CA3      		std Y+36,r19
+ 542 02cc 2BA3      		std Y+35,r18
+ 543               	.LM65:
+ 544 02ce C101      		movw r24,r2
+ 545 02d0 60E1      		ldi r22,lo8(16)
+ 546 02d2 70E0      		ldi r23,hi8(16)
+ 547 02d4 0E94 0000 		call __divmodhi4
+ 548 02d8 840D      		add r24,r4
+ 549 02da 951D      		adc r25,r5
+ 550 02dc 0897      		sbiw r24,8
+ 551 02de A901      		movw r20,r18
+ 552 02e0 849F      		mul r24,r20
+ 553 02e2 9001      		movw r18,r0
+ 554 02e4 859F      		mul r24,r21
+ 555 02e6 300D      		add r19,r0
+ 556 02e8 949F      		mul r25,r20
+ 557 02ea 300D      		add r19,r0
+ 558 02ec 1124      		clr r1
+ 559 02ee C901      		movw r24,r18
+ 560 02f0 990F      		lsl r25
+ 561 02f2 880B      		sbc r24,r24
+ 562 02f4 982F      		mov r25,r24
+ 563 02f6 4901      		movw r8,r18
+ 564               	.LVL44:
+ 565 02f8 A82E      		mov r10,r24
+ 566               	.LVL45:
+ 567 02fa B82E      		mov r11,r24
+ 568               	.LVL46:
+ 569 02fc C82E      		mov r12,r24
+ 570               	.LVL47:
+ 571 02fe D82E      		mov r13,r24
+ 572               	.LVL48:
+ 573 0300 E82E      		mov r14,r24
+ 574               	.LVL49:
+ 575 0302 F82E      		mov r15,r24
+ 576               	.LVL50:
+ 577 0304 0981      		ldd r16,Y+1
+ 578 0306 020F      		add r16,r18
+ 579 0308 81E0      		ldi r24,lo8(1)
+ 580 030a 9981      		ldd r25,Y+1
+ 581 030c 0917      		cp r16,r25
+ 582 030e 00F0      		brlo .L61
+ 583 0310 80E0      		ldi r24,lo8(0)
+ 584               	.L61:
+ 585 0312 1A81      		ldd r17,Y+2
+ 586               	.LVL51:
+ 587 0314 190D      		add r17,r9
+ 588 0316 A1E0      		ldi r26,lo8(1)
+ 589 0318 EA81      		ldd r30,Y+2
+ 590 031a 1E17      		cp r17,r30
+ 591 031c 00F0      		brlo .L62
+ 592 031e A0E0      		ldi r26,lo8(0)
+ 593               	.L62:
+ 594 0320 810F      		add r24,r17
+ 595 0322 91E0      		ldi r25,lo8(1)
+ 596 0324 8117      		cp r24,r17
+ 597 0326 00F0      		brlo .L63
+ 598 0328 90E0      		ldi r25,lo8(0)
+ 599               	.L63:
+ 600 032a A92B      		or r26,r25
+ 601 032c 182F      		mov r17,r24
+ 602 032e 2B81      		ldd r18,Y+3
+ 603 0330 2A0D      		add r18,r10
+ 604 0332 B1E0      		ldi r27,lo8(1)
+ 605 0334 FB81      		ldd r31,Y+3
+ 606 0336 2F17      		cp r18,r31
+ 607 0338 00F0      		brlo .L64
+ 608 033a B0E0      		ldi r27,lo8(0)
+ 609               	.L64:
+ 610 033c 8A2F      		mov r24,r26
+ 611 033e 820F      		add r24,r18
+ 612 0340 91E0      		ldi r25,lo8(1)
+ 613 0342 8217      		cp r24,r18
+ 614 0344 00F0      		brlo .L65
+ 615 0346 90E0      		ldi r25,lo8(0)
+ 616               	.L65:
+ 617 0348 B92B      		or r27,r25
+ 618 034a 282F      		mov r18,r24
+ 619 034c 3C81      		ldd r19,Y+4
+ 620 034e 3B0D      		add r19,r11
+ 621 0350 A1E0      		ldi r26,lo8(1)
+ 622 0352 8C81      		ldd r24,Y+4
+ 623 0354 3817      		cp r19,r24
+ 624 0356 00F0      		brlo .L66
+ 625 0358 A0E0      		ldi r26,lo8(0)
+ 626               	.L66:
+ 627 035a 8B2F      		mov r24,r27
+ 628 035c 830F      		add r24,r19
+ 629 035e 91E0      		ldi r25,lo8(1)
+ 630 0360 8317      		cp r24,r19
+ 631 0362 00F0      		brlo .L67
+ 632 0364 90E0      		ldi r25,lo8(0)
+ 633               	.L67:
+ 634 0366 A92B      		or r26,r25
+ 635 0368 382F      		mov r19,r24
+ 636 036a 4D81      		ldd r20,Y+5
+ 637 036c 4C0D      		add r20,r12
+ 638 036e B1E0      		ldi r27,lo8(1)
+ 639 0370 9D81      		ldd r25,Y+5
+ 640 0372 4917      		cp r20,r25
+ 641 0374 00F0      		brlo .L68
+ 642 0376 B0E0      		ldi r27,lo8(0)
+ 643               	.L68:
+ 644 0378 8A2F      		mov r24,r26
+ 645 037a 840F      		add r24,r20
+ 646 037c 91E0      		ldi r25,lo8(1)
+ 647 037e 8417      		cp r24,r20
+ 648 0380 00F0      		brlo .L69
+ 649 0382 90E0      		ldi r25,lo8(0)
+ 650               	.L69:
+ 651 0384 B92B      		or r27,r25
+ 652 0386 482F      		mov r20,r24
+ 653 0388 5E81      		ldd r21,Y+6
+ 654 038a 5D0D      		add r21,r13
+ 655 038c A1E0      		ldi r26,lo8(1)
+ 656 038e EE81      		ldd r30,Y+6
+ 657 0390 5E17      		cp r21,r30
+ 658 0392 00F0      		brlo .L70
+ 659 0394 A0E0      		ldi r26,lo8(0)
+ 660               	.L70:
+ 661 0396 8B2F      		mov r24,r27
+ 662 0398 850F      		add r24,r21
+ 663 039a 91E0      		ldi r25,lo8(1)
+ 664 039c 8517      		cp r24,r21
+ 665 039e 00F0      		brlo .L71
+ 666 03a0 90E0      		ldi r25,lo8(0)
+ 667               	.L71:
+ 668 03a2 A92B      		or r26,r25
+ 669 03a4 582F      		mov r21,r24
+ 670 03a6 6F81      		ldd r22,Y+7
+ 671 03a8 6E0D      		add r22,r14
+ 672 03aa B1E0      		ldi r27,lo8(1)
+ 673 03ac FF81      		ldd r31,Y+7
+ 674 03ae 6F17      		cp r22,r31
+ 675 03b0 00F0      		brlo .L72
+ 676 03b2 B0E0      		ldi r27,lo8(0)
+ 677               	.L72:
+ 678 03b4 9A2F      		mov r25,r26
+ 679 03b6 960F      		add r25,r22
+ 680 03b8 81E0      		ldi r24,lo8(1)
+ 681 03ba 9617      		cp r25,r22
+ 682 03bc 00F0      		brlo .L73
+ 683 03be 80E0      		ldi r24,lo8(0)
+ 684               	.L73:
+ 685 03c0 8B2B      		or r24,r27
+ 686 03c2 7885      		ldd r23,Y+8
+ 687 03c4 7F0D      		add r23,r15
+ 688 03c6 870F      		add r24,r23
+ 689 03c8 0983      		std Y+1,r16
+ 690 03ca 1A83      		std Y+2,r17
+ 691 03cc 2B83      		std Y+3,r18
+ 692 03ce 3C83      		std Y+4,r19
+ 693 03d0 4D83      		std Y+5,r20
+ 694 03d2 5E83      		std Y+6,r21
+ 695 03d4 9F83      		std Y+7,r25
+ 696 03d6 8887      		std Y+8,r24
+ 697               	.LM66:
+ 698 03d8 8BA1      		ldd r24,Y+35
+ 699 03da 9CA1      		ldd r25,Y+36
+ 700 03dc 990F      		lsl r25
+ 701 03de 880B      		sbc r24,r24
+ 702 03e0 982F      		mov r25,r24
+ 703 03e2 8BA0      		ldd r8,Y+35
+ 704 03e4 9CA0      		ldd r9,Y+36
+ 705 03e6 A82E      		mov r10,r24
+ 706               	.LVL52:
+ 707 03e8 B82E      		mov r11,r24
+ 708               	.LVL53:
+ 709 03ea C82E      		mov r12,r24
+ 710               	.LVL54:
+ 711 03ec D82E      		mov r13,r24
+ 712               	.LVL55:
+ 713 03ee E82E      		mov r14,r24
+ 714               	.LVL56:
+ 715 03f0 F82E      		mov r15,r24
+ 716               	.LVL57:
+ 717 03f2 0985      		ldd r16,Y+9
+ 718 03f4 080D      		add r16,r8
+ 719 03f6 81E0      		ldi r24,lo8(1)
+ 720 03f8 9985      		ldd r25,Y+9
+ 721 03fa 0917      		cp r16,r25
+ 722 03fc 00F0      		brlo .L74
+ 723               	.LVL58:
+ 724 03fe 80E0      		ldi r24,lo8(0)
+ 725               	.L74:
+ 726 0400 1A85      		ldd r17,Y+10
+ 727               	.LVL59:
+ 728 0402 190D      		add r17,r9
+ 729 0404 A1E0      		ldi r26,lo8(1)
+ 730 0406 EA85      		ldd r30,Y+10
+ 731 0408 1E17      		cp r17,r30
+ 732 040a 00F0      		brlo .L75
+ 733 040c A0E0      		ldi r26,lo8(0)
+ 734               	.L75:
+ 735 040e 810F      		add r24,r17
+ 736 0410 91E0      		ldi r25,lo8(1)
+ 737 0412 8117      		cp r24,r17
+ 738 0414 00F0      		brlo .L76
+ 739 0416 90E0      		ldi r25,lo8(0)
+ 740               	.L76:
+ 741 0418 A92B      		or r26,r25
+ 742 041a 182F      		mov r17,r24
+ 743 041c 2B85      		ldd r18,Y+11
+ 744 041e 2A0D      		add r18,r10
+ 745 0420 B1E0      		ldi r27,lo8(1)
+ 746 0422 FB85      		ldd r31,Y+11
+ 747 0424 2F17      		cp r18,r31
+ 748 0426 00F0      		brlo .L77
+ 749 0428 B0E0      		ldi r27,lo8(0)
+ 750               	.L77:
+ 751 042a 8A2F      		mov r24,r26
+ 752 042c 820F      		add r24,r18
+ 753 042e 91E0      		ldi r25,lo8(1)
+ 754 0430 8217      		cp r24,r18
+ 755 0432 00F0      		brlo .L78
+ 756 0434 90E0      		ldi r25,lo8(0)
+ 757               	.L78:
+ 758 0436 B92B      		or r27,r25
+ 759 0438 282F      		mov r18,r24
+ 760 043a 3C85      		ldd r19,Y+12
+ 761 043c 3B0D      		add r19,r11
+ 762 043e A1E0      		ldi r26,lo8(1)
+ 763 0440 8C85      		ldd r24,Y+12
+ 764 0442 3817      		cp r19,r24
+ 765 0444 00F0      		brlo .L79
+ 766 0446 A0E0      		ldi r26,lo8(0)
+ 767               	.L79:
+ 768 0448 8B2F      		mov r24,r27
+ 769 044a 830F      		add r24,r19
+ 770 044c 91E0      		ldi r25,lo8(1)
+ 771 044e 8317      		cp r24,r19
+ 772 0450 00F0      		brlo .L80
+ 773 0452 90E0      		ldi r25,lo8(0)
+ 774               	.L80:
+ 775 0454 A92B      		or r26,r25
+ 776 0456 382F      		mov r19,r24
+ 777 0458 4D85      		ldd r20,Y+13
+ 778 045a 4C0D      		add r20,r12
+ 779 045c B1E0      		ldi r27,lo8(1)
+ 780 045e 9D85      		ldd r25,Y+13
+ 781 0460 4917      		cp r20,r25
+ 782 0462 00F0      		brlo .L81
+ 783 0464 B0E0      		ldi r27,lo8(0)
+ 784               	.L81:
+ 785 0466 8A2F      		mov r24,r26
+ 786 0468 840F      		add r24,r20
+ 787 046a 91E0      		ldi r25,lo8(1)
+ 788 046c 8417      		cp r24,r20
+ 789 046e 00F0      		brlo .L82
+ 790 0470 90E0      		ldi r25,lo8(0)
+ 791               	.L82:
+ 792 0472 B92B      		or r27,r25
+ 793 0474 482F      		mov r20,r24
+ 794 0476 5E85      		ldd r21,Y+14
+ 795 0478 5D0D      		add r21,r13
+ 796 047a A1E0      		ldi r26,lo8(1)
+ 797 047c EE85      		ldd r30,Y+14
+ 798 047e 5E17      		cp r21,r30
+ 799 0480 00F0      		brlo .L83
+ 800 0482 A0E0      		ldi r26,lo8(0)
+ 801               	.L83:
+ 802 0484 8B2F      		mov r24,r27
+ 803 0486 850F      		add r24,r21
+ 804 0488 91E0      		ldi r25,lo8(1)
+ 805 048a 8517      		cp r24,r21
+ 806 048c 00F0      		brlo .L84
+ 807 048e 90E0      		ldi r25,lo8(0)
+ 808               	.L84:
+ 809 0490 A92B      		or r26,r25
+ 810 0492 582F      		mov r21,r24
+ 811 0494 6F85      		ldd r22,Y+15
+ 812 0496 6E0D      		add r22,r14
+ 813 0498 B1E0      		ldi r27,lo8(1)
+ 814 049a FF85      		ldd r31,Y+15
+ 815 049c 6F17      		cp r22,r31
+ 816 049e 00F0      		brlo .L85
+ 817 04a0 B0E0      		ldi r27,lo8(0)
+ 818               	.L85:
+ 819 04a2 8A2F      		mov r24,r26
+ 820 04a4 860F      		add r24,r22
+ 821 04a6 91E0      		ldi r25,lo8(1)
+ 822 04a8 8617      		cp r24,r22
+ 823 04aa 00F0      		brlo .L86
+ 824 04ac 90E0      		ldi r25,lo8(0)
+ 825               	.L86:
+ 826 04ae 9B2B      		or r25,r27
+ 827 04b0 7889      		ldd r23,Y+16
+ 828 04b2 7F0D      		add r23,r15
+ 829 04b4 970F      		add r25,r23
+ 830 04b6 0987      		std Y+9,r16
+ 831 04b8 1A87      		std Y+10,r17
+ 832 04ba 2B87      		std Y+11,r18
+ 833 04bc 3C87      		std Y+12,r19
+ 834 04be 4D87      		std Y+13,r20
+ 835 04c0 5E87      		std Y+14,r21
+ 836 04c2 8F87      		std Y+15,r24
+ 837 04c4 988B      		std Y+16,r25
+ 838               	.LBE2:
+ 839               	.LM67:
+ 840 04c6 2989      		ldd r18,Y+17
+ 841 04c8 3A89      		ldd r19,Y+18
+ 842 04ca 2F5F      		subi r18,lo8(-(1))
+ 843 04cc 3F4F      		sbci r19,hi8(-(1))
+ 844 04ce 3A8B      		std Y+18,r19
+ 845 04d0 298B      		std Y+17,r18
+ 846 04d2 0894      		sec
+ 847 04d4 211C      		adc r2,__zero_reg__
+ 848 04d6 311C      		adc r3,__zero_reg__
+ 849 04d8 2031      		cpi r18,16
+ 850 04da 3105      		cpc r19,__zero_reg__
+ 851 04dc 01F0      		breq .+2
+ 852 04de 00C0      		rjmp .L60
+ 853               	.LM68:
+ 854 04e0 6114      		cp r6,__zero_reg__
+ 855 04e2 7104      		cpc r7,__zero_reg__
+ 856 04e4 01F0      		breq .L88
+ 857               	.LM69:
+ 858 04e6 50E3      		ldi r21,lo8(48)
+ 859 04e8 A52E      		mov r10,r21
+ 860               	.LVL60:
+ 861 04ea BB24      		clr r11
+ 862               	.LVL61:
+ 863 04ec CC24      		clr r12
+ 864               	.LVL62:
+ 865 04ee DD24      		clr r13
+ 866               	.LVL63:
+ 867 04f0 EE24      		clr r14
+ 868               	.LVL64:
+ 869 04f2 FF24      		clr r15
+ 870               	.LVL65:
+ 871 04f4 00E0      		ldi r16,lo8(0)
+ 872 04f6 10E0      		ldi r17,lo8(0)
+ 873 04f8 2985      		ldd r18,Y+9
+ 874 04fa 3A85      		ldd r19,Y+10
+ 875 04fc 4B85      		ldd r20,Y+11
+ 876 04fe 5C85      		ldd r21,Y+12
+ 877 0500 6D85      		ldd r22,Y+13
+ 878 0502 7E85      		ldd r23,Y+14
+ 879 0504 0E94 0000 		call __divdi3
+ 880 0508 A22E      		mov r10,r18
+ 881 050a B32E      		mov r11,r19
+ 882 050c 82E3      		ldi r24,lo8(50)
+ 883 050e 90E0      		ldi r25,hi8(50)
+ 884 0510 8A19      		sub r24,r10
+ 885 0512 9B09      		sbc r25,r11
+ 886 0514 F301      		movw r30,r6
+ 887 0516 9183      		std Z+1,r25
+ 888 0518 8083      		st Z,r24
+ 889               	.LVL66:
+ 890               	.L88:
+ 891               	.LM70:
+ 892 051a 8980      		ldd r8,Y+1
+ 893               	.LVL67:
+ 894 051c 9A80      		ldd r9,Y+2
+ 895               	.LVL68:
+ 896 051e AB80      		ldd r10,Y+3
+ 897               	.LVL69:
+ 898 0520 BC80      		ldd r11,Y+4
+ 899               	.LVL70:
+ 900 0522 CD80      		ldd r12,Y+5
+ 901               	.LVL71:
+ 902 0524 DE80      		ldd r13,Y+6
+ 903               	.LVL72:
+ 904 0526 EF80      		ldd r14,Y+7
+ 905               	.LVL73:
+ 906 0528 F884      		ldd r15,Y+8
+ 907               	.LVL74:
+ 908 052a 01E0      		ldi r16,lo8(1)
+ 909 052c 282D      		mov r18,r8
+ 910 052e 392D      		mov r19,r9
+ 911 0530 4A2D      		mov r20,r10
+ 912 0532 5B2D      		mov r21,r11
+ 913 0534 6C2D      		mov r22,r12
+ 914 0536 7D2D      		mov r23,r13
+ 915 0538 8E2D      		mov r24,r14
+ 916 053a 9F2D      		mov r25,r15
+ 917 053c 0E94 0000 		call __ashldi3
+ 918 0540 2B8B      		std Y+19,r18
+ 919 0542 3C8B      		std Y+20,r19
+ 920 0544 4D8B      		std Y+21,r20
+ 921 0546 5E8B      		std Y+22,r21
+ 922 0548 6F8B      		std Y+23,r22
+ 923 054a 788F      		std Y+24,r23
+ 924 054c 898F      		std Y+25,r24
+ 925 054e 9A8F      		std Y+26,r25
+ 926 0550 02E0      		ldi r16,lo8(2)
+ 927 0552 0E94 0000 		call __ashldi3
+ 928 0556 B32E      		mov r11,r19
+ 929 0558 C42E      		mov r12,r20
+ 930 055a D52E      		mov r13,r21
+ 931 055c E62E      		mov r14,r22
+ 932 055e F72E      		mov r15,r23
+ 933 0560 082F      		mov r16,r24
+ 934 0562 192F      		mov r17,r25
+ 935 0564 2B88      		ldd r2,Y+19
+ 936 0566 220E      		add r2,r18
+ 937 0568 81E0      		ldi r24,lo8(1)
+ 938 056a FB89      		ldd r31,Y+19
+ 939 056c 2F16      		cp r2,r31
+ 940 056e 00F0      		brlo .L90
+ 941               	.LVL75:
+ 942 0570 80E0      		ldi r24,lo8(0)
+ 943               	.L90:
+ 944 0572 3C88      		ldd r3,Y+20
+ 945 0574 3B0C      		add r3,r11
+ 946 0576 21E0      		ldi r18,lo8(1)
+ 947 0578 3C89      		ldd r19,Y+20
+ 948 057a 3316      		cp r3,r19
+ 949 057c 00F0      		brlo .L91
+ 950 057e 20E0      		ldi r18,lo8(0)
+ 951               	.L91:
+ 952 0580 830D      		add r24,r3
+ 953 0582 91E0      		ldi r25,lo8(1)
+ 954 0584 8315      		cp r24,r3
+ 955 0586 00F0      		brlo .L92
+ 956 0588 90E0      		ldi r25,lo8(0)
+ 957               	.L92:
+ 958 058a 292B      		or r18,r25
+ 959 058c 382E      		mov r3,r24
+ 960 058e 4D88      		ldd r4,Y+21
+ 961               	.LVL76:
+ 962 0590 4C0C      		add r4,r12
+ 963 0592 31E0      		ldi r19,lo8(1)
+ 964 0594 4D89      		ldd r20,Y+21
+ 965 0596 4416      		cp r4,r20
+ 966 0598 00F0      		brlo .L93
+ 967 059a 30E0      		ldi r19,lo8(0)
+ 968               	.L93:
+ 969 059c 822F      		mov r24,r18
+ 970 059e 840D      		add r24,r4
+ 971 05a0 91E0      		ldi r25,lo8(1)
+ 972 05a2 8415      		cp r24,r4
+ 973 05a4 00F0      		brlo .L94
+ 974 05a6 90E0      		ldi r25,lo8(0)
+ 975               	.L94:
+ 976 05a8 392B      		or r19,r25
+ 977 05aa 482E      		mov r4,r24
+ 978 05ac 5E88      		ldd r5,Y+22
+ 979 05ae 5D0C      		add r5,r13
+ 980 05b0 21E0      		ldi r18,lo8(1)
+ 981 05b2 5E89      		ldd r21,Y+22
+ 982 05b4 5516      		cp r5,r21
+ 983 05b6 00F0      		brlo .L95
+ 984 05b8 20E0      		ldi r18,lo8(0)
+ 985               	.L95:
+ 986 05ba 832F      		mov r24,r19
+ 987 05bc 850D      		add r24,r5
+ 988 05be 91E0      		ldi r25,lo8(1)
+ 989 05c0 8515      		cp r24,r5
+ 990 05c2 00F0      		brlo .L96
+ 991 05c4 90E0      		ldi r25,lo8(0)
+ 992               	.L96:
+ 993 05c6 292B      		or r18,r25
+ 994 05c8 582E      		mov r5,r24
+ 995 05ca 6F88      		ldd r6,Y+23
+ 996               	.LVL77:
+ 997 05cc 6E0C      		add r6,r14
+ 998 05ce 31E0      		ldi r19,lo8(1)
+ 999 05d0 8F89      		ldd r24,Y+23
+ 1000 05d2 6816      		cp r6,r24
+ 1001 05d4 00F0      		brlo .L97
+ 1002 05d6 30E0      		ldi r19,lo8(0)
+ 1003               	.L97:
+ 1004 05d8 822F      		mov r24,r18
+ 1005 05da 860D      		add r24,r6
+ 1006 05dc 91E0      		ldi r25,lo8(1)
+ 1007 05de 8615      		cp r24,r6
+ 1008 05e0 00F0      		brlo .L98
+ 1009 05e2 90E0      		ldi r25,lo8(0)
+ 1010               	.L98:
+ 1011 05e4 392B      		or r19,r25
+ 1012 05e6 682E      		mov r6,r24
+ 1013 05e8 788C      		ldd r7,Y+24
+ 1014 05ea 7F0C      		add r7,r15
+ 1015 05ec 21E0      		ldi r18,lo8(1)
+ 1016 05ee 988D      		ldd r25,Y+24
+ 1017 05f0 7916      		cp r7,r25
+ 1018 05f2 00F0      		brlo .L99
+ 1019 05f4 20E0      		ldi r18,lo8(0)
+ 1020               	.L99:
+ 1021 05f6 832F      		mov r24,r19
+ 1022 05f8 870D      		add r24,r7
+ 1023 05fa 91E0      		ldi r25,lo8(1)
+ 1024 05fc 8715      		cp r24,r7
+ 1025 05fe 00F0      		brlo .L100
+ 1026 0600 90E0      		ldi r25,lo8(0)
+ 1027               	.L100:
+ 1028 0602 292B      		or r18,r25
+ 1029 0604 782E      		mov r7,r24
+ 1030 0606 898C      		ldd r8,Y+25
+ 1031               	.LVL78:
+ 1032 0608 800E      		add r8,r16
+ 1033 060a 31E0      		ldi r19,lo8(1)
+ 1034 060c E98D      		ldd r30,Y+25
+ 1035 060e 8E16      		cp r8,r30
+ 1036 0610 00F0      		brlo .L101
+ 1037 0612 30E0      		ldi r19,lo8(0)
+ 1038               	.L101:
+ 1039 0614 822F      		mov r24,r18
+ 1040 0616 880D      		add r24,r8
+ 1041 0618 91E0      		ldi r25,lo8(1)
+ 1042 061a 8815      		cp r24,r8
+ 1043 061c 00F0      		brlo .L102
+ 1044 061e 90E0      		ldi r25,lo8(0)
+ 1045               	.L102:
+ 1046 0620 932B      		or r25,r19
+ 1047 0622 9A8C      		ldd r9,Y+26
+ 1048               	.LVL79:
+ 1049 0624 910E      		add r9,r17
+ 1050 0626 990D      		add r25,r9
+ 1051 0628 A984      		ldd r10,Y+9
+ 1052               	.LVL80:
+ 1053 062a BA84      		ldd r11,Y+10
+ 1054 062c CB84      		ldd r12,Y+11
+ 1055 062e DC84      		ldd r13,Y+12
+ 1056 0630 ED84      		ldd r14,Y+13
+ 1057 0632 FE84      		ldd r15,Y+14
+ 1058 0634 0F85      		ldd r16,Y+15
+ 1059 0636 1889      		ldd r17,Y+16
+ 1060 0638 222D      		mov r18,r2
+ 1061 063a 332D      		mov r19,r3
+ 1062 063c 442D      		mov r20,r4
+ 1063 063e 552D      		mov r21,r5
+ 1064 0640 662D      		mov r22,r6
+ 1065 0642 772D      		mov r23,r7
+ 1066 0644 0E94 0000 		call __divdi3
+ 1067 0648 A22E      		mov r10,r18
+ 1068 064a B32E      		mov r11,r19
+ 1069 064c C42E      		mov r12,r20
+ 1070 064e D52E      		mov r13,r21
+ 1071 0650 E62E      		mov r14,r22
+ 1072 0652 F72E      		mov r15,r23
+ 1073 0654 082F      		mov r16,r24
+ 1074 0656 192F      		mov r17,r25
+ 1075 0658 F0EA      		ldi r31,lo8(-96)
+ 1076 065a FB8F      		std Y+27,r31
+ 1077 065c 1C8E      		std Y+28,__zero_reg__
+ 1078 065e 1D8E      		std Y+29,__zero_reg__
+ 1079 0660 1E8E      		std Y+30,__zero_reg__
+ 1080 0662 1F8E      		std Y+31,__zero_reg__
+ 1081 0664 18A2      		std Y+32,__zero_reg__
+ 1082 0666 19A2      		std Y+33,__zero_reg__
+ 1083 0668 1AA2      		std Y+34,__zero_reg__
+ 1084 066a 40EA      		ldi r20,lo8(-96)
+ 1085 066c 242E      		mov r2,r20
+ 1086 066e 2A0C      		add r2,r10
+ 1087 0670 81E0      		ldi r24,lo8(1)
+ 1088 0672 2A14      		cp r2,r10
+ 1089 0674 00F0      		brlo .L103
+ 1090 0676 80E0      		ldi r24,lo8(0)
+ 1091               	.L103:
+ 1092 0678 3C8C      		ldd r3,Y+28
+ 1093 067a 3B0C      		add r3,r11
+ 1094 067c 21E0      		ldi r18,lo8(1)
+ 1095 067e 3B14      		cp r3,r11
+ 1096 0680 00F0      		brlo .L104
+ 1097 0682 20E0      		ldi r18,lo8(0)
+ 1098               	.L104:
+ 1099 0684 830D      		add r24,r3
+ 1100 0686 91E0      		ldi r25,lo8(1)
+ 1101 0688 8315      		cp r24,r3
+ 1102 068a 00F0      		brlo .L105
+ 1103 068c 90E0      		ldi r25,lo8(0)
+ 1104               	.L105:
+ 1105 068e 292B      		or r18,r25
+ 1106 0690 382E      		mov r3,r24
+ 1107 0692 4D8C      		ldd r4,Y+29
+ 1108 0694 4C0C      		add r4,r12
+ 1109 0696 31E0      		ldi r19,lo8(1)
+ 1110 0698 4C14      		cp r4,r12
+ 1111 069a 00F0      		brlo .L106
+ 1112 069c 30E0      		ldi r19,lo8(0)
+ 1113               	.L106:
+ 1114 069e 822F      		mov r24,r18
+ 1115 06a0 840D      		add r24,r4
+ 1116 06a2 91E0      		ldi r25,lo8(1)
+ 1117 06a4 8415      		cp r24,r4
+ 1118 06a6 00F0      		brlo .L107
+ 1119 06a8 90E0      		ldi r25,lo8(0)
+ 1120               	.L107:
+ 1121 06aa 392B      		or r19,r25
+ 1122 06ac 482E      		mov r4,r24
+ 1123 06ae 5E8C      		ldd r5,Y+30
+ 1124 06b0 5D0C      		add r5,r13
+ 1125 06b2 21E0      		ldi r18,lo8(1)
+ 1126 06b4 5D14      		cp r5,r13
+ 1127 06b6 00F0      		brlo .L108
+ 1128 06b8 20E0      		ldi r18,lo8(0)
+ 1129               	.L108:
+ 1130 06ba 832F      		mov r24,r19
+ 1131 06bc 850D      		add r24,r5
+ 1132 06be 91E0      		ldi r25,lo8(1)
+ 1133 06c0 8515      		cp r24,r5
+ 1134 06c2 00F0      		brlo .L109
+ 1135 06c4 90E0      		ldi r25,lo8(0)
+ 1136               	.L109:
+ 1137 06c6 292B      		or r18,r25
+ 1138 06c8 582E      		mov r5,r24
+ 1139 06ca 6F8C      		ldd r6,Y+31
+ 1140 06cc 6E0C      		add r6,r14
+ 1141 06ce 31E0      		ldi r19,lo8(1)
+ 1142 06d0 6E14      		cp r6,r14
+ 1143 06d2 00F0      		brlo .L110
+ 1144 06d4 30E0      		ldi r19,lo8(0)
+ 1145               	.L110:
+ 1146 06d6 822F      		mov r24,r18
+ 1147 06d8 860D      		add r24,r6
+ 1148 06da 91E0      		ldi r25,lo8(1)
+ 1149 06dc 8615      		cp r24,r6
+ 1150 06de 00F0      		brlo .L111
+ 1151 06e0 90E0      		ldi r25,lo8(0)
+ 1152               	.L111:
+ 1153 06e2 392B      		or r19,r25
+ 1154 06e4 682E      		mov r6,r24
+ 1155 06e6 78A0      		ldd r7,Y+32
+ 1156 06e8 7F0C      		add r7,r15
+ 1157 06ea 21E0      		ldi r18,lo8(1)
+ 1158 06ec 7F14      		cp r7,r15
+ 1159 06ee 00F0      		brlo .L112
+ 1160 06f0 20E0      		ldi r18,lo8(0)
+ 1161               	.L112:
+ 1162 06f2 832F      		mov r24,r19
+ 1163 06f4 870D      		add r24,r7
+ 1164 06f6 91E0      		ldi r25,lo8(1)
+ 1165 06f8 8715      		cp r24,r7
+ 1166 06fa 00F0      		brlo .L113
+ 1167 06fc 90E0      		ldi r25,lo8(0)
+ 1168               	.L113:
+ 1169 06fe 292B      		or r18,r25
+ 1170 0700 782E      		mov r7,r24
+ 1171 0702 89A0      		ldd r8,Y+33
+ 1172 0704 800E      		add r8,r16
+ 1173 0706 31E0      		ldi r19,lo8(1)
+ 1174 0708 8016      		cp r8,r16
+ 1175 070a 00F0      		brlo .L114
+ 1176 070c 30E0      		ldi r19,lo8(0)
+ 1177               	.L114:
+ 1178 070e 822F      		mov r24,r18
+ 1179 0710 880D      		add r24,r8
+ 1180 0712 91E0      		ldi r25,lo8(1)
+ 1181 0714 8815      		cp r24,r8
+ 1182 0716 00F0      		brlo .L115
+ 1183 0718 90E0      		ldi r25,lo8(0)
+ 1184               	.L115:
+ 1185 071a 932B      		or r25,r19
+ 1186 071c 9AA0      		ldd r9,Y+34
+ 1187 071e 910E      		add r9,r17
+ 1188 0720 990D      		add r25,r9
+ 1189 0722 30EA      		ldi r19,lo8(-96)
+ 1190 0724 A32E      		mov r10,r19
+ 1191 0726 BB24      		clr r11
+ 1192 0728 CC24      		clr r12
+ 1193 072a DD24      		clr r13
+ 1194 072c EE24      		clr r14
+ 1195 072e FF24      		clr r15
+ 1196 0730 00E0      		ldi r16,lo8(0)
+ 1197 0732 10E0      		ldi r17,lo8(0)
+ 1198 0734 222D      		mov r18,r2
+ 1199 0736 332D      		mov r19,r3
+ 1200 0738 442D      		mov r20,r4
+ 1201 073a 552D      		mov r21,r5
+ 1202 073c 662D      		mov r22,r6
+ 1203 073e 772D      		mov r23,r7
+ 1204 0740 0E94 0000 		call __moddi3
+ 1205 0744 A22E      		mov r10,r18
+ 1206 0746 B32E      		mov r11,r19
+ 1207 0748 C501      		movw r24,r10
+ 1208               	.LVL81:
+ 1209               	.L59:
+ 1210               	/* epilogue: frame size=36 */
+ 1211 074a A496      		adiw r28,36
+ 1212 074c 0FB6      		in __tmp_reg__,__SREG__
+ 1213 074e F894      		cli
+ 1214 0750 DEBF      		out __SP_H__,r29
+ 1215 0752 0FBE      		out __SREG__,__tmp_reg__
+ 1216 0754 CDBF      		out __SP_L__,r28
+ 1217 0756 DF91      		pop r29
+ 1218 0758 CF91      		pop r28
+ 1219 075a 1F91      		pop r17
+ 1220 075c 0F91      		pop r16
+ 1221 075e FF90      		pop r15
+ 1222 0760 EF90      		pop r14
+ 1223 0762 DF90      		pop r13
+ 1224 0764 CF90      		pop r12
+ 1225 0766 BF90      		pop r11
+ 1226 0768 AF90      		pop r10
+ 1227 076a 9F90      		pop r9
+ 1228 076c 8F90      		pop r8
+ 1229 076e 7F90      		pop r7
+ 1230 0770 6F90      		pop r6
+ 1231 0772 5F90      		pop r5
+ 1232 0774 4F90      		pop r4
+ 1233 0776 3F90      		pop r3
+ 1234 0778 2F90      		pop r2
+ 1235 077a 0895      		ret
+ 1236               	/* epilogue end (size=25) */
+ 1237               	/* function bom_get_max10 size 676 (625) */
+ 1238               	.LFE10:
+ 1240               	.global	bom_refresh
+ 1242               	bom_refresh:
+ 1243               	.LFB4:
+ 1244               	.LM71:
+ 1245               	/* prologue: frame size=0 */
+ 1246 077c CF92      		push r12
+ 1247 077e DF92      		push r13
+ 1248 0780 EF92      		push r14
+ 1249 0782 FF92      		push r15
+ 1250 0784 0F93      		push r16
+ 1251 0786 1F93      		push r17
+ 1252 0788 CF93      		push r28
+ 1253 078a DF93      		push r29
+ 1254               	/* prologue end (size=8) */
+ 1255               	.LVL82:
+ 1256 078c EC01      		movw r28,r24
+ 1257               	.LM72:
+ 1258 078e 0E94 0000 		call analog_loop_status
+ 1259               	.LVL83:
+ 1260 0792 0197      		sbiw r24,1
+ 1261 0794 01F0      		breq .L120
+ 1262               	.LM73:
+ 1263 0796 CC24      		clr r12
+ 1264 0798 DD24      		clr r13
+ 1265               	.LVL84:
+ 1266 079a 00C0      		rjmp .L122
+ 1267               	.LVL85:
+ 1268               	.L120:
+ 1269               	.LM74:
+ 1270 079c 0E94 0000 		call analog_stop_loop
+ 1271 07a0 B1E0      		ldi r27,lo8(1)
+ 1272 07a2 CB2E      		mov r12,r27
+ 1273 07a4 D12C      		mov r13,__zero_reg__
+ 1274               	.LVL86:
+ 1275               	.L122:
+ 1276 07a6 00E0      		ldi r16,lo8(0)
+ 1277 07a8 10E0      		ldi r17,hi8(0)
+ 1278               	.LVL87:
+ 1279 07aa A0E0      		ldi r26,lo8(bom_val)
+ 1280 07ac EA2E      		mov r14,r26
+ 1281 07ae A0E0      		ldi r26,hi8(bom_val)
+ 1282 07b0 FA2E      		mov r15,r26
+ 1283               	.L123:
+ 1284               	.LM75:
+ 1285 07b2 C0FF      		sbrs r28,0
+ 1286 07b4 00C0      		rjmp .L124
+ 1287               	.LM76:
+ 1288 07b6 802F      		mov r24,r16
+ 1289 07b8 0E94 0000 		call bom_select
+ 1290               	.LM77:
+ 1291 07bc 8091 0000 		lds r24,analog_pin
+ 1292 07c0 9091 0000 		lds r25,(analog_pin)+1
+ 1293 07c4 0E94 0000 		call analog_get8
+ 1294 07c8 F701      		movw r30,r14
+ 1295 07ca 9183      		std Z+1,r25
+ 1296 07cc 8083      		st Z,r24
+ 1297               	.L124:
+ 1298               	.LM78:
+ 1299 07ce 0F5F      		subi r16,lo8(-(1))
+ 1300 07d0 1F4F      		sbci r17,hi8(-(1))
+ 1301 07d2 82E0      		ldi r24,lo8(2)
+ 1302 07d4 90E0      		ldi r25,hi8(2)
+ 1303 07d6 E80E      		add r14,r24
+ 1304 07d8 F91E      		adc r15,r25
+ 1305 07da 0031      		cpi r16,16
+ 1306 07dc 1105      		cpc r17,__zero_reg__
+ 1307 07de 01F0      		breq .L126
+ 1308               	.LM79:
+ 1309 07e0 D595      		asr r29
+ 1310 07e2 C795      		ror r28
+ 1311 07e4 00C0      		rjmp .L123
+ 1312               	.L126:
+ 1313               	.LM80:
+ 1314 07e6 CD28      		or r12,r13
+ 1315 07e8 01F0      		breq .L130
+ 1316               	.LM81:
+ 1317 07ea 0E94 0000 		call analog_start_loop
+ 1318               	.L130:
+ 1319               	/* epilogue: frame size=0 */
+ 1320 07ee DF91      		pop r29
+ 1321 07f0 CF91      		pop r28
+ 1322 07f2 1F91      		pop r17
+ 1323 07f4 0F91      		pop r16
+ 1324 07f6 FF90      		pop r15
+ 1325 07f8 EF90      		pop r14
+ 1326 07fa DF90      		pop r13
+ 1327 07fc CF90      		pop r12
+ 1328 07fe 0895      		ret
+ 1329               	/* epilogue end (size=9) */
+ 1330               	/* function bom_refresh size 67 (50) */
+ 1331               	.LFE4:
+ 1333               	.global	get_max_bom
+ 1335               	get_max_bom:
+ 1336               	.LFB12:
+ 1337               	.LM82:
+ 1338               	/* prologue: frame size=0 */
+ 1339               	/* prologue end (size=0) */
+ 1340               	.LM83:
+ 1341 0800 8FEF      		ldi r24,lo8(-1)
+ 1342 0802 9FEF      		ldi r25,hi8(-1)
+ 1343 0804 0E94 0000 		call bom_refresh
+ 1344               	.LM84:
+ 1345 0808 0E94 0000 		call bom_get_max
+ 1346               	/* epilogue: frame size=0 */
+ 1347 080c 0895      		ret
+ 1348               	/* epilogue end (size=1) */
+ 1349               	/* function get_max_bom size 7 (6) */
+ 1350               	.LFE12:
+ 1352               		.data
+ 1353               	.LC0:
+ 1354 0000 3A20 00   		.string	": "
+ 1355               	.LC1:
+ 1356 0003 0D0A 00   		.string	"\r\n"
+ 1357               		.text
+ 1358               	.global	bom_print_usb
+ 1360               	bom_print_usb:
+ 1361               	.LFB9:
+ 1362               	.LM85:
+ 1363               	/* prologue: frame size=32 */
+ 1364 080e AF92      		push r10
+ 1365 0810 BF92      		push r11
+ 1366 0812 CF92      		push r12
+ 1367 0814 DF92      		push r13
+ 1368 0816 EF92      		push r14
+ 1369 0818 FF92      		push r15
+ 1370 081a 0F93      		push r16
+ 1371 081c 1F93      		push r17
+ 1372 081e CF93      		push r28
+ 1373 0820 DF93      		push r29
+ 1374 0822 CDB7      		in r28,__SP_L__
+ 1375 0824 DEB7      		in r29,__SP_H__
+ 1376 0826 A097      		sbiw r28,32
+ 1377 0828 0FB6      		in __tmp_reg__,__SREG__
+ 1378 082a F894      		cli
+ 1379 082c DEBF      		out __SP_H__,r29
+ 1380 082e 0FBE      		out __SREG__,__tmp_reg__
+ 1381 0830 CDBF      		out __SP_L__,r28
+ 1382               	/* prologue end (size=18) */
+ 1383               	.LVL88:
+ 1384               	.LM86:
+ 1385 0832 0097      		sbiw r24,0
+ 1386 0834 01F0      		breq .L134
+ 1387               	.LM87:
+ 1388 0836 2FEF      		ldi r18,lo8(-1)
+ 1389 0838 A22E      		mov r10,r18
+ 1390 083a B22E      		mov r11,r18
+ 1391               	.LVL89:
+ 1392 083c FC01      		movw r30,r24
+ 1393 083e AC01      		movw r20,r24
+ 1394 0840 405E      		subi r20,lo8(-(32))
+ 1395 0842 5F4F      		sbci r21,hi8(-(32))
+ 1396               	.L136:
+ 1397 0844 2191      		ld r18,Z+
+ 1398 0846 3191      		ld r19,Z+
+ 1399 0848 A216      		cp r10,r18
+ 1400 084a B306      		cpc r11,r19
+ 1401 084c 04F4      		brge .L137
+ 1402               	.LVL90:
+ 1403 084e 5901      		movw r10,r18
+ 1404               	.L137:
+ 1405               	.LM88:
+ 1406 0850 E417      		cp r30,r20
+ 1407 0852 F507      		cpc r31,r21
+ 1408 0854 01F4      		brne .L136
+ 1409 0856 00C0      		rjmp .L139
+ 1410               	.LVL91:
+ 1411               	.L134:
+ 1412               	.LM89:
+ 1413 0858 8FEF      		ldi r24,lo8(-1)
+ 1414 085a 9FEF      		ldi r25,hi8(-1)
+ 1415               	.LVL92:
+ 1416 085c 0E94 0000 		call bom_refresh
+ 1417 0860 00E0      		ldi r16,lo8(0)
+ 1418 0862 10E0      		ldi r17,hi8(0)
+ 1419               	.LVL93:
+ 1420 0864 8FEF      		ldi r24,lo8(-1)
+ 1421 0866 A82E      		mov r10,r24
+ 1422 0868 B82E      		mov r11,r24
+ 1423               	.LVL94:
+ 1424 086a 7E01      		movw r14,r28
+ 1425 086c 0894      		sec
+ 1426 086e E11C      		adc r14,__zero_reg__
+ 1427 0870 F11C      		adc r15,__zero_reg__
+ 1428               	.L140:
+ 1429               	.LM90:
+ 1430 0872 C801      		movw r24,r16
+ 1431 0874 0E94 0000 		call bom_get
+ 1432 0878 F701      		movw r30,r14
+ 1433 087a 9183      		std Z+1,r25
+ 1434 087c 8083      		st Z,r24
+ 1435 087e A816      		cp r10,r24
+ 1436 0880 B906      		cpc r11,r25
+ 1437 0882 04F4      		brge .L141
+ 1438 0884 5C01      		movw r10,r24
+ 1439               	.L141:
+ 1440               	.LM91:
+ 1441 0886 0F5F      		subi r16,lo8(-(1))
+ 1442 0888 1F4F      		sbci r17,hi8(-(1))
+ 1443 088a 22E0      		ldi r18,lo8(2)
+ 1444 088c 30E0      		ldi r19,hi8(2)
+ 1445 088e E20E      		add r14,r18
+ 1446 0890 F31E      		adc r15,r19
+ 1447 0892 0031      		cpi r16,16
+ 1448 0894 1105      		cpc r17,__zero_reg__
+ 1449 0896 01F4      		brne .L140
+ 1450 0898 CE01      		movw r24,r28
+ 1451               	.LVL95:
+ 1452 089a 0196      		adiw r24,1
+ 1453               	.LVL96:
+ 1454               	.L139:
+ 1455 089c 8C01      		movw r16,r24
+ 1456               	.LVL97:
+ 1457 089e CC24      		clr r12
+ 1458 08a0 DD24      		clr r13
+ 1459               	.LVL98:
+ 1460               	.LVL99:
+ 1461               	.L143:
+ 1462               	.LM92:
+ 1463 08a2 C601      		movw r24,r12
+ 1464               	.LVL100:
+ 1465 08a4 0E94 0000 		call usb_puti
+ 1466               	.LVL101:
+ 1467               	.LM93:
+ 1468 08a8 80E0      		ldi r24,lo8(.LC0)
+ 1469 08aa 90E0      		ldi r25,hi8(.LC0)
+ 1470 08ac 0E94 0000 		call usb_puts
+ 1471               	.LM94:
+ 1472 08b0 F801      		movw r30,r16
+ 1473 08b2 8081      		ld r24,Z
+ 1474 08b4 9181      		ldd r25,Z+1
+ 1475 08b6 0E94 0000 		call usb_puti
+ 1476               	.LM95:
+ 1477 08ba 89E0      		ldi r24,lo8(9)
+ 1478 08bc 0E94 0000 		call usb_putc
+ 1479 08c0 EE24      		clr r14
+ 1480 08c2 FF24      		clr r15
+ 1481 08c4 00C0      		rjmp .L144
+ 1482               	.L145:
+ 1483               	.LM96:
+ 1484 08c6 83E2      		ldi r24,lo8(35)
+ 1485 08c8 0E94 0000 		call usb_putc
+ 1486               	.LM97:
+ 1487 08cc 0894      		sec
+ 1488 08ce E11C      		adc r14,__zero_reg__
+ 1489 08d0 F11C      		adc r15,__zero_reg__
+ 1490               	.L144:
+ 1491 08d2 F801      		movw r30,r16
+ 1492 08d4 8081      		ld r24,Z
+ 1493 08d6 9181      		ldd r25,Z+1
+ 1494 08d8 9501      		movw r18,r10
+ 1495 08da 281B      		sub r18,r24
+ 1496 08dc 390B      		sbc r19,r25
+ 1497 08de C901      		movw r24,r18
+ 1498 08e0 65E0      		ldi r22,lo8(5)
+ 1499 08e2 70E0      		ldi r23,hi8(5)
+ 1500 08e4 0E94 0000 		call __divmodhi4
+ 1501 08e8 E616      		cp r14,r22
+ 1502 08ea F706      		cpc r15,r23
+ 1503 08ec 04F0      		brlt .L145
+ 1504               	.LM98:
+ 1505 08ee 80E0      		ldi r24,lo8(.LC1)
+ 1506 08f0 90E0      		ldi r25,hi8(.LC1)
+ 1507 08f2 0E94 0000 		call usb_puts
+ 1508               	.LM99:
+ 1509 08f6 0894      		sec
+ 1510 08f8 C11C      		adc r12,__zero_reg__
+ 1511 08fa D11C      		adc r13,__zero_reg__
+ 1512 08fc 0E5F      		subi r16,lo8(-(2))
+ 1513 08fe 1F4F      		sbci r17,hi8(-(2))
+ 1514 0900 30E1      		ldi r19,lo8(16)
+ 1515 0902 C316      		cp r12,r19
+ 1516 0904 D104      		cpc r13,__zero_reg__
+ 1517 0906 01F4      		brne .L143
+ 1518               	.LM100:
+ 1519 0908 80E0      		ldi r24,lo8(.LC1)
+ 1520 090a 90E0      		ldi r25,hi8(.LC1)
+ 1521 090c 0E94 0000 		call usb_puts
+ 1522               	.LM101:
+ 1523 0910 80E0      		ldi r24,lo8(0)
+ 1524 0912 90E0      		ldi r25,hi8(0)
+ 1525               	/* epilogue: frame size=32 */
+ 1526 0914 A096      		adiw r28,32
+ 1527 0916 0FB6      		in __tmp_reg__,__SREG__
+ 1528 0918 F894      		cli
+ 1529 091a DEBF      		out __SP_H__,r29
+ 1530 091c 0FBE      		out __SREG__,__tmp_reg__
+ 1531 091e CDBF      		out __SP_L__,r28
+ 1532 0920 DF91      		pop r29
+ 1533 0922 CF91      		pop r28
+ 1534 0924 1F91      		pop r17
+ 1535 0926 0F91      		pop r16
+ 1536 0928 FF90      		pop r15
+ 1537 092a EF90      		pop r14
+ 1538 092c DF90      		pop r13
+ 1539 092e CF90      		pop r12
+ 1540 0930 BF90      		pop r11
+ 1541 0932 AF90      		pop r10
+ 1542 0934 0895      		ret
+ 1543               	/* epilogue end (size=17) */
+ 1544               	/* function bom_print_usb size 148 (113) */
+ 1545               	.LFE9:
+ 1547               	.global	bom_get_norm_vector
+ 1549               	bom_get_norm_vector:
+ 1550               	.LFB8:
+ 1551               	.LM102:
+ 1552               	/* prologue: frame size=32 */
+ 1553 0936 4F92      		push r4
+ 1554 0938 5F92      		push r5
+ 1555 093a 6F92      		push r6
+ 1556 093c 7F92      		push r7
+ 1557 093e 8F92      		push r8
+ 1558 0940 9F92      		push r9
+ 1559 0942 AF92      		push r10
+ 1560 0944 BF92      		push r11
+ 1561 0946 CF92      		push r12
+ 1562 0948 DF92      		push r13
+ 1563 094a EF92      		push r14
+ 1564 094c FF92      		push r15
+ 1565 094e 0F93      		push r16
+ 1566 0950 1F93      		push r17
+ 1567 0952 CF93      		push r28
+ 1568 0954 DF93      		push r29
+ 1569 0956 CDB7      		in r28,__SP_L__
+ 1570 0958 DEB7      		in r29,__SP_H__
+ 1571 095a A097      		sbiw r28,32
+ 1572 095c 0FB6      		in __tmp_reg__,__SREG__
+ 1573 095e F894      		cli
+ 1574 0960 DEBF      		out __SP_H__,r29
+ 1575 0962 0FBE      		out __SREG__,__tmp_reg__
+ 1576 0964 CDBF      		out __SP_L__,r28
+ 1577               	/* prologue end (size=24) */
+ 1578               	.LVL102:
+ 1579 0966 2C01      		movw r4,r24
+ 1580               	.LM103:
+ 1581 0968 7E01      		movw r14,r28
+ 1582 096a 0894      		sec
+ 1583 096c E11C      		adc r14,__zero_reg__
+ 1584 096e F11C      		adc r15,__zero_reg__
+ 1585 0970 80E2      		ldi r24,lo8(32)
+ 1586               	.LVL103:
+ 1587 0972 D701      		movw r26,r14
+ 1588 0974 1D92      		st X+,__zero_reg__
+ 1589 0976 8A95      	        dec r24
+ 1590 0978 01F4      		brne .-6
+ 1591               	.LM104:
+ 1592 097a 6115      		cp r22,__zero_reg__
+ 1593 097c 7105      		cpc r23,__zero_reg__
+ 1594 097e 01F0      		breq .L156
+ 1595 0980 4FEF      		ldi r20,lo8(255)
+ 1596 0982 50E0      		ldi r21,hi8(255)
+ 1597 0984 D701      		movw r26,r14
+ 1598 0986 FB01      		movw r30,r22
+ 1599 0988 9B01      		movw r18,r22
+ 1600 098a 205E      		subi r18,lo8(-(32))
+ 1601 098c 3F4F      		sbci r19,hi8(-(32))
+ 1602               	.LVL104:
+ 1603               	.L158:
+ 1604               	.LM105:
+ 1605 098e 8191      		ld r24,Z+
+ 1606 0990 9191      		ld r25,Z+
+ 1607 0992 BA01      		movw r22,r20
+ 1608 0994 681B      		sub r22,r24
+ 1609 0996 790B      		sbc r23,r25
+ 1610 0998 6D93      		st X+,r22
+ 1611 099a 7D93      		st X+,r23
+ 1612               	.LM106:
+ 1613 099c E217      		cp r30,r18
+ 1614 099e F307      		cpc r31,r19
+ 1615 09a0 01F0      		breq .L159
+ 1616 09a2 00C0      		rjmp .L158
+ 1617               	.LVL105:
+ 1618               	.L156:
+ 1619               	.LM107:
+ 1620 09a4 8FEF      		ldi r24,lo8(-1)
+ 1621 09a6 9FEF      		ldi r25,hi8(-1)
+ 1622 09a8 0E94 0000 		call bom_refresh
+ 1623               	.LVL106:
+ 1624 09ac 00E0      		ldi r16,lo8(0)
+ 1625 09ae 10E0      		ldi r17,hi8(0)
+ 1626               	.LVL107:
+ 1627               	.L160:
+ 1628               	.LM108:
+ 1629 09b0 C801      		movw r24,r16
+ 1630 09b2 0E94 0000 		call bom_get
+ 1631 09b6 2FEF      		ldi r18,lo8(255)
+ 1632 09b8 30E0      		ldi r19,hi8(255)
+ 1633 09ba 281B      		sub r18,r24
+ 1634 09bc 390B      		sbc r19,r25
+ 1635 09be D701      		movw r26,r14
+ 1636 09c0 2D93      		st X+,r18
+ 1637 09c2 3D93      		st X+,r19
+ 1638 09c4 7D01      		movw r14,r26
+ 1639               	.LM109:
+ 1640 09c6 0F5F      		subi r16,lo8(-(1))
+ 1641 09c8 1F4F      		sbci r17,hi8(-(1))
+ 1642 09ca 0031      		cpi r16,16
+ 1643 09cc 1105      		cpc r17,__zero_reg__
+ 1644 09ce 01F4      		brne .L160
+ 1645               	.LVL108:
+ 1646               	.L159:
+ 1647 09d0 40E0      		ldi r20,lo8(0)
+ 1648 09d2 50E0      		ldi r21,hi8(0)
+ 1649 09d4 60E0      		ldi r22,hlo8(0)
+ 1650 09d6 70E0      		ldi r23,hhi8(0)
+ 1651               	.LVL109:
+ 1652 09d8 AA24      		clr r10
+ 1653 09da BB24      		clr r11
+ 1654 09dc 6501      		movw r12,r10
+ 1655               	.LVL110:
+ 1656 09de E0E0      		ldi r30,lo8(0)
+ 1657 09e0 F0E0      		ldi r31,hi8(0)
+ 1658               	.LVL111:
+ 1659 09e2 8E01      		movw r16,r28
+ 1660               	.LVL112:
+ 1661 09e4 0F5F      		subi r16,lo8(-(1))
+ 1662 09e6 1F4F      		sbci r17,hi8(-(1))
+ 1663 09e8 B0E0      		ldi r27,lo8(x_comp)
+ 1664 09ea 8B2E      		mov r8,r27
+ 1665 09ec B0E0      		ldi r27,hi8(x_comp)
+ 1666 09ee 9B2E      		mov r9,r27
+ 1667 09f0 A0E0      		ldi r26,lo8(y_comp)
+ 1668 09f2 EA2E      		mov r14,r26
+ 1669 09f4 A0E0      		ldi r26,hi8(y_comp)
+ 1670 09f6 FA2E      		mov r15,r26
+ 1671 09f8 31E2      		ldi r19,lo8(33)
+ 1672 09fa 632E      		mov r6,r19
+ 1673 09fc 712C      		mov r7,__zero_reg__
+ 1674 09fe 6C0E      		add r6,r28
+ 1675 0a00 7D1E      		adc r7,r29
+ 1676               	.L161:
+ 1677               	.LM110:
+ 1678 0a02 D801      		movw r26,r16
+ 1679 0a04 2D91      		ld r18,X+
+ 1680 0a06 3D91      		ld r19,X+
+ 1681 0a08 8D01      		movw r16,r26
+ 1682               	.LM111:
+ 1683 0a0a D401      		movw r26,r8
+ 1684 0a0c 8D91      		ld r24,X+
+ 1685 0a0e 9D91      		ld r25,X+
+ 1686 0a10 4D01      		movw r8,r26
+ 1687 0a12 DC01      		movw r26,r24
+ 1688 0a14 2A9F      		mul r18,r26
+ 1689 0a16 C001      		movw r24,r0
+ 1690 0a18 2B9F      		mul r18,r27
+ 1691 0a1a 900D      		add r25,r0
+ 1692 0a1c 3A9F      		mul r19,r26
+ 1693 0a1e 900D      		add r25,r0
+ 1694 0a20 1124      		clr r1
+ 1695 0a22 AA27      		clr r26
+ 1696 0a24 97FD      		sbrc r25,7
+ 1697 0a26 A095      		com r26
+ 1698 0a28 BA2F      		mov r27,r26
+ 1699 0a2a 480F      		add r20,r24
+ 1700 0a2c 591F      		adc r21,r25
+ 1701 0a2e 6A1F      		adc r22,r26
+ 1702 0a30 7B1F      		adc r23,r27
+ 1703               	.LM112:
+ 1704 0a32 D701      		movw r26,r14
+ 1705 0a34 8D91      		ld r24,X+
+ 1706 0a36 9D91      		ld r25,X+
+ 1707 0a38 7D01      		movw r14,r26
+ 1708 0a3a DC01      		movw r26,r24
+ 1709 0a3c 2A9F      		mul r18,r26
+ 1710 0a3e C001      		movw r24,r0
+ 1711 0a40 2B9F      		mul r18,r27
+ 1712 0a42 900D      		add r25,r0
+ 1713 0a44 3A9F      		mul r19,r26
+ 1714 0a46 900D      		add r25,r0
+ 1715 0a48 1124      		clr r1
+ 1716 0a4a AA27      		clr r26
+ 1717 0a4c 97FD      		sbrc r25,7
+ 1718 0a4e A095      		com r26
+ 1719 0a50 BA2F      		mov r27,r26
+ 1720 0a52 A80E      		add r10,r24
+ 1721 0a54 B91E      		adc r11,r25
+ 1722 0a56 CA1E      		adc r12,r26
+ 1723 0a58 DB1E      		adc r13,r27
+ 1724               	.LM113:
+ 1725 0a5a E20F      		add r30,r18
+ 1726 0a5c F31F      		adc r31,r19
+ 1727               	.LM114:
+ 1728 0a5e 0615      		cp r16,r6
+ 1729 0a60 1705      		cpc r17,r7
+ 1730 0a62 01F4      		brne .L161
+ 1731               	.LM115:
+ 1732 0a64 1E16      		cp __zero_reg__,r30
+ 1733 0a66 1F06      		cpc __zero_reg__,r31
+ 1734 0a68 04F0      		brlt .L163
+ 1735 0a6a 8824      		clr r8
+ 1736 0a6c 9924      		clr r9
+ 1737               	.LVL113:
+ 1738 0a6e 20E0      		ldi r18,lo8(0)
+ 1739 0a70 30E0      		ldi r19,hi8(0)
+ 1740               	.LVL114:
+ 1741 0a72 00C0      		rjmp .L165
+ 1742               	.LVL115:
+ 1743               	.L163:
+ 1744               	.LM116:
+ 1745 0a74 7F01      		movw r14,r30
+ 1746 0a76 0027      		clr r16
+ 1747 0a78 F7FC      		sbrc r15,7
+ 1748 0a7a 0095      		com r16
+ 1749 0a7c 102F      		mov r17,r16
+ 1750 0a7e CB01      		movw r24,r22
+ 1751 0a80 BA01      		movw r22,r20
+ 1752 0a82 A801      		movw r20,r16
+ 1753 0a84 9701      		movw r18,r14
+ 1754 0a86 0E94 0000 		call __divmodsi4
+ 1755               	.LVL116:
+ 1756 0a8a 4901      		movw r8,r18
+ 1757               	.LVL117:
+ 1758               	.LM117:
+ 1759 0a8c C601      		movw r24,r12
+ 1760 0a8e B501      		movw r22,r10
+ 1761 0a90 A801      		movw r20,r16
+ 1762 0a92 9701      		movw r18,r14
+ 1763 0a94 0E94 0000 		call __divmodsi4
+ 1764               	.LVL118:
+ 1765               	.L165:
+ 1766               	.LM118:
+ 1767 0a98 F201      		movw r30,r4
+ 1768               	.LVL119:
+ 1769 0a9a 9182      		std Z+1,r9
+ 1770 0a9c 8082      		st Z,r8
+ 1771               	.LM119:
+ 1772 0a9e 3383      		std Z+3,r19
+ 1773 0aa0 2283      		std Z+2,r18
+ 1774               	.LM120:
+ 1775 0aa2 80E0      		ldi r24,lo8(0)
+ 1776 0aa4 90E0      		ldi r25,hi8(0)
+ 1777               	/* epilogue: frame size=32 */
+ 1778 0aa6 A096      		adiw r28,32
+ 1779 0aa8 0FB6      		in __tmp_reg__,__SREG__
+ 1780 0aaa F894      		cli
+ 1781 0aac DEBF      		out __SP_H__,r29
+ 1782 0aae 0FBE      		out __SREG__,__tmp_reg__
+ 1783 0ab0 CDBF      		out __SP_L__,r28
+ 1784 0ab2 DF91      		pop r29
+ 1785 0ab4 CF91      		pop r28
+ 1786 0ab6 1F91      		pop r17
+ 1787 0ab8 0F91      		pop r16
+ 1788 0aba FF90      		pop r15
+ 1789 0abc EF90      		pop r14
+ 1790 0abe DF90      		pop r13
+ 1791 0ac0 CF90      		pop r12
+ 1792 0ac2 BF90      		pop r11
+ 1793 0ac4 AF90      		pop r10
+ 1794 0ac6 9F90      		pop r9
+ 1795 0ac8 8F90      		pop r8
+ 1796 0aca 7F90      		pop r7
+ 1797 0acc 6F90      		pop r6
+ 1798 0ace 5F90      		pop r5
+ 1799 0ad0 4F90      		pop r4
+ 1800 0ad2 0895      		ret
+ 1801               	/* epilogue end (size=23) */
+ 1802               	/* function bom_get_norm_vector size 207 (160) */
+ 1803               	.LFE8:
+ 1805               	.global	bom_get_vector
+ 1807               	bom_get_vector:
+ 1808               	.LFB7:
+ 1809               	.LM121:
+ 1810               	/* prologue: frame size=32 */
+ 1811 0ad4 6F92      		push r6
+ 1812 0ad6 7F92      		push r7
+ 1813 0ad8 8F92      		push r8
+ 1814 0ada 9F92      		push r9
+ 1815 0adc AF92      		push r10
+ 1816 0ade BF92      		push r11
+ 1817 0ae0 CF92      		push r12
+ 1818 0ae2 DF92      		push r13
+ 1819 0ae4 EF92      		push r14
+ 1820 0ae6 FF92      		push r15
+ 1821 0ae8 0F93      		push r16
+ 1822 0aea 1F93      		push r17
+ 1823 0aec CF93      		push r28
+ 1824 0aee DF93      		push r29
+ 1825 0af0 CDB7      		in r28,__SP_L__
+ 1826 0af2 DEB7      		in r29,__SP_H__
+ 1827 0af4 A097      		sbiw r28,32
+ 1828 0af6 0FB6      		in __tmp_reg__,__SREG__
+ 1829 0af8 F894      		cli
+ 1830 0afa DEBF      		out __SP_H__,r29
+ 1831 0afc 0FBE      		out __SREG__,__tmp_reg__
+ 1832 0afe CDBF      		out __SP_L__,r28
+ 1833               	/* prologue end (size=22) */
+ 1834               	.LVL120:
+ 1835 0b00 3C01      		movw r6,r24
+ 1836               	.LM122:
+ 1837 0b02 7E01      		movw r14,r28
+ 1838 0b04 0894      		sec
+ 1839 0b06 E11C      		adc r14,__zero_reg__
+ 1840 0b08 F11C      		adc r15,__zero_reg__
+ 1841 0b0a 80E2      		ldi r24,lo8(32)
+ 1842               	.LVL121:
+ 1843 0b0c D701      		movw r26,r14
+ 1844 0b0e 1D92      		st X+,__zero_reg__
+ 1845 0b10 8A95      	        dec r24
+ 1846 0b12 01F4      		brne .-6
+ 1847               	.LM123:
+ 1848 0b14 6115      		cp r22,__zero_reg__
+ 1849 0b16 7105      		cpc r23,__zero_reg__
+ 1850 0b18 01F0      		breq .L172
+ 1851 0b1a 4FEF      		ldi r20,lo8(255)
+ 1852 0b1c 50E0      		ldi r21,hi8(255)
+ 1853 0b1e D701      		movw r26,r14
+ 1854 0b20 FB01      		movw r30,r22
+ 1855 0b22 9B01      		movw r18,r22
+ 1856 0b24 205E      		subi r18,lo8(-(32))
+ 1857 0b26 3F4F      		sbci r19,hi8(-(32))
+ 1858               	.LVL122:
+ 1859               	.L174:
+ 1860               	.LM124:
+ 1861 0b28 8191      		ld r24,Z+
+ 1862 0b2a 9191      		ld r25,Z+
+ 1863 0b2c BA01      		movw r22,r20
+ 1864 0b2e 681B      		sub r22,r24
+ 1865 0b30 790B      		sbc r23,r25
+ 1866 0b32 6D93      		st X+,r22
+ 1867 0b34 7D93      		st X+,r23
+ 1868               	.LM125:
+ 1869 0b36 E217      		cp r30,r18
+ 1870 0b38 F307      		cpc r31,r19
+ 1871 0b3a 01F0      		breq .L175
+ 1872 0b3c 00C0      		rjmp .L174
+ 1873               	.LVL123:
+ 1874               	.L172:
+ 1875               	.LM126:
+ 1876 0b3e 8FEF      		ldi r24,lo8(-1)
+ 1877 0b40 9FEF      		ldi r25,hi8(-1)
+ 1878 0b42 0E94 0000 		call bom_refresh
+ 1879               	.LVL124:
+ 1880 0b46 00E0      		ldi r16,lo8(0)
+ 1881 0b48 10E0      		ldi r17,hi8(0)
+ 1882               	.LVL125:
+ 1883               	.L176:
+ 1884               	.LM127:
+ 1885 0b4a C801      		movw r24,r16
+ 1886 0b4c 0E94 0000 		call bom_get
+ 1887 0b50 2FEF      		ldi r18,lo8(255)
+ 1888 0b52 30E0      		ldi r19,hi8(255)
+ 1889 0b54 281B      		sub r18,r24
+ 1890 0b56 390B      		sbc r19,r25
+ 1891 0b58 D701      		movw r26,r14
+ 1892 0b5a 2D93      		st X+,r18
+ 1893 0b5c 3D93      		st X+,r19
+ 1894 0b5e 7D01      		movw r14,r26
+ 1895               	.LM128:
+ 1896 0b60 0F5F      		subi r16,lo8(-(1))
+ 1897 0b62 1F4F      		sbci r17,hi8(-(1))
+ 1898 0b64 0031      		cpi r16,16
+ 1899 0b66 1105      		cpc r17,__zero_reg__
+ 1900 0b68 01F4      		brne .L176
+ 1901               	.LVL126:
+ 1902               	.L175:
+ 1903 0b6a EE24      		clr r14
+ 1904 0b6c FF24      		clr r15
+ 1905 0b6e 8701      		movw r16,r14
+ 1906               	.LVL127:
+ 1907 0b70 40E0      		ldi r20,lo8(0)
+ 1908 0b72 50E0      		ldi r21,hi8(0)
+ 1909 0b74 60E0      		ldi r22,hlo8(0)
+ 1910 0b76 70E0      		ldi r23,hhi8(0)
+ 1911               	.LVL128:
+ 1912 0b78 FE01      		movw r30,r28
+ 1913               	.LVL129:
+ 1914 0b7a 3196      		adiw r30,1
+ 1915 0b7c 20E0      		ldi r18,lo8(x_comp)
+ 1916 0b7e A22E      		mov r10,r18
+ 1917 0b80 20E0      		ldi r18,hi8(x_comp)
+ 1918 0b82 B22E      		mov r11,r18
+ 1919 0b84 90E0      		ldi r25,lo8(y_comp)
+ 1920 0b86 C92E      		mov r12,r25
+ 1921 0b88 90E0      		ldi r25,hi8(y_comp)
+ 1922 0b8a D92E      		mov r13,r25
+ 1923 0b8c 81E2      		ldi r24,lo8(33)
+ 1924 0b8e 882E      		mov r8,r24
+ 1925 0b90 912C      		mov r9,__zero_reg__
+ 1926 0b92 8C0E      		add r8,r28
+ 1927 0b94 9D1E      		adc r9,r29
+ 1928               	.L177:
+ 1929               	.LM129:
+ 1930 0b96 2191      		ld r18,Z+
+ 1931 0b98 3191      		ld r19,Z+
+ 1932               	.LM130:
+ 1933 0b9a D501      		movw r26,r10
+ 1934 0b9c 8D91      		ld r24,X+
+ 1935 0b9e 9D91      		ld r25,X+
+ 1936 0ba0 5D01      		movw r10,r26
+ 1937 0ba2 DC01      		movw r26,r24
+ 1938 0ba4 2A9F      		mul r18,r26
+ 1939 0ba6 C001      		movw r24,r0
+ 1940 0ba8 2B9F      		mul r18,r27
+ 1941 0baa 900D      		add r25,r0
+ 1942 0bac 3A9F      		mul r19,r26
+ 1943 0bae 900D      		add r25,r0
+ 1944 0bb0 1124      		clr r1
+ 1945 0bb2 AA27      		clr r26
+ 1946 0bb4 97FD      		sbrc r25,7
+ 1947 0bb6 A095      		com r26
+ 1948 0bb8 BA2F      		mov r27,r26
+ 1949 0bba E80E      		add r14,r24
+ 1950 0bbc F91E      		adc r15,r25
+ 1951 0bbe 0A1F      		adc r16,r26
+ 1952 0bc0 1B1F      		adc r17,r27
+ 1953               	.LM131:
+ 1954 0bc2 D601      		movw r26,r12
+ 1955 0bc4 8D91      		ld r24,X+
+ 1956 0bc6 9D91      		ld r25,X+
+ 1957 0bc8 6D01      		movw r12,r26
+ 1958 0bca DC01      		movw r26,r24
+ 1959 0bcc 2A9F      		mul r18,r26
+ 1960 0bce C001      		movw r24,r0
+ 1961 0bd0 2B9F      		mul r18,r27
+ 1962 0bd2 900D      		add r25,r0
+ 1963 0bd4 3A9F      		mul r19,r26
+ 1964 0bd6 900D      		add r25,r0
+ 1965 0bd8 1124      		clr r1
+ 1966 0bda AA27      		clr r26
+ 1967 0bdc 97FD      		sbrc r25,7
+ 1968 0bde A095      		com r26
+ 1969 0be0 BA2F      		mov r27,r26
+ 1970 0be2 480F      		add r20,r24
+ 1971 0be4 591F      		adc r21,r25
+ 1972 0be6 6A1F      		adc r22,r26
+ 1973 0be8 7B1F      		adc r23,r27
+ 1974               	.LM132:
+ 1975 0bea E815      		cp r30,r8
+ 1976 0bec F905      		cpc r31,r9
+ 1977 0bee 01F4      		brne .L177
+ 1978               	.LM133:
+ 1979 0bf0 F301      		movw r30,r6
+ 1980 0bf2 F182      		std Z+1,r15
+ 1981 0bf4 E082      		st Z,r14
+ 1982               	.LM134:
+ 1983 0bf6 5383      		std Z+3,r21
+ 1984 0bf8 4283      		std Z+2,r20
+ 1985               	.LM135:
+ 1986 0bfa 80E0      		ldi r24,lo8(0)
+ 1987 0bfc 90E0      		ldi r25,hi8(0)
+ 1988               	/* epilogue: frame size=32 */
+ 1989 0bfe A096      		adiw r28,32
+ 1990 0c00 0FB6      		in __tmp_reg__,__SREG__
+ 1991 0c02 F894      		cli
+ 1992 0c04 DEBF      		out __SP_H__,r29
+ 1993 0c06 0FBE      		out __SREG__,__tmp_reg__
+ 1994 0c08 CDBF      		out __SP_L__,r28
+ 1995 0c0a DF91      		pop r29
+ 1996 0c0c CF91      		pop r28
+ 1997 0c0e 1F91      		pop r17
+ 1998 0c10 0F91      		pop r16
+ 1999 0c12 FF90      		pop r15
+ 2000 0c14 EF90      		pop r14
+ 2001 0c16 DF90      		pop r13
+ 2002 0c18 CF90      		pop r12
+ 2003 0c1a BF90      		pop r11
+ 2004 0c1c AF90      		pop r10
+ 2005 0c1e 9F90      		pop r9
+ 2006 0c20 8F90      		pop r8
+ 2007 0c22 7F90      		pop r7
+ 2008 0c24 6F90      		pop r6
+ 2009 0c26 0895      		ret
+ 2010               	/* epilogue end (size=21) */
+ 2011               	/* function bom_get_vector size 170 (127) */
+ 2012               	.LFE7:
+ 2014               		.lcomm bom_type,1
+ 2015               		.data
+ 2018               	x_comp:
+ 2019 0006 1900      		.word	25
+ 2020 0008 1700      		.word	23
+ 2021 000a 1100      		.word	17
+ 2022 000c 0900      		.word	9
+ 2023 000e 0000      		.word	0
+ 2024 0010 F7FF      		.word	-9
+ 2025 0012 EFFF      		.word	-17
+ 2026 0014 E9FF      		.word	-23
+ 2027 0016 E7FF      		.word	-25
+ 2028 0018 E9FF      		.word	-23
+ 2029 001a EFFF      		.word	-17
+ 2030 001c F7FF      		.word	-9
+ 2031 001e 0000      		.word	0
+ 2032 0020 0900      		.word	9
+ 2033 0022 1100      		.word	17
+ 2034 0024 1700      		.word	23
+ 2037               	y_comp:
+ 2038 0026 0000      		.word	0
+ 2039 0028 0900      		.word	9
+ 2040 002a 1100      		.word	17
+ 2041 002c 1700      		.word	23
+ 2042 002e 1900      		.word	25
+ 2043 0030 1700      		.word	23
+ 2044 0032 1100      		.word	17
+ 2045 0034 0900      		.word	9
+ 2046 0036 0000      		.word	0
+ 2047 0038 F7FF      		.word	-9
+ 2048 003a EFFF      		.word	-17
+ 2049 003c E9FF      		.word	-23
+ 2050 003e E7FF      		.word	-25
+ 2051 0040 E9FF      		.word	-23
+ 2052 0042 EFFF      		.word	-17
+ 2053 0044 F7FF      		.word	-9
+ 2056               	lookup:
+ 2057 0046 07        		.byte	7
+ 2058 0047 06        		.byte	6
+ 2059 0048 05        		.byte	5
+ 2060 0049 0E        		.byte	14
+ 2061 004a 01        		.byte	1
+ 2062 004b 04        		.byte	4
+ 2063 004c 03        		.byte	3
+ 2064 004d 02        		.byte	2
+ 2065 004e 0F        		.byte	15
+ 2066 004f 00        		.byte	0
+ 2067 0050 0D        		.byte	13
+ 2068 0051 08        		.byte	8
+ 2069 0052 0C        		.byte	12
+ 2070 0053 0B        		.byte	11
+ 2071 0054 09        		.byte	9
+ 2072 0055 0A        		.byte	10
+ 2073               		.lcomm bom_val,32
+ 2074               		.lcomm select_pins,8
+ 2075               		.lcomm analog_pin,2
+ 2196               	.Letext0:
+DEFINED SYMBOLS
+                            *ABS*:00000000 bom.c
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:3      *ABS*:0000003f __SREG__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:4      *ABS*:0000003e __SP_H__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:5      *ABS*:0000003d __SP_L__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:6      *ABS*:00000000 __tmp_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:7      *ABS*:00000001 __zero_reg__
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:19     .text:00000000 bom_select
+                             .bss:00000000 bom_type
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:2056   .data:00000046 lookup
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:2073   .bss:00000021 select_pins
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:112    .text:00000088 bom_off
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:150    .text:000000b2 bom_on
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:188    .text:000000dc bom_set_leds
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:255    .text:00000138 bom_init
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:2074   .bss:00000029 analog_pin
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:342    .text:000001d4 bom_get
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:363    .text:000001e6 bom_get_max
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:428    .text:00000234 bom_get_max10
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:1242   .text:0000077c bom_refresh
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:2014   .bss:00000001 bom_val
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:1335   .text:00000800 get_max_bom
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:1360   .text:0000080e bom_print_usb
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:1549   .text:00000936 bom_get_norm_vector
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:2018   .data:00000006 x_comp
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:2037   .data:00000026 y_comp
+F:\DOCUME~1\Evan\LOCALS~1\Temp/cc4wTiWS.s:1807   .text:00000ad4 bom_get_vector
+
+UNDEFINED SYMBOLS
+__do_copy_data
+__do_clear_bss
+digital_output
+analog_get8
+__divmodhi4
+__divdi3
+__ashldi3
+__moddi3
+analog_loop_status
+analog_stop_loop
+analog_start_loop
+usb_puti
+usb_puts
+usb_putc
+__divmodsi4
Index: demos/hunter_prey_john/projects/libdragonfly/Makefile
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/Makefile	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/Makefile	(revision 1694)
@@ -0,0 +1,204 @@
+############################
+### Update this Section ####
+############################
+
+COLONYROOT = ../..
+
+# Target file name (without extension).
+TARGET = libdragonfly
+
+############################
+
+CDEFS = 
+
+# MCU name
+MCU = atmega128
+
+
+# Processor frequency.
+#     This will define a symbol, F_CPU, in all source code files equal to the 
+#     processor frequency. You can then use this symbol in your source code to 
+#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+#     automatically to create a 32-bit value in your source code.
+F_CPU = 16000000
+
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(wildcard *.c)
+
+# List Assembler source files here.
+#     Make them always end in a capital .S.  Files ending in a lowercase .s
+#     will not be considered source files but generated files (assembler
+#     output from the compiler), and will be deleted upon "make clean"!
+#     Even though the DOS/Win* filesystem matches both .s and .S the same,
+#     it will preserve the spelling of the filenames, and gcc itself does
+#     care about how the name is spelled on its command-line.
+ASRC = 
+
+# Optimization level, can be [0, 1, 2, 3, s]. 
+#     0 = turn off optimization. s = optimize for size.
+#     (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+# Debugging format.
+#     Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+#     AVR Studio 4.10 requires dwarf-2.
+#     AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG = 
+# dwarf-2
+
+# List any extra directories to look for include files here.
+#     Each directory must be seperated by a space.
+#     Use forward slashes for directory separators.
+#     For a directory that has spaces, enclose it in quotes.
+EXTRAINCDIRS = 
+
+# Compiler flag to set the C Standard level.
+#     c89   = "ANSI" C
+#     gnu89 = c89 plus GCC extensions
+#     c99   = ISO C99 standard (not yet fully implemented)
+#     gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+
+# Place -D or -U options here
+CDEFS += -DF_CPU=$(F_CPU)UL 
+
+# Place -I options here
+
+
+#---------------- Compiler Options ----------------
+#  -g*:          generate debugging information
+#  -O*:          optimization level
+#  -f...:        tuning, see GCC manual and avr-libc documentation
+#  -Wall...:     warning level
+#  -Wa,...:      tell GCC to pass this to the assembler.
+#    -adhlns...: create assembler listing
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS) $(CINCS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
+CFLAGS += -Wall -Wstrict-prototypes
+CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+CFLAGS += $(CSTANDARD)
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB = 
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB = 
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+MATH_LIB = -lm
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+AR = avr-ar
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+DOXYGEN = doxygen
+WINSHELL = cmd
+
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = --------  end  --------
+MSG_COMPILING = Compiling:
+MSG_CLEANING = Cleaning project:
+
+# Define all object files.
+OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) 
+
+# Define all listing files.
+LST = $(SRC:.c=.lst) $(ASRC:.S=.lst) 
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = rcs
+
+# Default target.
+all: begin build end
+
+dist: all publish
+
+publish:
+	$(COPY) $(TARGET).a $(COLONYROOT)/lib/bin
+	$(COPY) *.h $(COLONYROOT)/lib/include/$(TARGET)
+
+build: $(OBJ)
+	$(AR) $(ALL_ASFLAGS) $(TARGET).a $(OBJ)
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+	@echo
+	@echo $(MSG_BEGIN)
+
+end:
+	@echo $(MSG_END)
+	@echo
+
+# Compile: create object files from C source files.
+%.o : %.c
+	@echo
+	@echo $(MSG_COMPILING) $<
+	$(CC) -c $(ALL_CFLAGS) $< -o $@ 
+
+
+# Target: clean project.
+clean: begin clean_list end
+
+clean_list :
+	@echo
+	@echo $(MSG_CLEANING)
+	$(REMOVE) $(TARGET).a
+	$(REMOVE) $(OBJ)
+	$(REMOVE) $(LST)
+	$(REMOVE) $(SRC:.c=.s)
+	$(REMOVE) $(SRC:.c=.d)
+	$(REMOVEDIR) .dep
+
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
Index: demos/hunter_prey_john/projects/libdragonfly/analog.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/analog.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/analog.c	(revision 1694)
@@ -0,0 +1,371 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file analog.c
+ * @brief Analog input and output
+ *
+ * Contains functions for manipulating the ADC on the Dragonfly board.
+ * 
+ * @author Colony Project, CMU Robotics Club
+ * originally taken from fwr analog file (author: Tom Lauwers)
+ * loop code written by Kevin Woo and James Kong
+ **/
+
+#include <util/delay.h>
+#include <avr/interrupt.h>
+#include "analog.h"
+#include "serial.h"
+// Internal Function Prototypes
+void set_adc_mux(int which);
+
+/**
+ * @defgroup analog Analog
+ * Functions for manipulation the ADC on the dragonfly board.
+ * All definitions may be found in analog.h.
+ *
+ * @{
+ **/
+
+volatile int adc_loop_status = ADC_LOOP_STOPPED;
+volatile int adc_sig_stop_loop = 0;
+volatile int adc_current_port = 0;
+volatile adc_t an_val[11];
+
+/**
+ * Initializes the ADC.
+ * Call analog_init before reading from the analog ports.
+ *
+ * @see analog8, analog10, analog_get8, analog_get10
+ *
+ * @bug First conversion takes a performance penalty of
+ * 25 vs. 13 ADC clock cycles of successive conversions.
+ * Analog_init should run a dummy conversion to pre-empt
+ * this.
+ *
+ * For good 10-bit precision, ACD clock must be between
+ * 50kHz and 200kHz. Currently, ADC clock is fixed at
+ * 125kHz using 1/64prescalar. However, most code uses
+ * 8-bit precision which can work at ADC clock speeds
+ * higher than 200kHz. Experimental tests needed to
+ * determine highest clock speed for accurate 8-bit ADC.
+ *
+ **/
+void analog_init(int start_conversion) {
+	for (int i = 0; i < 11; i++) {
+		an_val[i].adc10 = 0;
+		an_val[i].adc8 = 0;
+	}
+
+	// ADMUX register
+	// Bit 7,6 - Set voltage reference to AVcc (0b01)
+	// Bit 5 - ADLAR set to simplify moving from register
+	// Bit 4 - X
+	// Bit 3:0 - Sets the current channel
+	// Initializes to read from AN1 first (AN0 is reservered for the BOM)
+	ADMUX = 0;
+	ADMUX |= ADMUX_OPT | _BV(MUX0);
+
+	// ADC Status Register A
+	// Bit 7 - ADEN is set (enables analog)
+	// Bit 6 - Start conversion bit is set (must be done once for free-running mode)
+	// Bit 5 - Enable Auto Trigger (for free running mode) NOT DOING THIS RIGHT NOW
+	// Bit 4 - ADC interrupt flag, 0
+	// Bit 3 - Enable ADC Interrupt (required to run free-running mode)
+	// Bits 2-0 - Set to create a clock divisor of 128, to make ADC clock = 8,000,000/64 = 125kHz EDIT: changed to 8MHz
+	ADCSRA = 0;
+	ADCSRA |= _BV(ADEN) | _BV(ADPS0);
+	
+	// Set external mux lines to outputs
+	DDRG |= 0x1C;
+	
+	// Set up first port for conversions
+	set_adc_mux(0x00);
+	adc_current_port = AN1;
+
+	//Start the conversion loop if requested
+	//if (start_conversion)
+		//analog_start_loop();
+		
+	//Conversion loop disabled by default
+}	
+
+/**
+ * Returns the 8-bit analog conversion of which from
+ * the lookup table. If the requested port is the BOM_PORT
+ * you will get an automatic 0 since the BOM_PORT is not
+ * read in the loop and not stored. If you need that port
+ * you should use the functions in bom.c. There is an analog_get8
+ * function which for instant lookups but should be avoided unless
+ * you know what you're doing.
+ *
+ * @param which the port that you want to read
+ *
+ * @bug may cause a seg fault if which is a larger value
+ * than exists in an_val table. Not sure if we should fix
+ * this or not since it would add overhead.
+ *
+ * @return 8-bit analog value for the which port requested
+ *
+ * @see analog10, analog_get8, analog_get10
+ **/
+unsigned int analog8(int which) {
+	if (which == BOM_PORT) {
+		return 0;
+	} else {
+		return an_val[which - 1].adc8;
+	}
+}
+
+/**
+ * Returns the 10-bit analog conversion of which from
+ * the lookup table. If the requested port is the BOM_PORT
+ * you will get an automatic 0 since the BOM_PORT is not
+ * read in the loop and not stored. If you need that port
+ * you should use the functions in bom.c. There is an analog_get10
+ * function which for instant lookups but should be avoided unless
+ * you know what you are doing.
+ *
+ * @param which the port that you want to read
+ *
+ * @bug may cause a seg fault if which is a larger value
+ * than exists in an_val table. Not sure if we should fix
+ * this or not since it would add overhead.
+ *
+ * @return 10-bit analog value for the which port requested
+ *
+ * @see analog8, analog_get8, analog_get10
+ **/
+unsigned int analog10(int which) {
+	if (which == BOM_PORT) {
+		return 0;
+	} else {
+		return an_val[which - 1].adc10;
+	}
+}
+
+/**
+ * Starts the analog update loop. Will continue to run
+ * until analog_stop_loop is called.
+ *
+ * @see analog_stop_loop, analog_loop_status
+ **/
+void analog_start_loop(void) {
+	if(adc_loop_status != ADC_LOOP_RUNNING){
+		//Start the conversion, enable ADC interrupt
+		ADCSRA |= _BV(ADIE);
+		ADCSRA |= _BV(ADSC);
+		adc_loop_status = ADC_LOOP_RUNNING;
+	}
+}
+
+/**
+ * Stops the analog update loop. If there is a current
+ * read, it will finish up and be stored before the loop
+ * is interrupted. No further updates will be made until
+ * the loop is started again.
+ *
+ * @see analog_start_loop, analog_loop_status
+ **/
+void analog_stop_loop() {
+	//Signal to stop after the next conversion
+	adc_sig_stop_loop = 1;
+}
+
+/**
+ * Returns the status of loop. 0 for stopped.
+ * 1 for running. 2 for paused.
+ *
+ * @see analog_start_loop, analog_stop_loop
+ **/
+int analog_loop_status(void) {
+	return adc_loop_status;
+}
+
+/**
+ * Reads an 8-bit number from an analog port.
+ * analog_init must be called before using this function.
+ * The analog loop must also be stopped before using this
+ * function or you will mess up the lookup table. You
+ * must also reenabled the loop when you are done unless
+ * you are doing more instant reads. See analog_stop_loop
+ * and analog_start_loop for more information about the loop.
+ * 
+ * @param which the analog port to read from. One of
+ * the constants AN0 - AN7.
+ *
+ * @return the 8-bit input to the specified port
+ *
+ * @see analog_init, analog_get10, analog8, analog_stop_loop,
+ * analog_start_loop
+ **/
+unsigned int analog_get8(int which) {	
+	// Let any previous conversion finish
+	while (ADCSRA & _BV(ADSC));
+	
+	if(which < EXT_MUX) {
+		ADMUX = ADMUX_OPT + which;
+	} else {
+		ADMUX = ADMUX_OPT + EXT_MUX;
+		set_adc_mux(which - 8);
+	}
+	
+	// Start the conversion
+	ADCSRA |= _BV(ADSC);
+
+	// Wait for the conversion to finish
+	while (ADCSRA & _BV(ADSC));
+
+	return ADCH; //since we left aligned the data, ADCH is the 8 MSB.
+}
+
+/**
+ * Reads an 10-bit number from an analog port.
+ * analog_init must be called before using this function.
+ * The analog loop must also be stopped before using this
+ * function or you will mess up the lookup table. You
+ * must also reenabled the loop when you are done unless
+ * you are doing more instant reads. See analog_stop_loop
+ * and analog_start_loop for more information about the loop.
+ * 
+ *
+ * @param which the analog port to read from. Typically
+ * a constant, one of AN0 - AN7.
+ *
+ * @return the 10-bit number input to the specified port
+ * 
+ * @see analog_init, analog_get8, analog10, analog_stop_loop,
+ * analog_start_loop
+ **/
+unsigned int analog_get10(int which) {
+	int adc_h;
+	int adc_l;
+	
+	// Let any previous conversion finish
+	while (ADCSRA & _BV(ADSC));
+
+	if(which < EXT_MUX) {
+		ADMUX = ADMUX_OPT + which;
+	} else {
+		ADMUX = ADMUX_OPT + EXT_MUX;
+		set_adc_mux(which - 8);
+	}
+	
+	// Start the conversion
+	ADCSRA |= _BV(ADSC);
+
+	// Wait for the conversion to finish
+	while (ADCSRA & _BV(ADSC));
+	
+	adc_l = ADCL;
+	adc_h = ADCH;
+
+	return ((adc_h << 2) | (adc_l >> 6));
+}
+
+/**
+ * Returns the current position of the wheel, as an integer
+ * in the range 0 - 255.
+ * analog_init must be called before using this function.
+ *
+ * @return the orientation of the wheel, as an integer in
+ * the range 0 - 255.
+ *
+ * @see analog_init
+ **/
+int wheel(void) {
+	return analog_get8(WHEEL_PORT);
+}
+
+
+/**
+ * Sets the value of the external analog mux. Values are read
+ * 	on AN7 physical port. (AN8 - AN15 are "virtual" ports).
+ *
+ * @param which which analog mux port (0-7) which corresponds
+ * 		  to AN8-AN15.
+ *
+ * @bug FIX THIS IN THE NEXT BOARD REVISION:
+ *		ADDR2 ADDR1 ADDR0
+ *		G2.G4.G3 set mux to port 0-7 via vinary selection
+ *		math would be much cleaner if it was G4.G3.G2
+ *
+ * @see analog_init
+ **/
+void set_adc_mux(int which) {  
+  // mask so only proper bits are possible.  
+  PORTG = (PORTG & 0xE3) | ((which & 0x03) << 3) | (which & 0x04);
+}
+
+/**@}**/ //end defgroup
+
+
+ISR(ADC_vect) {
+	/*int adc_h = 0;
+	int adc_l = 0;
+	
+	if(adc_loop_status != ADC_LOOP_RUNNING) return;
+
+	//Store the value only if this read isn't for the BOM
+	if (ADMUX != BOM_PORT) {
+		adc_l = ADCL;
+		adc_h = ADCH;
+	
+		an_val[adc_current_port - 1].adc10 = (adc_h << 2) | (adc_l >> 6);
+		an_val[adc_current_port - 1].adc8 = adc_h;
+	}
+	
+	//Skip AN7 because it is not a real port
+	if (adc_current_port == AN6) {
+		ADMUX = ADMUX_OPT | EXT_MUX;
+		set_adc_mux(AN8 - 8);
+		adc_current_port = AN8;
+	//Wrap around
+	} else if (adc_current_port == AN11) {
+		adc_current_port = AN1;
+		ADMUX = ADMUX_OPT | adc_current_port;
+	//Normal increment
+	} else {
+		adc_current_port++;
+	
+		if(adc_current_port < EXT_MUX) {
+			ADMUX = ADMUX_OPT | adc_current_port;
+		} else {
+			ADMUX = ADMUX_OPT | EXT_MUX;
+			set_adc_mux(adc_current_port - 8);
+		}
+	}
+
+	//Stop loop if signal is set
+	if(adc_sig_stop_loop) {
+		adc_sig_stop_loop = 0;
+		adc_loop_status = ADC_LOOP_STOPPED;
+		return;
+	}
+	
+	//Start next conversion
+	ADCSRA |= _BV(ADSC);*/
+}
+
Index: demos/hunter_prey_john/projects/libdragonfly/bom.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/bom.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/bom.c	(revision 1694)
@@ -0,0 +1,651 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file bom.c
+ * @brief Implementation for using the BOM
+ *
+ * Contains functions for using the Bearing and Orientation Module (BOM)
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#include "bom.h"
+#include "dio.h"
+#include "serial.h"
+#include "analog.h"
+
+//On the original BOM1.0, the emmitter angular order does not match the analog mux order
+//so you need to iterate through the mux index in the following order if you want to get
+//the detector readings in order:
+static const char lookup[16] = {7,6,5,0xe,1,4,3,2,0xf,0,0xd,8,0xc,0xb,9,0xa};
+
+
+/* *****************************
+ * BOM Vector Component Tables *
+ **************************** **/
+
+/*
+ * The x component of each BOM detector (indexed from 0 to 15)
+ * was calculated using the following formula:
+ *
+ *		x_comp[i] = fix(25 * cos ( 2 * pi / 16 * i) )
+ *
+ * where "fix" rounds towards 0. If the BOM detectors were superimposed
+ * onto a 2 dimensional Cartesian space, this effectively calculates the
+ * x component of the emitter vector where emitter 0 corresponds to an
+ * angle of 0 radians, 4 -> pi/2, 8 -> pi, ect.
+ */
+static const signed int x_comp[16] = {
+	25,
+	23,
+	17,
+	9,
+	0,
+	-9,
+	-17,
+	-23,
+	-25,
+	-23,
+	-17,
+	-9,
+	0,
+	9,
+	17,
+	23
+};
+
+
+/*
+ * The y component of each BOM detector (indexed from 0 to 15)
+ * was calculated using the following formula:
+ *
+ *		y_comp[i] = fix(25 * sin ( 2 * pi / 16 * i) )
+ *
+ * where "fix" rounds towards 0. If the BOM detectors were superimposed
+ * onto a 2 dimensional Cartesian space, this effectively calculates the
+ * x component of the emitter vector where emitter 0 corresponds to an
+ * angle of 0 radians, 4 -> pi/2, 8 -> pi, ect.
+ */
+static signed int y_comp[16] = {
+	0,
+	9,
+	17,
+	23,
+	25,
+	23,
+	17,
+	9,
+	0,
+	-9,
+	-17,
+	-23,
+	-25,
+	-23,
+	-17,
+	-9
+};
+
+// internal function prototypes
+static void bom_select(char which);
+
+/*
+ Bk R Y (Analog)
+---------
+ Green
+ Blue
+ White
+---------
+ Blue
+ White
+*/
+
+
+/*
+the analog pin definitions from dio.h DO NOT work here,
+so we must use PF0 from avrgcc (as opposed to _PIN_F0).
+BUT the dio pin definitions from dio.h must be used (no PE...).
+
+also, _PIN_E2 is initialized to high for some reason,
+which turns the BOM on when the robot is turned on.
+WORK-AROUND: call digital_output(_PIN_E2,0) at some point.
+
+*/
+
+#define MONKI PF0         //analog (yellow)
+//------------------------//
+#define MONKL _PIN_E2     //green
+#define MONK1 _PIN_E3     //blue
+#define MONK0 _PIN_E4     //white
+//------------------------//
+#define MONK3 _PIN_E6     //blue
+#define MONK2 _PIN_E7     //white
+
+#define BOM_VALUE_THRESHOLD 150 //200
+#define NUM_BOM_LEDS 16
+
+/*
+  *The following pin definitions are for the BOM v1.5
+  */
+
+#define BOM_MODE	_PIN_E2	//dio0
+#define BOM_STROBE	_PIN_E3	//dio1
+
+#define BOM_DATA	_PIN_A0 //servo0
+#define BOM_CLOCK	_PIN_A1	//servo1
+
+#define BOM_S0		_PIN_E5	//dio3
+#define BOM_S1		_PIN_E4	//dio2
+#define BOM_S2		_PIN_E7	//dio4
+#define BOM_S3		_PIN_E6	//dio5
+#define BOM_OUT		PF0		//analog(yellow)
+
+/**
+ * @defgroup bom BOM (Bearing and Orientation Module)
+ * @brief Functions for dealing with the BOM.
+ *
+ * The Bearing and Orientation Module / Barrel of Monkeys / BOM
+ * is a custom sensor designed and built by the Colony Project.
+ * It consists of a ring of 16 IR emitters and 16 IR detectors.
+ * The BOM is most often use to determine the direction of other
+ * robots. This module contains functions for controlling the BOM.
+ *
+ * Include bom.h to access these functions.
+ *
+ * @{
+ **/
+
+static unsigned int bom_val[NUM_BOM_LEDS];
+static volatile char bom_type = BOM10;
+static int select_pins[4];
+static int analog_pin;
+
+/**
+ * Initializes the BOM.
+ * Call bom_init before reading bom values or turning bom leds.
+ *
+ * @bugs INCOMPLETE - No utilization of BOM1.5 RSSI capability. Probably leave this out
+ * until Cornell and Pras return
+ * 
+ * @see bom_refresh, bom_leds_on, bom_leds_off
+ **/
+void bom_init(char type) {
+    bom_type = type;
+    
+    switch(bom_type) {
+    case BOM10:
+		select_pins[0] = MONK0; 
+		select_pins[1] = MONK1;
+		select_pins[2] = MONK2;
+		select_pins[3] = MONK3;
+		analog_pin = MONKI;
+        break;
+    case BOM15:
+        //Sets BOM1.5 to normal [BOM] mode
+        digital_output(BOM_MODE, 0);
+		select_pins[0] = BOM_S0; 
+		select_pins[1] = BOM_S1;
+		select_pins[2] = BOM_S2;
+		select_pins[3] = BOM_S3;
+		bom_set_leds(BOM_ALL);
+		analog_pin = BOM_OUT;
+        break;
+    case RBOM:
+        break;
+    //default:
+    }
+}
+
+/**
+ * Iterates through each bit in the bit_field. For each set bit, sets the corresponding bom select bits
+ *    and updates the corresponding bom value with an analog_get8 reading.  analog_init and bom_init
+ *    must be called for this to work. Must call this before reading BOM values!
+ *
+ *
+ * @param bit_field specifies which elements in bom_val[] should be updated. Use BOM_ALL to refresh all values.
+ *    Ex. if 0x0003 is passed, bom_val[0] and bom_val[1] will be updated.
+ *
+ * @see bom_get
+ **/
+void bom_refresh(int bit_field) {
+    int i;
+	int loop_was_running = 0;
+    
+	//Check analog loop status
+    if(analog_loop_status() == ADC_LOOP_RUNNING) {
+		loop_was_running = 1;
+		analog_stop_loop();
+	}
+    
+	//Read BOM values
+    for(i = 0; i < NUM_BOM_LEDS; i++) {
+        if(bit_field & 0x1) {
+            bom_select(i);
+            bom_val[i] = analog_get8(analog_pin);
+        }
+        bit_field = bit_field >> 1;
+    }
+    
+	//Restore analog loop status
+	if(loop_was_running)
+		analog_start_loop();
+}
+
+/**
+ * Gets the bom reading from bom_val[which].  Call bom_refresh beforehand to read new bom values.
+ *
+ * @pre must call bom refresh first
+ *
+ * @param which which bom value to return
+ *
+ * @return the bom value
+ *
+ * see bom_refresh
+ **/
+int bom_get(int which) {
+	//return bom_val[which];      deleted because we got rid of the analog loop
+	bom_select(which);
+    return analog_get8(analog_pin);
+}
+
+/** 
+ * Compares all the values in bom_val[] and returns the index to the lowest (max) value element.
+ *
+ * @pre must call bom refresh
+ * @return index to the lowest (max) bom value element.  -1 if no value is lower than
+ *    BOM_VALUE_THRESHOLD
+ **/
+int bom_get_max(void) {
+    int i, lowest_val, lowest_i, i_val;
+    lowest_i = -1;
+    lowest_val = 255;
+    for(i = 0; i < NUM_BOM_LEDS; i++) {
+		i_val = bom_get(i);
+        if(i_val < lowest_val) {
+            lowest_val = i_val;
+            lowest_i = i;
+        }
+    }
+    
+    if(lowest_val < BOM_VALUE_THRESHOLD)
+        return lowest_i;
+    else
+        return -1;
+}
+
+/** 
+ * Compute the net resultant BOM IR vector by scaling each IR unit vector by its intensity
+ *		and summing over all IR LEDs.
+ *
+ * @param v  Pointer to Vector struct to be filled by this function with an x and y net vector
+ *		component.
+ *
+ * @param usrBOMvals  Pointer to array which holds 16 raw BOM readings. Can be used if user
+ *		has already collected BOM information. Otherwise, leave as NULL and a new set of data
+ *		will be collected and used.
+ *
+ * @return  Exit status - Zero for success; negative on error.
+ **/
+int bom_get_vector(Vector* v, int* usrBOMvals) {
+
+	/* Store current BOM readings and use them as a weighting factor */
+	int intensity[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+	/* Arrays for storing the weighted x ("Rightness") and y ("Forwardness")
+	 * components. Calculated by multiplying the intensity by the x and y
+	 * component respectively (x and y components are stored in the tables
+	 * above). */
+	int weighted_x_comp[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+	int weighted_y_comp[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+	
+	/* Accumulators to sum up the net x ("Rightness") and y ("Forwardness")
+	 * components for the entire robot. */
+	long net_x_comp = 0;
+	long net_y_comp = 0;
+
+	int i = 0;
+
+	/* BOM intensity is actually measured as more intense = closer to 0 */
+	if (usrBOMvals) {
+		/* Use BOM values collected by user */
+		for (i = 0; i < 16; i++) {
+			intensity[i] = 255 - usrBOMvals[i];
+		}
+	} else {
+		/* Collect new set of BOM data */
+		bom_refresh(BOM_ALL);
+		for (i = 0; i < 16; i++) {
+			intensity[i] = 255 - bom_get(i);
+		}
+	}
+
+	/* Calculate weighted vector components and accumulate vector sum */
+	for (i = 0; i < 16; i++) {
+		weighted_x_comp[i] = intensity[i] * x_comp[i];
+		weighted_y_comp[i] = intensity[i] * y_comp[i];
+		net_x_comp += weighted_x_comp[i];
+		net_y_comp += weighted_y_comp[i];
+	}
+
+	/* Fill the Vector struct */
+	v->x = net_x_comp;
+	v->y = net_y_comp;
+
+	return 0;
+
+}
+
+/** 
+ * Compute the normalized net resultant BOM IR vector by scaling each IR unit vector by its
+ *		intensity and summing over all IR LEDs.
+ *
+ * @param v  Pointer to Vector struct to be filled by this function with an x and y net vector
+ *		component.
+ *
+ * @param usrBOMvals  Pointer to array which holds 16 raw BOM readings. Can be used if user
+ *		has already collected BOM information. Otherwise, leave as NULL and a new set of data
+ *		will be collected and used.
+ *
+ * @return  Exit status - Zero for success; negative on error.
+ **/
+int bom_get_norm_vector(Vector* v, int* usrBOMvals) {
+
+	/* Store current BOM readings and use them as a weighting factor */
+	int intensity[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+	/* Arrays for storing the weighted x ("Rightness") and y ("Forwardness")
+	 * components. Calculated by multiplying the intensity by the x and y
+	 * component respectively (x and y components are stored in the tables
+	 * above). */
+	int weighted_x_comp[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+	int weighted_y_comp[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+	
+	/* Accumulators to sum up the net x ("Rightness") and y ("Forwardness")
+	 * components for the entire robot. */
+	long net_x_comp = 0;
+	long net_y_comp = 0;
+
+	/* Variables used to normalize the net component values */
+	int total_intensity = 0;
+	int normalized_net_x_comp = 0;
+	int normalized_net_y_comp = 0;
+
+	int i = 0;
+
+	/* BOM intensity is actually measured as more intense = closer to 0 */
+	if (usrBOMvals) {
+		/* Use BOM values collected by user */
+		for (i = 0; i < 16; i++) {
+			intensity[i] = 255 - usrBOMvals[i];
+		}
+	} else {
+		/* Collect new set of BOM data */
+		bom_refresh(BOM_ALL);
+		for (i = 0; i < 16; i++) {
+			intensity[i] = 255 - bom_get(i);
+		}
+	}
+
+	/* Calculate weighted vector components and accumulate vector sum */
+	for (i = 0; i < 16; i++) {
+		weighted_x_comp[i] = intensity[i] * x_comp[i];
+		weighted_y_comp[i] = intensity[i] * y_comp[i];
+		net_x_comp += weighted_x_comp[i];
+		net_y_comp += weighted_y_comp[i];
+		total_intensity += intensity[i];
+	}
+
+	/* Normalize the resultant vector components by the total intensity */
+	if (total_intensity > 0) {
+		normalized_net_x_comp = net_x_comp / total_intensity;
+		normalized_net_y_comp = net_y_comp / total_intensity;
+	}
+
+	/* Fill the Vector struct */
+	v->x = normalized_net_x_comp;
+	v->y = normalized_net_y_comp;
+
+	return 0;
+
+}
+
+/** 
+ * Print a histogram which shows the current BOM intensity values for each of the 16 BOM IR
+ *		sensors. The function will attempt to send the histogram data over USB.
+ *
+ * @param curBOMvals  Pointer to an array of the current BOM values (the array must have
+ *		length 16). Use this to print values you have already collected. Otherwise pass in NULL
+ *		and bom_refresh() will be called and the current BOM intensity values will be collected.
+ * @return  Exit status - Zero for success; negative on error.
+ **/
+int bom_print_usb(int* usrBOMvals) {
+
+	int i, j, max = -1;
+	int curVals[16];
+	int* prtValPtr;
+
+	if (usrBOMvals) {
+		/* Use BOM values collected by user */
+		prtValPtr = usrBOMvals;
+
+		/* Find max BOM value from users values */
+		for (i = 0; i < 16; i++) {
+			if (max < prtValPtr[i])
+				max = prtValPtr[i];
+		}
+	} else {
+		/* Refresh and make sure the table is updated */
+		bom_refresh(BOM_ALL);
+
+		/* Record values into an array */
+		for (i = 0; i < 16; i++) {
+			curVals[i] = bom_get(i);
+			if (max < curVals[i])
+				max = curVals[i];
+		}
+
+		/* Use the current set of collected values */
+		prtValPtr = curVals;
+	}
+
+	/* Display results */
+	for (i = 0; i < 16; i++) {
+		
+		usb_puti(i);
+		usb_puts(": ");
+		usb_puti(prtValPtr[i]);
+		usb_putc('\t');
+
+		for (j = 0; j < (int)((max - prtValPtr[i]) / 5); j++) {
+			usb_putc('#');
+		}
+		usb_puts("\r\n");
+	}
+	usb_puts("\r\n");
+
+	return 0;
+
+}
+
+/** 
+ * Computes the weighted average of all the bom readings to estimate the position (and distance) of another robot.
+ *
+ * @pre must call bom refresh
+ * @param dist  pointer to int in which to return the estimated distance to the other robot
+ * @return estimated position of the max bom value element as a fixed point value analogous to 10 times the
+ *        index of the max bom value.  -1 if no value is lower than BOM_VALUE_THRESHOLD.
+ **/
+int bom_get_max10(int *dist) {
+    int i, max;
+    long long mean = 0, sum = 0;
+
+    max = bom_get_max();
+    if (max < 0)
+    {
+        if (dist)
+        {
+            *dist = -1;
+        }
+        return -1;
+    }
+    /* Record values into an array */
+    for (i = 0; i < NUM_BOM_LEDS; i++) {
+        int idx = ((i + (NUM_BOM_LEDS/2 - max) + NUM_BOM_LEDS) % NUM_BOM_LEDS) - (NUM_BOM_LEDS/2 - max);
+        int val = 255 - bom_get(i);
+        mean += idx * val;
+        sum += val;
+    }
+    mean = (mean * 10) / sum;
+    mean = (mean + NUM_BOM_LEDS*10) % (NUM_BOM_LEDS*10);
+
+    if (dist)
+    {
+        *dist = 50 - sum/48;
+    }
+
+    return mean;
+}
+
+/**
+ * Iterates through each bit in the bit_field. If the bit is set, the corresponding emitter will
+ *    be enabled to turn on when bom_on() is called.
+ *    bom_init must be called for this to work. Does nothing if a BOM1.0 is installed
+ *
+ * @param bit_field specifies which leds should be turned on when bom_on is called.  Use BOM_ALL to turn on all bom leds.
+ *    Ex. if 0x0005 is passed, leds 0 and 2 will be turned on.
+ **/
+void bom_set_leds(int bit_field) {
+    int i;
+	unsigned int mask = 1<<(NUM_BOM_LEDS-1);
+	switch(bom_type) {
+    case BOM10:
+        //TODO: put an assert here to alert the user that this should not be called
+        break;
+		
+    case BOM15:
+	    for(i=NUM_BOM_LEDS; i>0; i--)
+	    {
+		    //set the current bit, sending MSB first
+		    digital_output(BOM_DATA, bit_field&mask);
+		    //then pulse the clock
+		    digital_output(BOM_CLOCK, 1);
+		    digital_output(BOM_CLOCK, 0);
+			mask = mask>>1;
+	    }
+        break;
+		
+    case RBOM:
+        //add rbom code here
+        break;
+    }
+}
+
+
+/**
+ * (DEPRECATED) Returns the direction of the maximum BOM reading,
+ * as an integer in the range 0-15. 0 indicates to the
+ * robot's right, while the rest of the sensors are
+ * numbered counterclockwise. This is useful for determining
+ * the direction of a robot flashing its BOM, of only one
+ * robot is currently doing so. analog_init must be called
+ * before this function can be used.
+ *
+ * @return the direction of the maximum BOM reading
+ *
+ * @see analog_init
+ **/
+int get_max_bom(void) {
+    bom_refresh(BOM_ALL);
+    return bom_get_max();
+}
+
+/**
+ * Flashes the BOM.  If using a BOM1.5, only the emitters that have been enabled using
+ * bom_set_leds will turn on.
+ * 
+ * @see bom_off, bom_set_leds
+ **/
+void bom_on(void)
+{
+  switch(bom_type) {
+  case BOM10:
+	digital_output(MONKL, 1);
+	break;
+  case BOM15:
+	digital_output(BOM_STROBE, 1);
+	break;
+  case RBOM:
+	break;
+  }
+}
+
+/**
+ * Turns off all bom leds.
+ * 
+ * @see bom_on
+ **/
+void bom_off(void)
+{
+  switch(bom_type) {
+  case BOM10:
+	digital_output(MONKL, 0);
+	break;
+  case BOM15:
+	digital_output(BOM_STROBE, 0);
+	break;
+  case RBOM:
+	break;
+  }
+}
+
+/** @} **/ //end group
+
+//select a detector to read
+static void bom_select(char which) {
+	if(bom_type == BOM10)
+	  which = lookup[(int)which];
+	
+    if (which&8)
+      digital_output(select_pins[3], 1);
+    else
+      digital_output(select_pins[3], 0);
+
+    if (which&4)
+      digital_output(select_pins[2], 1);
+    else
+      digital_output(select_pins[2], 0);
+
+    if (which&2)
+      digital_output(select_pins[1], 1);
+    else
+      digital_output(select_pins[1], 0);
+
+    if (which&1)
+      digital_output(select_pins[0], 1);
+    else
+      digital_output(select_pins[0], 0);
+	
+}
Index: demos/hunter_prey_john/projects/libdragonfly/rangefinder.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/rangefinder.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/rangefinder.c	(revision 1694)
@@ -0,0 +1,154 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file rangefinder.c
+ * @brief Rangefinders
+ *
+ * Implementation of functions for rangefinder use.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+/*
+  Authors: James Kong and Greg Tress
+
+  Last Modified: 4/30/06 by James
+  -Started log_distance conversion function !!!NOT COMPLETE!!!
+  -Cleaning up comments
+
+  -----------------
+  rangefinder.c
+  Using Sharp GP2D02 IR Rangefinder
+
+  Vin is the input to the rangefinder, designated RANGE_CTRL.
+  Vout is the output from the rangefinder, designated RANGE_IN# where # is the rangefinder you are reading from
+
+  Expected Initial Conditions:
+  Vin is high and Vout should read high.
+
+  Usage:
+  1.) Set Vin low. Vout should read low.
+  2.) Wait for high on Vout.
+  3.) Begin clocking Vin and reading 8 bits from Vout (MSB first).
+  4.) Set Vin high for 2ms or more to turn off rangefinder
+
+*/
+#include <avr/pgmspace.h>
+
+#include "rangefinder.h"
+#include "analog.h"
+#include "dio.h"
+
+/*
+  read_distance returns the 8-bit reading from the rangefinder
+  parameters:
+  range_id - dio pin set as the rangefinder Vout [i.e. RANGE_IN0]
+
+  NOTE:
+  The Sharp GD2D02 returns values on a decreasing logrithmic scale.
+  So higher values correspond to closer distances.  Use linearize_distance to convert to normal centimeter scale.
+  Also, when reading distances closer than 8cm, the Sharp GD2D02 will return lower values than the values at 8cm.
+  At this point, we are only reading from one rangefinder [RANGE_IN0].
+*/
+
+// constants
+/* Nasty IR approximation table
+   I'm using this for the heck of it.  We can do whatever.
+
+   Note the minimum value is .4V (20), and the maximum is 2.6V (133).
+   Gives distance in mm.
+
+   excel formula(valid for inputs 20-133):  ROUND(2353.6*(E2^(-1.1146))*10,0)
+
+   This is only valid for the GP2D12, with objects directly ahead and more than
+   10cm from the detector.  See the datasheet for more information.
+*/
+
+static int IR_dist_conversion[72] PROGMEM = {
+	327,315,303,291,281,271,262,253,245,238,231,224,218,212,206,200,
+	195,190,185,181,177,173,168,165,161,158,155,151,148,145,143,140,
+	137,134,132,130,127,125,123,121,119,117,115,114,111,110,108,106,
+	105,104,102,100,99,98,97,95,94,93,91,90,89,88,87,86,84,83,83,82,
+	81,80,79,78
+};
+
+/**
+ * @defgroup rangefinder Rangefinder
+ * @brief Functions for using the IR rangefinders
+ * 
+ * Functions for using the IR rangefinders.
+ *
+ * @{
+ **/
+
+/**
+ * Initializes the rangefinders. This must be called before
+ * range_read_distance.
+ *
+ * @see range_read_distance
+ **/
+void range_init(void)
+{
+  digital_output(_PIN_B4,0);
+}
+
+/**
+ * Reads the distance measured by one of the rangefinders.
+ * This distance is in arbitrary units.
+ *
+ * @param range_id the rangefinder to use. This should be one
+ * of the constants IR1 - IR5.
+ *
+ * @return the distance measured by the rangefinder
+ *
+ * @see range_init
+ **/
+int range_read_distance(int range_id) {
+  return linearize_distance(analog_get8(range_id));
+}
+
+/**
+ * Transforms distance readings from logarithmic to linear scale.
+ * This probably isn't the function you are looking for.
+ *
+ * Note: pgm_read_word() needs additional testing
+ *
+ * @param value the 8-bit analog value from rangefinder
+ *
+ * @return linearized distance reading from rangefinder (integer in [101,800])
+ **/
+int linearize_distance(int value) {
+  if(value < MIN_IR_ADC8) {
+    return -1;
+  } else if(value > MAX_IR_ADC8) {
+    return -1;
+  } else {
+    return pgm_read_word(&(IR_dist_conversion[value - MIN_IR_ADC8]));
+  }
+}
+
+/** @} **/ //end defgroup
Index: demos/hunter_prey_john/projects/libdragonfly/bom.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/bom.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/bom.h	(revision 1694)
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file bom.h
+ * @brief Definitions for using the BOM
+ * 
+ * This file contains definitions for using the Bearing and 
+ * Orientation Module (BOM).
+ *
+ * @author Colony Project, CMU Robotics Club
+ *
+ **/
+
+#ifndef _BOM_H
+#define _BOM_H
+
+/**
+ * @addtogroup bom
+ * @{
+ **/
+ 
+/** @brief Include all elements in the 16-bit bitfield **/
+#define BOM_ALL 0xFFFF
+
+/** @brief Original BOM - No Range, No Individual LED control **/
+#define BOM10     0
+
+/** @brief BOM 1.5 - No Range, Individual LED control **/
+#define BOM15   1
+
+/** @brief RBOM - Range, Individual LED control **/
+#define RBOM    2
+
+
+/** @brief Struct for storing x and y component vector data. Used by bom_get_vector() functions **/
+typedef struct vector {
+	int x;
+	int y;
+} Vector;
+
+
+/** @brief Initialize the bom according to bom type **/
+void bom_init(char type);
+
+/** @brief Refresh bom_val[] with new values from analog8.  analog_init and bom_init must be called for this to work. **/
+void bom_refresh(int bit_field);
+
+/** @brief Gets the bom reading from bom_val[which].  Call bom_refresh beforehand to read new bom values. **/
+int bom_get(int which);
+
+/** @brief Compares all the values in bom_val[] and returns the index to the highest value element. **/
+int bom_get_max(void);
+
+/** @brief Computes the net resultant BOM IR vector. **/
+int bom_get_vector(Vector*, int*);
+
+/** @brief Computes the normalized net resultant BOM IR vector. **/
+int bom_get_norm_vector(Vector*, int*);
+
+/** @brief Print snapshot of BOM intensity histogram over USB connection **/
+int bom_print_usb(int*);
+
+/** @brief Computes the weighted average of all the bom readings to estimate the position and distance of another robot. **/
+int bom_get_max10(int *dist);
+
+/** @brief Enables the selected bom leds on a BOM1.5 **/
+void bom_set_leds(int bit_field);
+
+/** @brief (DEPRECATED) Gets and compares all bom values.  Returns the index to the highest value element since last refresh. **/
+int get_max_bom(void);
+
+/** @brief Turns on all BOM leds, or turns on enabled leds on a BOM1.5. **/
+void bom_on(void);
+
+/** @brief Turns off all bom leds. **/
+void bom_off(void);
+
+/** @} **/
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/rangefinder.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/rangefinder.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/rangefinder.h	(revision 1694)
@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file rangefinder.h
+ * @brief Contains rangefinder declarations and functions
+ * 
+ * Contains functions and definitions for the use of
+ * IR rangefinders.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _RANGEFINDER_H_
+#define _RANGEFINDER_H_
+
+/**
+ * @addtogroup rangefinder
+ * @{
+ **/
+
+/** @brief IR Rangefinder 1 **/
+#define IR1 6
+/** @brief IR Rangefinder 2 **/
+#define IR2 5
+/** @brief IR Rangefinder 3 **/
+#define IR3 4
+/** @brief IR Rangefinder 4 **/
+#define IR4 3
+/** @brief IR Rangefinder 5 **/
+#define IR5 2
+/** @brief smallest meaningful rangefinder reading (logarithmic scale) **/
+#define MIN_IR_ADC8 27
+/** @brief largest meaningful rangefinder reading (logarithmic scale) **/
+#define MAX_IR_ADC8 98
+
+/** @brief Initialize the rangefinders **/
+void range_init(void);
+/** @brief Read the distance from a rangefinder **/
+int range_read_distance(int range_id);
+/** @brief Convert logarithmic-scale distance readings to a linear scale **/
+int linearize_distance(int value);
+
+/** @} **/ //end addtogroup
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/motor.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/motor.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/motor.c	(revision 1694)
@@ -0,0 +1,174 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file motor.c
+ * @brief Motors
+ *
+ * Implementation of functions for controlling the motors.
+ *
+ * @author Colony Project, CMU Robotics Club
+ * Much of this is taken from FWR's library, author: Tom Lauwers
+ **/
+
+#include "motor.h"
+
+/**
+ * @defgroup motors Motors
+ * @brief Functions for controlling the motors.
+ * Functions for controlling the motors. Found in motor.h.
+ * @{
+ **/
+
+/**
+ * Initializes both motors so that they can be used with future
+ * calls to motor1_set and motor2_set.
+ *
+ * @see motors_off, motor1_set, motor2_set
+ **/
+void motors_init( void ) {
+  // Configure counter such that we use phase correct
+  // PWM with 8-bit resolution
+  PORTA &= 0x0F;
+  DDRA |= 0xF0;
+  DDRB |= 0x60;
+
+  //timer 1A and 1B
+  TCCR1A = _BV(COM1A1) | _BV(COM1B1) | _BV(WGM10);
+  TCCR1B = _BV(WGM12) | _BV(CS10);
+  //	TCCR1A = 0xA1;
+  //	TCCR1B = 0x04;
+  OCR1AH=0;
+  OCR1AL=0;
+  OCR1BH=0;
+  OCR1BL=0;
+}
+
+/**
+ * Sets the speed and direction of the left motor.
+ * motors_init must be called before this function can be used.
+ *
+ * @param direction Either FORWARD or BACKWARD to set the direction of rotation.
+ * @param speed The speed the motor will run at, in the range 0-255.
+ * 
+ * @see motor_r_set, motors_init
+ **/
+void motor_l_set(int direction, int speed) {
+
+  if(direction == 0) {
+    // turn off PWM first if switching directions
+    if((PORTA & 0x30) != 0x10) {
+      OCR1A = 0;
+    }	
+    PORTA = (PORTA & 0xCF) | 0x10;
+    //		PORTD |= 0x10;
+    //		PORTD &= 0xBF;
+  } else {
+    // turn off PWM first if switching directions
+    if((PORTA & 0x30) != 0x20) {
+      OCR1A = 0;
+    }
+    PORTA = (PORTA & 0xCF) | 0x20;
+    //		PORTD |= 0x40;
+    //		PORTD &= 0xEF;
+  }
+	
+  // Set the timer to count up to speed, an 8-bit value
+  OCR1AL = speed;
+}
+
+/**
+ * Sets the speed and direction of the right motor.
+ * motors_init must be called before this function can be used.
+ *
+ * @param direction Either FORWARD or BACKWARD to set the direction of rotation.
+ * @param speed The speed the motor will run at, in the range 0-255.
+ *
+ * @see motor_l_set, motors_init
+ **/
+void motor_r_set(int direction, int speed) {
+  if(direction == 0) {
+    //		PORTD |= 0x20;
+    //		PORTD &= 0x7F;
+    // turn off PWM first if switching directions
+    if((PORTA & 0xC0) != 0x80) {
+      OCR1B = 0;
+    }		
+		
+    PORTA = (PORTA & 0x3F) | 0x80;
+  } else {
+    //		PORTD |= 0x80;
+    //		PORTD &= 0xDF;
+
+    // turn off PWM first if switching directions
+    if((PORTA & 0xC0) != 0x40) {
+      OCR1B = 0;
+    }		
+		
+    PORTA = (PORTA & 0x3F) | 0x40;
+  }
+  OCR1BL = speed;
+}
+
+/**
+ * Sets the speed and direction of motor1.
+ * motors_init must be called before this function can be used.
+ *
+ * @param direction Either FORWARD or BACKWARD to set the direction of rotation.
+ * @param speed The speed the motor will run at, in the range 0-255.
+ *
+ * @see motor2_set, motors_init
+ **/
+void motor1_set(int direction, int speed) {
+	motor_l_set(direction, speed);
+}
+
+/**
+ * Sets the speed and direction of motor2.
+ * motors_init must be called before this function can be used.
+ *
+ * @param direction Either FORWARD or BACKWARD to set the direction of rotation.
+ * @param speed The speed the motor will run at, in the range 0-255.
+ *
+ * @see motor2_set, motors_init
+ **/
+void motor2_set(int direction, int speed) {
+	motor_r_set(direction, speed);
+}
+
+
+/**
+ * Turns off both motors.
+ *
+ * @see motors_init
+ **/
+void motors_off( void ) {
+  OCR1AL = 0x0;
+  OCR1BL = 0x0;
+}
+
+/**@}**///end defgroup
+
Index: demos/hunter_prey_john/projects/libdragonfly/motor.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/motor.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/motor.h	(revision 1694)
@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file motor.h
+ * @brief Contains definitions for controlling the motors
+ *
+ * Contains definitions and functions for controlling
+ * the motors.
+ *
+ * @author Colony Project, CMU Robotics Club
+ * Based on Tom Lauwer's Firefly Library
+ **/
+
+#ifndef _MOTOR_H
+#define _MOTOR_H
+
+#include <avr/io.h>
+/**
+ * @addtogroup motors
+ * @{
+ **/
+
+/** @brief make the motors go forwards **/
+#define FORWARD 1
+/** @brief make the motors go backwards **/
+#define BACKWARD 0
+
+/** @brief Initialize the motors **/
+void motors_init(void);
+/** @brief Set speed and direction of motor1 
+ *  @deprecated use the left motor function instead. it's more intuitive and easier to read.**/
+void motor1_set(int direction, int speed);
+/** @brief Set speed and direction of motor2 
+ *  @deprecated use the right motor function instead. it's more intuitive and easier to read.**/
+void motor2_set(int direction, int speed);
+/** @brief Set speed and direction of left motor **/
+void motor_l_set(int direction, int speed);
+/** @brief Set speed and direction of right motor **/
+void motor_r_set(int direction, int speed);
+/** @brief Turn the motors off **/
+void motors_off(void);
+
+/**@}**/ // end addtogroup
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/i2c.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/i2c.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/i2c.c	(revision 1694)
@@ -0,0 +1,345 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file i2c.c
+ * @brief Implemenation of I2C communications protocol
+ * 
+ * In the case where you have master sends and then a master request to the same
+ * address, you will not give up control of the line because the send and
+ * request addresses are seen as different addresses. In between it will send a
+ * restart but will not give up the line.
+ *
+ * @author CMU Robotics Club, Kevin Woo, Sursh Nidhiry
+ * @bug Not tested.
+ */
+
+#include <avr/interrupt.h>
+#include <util/twi.h>
+
+#include "i2c.h"
+#include "ring_buffer.h"
+
+/**
+ * @defgroup i2c I2C 
+ *
+ * @brief Provides Inter-Interconnected-Communications (I2C)
+ * 
+ * Initiates I2C functions on an ATMega128 which has a fully hardware Two Wire 
+ * Interface (TWI) module. Any Atmel chip with this hardware should be able to
+ * use the software.
+ *
+ * This code will operate in a multi-master enviornment and can be either a
+ * slave or a master at any time (as long as they are not one or the other at
+ * the moment. You can queue up multiple transmission modes in the buffer up to 
+ * the buffer size. The buffer is implemented as a ring buffer.
+ *
+ * It is implemented using callback functions. Whenever you want to send a packet
+ * you can call the built in send function (as a master) and it will send an array
+ * of bytes. Master recieve and slave send/receive are all handled by the call back
+ * functions. It is up to the end user to create functions that will handle the
+ * receiving of packets. Their functions will be called with every byte recieved
+ * so you must either buffer the inputs or handle each one separately.
+ *
+ * On errors we will simply flush the entire buffer.
+ * 
+ * For information on how I2C operates, read the wikipedia article
+ * http://en.wikipedia.org/wiki/I2c
+ * for a good explanation of how it works.
+ * @{
+ */
+
+/** 
+ * @brief Set bit rate 12 = 100kbit/s (max speed setting is 10 for an
+ *  8 MHz clock). It is a divider, so the lower the number the faster the speed.
+ */
+#define I2C_BIT_RATE_DIVIDER 0x0C
+
+static int start_flag;
+
+static fun_mrecv_t master_recv_function;
+static fun_srecv_t slave_recv_function;
+static fun_send_t slave_send_function;
+
+RING_BUFFER_NEW(i2c_buffer, 128, char, i2c_write_buff, i2c_addr_buff);
+
+
+/**
+ * @brief Initializes the i2c module.
+ *
+ * Initializes the I2C module to start listening on the i2c lines. If the callback functions
+ * are not set to null they will be called when that transmission mode is called. The address
+ * is your address that you will listen to when you are not the master.
+ *
+ * @param addr 			Your address on the I2C bus.
+ * @param master_recv 	The address of the function to call when you receive a byte when you are a
+ *                    	master.
+ * @param slave_recv 	The address of the function to call when you are a slave you receive data
+ *								from the master
+ * @param slave_send		The address of the function to call when you are a slave and the master
+ *								requests data from you.
+ *
+ * @return 0 for success, nonzero for failure
+ **/
+int i2c_init(char addr, fun_mrecv_t master_recv, fun_srecv_t slave_recv, fun_send_t slave_send) {
+    master_recv_function = master_recv;
+    slave_recv_function = slave_recv;
+    slave_send_function = slave_send;
+
+    RING_BUFFER_CLEAR(i2c_write_buff);
+    RING_BUFFER_CLEAR(i2c_addr_buff);
+  
+    /* enables twi interrupt, automatic ack sending, and all twi hardware */
+    TWCR =  (_BV(TWEA) | _BV(TWEN) | _BV(TWIE));
+
+    /* sets the bit rate of data transmission */
+    TWBR = I2C_BIT_RATE_DIVIDER;
+
+    /* sets the address (it is stored in the 7 most significant bits) and allows
+     * global messages to be accepted */
+    TWAR = (addr << 1) | 1;
+  
+    return 0;
+}
+
+/**
+ * @brief Sends a byte array over I2C as a master
+ *
+ * Will perform a send over I2C to the destination from data for the ammount of
+ * bytes that bytes is.
+ *
+ * @param dest		Destination address of the data on the I2C bus.
+ * @param data 	The pointer to the byte array of data
+ * @param bytes	The amount of bytes long that the byte array is. This is how
+ *						many bytes from the array that the function will send.
+ *
+ * @return zero for success, nonzero for failure
+ **/
+int i2c_send(char dest, char *data, unsigned int bytes) {
+    int i;
+
+    /* adding data to be sent to ring buffers is not atomic,
+     * so disable interrupts */
+    cli();
+    for(i = 0; i < bytes; i++) {
+        if(RING_BUFFER_FULL(i2c_write_buff)) {
+            sei();
+            return -1;
+        }
+
+        RING_BUFFER_ADD(i2c_write_buff, data[i]);
+        RING_BUFFER_ADD(i2c_addr_buff, dest << 1);
+    }
+    
+    /* re-enable the interrupts */
+    sei();
+    
+    /* send the start bit, only if this device is not currently master */
+    if(!start_flag) {
+        start_flag = 1;
+        TWCR |= _BV(TWSTA);
+        TWCR |= _BV(TWINT);
+    }
+  
+    return 0;
+}
+ 
+/**
+ * @brief Send a master request to the destination
+ *
+ * Sends a request of data from the target address and calls
+ * the callback function to handle data as it comes in. This function will
+ * not work if the slave has not informationt to send or has nothing implemented
+ * to send it.
+ *
+ * @param dest		The destination that we want to receive information from.
+ *
+ * @return 0 for success, nonzero for failure
+ **/ 
+int i2c_request(char dest) {
+    if(RING_BUFFER_FULL(i2c_write_buff))
+        return -1;
+  
+    RING_BUFFER_ADD(i2c_write_buff, 0);
+    RING_BUFFER_ADD(i2c_addr_buff, (dest << 1) | 1);
+  
+    if(!start_flag) {
+        start_flag = 1;
+        TWCR |= _BV(TWSTA);
+        TWCR |= _BV(TWINT);
+    }
+  
+    return 0;
+}
+
+/** @} **/
+ 
+/**
+ * @brief Interrupt to handle I2C interrupts from the I2C hardware.
+ * 
+ * Uses the status codes from the I2C register to handle the events
+ * needed to advance in I2C stages. For instance, you will get a bit for
+ * receiving a start ack, then a address ack, then a data ack, etc.
+ * The events are handled in each switch case. The status codes are defined
+ * by avr-gcc in /util/twi.h but are the same codes as the Atmel documentation.
+ *
+ * Bytes are sent by popping off the ring buffer. It also will keep track
+ * of what modes the send is in.
+ *
+ * Errors are handled here as well.
+ **/ 
+ISR(TWI_vect) {
+	static char data_to_send;
+	static char addr_to_send = -1;
+	char addr, statusCode;
+  
+	//Get status code (only upper 5 bits)
+	statusCode = (TWSR & 0xF8);
+
+    switch (statusCode) {
+        //Start sent successfully
+        case TW_START:
+        case TW_REP_START:
+            /* Send address and write
+             * ring_buffer will not be empty */
+            RING_BUFFER_REMOVE(i2c_addr_buff, addr_to_send);
+            RING_BUFFER_REMOVE(i2c_write_buff, data_to_send);
+            
+            /* first send the address */
+            TWDR = addr_to_send; 
+            
+            //Turn off start bits
+            TWCR &= ~_BV(TWSTA);
+            break;
+
+        //Master Transmit - Address sent succesfully
+        case TW_MT_SLA_ACK:
+        //Send byte
+            TWDR = data_to_send;
+            PORTG &= ~_BV(PG2);
+            break;
+	 
+        //Master Transmit - Data sent succesfully
+        case TW_MT_DATA_ACK:    
+            //If there is still data to send
+            if(!RING_BUFFER_EMPTY(i2c_write_buff)) {
+                RING_BUFFER_PEEK(i2c_addr_buff, addr);
+        
+                //Still data for this address
+                if (addr == addr_to_send) {
+                    RING_BUFFER_REMOVE(i2c_addr_buff, addr);
+                    RING_BUFFER_REMOVE(i2c_write_buff, TWDR);
+                    break;
+                //No more data for this address, data for another address -> resend start
+                } else {
+                    TWCR |= _BV(TWSTA);
+                    break;
+                }
+            }
+            /* there are no bytes to send */
+            TWCR |= _BV(TWSTO);
+            start_flag = 0;
+            break; 
+            
+        //Master Transmit - Slave sends a nack, transmit is done
+        case TW_MT_DATA_NACK:
+            PORTG |= _BV(PG2);
+            TWCR |= _BV(TWSTO);
+            start_flag = 0;
+            break;
+    
+        //Master Receive - Address sent succesfully
+        case TW_MR_SLA_ACK:
+            PORTG |= _BV(PG2);
+            break;
+            
+        //Master Receive - Data received succesfully
+        case TW_MR_DATA_ACK:
+            if(master_recv_function) {
+                if(!master_recv_function(TWDR)) {
+                    TWCR &= ~_BV(TWEA);
+                }
+            }
+            break;
+            
+        //Master Receive - Slave sends a nack, transmission is done    
+        case TW_MR_DATA_NACK:
+            TWCR |= _BV(TWEA);
+      
+            //If there is still data to send
+            if(!RING_BUFFER_EMPTY(i2c_write_buff)) {
+                TWCR |= _BV(TWSTA);
+                break;
+            }
+      
+            /* there are no bytes to send */
+            TWCR |= _BV(TWSTO);
+            start_flag = 0;  
+            break;
+    
+        //Slave Transmit - Address received
+        case TW_ST_SLA_ACK:
+            break;
+    
+        //Slave Transmit - Nack received, no data requsted
+        case TW_ST_DATA_NACK:
+            break;
+        
+        //Slave Transmit - Data requested, ack received
+        case TW_ST_DATA_ACK:
+            if (slave_send_function) {
+                TWDR = slave_send_function();
+            }
+            break;
+    
+        //Slave Receive - Address received  
+        case TW_SR_SLA_ACK:
+            break;
+    
+        //Slave Receive - Data received, ack returned
+        case TW_SR_DATA_ACK:
+            if(slave_recv_function) {
+                slave_recv_function(TWDR);
+            }
+            
+            break;
+      
+        //Stop sent  
+        case TW_SR_STOP:
+            break;
+	
+        //Problem on the bus, reset everything
+        default:
+            TWCR |= _BV(TWSTO);
+            start_flag = 0;
+            RING_BUFFER_CLEAR(i2c_write_buff);
+            RING_BUFFER_CLEAR(i2c_addr_buff);  	
+    }
+  
+  /* Toggle TWINT so that it resets and executes the commands */
+  TWCR |= _BV(TWINT);
+}
+
Index: demos/hunter_prey_john/projects/libdragonfly/serial.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/serial.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/serial.c	(revision 1694)
@@ -0,0 +1,355 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file serial.c
+ * @brief Serial Input and Output
+ *
+ * Implementation of functions for serial input and output.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#include <avr/io.h>
+#include "serial.h"
+
+#ifdef USE_STDIO
+
+#include <stdio.h>
+
+/**
+ * For use with fprintf() and related stdio functions
+ **/
+FILE *usb_fd;
+
+/**
+ * For use with fprintf() and related stdio functions
+ **/
+FILE *xbee_fd;
+
+#endif
+
+/**
+ * Initializes communication over the USB serial port.
+ * This must be called before any other usb function
+ * may be used.
+ **/
+void usb_init() {
+  //Set baud rate
+  // - 115200 (both wired and wireless) is UBRR=8, U2X=1
+  // - 9600 is U2X =1, UBRR = 107.
+#if (USB_BAUD == 115200)
+  UBRR0H = 0x00;
+  UBRR0L = 8;
+  UCSR0A |= _BV(U2X0);
+#elif (USB_BAUD == 9600)
+  UBRR0H = 0x00;
+  UBRR0L = 103;
+  UCSR0A |= _BV(U2X0);
+#else //Baud rate is defined in the header file, we should not get here
+  return;
+#endif
+
+  /*Enable receiver and transmitter */
+  UCSR0B |= (1<<RXEN0)|(1<<TXEN0);
+	
+  /* Set frame format: 8data, 1stop bit, asynchronous normal mode */
+  UCSR0C |= (1<<UCSZ00) | (1<<UCSZ01);
+  
+  // if we have enabled the stdio stuff, then we init it here
+#ifdef USE_STDIO
+  /* Open the stdio stream corresponding to this port */
+  usb_fd = fdevopen(usb_putc, usb_getc);
+#endif
+}
+
+/**
+ * Initializes communication over the XBee.
+ * This must be called before any other xbee function
+ * may be used.
+ **/
+void xbee_init() {
+  //Set baud rate
+  // - 115200 (both wired and wireless) is UBRR=8, U2X=1
+  // - 9600 is U2X =1, UBRR = 107.
+#if (XBEE_BAUD == 115200)
+  UBRR1H = 0x00;
+  UBRR1L = 8;
+  UCSR1A |= _BV(U2X1);
+#elif (XBEE_BAUD == 9600)
+  UBRR1H = 0x00;
+  UBRR1L = 103;
+  UCSR1A |= _BV(U2X1);
+#else //Baud rate is defined in the header file, we should not get here
+  return;
+#endif
+
+  //Enable receiver and transmitter
+  UCSR1B |= (1<<RXEN1)|(1<<TXEN1);
+	
+  // Set frame format: 8data, 1stop bit, asynchronous normal mode
+  UCSR1C |= (1<<UCSZ10) | (1<<UCSZ11);
+  
+  // if we have enabled the stdio stuff, then we init it here
+#ifdef USE_STDIO
+  /* Open the stdio stream corresponding to this port */
+  xbee_fd = fdevopen(xbee_putc, xbee_getc);
+#endif
+}
+
+/**
+ * Sends a character over USB.
+ *
+ * @param c the character to send
+ * @return 0 for success, nonzero for failure
+ **/
+int usb_putc(char c) {
+  // Wait until buffer is clear for sending
+  loop_until_bit_is_set(UCSR0A, UDRE0);
+	
+  // Load buffer with your character
+  UDR0 = c;
+  return 0;
+}
+
+/**
+ * Sends a character to the XBee.
+ *
+ * @param c the character to send
+ * @return 0 for success, nonzero for failure
+ **/
+int xbee_putc(char c) {
+  // Wait until buffer is clear for sending
+  loop_until_bit_is_set(UCSR1A, UDRE1);
+	
+  // Load buffer with your character
+  UDR1 = c;
+  return 0;
+}
+
+/**
+ * Sends a sequence of characters over USB.
+ *
+ * @param s the string to send
+ * @return 0 for success, nonzero for failure
+ **/
+int usb_puts(char *s) {
+  char *t = s;
+  while (*t != 0) {
+    usb_putc(*t);
+    t++;
+  }
+  return 0;
+}
+
+/**
+ * Sends a sequence of characters from program space over USB.
+ *
+ * @param s the string to send
+ **/
+void usb_puts_P (PGM_P s) {
+    char buf;
+	
+    while (memcpy_P (&buf, s, sizeof (char)), buf!=0) {
+        usb_putc (buf);
+        s++;
+    }
+}
+
+
+
+/**
+ * Returns the first character in the buffer received from USB.
+ * This function blocks execution until a character has been received.
+ * xbee_init must be called before this function may be used.
+ * 
+ * @return the first character in the usb buffer
+ *
+ * @see usb_init, usb_getc_nb
+ **/
+int usb_getc(void) {
+  // Wait for the receive buffer to be filled
+  loop_until_bit_is_set(UCSR0A, RXC0);
+	
+  // Read the receive buffer
+  return UDR0;
+}
+
+/**
+ * Returns the first character in the buffer received from USB.
+ * This function blocks execution until a character has been
+ * received. xbee_init must be called before this function
+ * may be used.
+ * 
+ * @return the first character in the xbee buffer
+ * 
+ * @see xbee_init, xbee_getc_nb
+ **/
+int xbee_getc(void) {
+  // Wait for the receive buffer to be filled
+  loop_until_bit_is_set(UCSR1A, RXC1);
+	
+  // Read the receive buffer
+  return UDR1;
+}
+
+/**
+ * Non blocking version of usb_getc. If a character is present in the buffer,
+ * it is returned, otherwise -1 is returned immediately. usb_init must be
+ * called before this function can be used.
+ *
+ * @param c the received character. This will be set if a character has
+ * been received.
+ * 
+ * @return -1 if no character is available, 0 otherwise
+ * 
+ * @see usb_init, usb_getc
+ **/
+int usb_getc_nb(char *c) {
+  // check if the receive buffer is filled
+  if (UCSR0A & _BV(RXC0)) {
+    // Read the receive buffer
+    (*c) = UDR0;
+    return 0;
+  } else {
+    // Return empty
+    return -1;
+  }
+}
+
+/**
+ * Non blocking version of xbee_getc. If a character is present in the buffer,
+ * it is returned, otherwise -1 is returned immediately. xbee_init
+ * must be called before this function can be used.
+ *
+ * @param c the received character. This will be set if a character has
+ * been received.
+ * 
+ * @return -1 if no character is available, 0 otherwise
+ *
+ * @see xbee_init, xbee_getc
+ **/
+int xbee_getc_nb(char *c) {
+  // check if the receive buffer is filled
+  if (UCSR1A & _BV(RXC1)) {
+    // Read the receive buffer
+    (*c) = UDR1;
+    return 0;
+  } else {
+    // Return empty
+    return -1;
+  }
+}
+
+
+/*
+  prints an int to serial
+
+  code adapted from Chris Efstathiou's code (hendrix@otenet.gr)
+  uses usb_putc
+*/
+/**
+ * Prints an integer, converted to ASCII, to usb. usb_init must be called
+ * before this function can be used.
+ *
+ * @param value the integer to print
+ * 
+ * @return 0 if successful, nonzero otherwise
+ *
+ * @see usb_init, usb_putc
+ **/
+int usb_puti(int value ) {
+  unsigned char usb_data[6]={'0','0','0','0','0','0' }, position=sizeof(usb_data), radix=10; 
+
+  /* convert int to ascii  */ 
+  if(value<0) { 
+    usb_putc('-'); 
+    value=-value; 
+  }    
+  do { 
+    position--; 
+    *(usb_data+position)=(value%radix)+'0'; 
+    value/=radix;  
+  } while(value); 
+
+    
+  /* start displaying the number */
+  for(;position<=(sizeof(usb_data)-1);position++) {
+            
+    usb_putc(usb_data[position]);
+  }
+
+  return 0;
+}
+
+/**
+ * Determines a hexadecimal digit in ASCII code.
+ *
+ * @param value the value of the digit (0<=value<=15)
+ * 
+ * @return the hexadecimal digit in ASCII code, or '?'
+ * if the input is invalid.
+ **/
+uint8_t hex_digit (uint8_t value)
+{
+    if (value>15) return '?';
+    // Postcondition: 0<=x<=15
+
+    return "0123456789ABCDEF"[value];
+}
+
+/**
+ * Prints a fixed width hexadecimal representation of an unsigned
+ * 16 bit integer in ASCII code to USB.
+ * usb_init must be called before this function can be used.
+ *
+ * @param value the value to print
+ * 
+ * @see usb_init, usb_puti, usb_puts, usb_puth8, hex_digit
+ **/
+void usb_puth16 (uint16_t value)
+{
+    usb_putc (hex_digit((value >>12)&0xF));
+    usb_putc (hex_digit((value >>8 )&0xF));
+    usb_putc (hex_digit((value >>4 )&0xF));
+    usb_putc (hex_digit( value      &0xF));
+}
+
+/**
+ * Prints a fixed width hexadecimal representation of an unsigned
+ * 8 bit integer in ASCII code to USB.
+ * usb_init must be called before this function can be used.
+ *
+ * @param value the value to print
+ * 
+ * @see usb_init, usb_puti, usb_puts, usb_puth16, hex_digit
+ **/
+void usb_puth8(uint8_t value)
+{
+    usb_putc (hex_digit ((value)>>4 &0xF));
+    usb_putc (hex_digit ( value     &0xF));
+}
+
Index: demos/hunter_prey_john/projects/libdragonfly/dragonfly_lib.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/dragonfly_lib.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/dragonfly_lib.h	(revision 1694)
@@ -0,0 +1,118 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file dragonfly_lib.h
+ * @brief Contains other include files
+ * 
+ * Include this file for all the functionality of libdragonfly.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _DRAGONFLY_LIB_H_
+#define _DRAGONFLY_LIB_H_
+
+/**
+ * @addtogroup dragonfly
+ * @{
+ **/
+
+// Configuration definitions
+/** @brief Initialize analog **/
+#define ANALOG 0x01
+/** @brief Initialize serial communications **/
+#define SERIAL 0x02
+/** @brief Initialize USB communications **/
+#define USB    0x02
+/** @brief Initialize communications **/
+#define COMM   0x02
+/** @brief Initialize the orb **/
+#define ORB    0x04
+/** @brief Initialize the motors **/
+#define MOTORS 0x08
+/** @brief Initialize I2C **/
+#define I2C    0x20
+/** @brief Initialize the buzzer **/
+#define BUZZER 0x40
+/** @brief Initialize the LCD screen **/
+#define LCD    0x80
+/** @brief Initialize the rangefinders **/
+#define RANGE  0x0100
+/** @brief Initialize the BOM **/
+#define BOM  0x0200
+/** @brief Initilize encoders **/
+#define ENCODERS 0x400
+/** @brief Initialize everything  **/
+#define ALL_ON 0x07FF
+
+/** @brief Initialize the board **/
+void dragonfly_init(int config);
+
+/** @} **/ //end addtogroup
+
+#include <inttypes.h>
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include <util/twi.h>
+
+// This file is included from the libdragonfly directory because it seems to be
+// missing from the AVR libc distribution.
+#include "atomic.h"
+
+#include "analog.h"
+#include "dio.h"
+#include "time.h"
+#include "lcd.h"
+#include "lights.h"
+#include "motor.h"
+#include "serial.h"
+#include "buzzer.h"
+#include "rangefinder.h"
+#include "bom.h"
+#include "encoders.h"
+#include "move.h"
+#include "reset.h"
+#include "math.h"
+#include "eeprom.h"
+
+#include <stddef.h>
+#include <stdbool.h>
+
+/** @brief shortcut for ATOMIC_BLOCK(ATOMIC_RESTORESTATE) **/
+#define SYNC ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
+
+/** @brief atomically grab a lock if it is free, return otherwise **/
+#define REQUIRE_LOCK_OR_RETURN(LOCK) do { SYNC { if (LOCK) return; LOCK=1; } } while (0)
+
+/** @brief atomically release a lock **/
+#define RELEASE_LOCK(LOCK) do { LOCK=0; } while (0)
+
+
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/serial.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/serial.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/serial.h	(revision 1694)
@@ -0,0 +1,146 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file serial.h
+ * @brief Contains declarations for serial input and output
+ *
+ * Contains definitions for serial input and output.
+ *
+ * @author Colony Project, CMU Robotics Club
+ * Based on Tom Lauwer's Firefly Library
+ *
+ **/
+
+/*
+  serial.h - Contains definitions and function prototypes for the RS232 serial port
+  author(s): pkv
+  
+  Directions:
+  Call the initialization function for the serial port you wish to use.  Then, use
+  either the provided functions or the stdio functions (fprintf, etc) to read and
+  write characters to the serial ports.
+  
+  UART Mapping:
+  usb_*() -> UART0
+  xbee_*() -> UART1
+  
+  Options: (Add the following defines to your code to configure this library)
+  #define USB_BAUD { 115200 | 9600 } <= pick ONE value from in here
+  #define XBEE_BAUD { 115200 | 9600 } <= pick ONE value from in here
+  #define USE_STDIO
+  
+  Note: If you enable USE_STDIO, the first init function that is called will 
+  automatically be linked to stdin, stdout, and stderr.  To use the baud rate 
+  commands, add something like the following to your code:
+  
+  #define FOO_BAUD 9600
+  
+  **UNLESS YOU KNOW WHAT YOU ARE DOING, PLEASE DO NOT CHANGE THIS FILE**
+  Many, many other people use this file in their code.  If you change it, you will
+  probably break all of their nice code.  You should not need to change anything in
+  here, except to accomodate new hardware.
+*/
+
+#ifndef _SERIAL_H
+#define _SERIAL_H
+
+#include <inttypes.h>
+#include <avr/pgmspace.h>
+
+/**
+ * @defgroup usb USB Input / Output
+ * @brief Functions for USB input / output
+ *
+ * Low level functions for USB input and output.
+ *
+ * @{
+ **/
+
+// if no baud rate is defined for usb, default is set here
+#ifndef USB_BAUD
+/** @brief the USB baud rate **/
+#define USB_BAUD 115200
+#endif
+
+/** @brief Initialize the USB **/
+void usb_init(void);
+/** @brief Print a character to USB **/
+int usb_putc(char c);
+/** @brief Read a character from USB **/
+int usb_getc(void);
+/** @brief Read a character from USB without blocking **/
+int usb_getc_nb(char *c);
+/** @brief Print a string to USB **/
+int usb_puts(char *s);
+/** @brief Print a string from program space to USB **/
+void usb_puts_P (PGM_P s);
+/** @brief Print an integer to USB **/
+int usb_puti(int value);
+/** @brief Determine a hexadecimal digit **/
+uint8_t hex_digit (uint8_t value);
+/** @brief Print a fixed width hexadecimal representation to USB **/
+void usb_puth16 (uint16_t value);
+/** @brief Print a fixed width hexadecimal representation to USB **/
+void usb_puth8(uint8_t value);
+/** @brief Alias for usb_puth16 **/
+static inline void usb_puth (uint16_t value) { usb_puth16 (value); };
+
+
+/** @} **/ //end addtogroup
+
+/**
+ * @defgroup xbee XBee Input / Output
+ * @brief Functions for XBee input / output
+ *
+ * Low level functions for XBee input and output.
+ *
+ * @{
+ **/
+
+// if no baud rate is defined for usb, default is set here
+
+// if no baud rate is defined for xbee, default is set here
+#ifndef XBEE_BAUD
+/** @brief the XBee baud rate **/
+#define XBEE_BAUD 9600
+#endif
+
+/** @brief Initialize the XBee **/
+void xbee_init(void);
+/** @brief Print a character to the XBee **/
+int xbee_putc(char c);
+/** @brief Read a character from the XBee **/
+int xbee_getc(void);
+/** @brief Read a character from the XBee without blocking **/
+int xbee_getc_nb(char *c);
+
+
+
+/** @} **/ //end addtogroup
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/eeprom.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/eeprom.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/eeprom.c	(revision 1694)
@@ -0,0 +1,55 @@
+#include <avr/io.h>
+#include "eeprom.h"
+
+int eeprom_put_byte(unsigned int uiAddress, unsigned char ucData) {
+    /* Wait for completion of previous write */
+    while(EECR & (1<<EEWE));
+    /* Set up address and data registers */
+    EEAR = uiAddress;
+    EEDR = ucData;
+    /* Write logical one to EEMWE */
+    EECR |= (1<<EEMWE);
+    /* Start eeprom write by setting EEWE */
+    EECR |= (1<<EEWE);
+    
+    return 0;
+}
+
+int eeprom_get_byte(unsigned int uiAddress, unsigned char *byte) {
+    /* Wait for completion of previous write */
+    while(EECR & (1<<EEWE));
+    /* Set up address register */
+    EEAR = uiAddress;
+    /* Start eeprom read by writing EERE */
+    EECR |= (1<<EERE);
+    /* get data from data register */
+    *byte=EEDR;
+    
+    return 0;
+}
+
+
+unsigned char get_robotid(void) {
+    unsigned char c0, c1, c2;
+    
+    eeprom_get_byte(EEPROM_ROBOT_ID_ADDR, &c0);
+    eeprom_get_byte(EEPROM_ROBOT_ID_ADDR+1, &c1);
+    eeprom_get_byte(EEPROM_ROBOT_ID_ADDR+2, &c2);
+    if(c0 == 'I' && c1 == 'D')
+        return c2;
+    else
+        return 0xFF;
+}
+
+unsigned char get_bom_type(void) {
+    unsigned char c0, c1, c2, c3;
+    
+    eeprom_get_byte(EEPROM_BOM_TYPE_ADDR, &c0);
+    eeprom_get_byte(EEPROM_BOM_TYPE_ADDR+1, &c1);
+    eeprom_get_byte(EEPROM_BOM_TYPE_ADDR+2, &c2);
+    eeprom_get_byte(EEPROM_BOM_TYPE_ADDR+3, &c3);
+    if(c0 == 'B' && c1 == 'O' && c2 == 'M')
+        return c3;
+    else
+        return 0xFF;
+}
Index: demos/hunter_prey_john/projects/libdragonfly/spi.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/spi.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/spi.c	(revision 1694)
@@ -0,0 +1,73 @@
+/**
+ * @file spi.c
+ * @brief Basic SPI module to handle encoders
+ * @author Colony Project, CMU Robotics Club
+ *	Need to move spi.h include into dragonfly_lib.h when stable
+ **/
+
+#include <avr/interrupt.h>
+#include "spi.h"
+
+
+static volatile char spi_bytes; /* number of bytes to read */
+static spi_fun_recv_t spi_recv_func; /* byte handler */
+static spi_fun_recv_complete_t spi_recv_complete_func; /*transmission completion handler */
+
+/** 
+* @brief Initialize SPI hardware for communication.
+* 
+* @param recv_func The function to be called for each byte of data received.
+* @param recv_complete_func  The function to be called at the end of a complete transmission.
+*/
+void spi_init (spi_fun_recv_t recv_func, spi_fun_recv_complete_t recv_complete_func)
+{
+    /*  Enable Interrupt, Enable SPI Module, MSB First, Master Mode, Clock div = 64 */
+    SPCR = _BV(SPE) | _BV(SPIE) /*| _BV(DORD)*/ | _BV(MSTR) | _BV(SPR1) | _BV(SPR0);
+    SPSR = _BV(SPI2X); 
+
+    /* Set SCLK, SS, MOSI as outputs. MISO as input */
+    DDRB |= MOSI | SCLK | SS;
+    DDRB &= ~MISO;
+    
+    /* Keep SS high until transmit */
+    PORTB |= SS;
+
+    /* set function to be executed when we receive a byte */
+    spi_recv_func = recv_func;
+    spi_recv_complete_func = recv_complete_func;
+    spi_bytes = 0;
+    //usb_puts("\tspi.c Debug: SPI INITIALIZED\n");
+}
+
+/** 
+* @brief Transfer a given byte to slave and receive a byte 
+* 
+* @param bytes The number of bytes to be transferred.
+**/
+void spi_transfer(char bytes)
+{
+    spi_bytes = bytes;
+    PORTB &= ~SS; /* Set SS low to initiate transmission */
+    SPDR = 0xff; /* Initiate data transmision */
+}
+
+ISR(SIG_SPI) 
+{
+	//usb_puts("Interrupt");
+    /* only handle intterupt when we are expecting data */
+    if(spi_bytes > 0){
+	/* process byte */
+	spi_recv_func(SPDR);
+	/* if we've read all the bytes, set SS high to end transmission,
+	 * otherwise get the next byte  */
+	if(--spi_bytes == 0){
+		//usb_puts("Read all bytes\r\n");
+		PORTB |= SS;
+		if(spi_recv_complete_func)
+			spi_recv_complete_func();
+	}else {
+		//usb_puts("There are this many bytes left: "); usb_puti(spi_bytes);usb_puts("\r\n");
+		SPDR = 0xff;
+	}
+    }
+}		
Index: demos/hunter_prey_john/projects/libdragonfly/eeprom.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/eeprom.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/eeprom.h	(revision 1694)
@@ -0,0 +1,47 @@
+/**
+ * @file eeprom.h
+ * @brief handles eeprom storage for persistent data
+ *
+ * Contains functions and definitions for reading and writing to eeprom
+ *
+ * @author Colony Project, Brad Neuman
+ */
+ 
+ #ifndef _EEPROM_H_
+ #define _EEPROM_H_
+ 
+ #define EEPROM_ROBOT_ID_ADDR 0x10
+ #define EEPROM_BOM_TYPE_ADDR 0x14
+ 
+ /** @brief store a byte to eeproem
+  *  @return 0 if success, nonzero on failure
+  */
+ int eeprom_put_byte(unsigned int addr, unsigned char byte);
+ 
+ /** @brief reads a byte from eeprom
+  *
+  *  Pass it thge address and a pointer to a byte where the byte at the
+  *  address will be stored
+  *
+  *  @return 0 if successful (byte is set to the eeprom value at addr), 
+  *  nonzero if there was a problem
+   */
+ int eeprom_get_byte(unsigned int addr, unsigned char *byte);
+ 
+ /** @brief get stored robot ID
+  *
+  *  checks that EEPROM has been programed with an ID and returns it
+  *
+  *  @return the robot id, if it is stored. If it returns 0xFF it is probably invalid
+  */
+ unsigned char get_robotid(void);
+  
+   /** @brief get stored robot ID
+  *
+  * checks that EEPROM has been programed with an BOM type and returns it
+  *
+  *  @return the robot bom type as defined in bom.h, if it is stored. If it returns 0xFF it is probably invalid
+  */
+ unsigned char get_bom_type(void);
+ 
+ #endif
Index: demos/hunter_prey_john/projects/libdragonfly/time.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/time.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/time.c	(revision 1694)
@@ -0,0 +1,201 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file time.c
+ * @brief Timer code
+ *
+ * Implementation of functions for timers.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+/*
+  time.c
+  anything that requires a delay
+  mostly delay_ms
+
+  author: Robotics Club, Colony Project
+
+  Change Log:
+  2.5.07 - Kevin
+  Aaron fixed the orb/servo code and made them use timer3 but compare registers B and C. He hard set the prescaler
+  to 8 so the RTC broke. Changed it so that we use a 8 prescaler which sets the compare match at 1/16th of a second.
+  You now count how many 16ths of a second you want until you trigger your actual interrupt. Works. Changed defines
+  for time so you can still call rtc_init with a scale but now it is defined in terms of actual time like second, quarter_second
+  etc. Read that section in the time.h file for more information. Tested and works, though the clock drifts more than
+  it used to
+  1.30.07 - Kevin
+  Modified the clock to run on timer3 on the Dragonfly. Works with decent accuracy. Using a prescaler of 256
+  the timer counts up to a precomputer value which will trigger an interrupt and reset the timer. Multiples of
+  256 change it by that multiple. Refer to the time.h file for all possible prescalers.
+  The interrupt will call a specified function _rtc_func every pulse.
+  All of it has been tested and it works.
+
+*/
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include "time.h"
+
+
+/* Calculate how many cycles to delay for to get 1 ms. Based on F_CPU which should be defined by the makefile */
+#ifdef F_CPU
+#define WAIT_CYCLES ((F_CPU / 1000) / 10)
+#else
+#define WAIT_CYCLES (8000 / 10)
+#endif
+
+static volatile int _rtc_val = 0;
+static volatile int _rtc_pulse = 0;
+static volatile int _rtc_scale = 32;	//Defaults to 1 Second per pulse
+static void (*_rtc_f)(void) = 0;
+
+
+
+/**
+ * @defgroup time Time
+ * @brief Time functions
+ * 
+ * Functions dealing with time.
+ * 
+ * @{
+ **/
+
+/**
+ * Delays for the specified number of milliseconds.
+ * It depends on F_CPU to be defined in order to calculate how many cycles
+ * it should delay. If it is not defined, a default clock of 8MHz is assumed.
+ * 
+ * We use _delay_loop_2 which will run assembly instructions that should be
+ * 4 cycles long. Optimizations must be enabled for this to be true.
+ * That function is called to ensure around 1ms per execution. To generate
+ * multiple ms we run a for loop of how many milliseconds are desired.
+ *
+ * The error should be just the skew on the oscillator as the formula to 
+ * calculate delay cycles should always be a whole number. The is some skew
+ * in practice though it is unavoidable. Delaying for less than 1s should make
+ * the error negligable.
+ *
+ * @param ms the number of milliseconds to delay for
+ **/
+void delay_ms(int ms) {
+    for (; ms > 0; ms--) {
+        _delay_loop_2(WAIT_CYCLES);
+    }
+}
+
+
+/* 	Prescales defined in time.h. SECOND will give you 1 second.
+	More scales are defined in the time.h file.
+	rtc_func is the address to a function that you want called every clock tick. */
+/**
+ * Initializes the real time clock. Prescales are defined in time.h.
+ * For example, SECOND will give 1 second. The specified function is
+ * called every clock tick. For the real time clock to activate,
+ * interrupts must be enabled. (through sei() )
+ *
+ * @param prescale_opt the period with which the timer is triggered
+ * @param rtc_func the function called when the timer is triggered
+ *
+ * @see rtc_get, rtc_reset
+ *
+ **/
+void rtc_init(int prescale_opt, void (*rtc_func)(void)) {
+	
+  //Clear timer register for Timer 3
+  TCNT3 = 0;
+	
+  /* 	This sets the Waveform Generation Module to CTC (Clear Timer on Compare) Mode (100)
+	See page135 in Atmega128 Docs for more modes and explanations */
+  TCCR3B |= _BV(WGM32);
+	
+  /* 	This sets the prescaler for the system clock (8MHz) ie: divides the clock by some number.
+	Currently set to a prescaler of 8 because that is what the orb and servos use (they are on this timer as well)
+	See page137 in Atemga128 Docs for all the available prescalers */
+  TCCR3B |= _BV(CS31);
+	
+  /* 	Sets the two regsiters that we compare against. So the timer counts up to this number and
+	then resets back to 0 and calls the compare match interrupt.
+	8x10^6 / 8 = 1/16 Second. All values are based off of this number. Do not change it unless you
+	are l337*/
+		
+  OCR3A = 0xF424;	
+
+  /* 	Enable Output Compare A Interrupt. When OCR3A is met by the timer TCNT3 this interrupt will be
+	triggerd. (See page140 in Atmega128 Docs for more information */
+  ETIMSK |= _BV(OCIE3A);
+	
+  /*	Store the pointer to the function to be used in the interrupt */
+  _rtc_f = rtc_func;
+	
+  /*	Store how many 1/16ths of a second you want to let by before triggering an interrupt */
+  _rtc_scale = prescale_opt;
+}
+
+/**
+ * Returns the time elapsed in seconds since the last call to
+ * rtc_init or rtc_reset.
+ *
+ * @return the number of seconds since the last call to rtc_init or rtc_reset
+ *
+ * @see rtc_init, rtc_reset
+ **/
+int rtc_get(void) {
+  return _rtc_val;
+}
+
+/**
+ * Resets the real time clock counter to 0.
+ *
+ * @see rtc_init, rtc_get
+ **/
+void rtc_reset(void) {
+  _rtc_val = 0;
+}
+
+/** @} **/ //end defgroup
+
+/*	Called every pulse. Function in _rtc_f is called every _rtc_scale and also the counter is updated.
+	Bascially, since the pulse is hard set at 1/16s  you want to count how many 16ths of a second have passed
+	and when it reaches the amount of time you want, execute the code. */
+SIGNAL(TIMER3_COMPA_vect) {
+
+  if (_rtc_pulse ==  _rtc_scale) {
+    //Increment the real time clock counter
+    _rtc_val++;
+		
+    //Calls the function tied to the real time clock if defined
+    if(_rtc_f != 0)
+      _rtc_f();
+		
+    //Resets the pulse until the next scale is matched
+    _rtc_pulse = 0;
+  }	
+	
+  //Updates the amount of pulses seen since the last scale match
+  _rtc_pulse++;
+	
+}
Index: demos/hunter_prey_john/projects/libdragonfly/spi.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/spi.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/spi.h	(revision 1694)
@@ -0,0 +1,46 @@
+/**
+ * @file spi.h
+ * @brief Definitions for SPI
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+/**
+ * @addtogroup spi
+ * @{
+ **/
+
+#ifndef __SPI_H__
+#define __SPI_H__
+
+#define DOUBLE_SCK 1
+#define SPR0_BIT 1
+
+#define MASTER 1
+#define SLAVE 0
+
+#define MOSI _BV(PB2)
+#define MISO _BV(PB3)
+#define SS   _BV(PB0)
+#define SCLK _BV(PB1)
+
+typedef void (*spi_fun_recv_t)(char);
+typedef void (*spi_fun_recv_complete_t)(void);
+
+/** 
+* @brief Initialize SPI
+* 
+* @param spi_fun_recv_t The function that handles SPI data, byte for byte.
+* @param spi_fun_recv_complete_t  Called on a completed transmission - typically for cleaning up.
+*/
+void spi_init (spi_fun_recv_t, spi_fun_recv_complete_t);
+
+/** 
+* @brief Initialize SPI transfer.
+* 
+* @param char The number of bytes to transfer.
+*/
+void spi_transfer (char);
+
+/**@}**/ //end group
+
+#endif
Index: demos/hunter_prey_john/projects/libdragonfly/encoders.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/encoders.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/encoders.c	(revision 1694)
@@ -0,0 +1,354 @@
+#include "encoders.h"
+#include "spi.h"
+#include "ring_buffer.h"
+#include <avr/io.h>
+
+unsigned int left_data_buf;
+unsigned int right_data_buf;
+char encoder_buf_index;
+
+unsigned int left_data;
+unsigned int right_data;
+
+unsigned int left_data_array[BUFFER_SIZE];
+unsigned int right_data_array[BUFFER_SIZE];
+int left_data_idx;
+int right_data_idx;
+
+int left_dx;
+int right_dx;
+long int timecount;
+
+volatile short int data_ready;
+
+void encoder_recv(char data);
+
+//Helper Function Prototypes
+inline void left_data_array_put(unsigned short int value);
+inline unsigned int left_data_array_top(void);
+inline unsigned int left_data_array_prev(void);
+inline unsigned int left_data_array_bottom(void);
+
+inline void right_data_array_put(unsigned short int value);
+inline unsigned int right_data_array_top(void);
+inline unsigned int right_data_array_prev(void);
+inline unsigned int right_data_array_bottom(void);
+
+//encoder_get_v helper function prototypes
+int left_data_at(int index);
+int right_data_at(int index);
+int get_dx(char encoder, int index);
+
+void encoder_recv_complete(void){
+  	encoder_buf_index = 0;
+	data_ready++;
+  
+   	spi_transfer(5);
+}
+
+/** 
+* @brief Initializes encoder variables and the hardware interface.
+*/
+void encoders_init(void){
+	int i;
+	
+	data_ready=0;
+
+	spi_init(encoder_recv, encoder_recv_complete);
+	encoder_buf_index = 0;
+	left_data_buf = 0;
+	right_data_buf= 0;
+	left_data = -1;
+	right_data = -1;
+	
+	//RING_BUFFER_INIT(enc_buffer,BUFFER_SIZE);
+	left_data_idx = 0;
+	right_data_idx = 0;
+	for(i = 0; i < BUFFER_SIZE; i++) {
+		left_data_array[i] = 0;
+	}
+	for(i = 0; i < BUFFER_SIZE; i++) {
+		right_data_array[i] = 0;
+	}
+	spi_transfer(5);
+}
+
+/**
+ * @brief Returns the specified encoders value
+ *
+ * @param encoder this is the encoder that you want to read. Valid arguments
+ *          are LEFT and RIGHT
+ *
+ * @return the value of the specified encoder.
+ *         -1 usually means low battery.
+ *         values above ENCODER_MAX usually means phyiscal problems with
+ *         the encoder.
+ **/
+int encoder_read(char encoder){
+	
+	if(encoder==LEFT) return left_data;
+	else if(encoder==RIGHT) return right_data;
+	else return -1;
+}
+
+/**
+ * @brief Get total distance travelled by the specified encoder (in encoder ticks)
+ *
+ * @param encoder the encoder that you want to read, either LEFT or RIGHT
+ *
+ * @return The distance covered by the specified encoder.
+ *
+ * @note Simply calls encoder_get_dx.
+ **/
+int encoder_get_x(char encoder) {
+	return encoder_get_dx(encoder);
+}
+
+/**
+ * Gets the total distance covered by the specified encoder (in encoder clicks)
+ *
+ * @param encoder the encoder that you want to read, use LEFT or RIGHT
+ *
+ * @return The distance covered by the specified encoder.
+ **/
+int encoder_get_dx(char encoder) {
+	
+	if(encoder==LEFT) return left_dx;
+	else if(encoder==RIGHT) return right_dx;
+	else return -1;
+}
+
+/** 
+ * @brief Returns the approximated instantaneous velocity of the robot
+ * in terms of encoder clicks.
+ * 
+ * @param encoder RIGHT or LEFT - the wheel you want the velocity for.
+ * 
+ * @return The instantaneous velocity for the given wheel or twice the ERR_VEL
+ *         if an error occurs (1024 * 2 = 2048)
+ *
+ * @bug This uses hard coded values and results are inconsistent.
+ *      Use at your own risk.
+ */
+int encoder_get_v(char encoder){
+    int vel1, vel2;
+    vel1 = get_dx(encoder, 0);
+    vel2 = get_dx(encoder, 1);
+
+    if (vel1 == ERR_VEL && vel2 == ERR_VEL)
+        return ERR_VEL << 1;
+    else if (vel2 == ERR_VEL)
+        return vel1 << 1;
+    else if (vel1 == ERR_VEL)
+        return vel2 << 1;
+    else
+        return vel1 + vel2;
+}
+
+/**
+ * Resets the distance accumulator for the specified
+ *  encoder.
+ *
+ * @param encoder the encoder that you want to reset distance for
+ **/
+void encoder_rst_dx(char encoder) {
+	
+	if(encoder==LEFT) left_dx = 0;
+	else if(encoder==RIGHT) right_dx = 0;
+}
+
+/** 
+* @brief Returns the number of encoder reads that have occurred.
+* 
+* @return The time count.
+*/
+int encoder_get_tc(void) {
+	return timecount;
+}
+
+/** 
+* @brief Resets the encoder read counter.
+*/
+void encoder_rst_tc(void) {
+	timecount = 0;
+}
+
+/** 
+* @brief Waits until n encoder reads have occurred.
+* Counter is reset on functions exit.
+* 
+* @param n 
+*/
+void encoder_wait(int n){
+	while(data_ready<n);
+	data_ready=0;
+}
+
+
+//Full reads occur every 40 microseconds. This function should be called
+//every 8 microseconds.
+void encoder_recv(char data){
+	short int dx;
+	
+	//Parse the encoder data, comes in over 5 bytes 16 bits per encoder,
+	// second is offset by 1 bit.
+	switch(encoder_buf_index){	
+	case 0: 
+		right_data_buf |= ((short)data)<<8 & 0xff00;
+		break;
+	case 1:
+		right_data_buf |= ((short)data) & 0xff;
+		break;
+	case 2:
+		left_data_buf |= (((short)data) << 9) & (0x7F << 9);
+		break;
+	case 3:
+		left_data_buf |= (((short)data) << 1) & (0xFF<<1);
+		break;
+	case 4: left_data_buf |= (((short)data)>>7) & 0x1;
+	}	
+		
+	encoder_buf_index = (encoder_buf_index + 1) % 5;
+
+	if(encoder_buf_index==0) {
+		
+		/*Error handling for the left encoder*/ 
+		if(!(left_data_buf & OCF)) 
+			left_data = ENCODER_DATA_NOT_READY; 
+		if(left_data_buf & (COF | LIN))  
+			left_data = ENCODER_MISALIGNED;
+		else if((left_data_buf & MagINCn) && (left_data_buf & MagDECn)) 
+			left_data = ENCODER_MAGNET_FAILURE;
+		else left_data = (left_data_buf>>5) & 1023;
+			
+		/*Error handling for the right encoder*/ 
+	 	if(!(right_data_buf & OCF))
+			right_data = ENCODER_DATA_NOT_READY;	
+		if(right_data_buf & (COF | LIN)) 
+			right_data = ENCODER_MISALIGNED;
+		else if ((right_data_buf & MagINCn)  && (right_data_buf & MagDECn)) 
+			right_data = ENCODER_MAGNET_FAILURE;
+		else right_data = (right_data_buf>>5) & 1023;
+			
+  		left_data_buf = 0;
+		right_data_buf = 0;
+
+		/*Note: Above 1023 is invalid data*/	
+		if(!(left_data > 1023)) {
+			//Reverse the left wheel since encoders are necessarily mounted backwards.
+			left_data = 1023 - left_data;
+			left_data_array_put(left_data);
+
+			//Adjust left accumulator
+			dx = left_data - left_data_array_prev();
+			
+			if(left_data_array_prev()==0)  dx=0;
+
+			if(dx > 512) left_dx += dx - 1023; //Underflow
+			else if(dx < -512) left_dx += dx + 1023; //Overflow
+			else left_dx += dx;
+		}
+
+		/*Above 1023 is invalid data*/	
+		if(!(right_data > 1023)) {
+			right_data_array_put(right_data);
+
+			//Adjust right accumulator
+			dx = right_data - right_data_array_prev();
+
+			if(right_data_array_prev()==0) dx=0;
+			  
+			if(dx > 512) right_dx += dx - 1023; //underflow
+			else if(dx < -512) right_dx += dx + 1023; //overflow 
+			else right_dx += dx;
+		}
+	}
+
+	//Increment timecount accumulator
+	timecount++;
+}
+
+
+//Helper Functions
+inline void left_data_array_put(unsigned short int value) {
+	if(left_data_idx == BUFFER_SIZE-1)
+		left_data_idx = 0;
+	else
+		left_data_idx++;
+	left_data_array[left_data_idx] = value;
+}
+
+inline unsigned int left_data_array_top(void) {
+	return left_data_array[left_data_idx];
+}
+
+inline unsigned int left_data_array_prev(void) {
+	if(left_data_idx == 0)
+		return left_data_array[BUFFER_SIZE-1];
+	else
+		return left_data_array[left_data_idx - 1];
+}
+
+inline unsigned int left_data_array_bottom(void) {
+	if(left_data_idx == BUFFER_SIZE-1)
+		return left_data_array[0];
+	else
+		return left_data_array[left_data_idx + 1];
+}
+
+inline void right_data_array_put(unsigned short int value) {
+	if(right_data_idx == BUFFER_SIZE-1)
+		right_data_idx = 0;
+	else
+		right_data_idx++;
+	right_data_array[right_data_idx] = value;
+}
+
+inline unsigned int right_data_array_top(void) {
+	return right_data_array[right_data_idx];
+}
+
+inline unsigned int right_data_array_prev(void) {
+	if(right_data_idx == 0)
+		return right_data_array[BUFFER_SIZE-1];
+	else
+		return right_data_array[right_data_idx - 1];
+}
+
+inline unsigned int right_data_array_bottom(void) {
+	if(right_data_idx == BUFFER_SIZE-1)
+		return right_data_array[0];
+	else
+		return right_data_array[right_data_idx + 1];
+}
+
+/* Helper functions for encoder_get_v */
+int left_data_at(int index) {
+    int tmp_idx = left_data_idx - index;
+    if (tmp_idx < 0)
+        tmp_idx += BUFFER_SIZE;
+    return left_data_array[tmp_idx];
+}
+
+int right_data_at(int index) {
+    int tmp_idx = right_data_idx - index;
+    if (tmp_idx < 0)
+        tmp_idx += BUFFER_SIZE;
+    return right_data_array[tmp_idx];
+}
+
+int get_dx(char encoder, int index) {
+    int dx, ctr;
+    ctr = 0;
+    dx = 1024;
+    do {
+        if (encoder == LEFT)
+            dx = left_data_at(index+ctr) - left_data_at(index+ctr+38);
+        else
+            dx = right_data_at(index+ctr) - right_data_at(index+ctr+38);
+        ctr++;
+    } while ((dx > 30 || dx < -30) && ctr < 3); 
+    if (dx > 30 || dx < -30)
+        return ERR_VEL;
+    return dx; 
+}
Index: demos/hunter_prey_john/projects/libdragonfly/time.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/time.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/time.h	(revision 1694)
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file time.h
+ * @brief Contains time-related functions and definitions
+ *
+ * Contains functions and definitions for dealing with time,
+ * namely delay_ms and the realtime clock.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _TIME_H_
+#define _TIME_H_
+
+/*	Predefined times for prescale_opt in time.c.
+	To make you own, know that a pulse is 1/16th of a second. You cannot get less than this. To get more, you need
+	to know how many 16ths of a second are in the time you want. (Time_desired * 16 = prescaler_opt)
+*/
+/**
+ * @addtogroup time
+ * @{
+ **/
+/** @brief A sixteenth of a second **/
+#define SIXTEENTH_SECOND 1
+/** @brief An eighth of a second **/
+#define EIGTH_SECOND 2
+/** @brief A quarter of a second **/
+#define QUARTER_SECOND 4
+/** @brief Half of a second **/
+#define HALF_SECOND	8
+/** @brief One second **/
+#define SECOND 16
+/** @brief Two seconds **/
+#define TWO_SECOND 32
+/** @brief Four seconds **/
+#define FOUR_SECOND 64
+
+/** @brief Delay execution for the specified time **/
+void delay_ms(int ms) ;
+/** @brief Enable the realtime clock **/
+void rtc_init(int prescale_opt, void (*rtc_func)(void));
+/** @brief Reset the counter of the realtime clock **/
+void rtc_reset(void);
+/** @brief Get the value of the realtime clock. **/
+int rtc_get(void);
+
+/** @} **/
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/analog.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/analog.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/analog.h	(revision 1694)
@@ -0,0 +1,138 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * 
+ * @file analog.h
+ * @brief Contains functions and definitions for using the ADC
+ * 
+ * Contains definitions and function prototypes for using the
+ * ADC to detect analog signals on pins AN0 - AN7.
+ * AN6 and AN7 are used for the wheel and battery.
+	
+ * The pins labeled E6 and E7 are external interrupt pins and are not related 
+ * to analog.
+	
+ * @author Colony Project, CMU Robotics Club, based on firefly
+ * originally taken from fwr analog file (author: Tom Lauwers)
+ * loop code written by Kevin Woo and James Kong
+ */
+
+#ifndef _ANALOG_H
+#define _ANALOG_H
+
+#include <inttypes.h>
+
+/**
+ * @addtogroup analog
+ * @{
+ **/
+
+/** @brief Analog port 0 **/
+#define AN0 0x00
+/** @brief Analog port 1 **/
+#define AN1 0x01
+/** @brief Analog port 2 **/
+#define AN2 0x02
+/** @brief Analog port 3 **/
+#define AN3 0x03
+/** @brief Analog port 4 **/
+#define AN4 0x04
+/** @brief Analog port 5 **/
+#define AN5 0x05
+/** @brief Analog port 6 **/
+#define AN6 0x06
+/** @brief Analog port 7 **/
+#define AN7 0x07
+/** @brief Analog port 8 **/
+#define AN8 0x08
+/** @brief Analog port 9 **/
+#define AN9 0x09
+/** @brief Analog port 10 **/
+#define AN10 0x0A
+/** @brief Analog port 11 **/
+#define AN11 0x0B
+/** @brief Analog port 12 **/
+#define AN12 0x0C
+/** @brief Analog port 13 **/
+#define AN13 0x0D
+/** @brief Analog port 14 **/
+#define AN14 0x0E
+/** @brief Analog port 15 **/
+#define AN15 0x0F
+
+/** @brief BOM_PORT analog port for BOM **/
+#define BOM_PORT AN0
+/** @brief EXT_MUX analog port **/
+#define EXT_MUX AN7
+/** @brief Analog port for the wheel **/
+#define WHEEL_PORT AN10
+/** @brief Analog port for the battery voltage detector **/
+#define BATT_PORT  AN11
+
+/** @brief Analog loop status. ADC conversion running. **/
+#define ADC_LOOP_RUNNING 1
+/** @brief Analog loop status.  No ADC conversion running.**/
+#define ADC_LOOP_STOPPED 0
+
+/** @brief Analog init parameter. Start the analog loop. **/
+#define ADC_START 1
+/** @brief Analog init parameter. Don't start the analog loop. **/
+#define ADC_STOP  0
+
+#define ADMUX_OPT 0x60
+
+/** @brief Struct to hold the value of a particular analog port **/
+typedef struct {
+  uint8_t adc8;
+  uint16_t adc10;
+} adc_t;
+
+
+/** @brief Initialize analog ports. Will start running a loop
+    if start_conversion is ADC_START.**/
+void analog_init(int start_conversion);
+/** @brief starts the analog loop. Doesn't do anything if the loop is already running. **/
+void analog_start_loop(void);
+/** @brief Stops the analog loop. Doesn't do anything if the loop is already stopped. **/
+void analog_stop_loop(void);
+/** @brief Returns the status of the analog loop. **/
+int analog_loop_status(void);
+/** @brief Returns an 8-bit analog value from the look up table. Use this instead of analog_get8. **/
+unsigned int analog8(int which);
+/** @brief Returns an 10-bit analog value from the look up table. Use this instead of analog_get10. **/
+unsigned int analog10(int which);
+/** @brief Read the position of the wheel. **/
+int wheel(void);
+/** @brief Read an 8-bit number from an analog port. Loop must be stopped for this to work. **/
+unsigned int analog_get8(int which);
+/** @brief Read a 10-bit number from an analog port. Loop must be stopped for this to work. **/
+unsigned int analog_get10(int which);
+
+
+/**@}**/ //end group
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/encoders.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/encoders.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/encoders.h	(revision 1694)
@@ -0,0 +1,86 @@
+/**
+ * 
+ * @file encoders.h
+ * @brief Contains functions for reading encoder values.
+ *
+ * Contains high and low level functions for reading encoders
+ * including reading out total distance covered, and 
+ * eventually velocity.
+ *	
+ * @author Colony Project, CMU Robotics Club
+*/
+
+/**
+ * @addtogroup encoders
+ * @{
+ **/
+
+#ifndef __ENCODERS_H__
+#define __ENCODERS_H__
+
+
+#ifndef LEFT
+	/** @brief Left wheel **/
+	#define LEFT 0
+#endif
+#ifndef RIGHT
+	/** @brief Right wheel **/
+	#define RIGHT 1
+#endif
+
+/** @brief Max value of valid encoder reading. **/
+#define ENCODER_MAX 1024
+
+/** @brief Magnet misaligned - likely distance from encoder problem. **/
+#define ENCODER_MAGNET_FAILURE 1025
+/** @brief Encoder misaligned - likely on XY plane. **/
+#define ENCODER_MISALIGNED 1027
+/** @brief Not enough time has passed - encoders not initialized in hardware. **/
+#define ENCODER_DATA_NOT_READY 1026
+
+/** @brief delay_ms argument after a full read is complete **/
+#define ENCODER_DELAY 20
+
+//Data invalid flags (hardware failure):
+#define OCF _BV(4)
+#define COF _BV(3)
+
+//Data invalid alarm (May be invalid):
+#define LIN _BV(2)
+
+#define MagINCn _BV(1)
+#define MagDECn _BV(0)
+
+/** @brief Buffer size **/
+#define BUFFER_SIZE 46
+
+#define ERR_VEL 1024
+
+/** @brief Initialize encoders. **/
+void encoders_init(void);
+/** @brief Read instantaneous encoder value. **/
+int encoder_read(char encoder);
+
+/** @brief Get total distance traveled.
+ *  @note  Simply calls encoder_get_dx.
+ **/
+int encoder_get_x(char encoder);
+
+/** @brief Get instantaneous velocity. **/
+int encoder_get_v(char encoder);
+
+/** @brief Get total distance traveled. **/
+int encoder_get_dx(char encoder);
+/** @brief Reset distance counter. **/
+void encoder_rst_dx(char encoder);
+/** @brief Get time count: The number of encoder reads that have occurred. **/
+int encoder_get_tc(void);
+/** @brief Reset the time count. **/
+void encoder_rst_tc(void);
+
+/** @brief Waits for the next n encoder reading, then returns. **/
+void encoder_wait( int nReadings );
+
+/**@}**/ //end group
+
+#endif
Index: demos/hunter_prey_john/projects/libdragonfly/lcd.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/lcd.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/lcd.c	(revision 1694)
@@ -0,0 +1,312 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file lcd.c
+ * @brief LCD
+ *
+ * Implementation of functions for using the LCD.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+#include <avr/io.h>
+#include <avr/pgmspace.h>
+
+#include "lcd.h"
+#include "time.h"
+
+//LCD defines
+#define RST _BV(4)  // pd4 (GPIO)
+#define SCE _BV(0)  // pb0 (~SS)
+#define D_C _BV(5)  // pd5 (GPIO?)
+#define SDI _BV(2)  // pb2 (MOSI)
+#define SCK _BV(1) // pb1 (SCK)
+
+#define LCDPORT PORTB
+#define LCDDDR DDRB
+
+#define LCDRESETPORT PORTD
+#define LCDRESETDDR DDRD
+
+void lcd_putbyte(unsigned char b);
+
+
+//**************************************Old shit below!*****************
+/*
+  FontLookup - a lookup table for all characters
+*/
+static const unsigned char FontLookup [][5] PROGMEM =
+  {
+    { 0x00, 0x00, 0x00, 0x00, 0x00 },  // sp
+    { 0x00, 0x00, 0x5f, 0x00, 0x00 },   // !
+    { 0x00, 0x07, 0x00, 0x07, 0x00 },   // "
+    { 0x14, 0x7f, 0x14, 0x7f, 0x14 },   // #
+    { 0x24, 0x2a, 0x7f, 0x2a, 0x12 },   // $
+    { 0x23, 0x13, 0x08, 0x64, 0x62 },   // %
+    { 0x36, 0x49, 0x55, 0x22, 0x50 },   // &
+    { 0x00, 0x05, 0x03, 0x00, 0x00 },   // '
+    { 0x00, 0x1c, 0x22, 0x41, 0x00 },   // (
+    { 0x00, 0x41, 0x22, 0x1c, 0x00 },   // )
+    { 0x14, 0x08, 0x3E, 0x08, 0x14 },   // *
+    { 0x08, 0x08, 0x3E, 0x08, 0x08 },   // +
+    { 0x00, 0x00, 0x50, 0x30, 0x00 },   // ,
+    { 0x10, 0x10, 0x10, 0x10, 0x10 },   // -
+    { 0x00, 0x60, 0x60, 0x00, 0x00 },   // .
+    { 0x20, 0x10, 0x08, 0x04, 0x02 },   // /
+    { 0x3E, 0x51, 0x49, 0x45, 0x3E },   // 0
+    { 0x00, 0x42, 0x7F, 0x40, 0x00 },   // 1
+    { 0x42, 0x61, 0x51, 0x49, 0x46 },   // 2
+    { 0x21, 0x41, 0x45, 0x4B, 0x31 },   // 3
+    { 0x18, 0x14, 0x12, 0x7F, 0x10 },   // 4
+    { 0x27, 0x45, 0x45, 0x45, 0x39 },   // 5
+    { 0x3C, 0x4A, 0x49, 0x49, 0x30 },   // 6
+    { 0x01, 0x71, 0x09, 0x05, 0x03 },   // 7
+    { 0x36, 0x49, 0x49, 0x49, 0x36 },   // 8
+    { 0x06, 0x49, 0x49, 0x29, 0x1E },   // 9
+    { 0x00, 0x36, 0x36, 0x00, 0x00 },   // :
+    { 0x00, 0x56, 0x36, 0x00, 0x00 },   // ;
+    { 0x08, 0x14, 0x22, 0x41, 0x00 },   // <
+    { 0x14, 0x14, 0x14, 0x14, 0x14 },   // =
+    { 0x00, 0x41, 0x22, 0x14, 0x08 },   // >
+    { 0x02, 0x01, 0x51, 0x09, 0x06 },   // ?
+    { 0x32, 0x49, 0x59, 0x51, 0x3E },   // @
+    { 0x7E, 0x11, 0x11, 0x11, 0x7E },   // A
+    { 0x7F, 0x49, 0x49, 0x49, 0x36 },   // B
+    { 0x3E, 0x41, 0x41, 0x41, 0x22 },   // C
+    { 0x7F, 0x41, 0x41, 0x22, 0x1C },   // D
+    { 0x7F, 0x49, 0x49, 0x49, 0x41 },   // E
+    { 0x7F, 0x09, 0x09, 0x09, 0x01 },   // F
+    { 0x3E, 0x41, 0x49, 0x49, 0x7A },   // G
+    { 0x7F, 0x08, 0x08, 0x08, 0x7F },   // H
+    { 0x00, 0x41, 0x7F, 0x41, 0x00 },   // I
+    { 0x20, 0x40, 0x41, 0x3F, 0x01 },   // J
+    { 0x7F, 0x08, 0x14, 0x22, 0x41 },   // K
+    { 0x7F, 0x40, 0x40, 0x40, 0x40 },   // L
+    { 0x7F, 0x02, 0x0C, 0x02, 0x7F },   // M
+    { 0x7F, 0x04, 0x08, 0x10, 0x7F },   // N
+    { 0x3E, 0x41, 0x41, 0x41, 0x3E },   // O
+    { 0x7F, 0x09, 0x09, 0x09, 0x06 },   // P
+    { 0x3E, 0x41, 0x51, 0x21, 0x5E },   // Q
+    { 0x7F, 0x09, 0x19, 0x29, 0x46 },   // R
+    { 0x46, 0x49, 0x49, 0x49, 0x31 },   // S
+    { 0x01, 0x01, 0x7F, 0x01, 0x01 },   // T
+    { 0x3F, 0x40, 0x40, 0x40, 0x3F },   // U
+    { 0x1F, 0x20, 0x40, 0x20, 0x1F },   // V
+    { 0x3F, 0x40, 0x38, 0x40, 0x3F },   // W
+    { 0x63, 0x14, 0x08, 0x14, 0x63 },   // X
+    { 0x07, 0x08, 0x70, 0x08, 0x07 },   // Y
+    { 0x61, 0x51, 0x49, 0x45, 0x43 },   // Z
+    { 0x00, 0x7F, 0x41, 0x41, 0x00 },   // [
+    { 0x02, 0x04, 0x08, 0x10, 0x20 },   // backslash
+    { 0x00, 0x41, 0x41, 0x7F, 0x00 },   // ]
+    { 0x04, 0x02, 0x01, 0x02, 0x04 },   // ^
+    { 0x40, 0x40, 0x40, 0x40, 0x40 },   // _
+    { 0x00, 0x01, 0x02, 0x04, 0x00 },   // '
+    { 0x20, 0x54, 0x54, 0x54, 0x78 },   // a
+    { 0x7F, 0x48, 0x44, 0x44, 0x38 },   // b
+    { 0x38, 0x44, 0x44, 0x44, 0x20 },   // c
+    { 0x38, 0x44, 0x44, 0x48, 0x7F },   // d
+    { 0x38, 0x54, 0x54, 0x54, 0x18 },   // e
+    { 0x08, 0x7E, 0x09, 0x01, 0x02 },   // f
+    { 0x0C, 0x52, 0x52, 0x52, 0x3E },   // g
+    { 0x7F, 0x08, 0x04, 0x04, 0x78 },   // h
+    { 0x00, 0x44, 0x7D, 0x40, 0x00 },   // i
+    { 0x20, 0x40, 0x44, 0x3D, 0x00 },   // j
+    { 0x7F, 0x10, 0x28, 0x44, 0x00 },   // k
+    { 0x00, 0x41, 0x7F, 0x40, 0x00 },   // l
+    { 0x7C, 0x04, 0x18, 0x04, 0x78 },   // m
+    { 0x7C, 0x08, 0x04, 0x04, 0x78 },   // n
+    { 0x38, 0x44, 0x44, 0x44, 0x38 },   // o
+    { 0x7C, 0x14, 0x14, 0x14, 0x08 },   // p
+    { 0x08, 0x14, 0x14, 0x18, 0x7C },   // q
+    { 0x7C, 0x08, 0x04, 0x04, 0x08 },   // r
+    { 0x48, 0x54, 0x54, 0x54, 0x20 },   // s
+    { 0x04, 0x3F, 0x44, 0x40, 0x20 },   // t
+    { 0x3C, 0x40, 0x40, 0x20, 0x7C },   // u
+    { 0x1C, 0x20, 0x40, 0x20, 0x1C },   // v
+    { 0x3C, 0x40, 0x30, 0x40, 0x3C },   // w
+    { 0x44, 0x28, 0x10, 0x28, 0x44 },   // x
+    { 0x0C, 0x50, 0x50, 0x50, 0x3C },   // y
+    { 0x44, 0x64, 0x54, 0x4C, 0x44 },    // z
+    { 0x00, 0x08, 0x36, 0x41, 0x41 },   // {
+    { 0x00, 0x00, 0x7F, 0x00, 0x00 },   // |
+    { 0x41, 0x41, 0x36, 0x08, 0x00 },   // }
+    { 0x02, 0x01, 0x01, 0x02, 0x01 },   // ~
+    { 0x55, 0x2A, 0x55, 0x2A, 0x55 },   // del
+  };
+
+
+/**
+ * @defgroup lcd LCD
+ * @brief Functions for the LCD
+ * Functions for writing to the LCD.
+ * All functions may be found in lcd.h.
+ *
+ * @{
+ **/
+
+/**
+ * Initializes the LCD. Must be called before any other
+ * LCD functions.
+ **/
+void lcd_init(void) {
+  LCDDDR |= (SCE | SDI | SCK);
+  LCDRESETDDR |= (RST|D_C);
+
+  LCDPORT &= ~( SCE | SDI | SCK);
+  LCDRESETPORT &=~(D_C);
+  
+  SPCR |= 0x50;//0b01010000; // no SPI int, SPI en, Master, sample on rising edge, fosc/2
+  SPSR |= 0x01;       // a continuation of the above
+
+  LCDRESETPORT |= RST;
+  delay_ms(10);
+  LCDRESETPORT &= (~RST);
+  delay_ms(100);
+  LCDRESETPORT |= RST;
+	
+  lcd_putbyte( 0x21 );  // LCD Extended Commands.
+  lcd_putbyte( 0xC8 );  // Set LCD Vop (Contrast).
+  lcd_putbyte( 0x06 );  // Set Temp coefficent.
+  lcd_putbyte( 0x13 );  // LCD bias mode 1:48.
+  lcd_putbyte( 0x20 );  // LCD Standard Commands, Horizontal addressing mode.
+  lcd_putbyte( 0x0C );  // LCD in normal mode.
+	
+  LCDRESETPORT |= D_C;		//put it in init instead of main
+	
+  lcd_clear_screen();
+}
+
+/**
+ * Clears the LCD screen. lcd_init must be called first.
+ * 
+ * @see lcd_init
+ **/
+void lcd_clear_screen( void ) {
+  int i;
+  for (i = 0; i < 504; i++)
+    lcd_putbyte(0x0);
+	
+  lcd_gotoxy(0,0);
+}
+
+/**
+ * Prints a character on the LCD screen. lcd_init
+ * must be called before this function may be used.
+ *
+ * Note: pgm_read_byte() is untested
+ *
+ * @param c the character to print
+ *
+ * @see lcd_init
+ **/
+void lcd_putc(char c) {
+  int i;
+	
+  for (i = 0; i < 5; i++)
+    lcd_putbyte(pgm_read_byte(&(FontLookup[c-32][i])));
+  lcd_putbyte(0);
+}
+
+/*
+  print an entire string to the lcd
+*/
+void lcd_puts(char *s) {
+  char *t = s;
+  while (*t != 0) {
+    lcd_putc(*t);
+    t++;
+  }
+}
+
+/*
+  go to coordinate x, y
+  y: vertically - 1 char
+  x: horizontally - 1 pixel
+
+  multiply x by 6 if want to move 1 entire character
+
+  origin (0,0) is at top left corner of lcd screen
+*/
+
+/**
+ * Move the current cursor position to the one specified.
+ * lcd_init must be called before this function may be used.
+ * 
+ * @param x The x coordinate of the new position
+ * @param y The y coordinate of the new position
+ *
+ * @see lcd_init
+ **/
+void lcd_gotoxy(int x, int y) {
+  LCDRESETPORT &= ~(D_C);
+  lcd_putbyte(0x40 | (y & 0x07));
+  lcd_putbyte(0x80 | (x & 0x7f));
+  LCDRESETPORT |= D_C;
+}
+
+/*
+  prints an int to the lcd
+
+  code adapted from Chris Efstathiou's code (hendrix@otenet.gr)
+*/
+
+/**
+ * Print an integer to the LCD screen.
+ * lcd_init must be called before this function may be used.
+ * 
+ * @param value the integer to print
+ *
+ * @see lcd_init
+ **/
+void lcd_puti(int value ) {
+  unsigned char lcd_data[6]={'0','0','0','0','0','0' }, position=sizeof(lcd_data), radix=10; 
+
+  /* convert int to ascii  */ 
+  if(value<0) { 
+    lcd_putc('-'); 
+    value=-value; 
+  }    
+  do { 
+    position--; 
+    *(lcd_data+position)=(value%radix)+'0'; 
+    value/=radix;  
+  } while(value); 
+
+    
+  /* start displaying the number */
+  for(;position<=(sizeof(lcd_data)-1);position++)
+    lcd_putc(lcd_data[position]);
+
+  return;
+}
+
+/** @} **/ //end defgroup
+
+void lcd_putbyte(unsigned char b) {
+  SPDR = b;
+  while (!(SPSR & 0x80)); /* Wait until SPI transaction is complete */
+}
Index: demos/hunter_prey_john/projects/libdragonfly/dragonfly_lib.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/dragonfly_lib.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/dragonfly_lib.c	(revision 1694)
@@ -0,0 +1,146 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file dragonfly_lib.c
+ * @brief Dragonfly initialization
+ *
+ * Contains implementation of dragonfly_init.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#include "dragonfly_lib.h"
+
+/* init_dragonfly - Initializes functions based on configuration parameters
+   examples:
+
+   init_dragonfly (0, 0, 0); - just initialize the digital IO (buttons, potentiometer)
+
+   init_dragonfly (ANALOG | SERIAL | BUZZER, C0_C1_ANALOG, BAUD115200); 
+   Initialize ADC and set C0 and C1 as analog inputs.  Initialize serial and set baud rate
+   to 115200 bps.  Initialize the buzzer.
+   
+   init_dragonfly (MOTORS | ORB, 0, 0);
+   Initialize motor driving and the color fading abilities of the ORB. */
+
+/**
+ * @defgroup dragonfly Dragonfly
+ * @brief General Dragonfly Functions
+ * General functions for the dragonfly. Include
+ * dragonfly_lib.h to access these functions.
+ *
+ * @{
+ **/
+
+/**
+ * Initializes the components specified by config.
+ * 
+ * @see analog_init, usb_init, xbee_init, buzzer_init,
+ * bom_init, orb_init, motors_init, lcd_init, encoders_init
+ **/
+ 
+void flash_red(void);
+
+void dragonfly_init(int config) 
+{
+    sei();
+    // Set directionality of various IO pins
+    DDRG &= ~(_BV(PING0)|_BV(PING1));
+    PORTG |= _BV(PING0)|_BV(PING1);
+    
+    if(config & ANALOG)
+        analog_init(ADC_START);
+    
+    if(config & COMM)
+    {
+        //Defaults to 115200. Check serial.h for more information.
+        usb_init();
+        xbee_init();
+    }
+    
+    if(config & BUZZER)
+    {
+        sei();
+        buzzer_init();
+    }
+    
+    if(config & ORB)
+    {
+        sei();
+        orb_init();
+    }
+    
+    if(config & MOTORS)
+        motors_init();
+
+    if(config & LCD)
+        lcd_init();
+    
+    if(config & RANGE)
+        range_init();
+        
+    if(config & BOM)
+    {
+        unsigned char bom_read = get_bom_type();
+        if(bom_read == 0xFF)
+            //warn that bom initialization failed
+            flash_red();
+        else
+            bom_init(bom_read);
+    }
+
+	if (config & ENCODERS)
+	{
+		encoders_init();
+	}
+
+    // delay a bit for stability
+    _delay_ms(1);
+}
+
+//flash lights red three times and restore ports
+void flash_red(void)
+{
+    cli();
+    char dd = DDRC;
+    char po = PORTC;
+    char i;
+    DDRC = 0x77;
+    for(i = 0; i<3; i++)
+    {
+        PORTC = 0x77;
+        delay_ms(300);
+        PORTC = 0x66;
+        delay_ms(300);
+    }
+    
+    DDRC = dd;
+    PORTC = po;
+    sei();
+}
+/** @} **/ //end defgroup
+
Index: demos/hunter_prey_john/projects/libdragonfly/buzzer.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/buzzer.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/buzzer.c	(revision 1694)
@@ -0,0 +1,137 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file buzzer
+ * @brief Functions for using the buzzer
+ *
+ * Contains functions for using the buzzer.
+ *
+ * @author Colony Project, CMU Robotics Club
+ *
+ * much taken from FWR's firefly library (author: Tom Lauwers)
+ **/
+
+#include <avr/io.h>
+#include "buzzer.h"
+#include "time.h"
+
+/**
+ * @defgroup buzzer Buzzer
+ * @brief Functions for controlling the buzzer.
+ * Functions for controlling the buzzer. Include
+ * buzzer.h to access these functions.
+ * @{
+ **/
+
+/**
+ * Initializes the buzzer. Must be called before any other buzzer
+ * function may be used.
+ **/
+void buzzer_init( void )
+{
+	//NOTE: This is mostly handled by buzzer_Set_val for now
+	// Set pin B7 to output - B7 is buzzer pin
+	//DDRB |= _BV(DDB7);
+	//Fast PWM Mode, Clear OCR0 on compare match and set at bottom, clock/64
+	//TCCR2 = _BV(COM20) | _BV(WGM21)  | _BV(CS22);
+}
+
+/**
+ * Sets the value of the buzzer's pitch.
+ * Higher values are lower frequencies.
+ *
+ * @param buzz_value the value to set the buzzer's frequency too,
+ * in the range 0-255
+ *
+ * @see buzzer_init, buzzer_set_freq, buzzer_off
+ **/
+void buzzer_set_val(unsigned int buzz_value)
+{ 
+	TCCR2 = _BV(COM20) | _BV(WGM21)  | _BV(CS22);
+	DDRB |= _BV(DDB7);
+	OCR2 = buzz_value;
+}
+
+/**
+ * Sets the buzzer frequency. Usage of constants such as C4
+ * is highly recommended as input to this function.
+ * buzzer_init must be called before this function may
+ * be used.
+ *
+ * @param buzz_freq the frequency to set the buzzer to
+ *
+ * @see buzzer_init, buzzer_set_val, buzzer_off
+ **/
+void buzzer_set_freq(unsigned int buzz_freq)
+{
+  int buzz_value;
+  
+  buzz_value = 62500/buzz_freq - 1;
+
+  if(buzz_value > 255){
+    buzz_value = 255;
+  }else if(buzz_value < 0){
+    buzz_value = 0;
+  }
+  
+  buzzer_set_val(buzz_value);
+}
+
+/**
+ * Plays the specified frequency for the specified
+ * amount of time. This function blocks execution
+ * until the time is completed. buzzer_init must be
+ * called before this function can be used.
+ *
+ * @param ms the time in milliseconds to play the frequency
+ * @param buzz_freq the frequency to play
+ *
+ * @see buzzer_init, buzzer_set_freq
+ **/
+void buzzer_chirp(unsigned int ms, unsigned int buzz_freq) 
+{ 
+  buzzer_set_freq(buzz_freq);
+  delay_ms(ms);
+  buzzer_off();
+}
+
+/**
+ * Turns off the buzzer by disabling the timer0 clock.
+ *
+ * @see buzzer_init
+ **/
+void buzzer_off()
+{
+  // Disable clock, to halt counter
+  TCCR2 &= 0xF8;//0b11111000;
+  
+  // Set buzzer pin low in case it's high
+  PORTB &= 0xBF;//0b10111111;
+}
+
+/** @} **/ // end buzzer group
+
Index: demos/hunter_prey_john/projects/libdragonfly/i2c.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/i2c.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/i2c.h	(revision 1694)
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/** @file i2c.h
+ *  @brief Header file for I2C
+ *
+ *  Contains functions for I2C.
+ *
+ *  @author Kevin Woo and Suresh Nidhiry, Colony Project, CMU Robotics Club
+ **/
+
+
+#ifndef _I2C_H_
+#define _I2C_H_
+
+/** @brief Address of slave receive handler function **/
+typedef void (*fun_srecv_t)(char);
+
+/** @brief Address of master receive handler function**/
+typedef int (*fun_mrecv_t)(char);
+
+/** @brief Address of slave send handler function**/
+typedef char (*fun_send_t)(void);
+
+int i2c_init(char addr, fun_mrecv_t master_recv, fun_srecv_t slave_recv, fun_send_t slave_send);
+int i2c_send(char dest, char* data, unsigned int bytes);
+int i2c_request(char dest);
+
+void i2c_packet_rec (char i2c_byte);
+void i2c_packet_sniff(char data);
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/odometry.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/odometry.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/odometry.c	(revision 1694)
@@ -0,0 +1,152 @@
+#include "odometry.h"
+#include "encoders.h"
+#include <math.h>
+#include <avr/interrupt.h>
+#include "time.h"
+#include "serial.h"
+
+long lround(double d);
+
+
+int encoder_ltm1, encoder_rtm1;
+
+//Measure mm displacement in x and y from starting position. (+x:theta=0 +y:theta=M_PI/2)
+long diff_x,diff_y, velocity;
+
+//Measures radian angle displacement from starting position. (initially 0)
+double angle;
+
+/**
+ * Retrieve the estimated x position. [millimeters]
+ */
+long odometry_dx(void){
+	return diff_x;
+}
+
+/**
+ * Retrieve the estimated y position. [millimeters]
+ */
+long odometry_dy(void){
+	return diff_y;
+}
+
+/**
+ * Retrieve the estimated angle [radians]
+ */
+double odometry_angle(void){
+	return angle;
+}
+
+long odometry_velocity(void){
+	return velocity;
+}
+
+/**
+ * Initializes odometry to run on timer 2.
+ * Also resets all values so that the center of the robot is 
+ * considered to be at the origin facing the x direction.
+ */
+void odometry_init(void){
+	
+	encoders_init();
+	
+	delay_ms(100);
+
+	odometry_reset();
+
+	
+	//CTC Mode. CLK / 1024
+	TCCR2 = 0; // (Fully disconnected)
+	TCCR2 = _BV(WGM21) | _BV(CS22) | _BV(CS20); //CLK/1024 , CTC Mode.
+
+	TIMSK |= _BV(OCIE2);
+
+	OCR2 = ODOMETRY_CLK;
+}
+/**
+ * Resets all values so that the center of the robot is 
+ * considered to be at the origin facing the x direction.
+ */
+void odometry_reset(void){
+	diff_x = 0;
+	diff_y = 0;
+	encoder_ltm1 = encoder_read(LEFT);
+	encoder_rtm1 = encoder_read(RIGHT);
+	angle = 0.0;
+}
+
+
+void odometry_run(void){
+	//Angle swept through in a time step CCW-
+	double theta, rl, dc;
+	long dr,dl;
+	
+	//Get the change in wheel positions
+	{	
+		int encoder_right = encoder_read(RIGHT);	
+		int encoder_left = encoder_read(LEFT);	
+	
+		dl = encoder_left - encoder_ltm1;
+		dr = encoder_right - encoder_rtm1;
+		
+		//No motion.
+		if(dl == 0 && dr == 0) return;
+
+		encoder_ltm1 = encoder_left;
+		encoder_rtm1 = encoder_right;
+	
+		// Try to avoid over/underflow.
+		dl = dl > 512 ? dl - 1024 :dl;
+		dl = dl < -512 ? dl + 1024 :dl;
+		dr = dr > 512 ? dr - 1024 :dr;
+		dr = dr < -512 ? dr + 1024 :dr;
+	
+		//Convert "clicks" to um
+		dl *= CLICK_DISTANCE_UM; //um
+		dr *= CLICK_DISTANCE_UM;
+	}
+	
+
+	if(dl == dr){
+		diff_x += lround(dl*cos(angle)/1000.0); //mm
+		diff_y += lround(dl*sin(angle)/1000.0); //mm
+		velocity = lround((dl * 1000.0)/(ODOMETRY_CLK*TIME_SCALE)); //um / ms = mm/s
+    usb_puts("dc: ");
+    usb_puti(dl);
+    usb_puts("um, velocity: ");
+    usb_puti(velocity);
+		usb_puts("\r\n mm/s");
+		return;
+	}
+	
+	//Call the left wheel 0, clockwise positive.
+	rl = ((double)(ROBOT_WIDTH_UM*dl))/((double)(dl - dr)); //um
+	theta = ((double)(dl - dr))/((double)ROBOT_WIDTH_UM);   //rad
+	
+	//Distance the center has traveled.
+	dc = (theta * (rl - ROBOT_WIDTH_UM)) / 2.0; //um
+	velocity = lround( dc * 1000 /(ODOMETRY_CLK*TIME_SCALE));
+	usb_puts("dc: ");
+  usb_puti(dl);
+  usb_puts("um, velocity: ");
+  usb_puti(velocity);
+  usb_puts("\r\n mm/s");
+	
+	//angle is necessarily CCW+, so subtract.
+	angle -= ANGLE_SCALE * theta; 
+	
+	//Change state variables. Probably lose all measurements less then a mm.
+	diff_x += lround((DISTANCE_SCALE * dc * cos(angle))/1000.0); //mm
+	diff_y += lround((DISTANCE_SCALE * dc * sin(angle))/1000.0); //mm
+}
+
+ISR(TIMER2_COMP_vect){
+	odometry_run(); 
+}
+
+long lround(double d){
+	double f = floor(d);
+	return (long)(d - f > 0.5 ? f + 1 : f);
+}
+
+
Index: demos/hunter_prey_john/projects/libdragonfly/move.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/move.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/move.c	(revision 1694)
@@ -0,0 +1,189 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file move.c
+ * @brief Functions for moving
+ *
+ * Implementation of functions for moving the robot.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#include "move.h"
+#include "motor.h"
+#include "rangefinder.h"
+
+
+// Internal prototypes
+void translateAngulartoLinear (int velocity, int omega, int* vl, int* vr);
+
+// global varaibles for move_avoid
+int d1, d2, d3, d4, d5; 
+/**
+ * @defgroup move Movement
+ * @brief Functions fo controlling robot motion
+ * Higher level functions to control the movement of robots.
+ * 
+ * @{
+ **/
+
+
+/**
+ * Causes the robot to move with the given translation and rotational velocities.
+ * motors_init must be called before this function can be used.
+ *
+ * @param velocity the translational velocity of the robot, in the range -255 to 255.
+ * A positive value indicates forward motion, while a negative value indicates
+ * backwards motion.
+ * 
+ * @param omega the rotational velocity of the robot, in the range -255 to 255.
+ * A positive value indicates a counterclockwise velocity, while a negative
+ * value indicates a clockwise velocity.
+ *
+ * @see motors_init, motor1_set, motor2_set
+ **/
+void move (int velocity, int omega) {
+  int vl = 0;
+  int vr = 0;
+  translateAngulartoLinear(velocity, omega, &vl , &vr );
+  //
+  
+  if (vl < 0) {
+    motor1_set(BACKWARD, -vl);
+  } else {
+    motor1_set(FORWARD, vl);
+  }
+  if (vr < 0) {
+    motor2_set(BACKWARD, -vr);
+  } else {
+    motor2_set(FORWARD, vr);
+  }
+}
+
+
+/**
+ * Moves the robot with the given translational and angular velocities
+ * while avoiding obstacles. To be effective, this function must be
+ * called repeatedly throughout the motion. It relies on the IR
+ * rangefinders to detect obstacles. Before calling this function,
+ * motors_init and range_init must be called.
+ *
+ * @param velocity the translational velocity of the robot, in the
+ * range -255 to 255. A positive value indicates forward motion.
+ *
+ * @param omega the rotational velocity of the robot, in the range
+ * -255 to 255. A positive value indicates a counterclockwise velocity.
+ *
+ * @param strength the strength of the avoid behavior, in the range
+ * 0 to 100.
+ *
+ * @see motors_init, range_init, move
+ **/
+void move_avoid(int velocity, int omega, int strength) {
+  int pControl;
+  int vl = 0;
+  int vr = 0;
+  int temp;
+  
+  temp=range_read_distance(IR1);
+  d1 = (temp == -1) ? d1 : temp;
+  
+  temp=range_read_distance(IR2);
+  d2=(temp == -1) ? d2 : temp;
+  
+  temp=range_read_distance(IR3);
+  d3=(temp == -1) ? d3 : temp;
+  
+  temp=range_read_distance(IR4);
+  d4=(temp == -1) ? d4 : temp;
+  
+  temp=range_read_distance(IR5);
+  d5=(temp == -1) ? d5 : temp;
+  
+  /* Avoid obstacles ahead
+     if(d2>170)
+     v*=-1;
+    
+     Naturally slow down if there is something in the way.
+     if(d2>150 || d1>180 || d3>180){
+     v>>=1;
+  */
+  
+  //pControl= (((d3-d1) + (d4-d5))*strength)/100;
+  pControl= (((d5-d4))*strength)/100;
+  omega = (omega*(100-strength))/100 + pControl;
+  translateAngulartoLinear(velocity, omega, &vl , &vr );
+  
+  if (vl < 0) {
+    motor1_set(BACKWARD, -vl);
+  } else {
+    motor1_set(FORWARD, vl);
+  }
+  if (vr < 0) {
+    motor2_set(BACKWARD, -vr);
+  } else {
+    motor2_set(FORWARD, vr);
+  }
+}
+
+/**@}**///end the motion group
+
+void translateAngulartoLinear (int velocity, int omega, int* vl, int* vr) {
+  //omega: angle measure, positive couter-clockwise from front.
+  // -180 <= omega <= 180
+  //velocity: -255 <= velocity <= 255
+  
+  long int vltemp, vrtemp;
+  
+  //make sure values are in bounds
+  if (velocity < -255 || velocity >255 || omega < -255 || omega > 255) return;
+	
+  //compute
+  vrtemp = velocity + omega * 3;
+  vltemp = velocity - omega * 3;
+	
+  //check to see if max linear velocities have been exceeded.
+  if (vrtemp > 255) {
+    vltemp = 255 * vltemp / vrtemp;
+    vrtemp = 255;
+  }
+  if (vltemp > 255) {	   
+    vrtemp = 255 * vrtemp / vltemp;    
+    vltemp = 255;  
+  }
+  if (vrtemp < -255) {
+    vltemp = -255 * vltemp / vrtemp;
+    vrtemp = -255;
+  }
+  if (vltemp < -255) {
+    vrtemp = -255 * vrtemp / vltemp;
+    vltemp = -255;
+  }
+  
+  *vr = (int)vrtemp;
+  *vl = (int)vltemp;
+}
Index: demos/hunter_prey_john/projects/libdragonfly/dio.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/dio.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/dio.c	(revision 1694)
@@ -0,0 +1,318 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file dio.c
+ * @brief Digital Input and Output
+ *
+ * Implementation of functions for digital input and output.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#include <avr/interrupt.h>
+#include "dio.h"
+#include "time.h"
+#include "lights.h"
+
+/**
+ * @defgroup dio Digital Input / Output
+ * @brief Controls digital input and output
+ * 
+ * A general note on how port / pin numbers work:<br>
+ * The portpin is used to select both the bank and which pin is selected.
+ * 6 bits are used (lower 6, ex: 0b00abcdef).
+ * The first 3 (abc in this example) are used to select the bank.<br>
+ * A = 001<br>
+ * B = 010<br>
+ * C = 011<br>
+ * D = 100<br>
+ * E = 101<br>
+ * F = 110<br>
+ * G = 111<br><br>
+ * 		
+ * The bank can be found by doing portpin >> 3. <br>
+ * 		
+ * The next three (def in this example) are used to select the pin number.
+ * These three bits are just the binary representation of the pin number.<br>
+ * <br>
+ * The pin number can be found by doing portpin & 0b111.<br><br>
+ *
+ * Include dio.h to access these functions.
+ **/
+
+/**
+ * Reads the selected portpin.
+ * 
+ * @param portpin The portpin to be read. See the general description
+ * for a description of portpins.
+ *
+ * @return 1 or 0, depending on the value of the portpin.
+ **/
+int digital_input(int portpin) {
+  int pin = portpin & 0x7;
+  int pin_val = 0;
+  
+  switch(portpin >> 3) {
+  case _PORT_A:
+    DDRA &= ~_BV(pin);
+    pin_val = PINA;
+    return (pin_val >> pin) & 1;
+  case _PORT_B:
+    DDRB &= ~_BV(pin);
+    pin_val = PINB;
+    return (pin_val >> pin) & 1;
+  case _PORT_C:
+    DDRC &= ~_BV(pin);
+    pin_val = PINC;
+    return (pin_val >> pin) & 1;
+  case _PORT_D:
+    DDRD &= ~_BV(pin);
+    pin_val = PIND;
+    return (pin_val >> pin) & 1;
+  case _PORT_E:
+    DDRE &= ~_BV(pin);
+    pin_val = PINE;
+    return (pin_val >> pin) & 1;
+  case _PORT_F:
+    if(pin>=4) {
+      MCUSR|=1<<7;
+      MCUSR|=1<<7;
+    }
+    DDRF &= ~_BV(pin);
+    pin_val = PINF;
+    return (pin_val >> pin) & 1;
+  case _PORT_G:
+    DDRG &= ~_BV(pin);
+    pin_val = PING;
+    return (pin_val >> pin) & 1;
+  default: break;
+  }
+  
+  return -1;
+}
+
+/**
+ * Enables pullup on a pin. If it is an output pin, the pin will output
+ * 1.
+ *
+ * @param portpin the pin to enable pullup on. See the general description
+ * for a discussion of portpins.
+ **/
+void digital_pull_up(int portpin) {
+  int pins = portpin & 0x07;
+
+  switch(portpin >> 3) {
+  case _PORT_A:
+    PORTA |= _BV(pins);
+    break;
+  case _PORT_B:
+    PORTB |= _BV(pins);
+    break;    
+  case _PORT_C:
+    PORTC |= _BV(pins);
+    break;    
+  case _PORT_D:
+    PORTD |= _BV(pins);
+    break;    
+  case _PORT_E:
+    PORTE |= _BV(pins);
+    break;    
+  case _PORT_F:
+    PORTF |= _BV(pins);
+    break;    
+  case _PORT_G:
+    PORTG |= _BV(pins);
+    break;
+  }
+}
+
+/**
+ * Sets portpin to the given value.
+ * 
+ * @param portpin the portpin to output to. See the general
+ * description for a discussion of portpins.
+ *
+ * @param val the value to set the portpin to. 0 for off,
+ * nonzero for on.
+ **/
+void digital_output(int portpin, int val) {
+  int pins = portpin & 0x07;
+  
+  /* if you want to set to 0... */
+  if(val == 0) {
+    switch(portpin >> 3) {
+    case _PORT_A:
+      DDRA |= _BV(pins);
+      PORTA &= (0XFF - _BV(pins));
+      break;
+    case _PORT_B:
+      DDRB |= _BV(pins);
+      PORTB &= (0XFF - _BV(pins));
+      break;    
+    case _PORT_C:
+      DDRC |= _BV(pins);
+      PORTC &= (0XFF - _BV(pins));
+      break;    
+    case _PORT_D:
+      DDRD |= _BV(pins);
+      PORTD &= (0XFF - _BV(pins));
+      break;    
+    case _PORT_E:
+      DDRE |= _BV(pins);
+      PORTE &= (0XFF - _BV(pins));
+      break;    
+    case _PORT_F:
+      DDRF |= _BV(pins);
+      PORTF &= (0XFF - _BV(pins));
+      break;    
+    case _PORT_G:
+      DDRG |= _BV(pins);
+      PORTG &= (0XFF - _BV(pins));
+      break;
+    }
+  } else { /* ( val == 1) */ 
+    switch(portpin >> 3) {
+    case _PORT_A:
+      DDRA |= _BV(pins);
+      PORTA |= _BV(pins);
+      break;
+    case _PORT_B:
+      DDRB |= _BV(pins);
+      PORTB |= _BV(pins);
+      break;    
+    case _PORT_C:
+      DDRC |= _BV(pins);
+      PORTC |= _BV(pins);
+      break;    
+    case _PORT_D:
+      DDRD |= _BV(pins);
+      PORTD |= _BV(pins);
+      break;    
+    case _PORT_E:
+      DDRE |= _BV(pins);
+      PORTE |= _BV(pins);
+      break;    
+    case _PORT_F:
+      DDRF |= _BV(pins);
+      PORTF |= _BV(pins);
+      break;    
+    case _PORT_G:
+      DDRG |= _BV(pins);
+      PORTG |= _BV(pins);
+      break;
+    }
+  }
+}
+
+/**
+ * Checks if button1 is currently pressed.
+ * 
+ * @return 1 if button1 is pressed, 0 otherwise
+ *
+ * @see button1_wait, button1_click
+ **/
+int button1_read( void ) {
+  int pin_val;
+  DDRG &= ~_BV(PING0);
+  PORTG|= _BV(PING0);
+  pin_val = PING;
+  return !((pin_val & _BV(PING0)));
+}
+
+/**
+ * Delays execution until button1 is pressed.
+ *
+ * @see button1_read, button1_click
+ **/
+void button1_wait( void ) {
+  while(!button1_read() ) {
+    delay_ms(15);
+  }
+}
+
+/**
+ * If button1 is pressed, waits until it is released before returning.
+ * Otherwise, the function returns immediately.
+ *
+ * @return 1 if button1 has been pressed, 0 otherwise
+ *
+ * @see button1_read, button1_wait
+ **/
+int button1_click() {
+  if(button1_read()) {
+    while(button1_read());
+    return 1;
+  } else {
+    return 0;
+  }
+}
+
+/**
+ * Checks if button2 is currently pressed.
+ * 
+ * @return 1 if button2 is pressed, 0 otherwise
+ *
+ * @see button2_wait, button2_click
+ **/
+int button2_read( void ) {
+  int pin_val;
+  DDRG &= ~_BV(PING1);
+  PORTG|= _BV(PING1);
+  pin_val = PING;
+  return !((pin_val & _BV(PING1)));
+}
+
+/**
+ * Delays execution until button2 is pressed.
+ *
+ * @see button2_read, button2_click
+ **/
+void button2_wait( void ) {
+  while(!button2_read()){
+    delay_ms(15);
+  }
+}
+
+/**
+ * If button2 is pressed, waits until it is released before returning.
+ * Otherwise, the function returns immediately.
+ *
+ * @return 1 if button2 has been pressed, 0 otherwise
+ *
+ * @see button2_read, button2_wait
+ **/
+int button2_click() {
+  if(button2_read()) {
+    while(button2_read());
+    return 1;
+  } else {
+    return 0;
+  }
+}
+
+/** @} **/ //end defgroup
+
Index: demos/hunter_prey_john/projects/libdragonfly/reset.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/reset.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/reset.c	(revision 1694)
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file reset
+ * @brief Reset the Robot
+ *
+ * Implementation of a function to reset the robot.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include "reset.h"
+
+/**
+ * @defgroup reset Reset
+ * Functions for manipulation the ADC on the dragonfly board.
+ * All definitions may be found in analog.h.
+ *
+ * @{
+ **/
+
+/**
+ * Resets the AVR when called.  Sets the watchdog timer and lets it overflow
+ * to reset the AVR.  The reset clears all memory and resets all registers
+ * with the exception of the Watchdog Reset Flag (WDRF) in the MCU Control
+ * and Status Register (MCUCSR).
+ **/
+void reset(void) {
+  WDTCR &= 0xF8;
+  WDTCR |= 0x08;
+  _delay_ms(15);
+}
+
+/**@}**/ //end defgroup
+
Index: demos/hunter_prey_john/projects/libdragonfly/lights.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/lights.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/lights.c	(revision 1694)
@@ -0,0 +1,752 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file ligths.c
+ * @brief Orbs
+ *
+ * Implemenation for the orbs (tri-colored LEDs)
+ *
+ * @author Colony Project, CMU Robotics Club
+ * @bug Unfinished
+ **/
+
+/*
+lights.c
+Controls orb1 and orb2. Can be extended for a software PWM that may be used for servos in the future (although maybe
+using a different timer might be preferable).
+
+author: CMU Robotics Club, Colony Project
+
+Change Log:
+3/31/2009 - Martin
+    Rewritten from scratch. Fixes code duplication, long ISRs, bugs, unnecessary synchronized code, memory waste
+*/
+
+
+
+/*
+ * Test cases:
+ *   - The following code has to work without flickering:
+ *     orb_init_pwm(); while(1) { orbs_set(1,1,1,254,254,254); }
+ */
+
+/*
+ * Possible optimizations:
+ *   - Use pointers instead of indicies for current_pwm_channel
+ *   - Optimize output_compare()
+ *   - Use a different sorting algorithm (see sort_orbs_buffer for further comments on this issue)
+ *   - Use pointers in fill_orbs_buffer
+ *   - Optimized orb_set (use the knowledge that there are only 3 distinct values, don't use a loop but unroll the
+ *     sorting, which is no problem for 3 values)
+ *   - Use a lower update frequency. The next higher prescaler value leads to a frequency of 30Hz which is too low (the
+ *     orbs are flickering). So the timer would have to be reloaded manually after 127 to generate 60Hz. This would
+ *     decrease the resolution from 8 to 7 bit, but 128 steps should still be enough.
+ *   - On setting the orbs, combine channels with the same time. This would reduce the all-values-equal OC interrupt
+ *     (30us) to the time of one regular OC interrupt (6us/10us). Also, it would reduce the total cpu usage whenever
+ *     some of the values are equal.
+ *
+ * When code is changed, the performance measurements above should be redone.
+ */
+
+#include "dragonfly_lib.h"
+#include "lights.h"
+
+// ***************
+// ** Constants **
+// ***************
+
+#define NUM_ORBS 2   // Number or orbs
+#define NUM_COLORS 3 // Number of colors per orb
+#define num_pwm_channels NUM_ORBS*NUM_COLORS
+
+
+// *********
+// ** I/O **
+// *********
+
+// Orb port
+#define ORBPORT PORTC
+#define ORBDDR  DDRC
+
+// Orb pins
+#define ORB1_RED   0
+#define ORB1_GREEN 1
+#define ORB1_BLUE  2
+#define ORB2_RED   4
+#define ORB2_GREEN 5
+#define ORB2_BLUE  6
+
+
+// ***************
+// ** Debugging **
+// ***************
+
+//#define LIGHTS_DEBUG
+#undef LIGHTS_DEBUG
+
+#define LIGHTS_DEBUG_INIT                             DDRF=6;
+#define LIGHTS_DEBUG_OVERFLOW_INTERRUPT_START         PORTF|=4;
+#define LIGHTS_DEBUG_OVERFLOW_INTERRUPT_END           PORTF&=~4;
+#define LIGHTS_DEBUG_OUTPUT_COMPARE_INTERRUPT_START   PORTF|=2;
+#define LIGHTS_DEBUG_OUTPUT_COMPARE_INTERRUPT_END     PORTF&=~2;
+#define LIGHTS_DEBUG_APPLY_START                      //PORTF|=2;
+#define LIGHTS_DEBUG_APPLY_END                        //PORTF&=~2;
+
+
+// ***********
+// ** Masks **
+// ***********
+
+// Some useful bit masks. All of them are are calculated from the I/O definitions above. The calculations should be done
+// at compile time (even if they are not, they are only executed once at startup).
+
+// Masks for the individual LEDs
+#define orb1_red_mask    _BV (ORB1_RED  )
+#define orb1_green_mask  _BV (ORB1_GREEN)
+#define orb1_blue_mask   _BV (ORB1_BLUE )
+#define orb2_red_mask    _BV (ORB2_RED  )
+#define orb2_green_mask  _BV (ORB2_GREEN)
+#define orb2_blue_mask   _BV (ORB2_BLUE )
+
+// Mask for all LEDs
+#define all_orbs_mask \
+    orb1_red_mask | orb1_green_mask | orb1_blue_mask | \
+    orb2_red_mask | orb2_green_mask | orb2_blue_mask;
+
+// Mask for the individual LEDs, organized as an array for programmatic access. The layout of this array is
+// orb_mask[orb_num, color_num]
+const uint8_t orb_mask[NUM_ORBS][NUM_COLORS]={
+    { orb1_red_mask, orb1_green_mask, orb1_blue_mask },
+    { orb2_red_mask, orb2_green_mask, orb2_blue_mask }
+};
+
+// ***********
+// ** Types **
+// ***********
+
+struct pwm_channel_t { // 2 bytes
+    uint8_t time;
+    uint8_t mask;
+};
+
+struct pwm_t { // 13 bytes
+    uint8_t init_mask;
+    struct pwm_channel_t channel[num_pwm_channels];
+};
+
+
+// ***************
+// ** Variables **
+// ***************
+
+// Whether to use PWM (true) or binary (false) orb mode. Not volatile because it's only read once per function.
+bool enable_orb_pwm=true;
+
+// The PWM channels and the buffer pointers. This data structure is triple buffered, see above for the reasons. Not
+// volatile because they are not modified asynchronously (the read buffer is never written to asynchronously).
+struct pwm_t pwm_buffer[3];
+
+// The front buffer the ISR reads from. Other threads may not touch this pointer or the buffer it points to. Not
+// volatile because it may only be modified by the ISR.
+struct pwm_t *pwm_read_buffer =&pwm_buffer[0];
+
+// The back buffer we can write to. The ISR may not touch this pointer or the buffer it points to. Not volatile because
+// it may only be modified by the caller.
+struct pwm_t *pwm_write_buffer=&pwm_buffer[1]; 
+
+// The middle buffer to flip the write or read buffer with. Not volatile because it is only read once per function.
+struct pwm_t *pwm_free_buffer =&pwm_buffer[2]; 
+
+// Whether to perform a page flip on the beginning of the next PWM cycle. Not volatile because it is only read once
+// per function.
+bool pwm_page_flip=false; // Whether to do a page flip on the next overflow
+
+// The orb value array. Orb values are written here to be sorted into pwm_channels. Not volatile because all accesses
+// are from guarded (thread safe) functions.
+uint8_t orb_values[NUM_ORBS][NUM_COLORS];
+
+
+// ****************
+// ** Timer ISRs **
+// ****************
+
+// Not volatile because it is only accessed in the interrupt handler.
+uint8_t current_pwm_channel=0;
+
+
+static void output_compare (void) {
+	// This function is called when an output compare condition may have occured.
+	
+    // If the OC interrupt is executed without delay, TCNT0==time+1 (where time==OCR0), because the interrupt flag is
+	// queued at the next timer clock cycle after an output compare.
+
+    // What may happen here is that the interrupt is delayed for more than one timer clock cycle (33 us). In that case,
+	// the timer has already counted on and TCNT0 is bigger than current_channel_timer. Also, while during the ISR no
+	// other interrupts will occur, the timer may still count on. Thus, we have to check the following channel as well.
+
+	// Some optimization is possible in this function.
+
+    while (1) {
+		// The timer value at which the output compare interrupt should occur (one timer clock cycle after the output
+		// compare condition is detected).
+		uint8_t current_channel_time=pwm_read_buffer->channel[current_pwm_channel].time+1;
+		
+		// If the counter is not at this time yet, we don't have to do anything right now.
+		if (current_channel_time>TCNT0) return;
+		
+		// We have an output compare condition for the current channel.
+		
+        // Turn the current channel off
+        ORBPORT|=pwm_read_buffer->channel[current_pwm_channel].mask;
+
+		// If this was the last channel, exit
+		if (current_pwm_channel==num_pwm_channels-1) return;
+
+        // Increment the channel index
+        current_pwm_channel++;
+
+        // There is a next channel, load its OCR value
+        if (pwm_read_buffer->channel[current_pwm_channel].time<255)
+            OCR0=pwm_read_buffer->channel[current_pwm_channel].time;
+    }
+}
+
+SIGNAL (SIG_OVERFLOW0) {
+#ifdef LIGHTS_DEBUG
+    LIGHTS_DEBUG_OVERFLOW_INTERRUPT_START
+#endif
+
+    if (pwm_page_flip) {
+        // Flip the read buffer with the free buffer. We are in an ISR (and we didn't re-enable interrupts), so we don't
+        // have to synchronize explicitly.
+        struct pwm_t *temp = pwm_read_buffer;
+        pwm_read_buffer    = pwm_free_buffer;
+        pwm_free_buffer    = temp;
+        pwm_page_flip=false;
+    }
+
+    // Turn only the appropriate PWM channels on. Do this directly on the orb port because at this point all orbs should
+    // be off anyway.
+    ORBPORT|=all_orbs_mask;
+    ORBPORT&=pwm_read_buffer->init_mask;
+    
+    // Start at the first channel
+    current_pwm_channel=0;
+    
+    // Load the first OCR
+    OCR0=pwm_read_buffer->channel[current_pwm_channel].time;
+
+	// If this interrupt was delayed, we might already have an output compare condition.
+	output_compare ();
+
+#ifdef LIGHTS_DEBUG
+    LIGHTS_DEBUG_OVERFLOW_INTERRUPT_END
+#endif
+}
+
+SIGNAL(SIG_OUTPUT_COMPARE0) {
+#ifdef LIGHTS_DEBUG
+    LIGHTS_DEBUG_OUTPUT_COMPARE_INTERRUPT_START
+#endif
+
+	// We have an output compare condition.
+	output_compare ();
+    
+#ifdef LIGHTS_DEBUG
+    LIGHTS_DEBUG_OUTPUT_COMPARE_INTERRUPT_END
+#endif
+}
+
+
+
+// ************************************
+// ** Internal orb setting functions **
+// ************************************
+
+static void sort_orbs_buffer (void) {
+    // This function applies a bubble sort to sort the elements of the pwm_write_buffer->channel array by the time
+    // field.
+    // This implementation is heavily optimized. Note that due to the low (and constant) number of elements to be
+    // sorted, the runtime complexity (O(n^2) for bubble sort) is not relevant here. In fact, a more advanced algorithm
+    // like quick sort or merge sort might even be slower due to higher overhead.
+    // That said, it is possible that selection sort (which is also in O(n^2)) would be faster that bubble sort because
+    // it only has to do a maximum of (n-1) swapping steps (as opposed to n*(n-1)/2 for bubble sort). However, the check
+    // if the elements are already in the correct order would either have to be left out (doing the full search every
+    // time, even if the array is already sorted) or done explicitly, so selection sort might actually be slower than
+    // bubble sort, especially if the array is already sorted or almost sorted.
+    
+    // This implementation uses macros to make the algorithm more clear because the loop is rolled out and the function
+    // would become quite long without macros.
+    
+    // Macro to swap two values of any type. Requires a variable of the appropriate type called swap_temp.
+    #define swap(a,b) { swap_temp=a; a=b; b=swap_temp; }
+
+    // Macro to do one bubble sorting step (compare & swap)
+    #define bubble \
+        if(a->time > b->time) \
+        { \
+            swap (a->time, b->time); \
+            swap (a->mask, b->mask); \
+            done=false; \
+        }
+    
+    // Macro to move to the next bubble sort pair
+    #define next { a++; b++; }
+
+    // Whether no change was made during the last run, which means that all values are already in correct order.
+    bool done;
+    
+    // A temporary variable for swapping.
+    uint8_t swap_temp;
+    
+    // Precompute the first PWM channel (tested faster).
+    struct pwm_channel_t *first=&(pwm_write_buffer->channel[0]);
+
+    // Pointers to the two PWM channels under inspection
+    struct pwm_channel_t *a, *b;
+
+    // The actual sorting
+    a=first; b=a+1; done=true;
+    bubble next bubble next bubble next bubble next bubble
+    if (done) return;
+
+    a=first; b=a+1; done=true;
+    bubble next bubble next bubble next bubble
+    if (done) return;
+
+    a=first; b=a+1; done=true;
+    bubble next bubble next bubble
+    if (done) return;
+
+    a=first; b=a+1; done=true;
+    bubble next bubble
+    if (done) return;
+
+    a=first; b=a+1; done=true;
+    bubble
+    if (done) return;
+
+    // Undefine the macros so they do not disturb some other function.
+    #undef next
+    #undef bubble
+    #undef swap
+}
+
+static void fill_orbs_buffer (void) {
+    // We do not use a loop here because it introduces 27us overhead, which is quite much, given the total time for
+    // optimized copying and sorting of 34us (elements already in correct order) to 71 us (elements in reverse order).
+    
+    #define copy_value(orb, color) \
+        index=NUM_COLORS*orb+color; \
+        time=orb_values[orb][color]; \
+        mask=orb_mask[orb][color]; \
+        \
+        pwm_write_buffer->channel[index].time=time-1; \
+        pwm_write_buffer->channel[index].mask=mask; \
+        \
+        if (time!=0) \
+            pwm_write_buffer->init_mask &= ~mask; \
+
+    uint8_t index, time, mask;
+    copy_value(0,0); copy_value(0,1); copy_value(0,2);
+    copy_value(1,0); copy_value(1,1); copy_value(1,2);
+    
+    #undef copy_value
+}
+
+static void apply_orbs (void) {
+	/*
+	 * Some timing tests: Time for apply_orbs with interrupts disabled, in microseconds:
+     *             Values in:     Correct order      Reverse order
+     * Naive bubble sort:         148                217
+     * Aborting bubble sort:       71                232
+     * Only count to top:          73                189
+     *
+     * Loops rolled out:           61                120
+     * Using pointers:             62                 98
+     * Copy loop also rolled out:  35                 72
+	 *
+	 * Note that rolling out both loops and using pointers saves 52%/62% of time! 27us were spent on loop overhead,
+	 * which is quite much, considering an optimized total time for copying and sorting or 35us.
+	 */
+
+#ifdef LIGHTS_DEBUG
+    LIGHTS_DEBUG_APPLY_START
+#endif
+
+    if (enable_orb_pwm) {
+        // PWM mode
+        
+        pwm_write_buffer->init_mask=~0;
+    
+        // 1. Write the orb values and corresponding masks to the pwm channels
+        // array unsorted.
+        fill_orbs_buffer ();
+
+        // 2. sort the buffer.
+        sort_orbs_buffer ();
+
+        // Flip the write buffer with the free buffer.
+        SYNC {
+            struct pwm_t *temp = pwm_write_buffer;
+            pwm_write_buffer   = pwm_free_buffer;
+            pwm_free_buffer    = temp;
+        }
+        
+        // On the next overflow, flip the read buffer with the free buffer.
+        pwm_page_flip=true;
+    }
+    else {
+        // Binary mode.
+        // The outputs are inverted.
+        uint8_t on=0;
+        
+        if (orb_values[0][0]) on |= orb_mask[0][0];
+        if (orb_values[0][1]) on |= orb_mask[0][1];
+        if (orb_values[0][2]) on |= orb_mask[0][2];
+        if (orb_values[1][0]) on |= orb_mask[1][0];
+        if (orb_values[1][1]) on |= orb_mask[1][1];
+        if (orb_values[1][2]) on |= orb_mask[1][2];
+    
+        // Write the new orb states to the output port. Synchronized because it is a RMW operation.
+        SYNC {
+            uint8_t value=ORBPORT;
+            value |= all_orbs_mask; // All orbs off
+            value &= ~on; // Selected orbs on
+            ORBPORT=value;
+        }
+    }
+            
+#ifdef LIGHTS_DEBUG
+    LIGHTS_DEBUG_APPLY_END
+#endif
+}
+
+static void set_orb_values (uint8_t num, uint8_t red, uint8_t green, uint8_t blue) {
+    // Write the values to the array, but do not sort them yet, as we might want to write the other orb values first so
+    // we don't have to sort twice.
+    // Any function calling this function will probably want to call apply_orbs() afterwards.
+    orb_values[num][0]=red;
+    orb_values[num][1]=green;
+    orb_values[num][2]=blue;
+}
+
+
+// ***********************
+// ** RGB color setting **
+// ***********************
+
+// All of these functions use set_orb_values to set the actual values, and then call apply_orbs() to apply the changes.
+// set_orb_values should be used (even though it would be faster to set the array directly) because the binary/pwm mode
+// has to be handled.
+// All of these functions must be 
+
+uint8_t orb_lock=0;
+
+/**
+ * Sets the specified orb to the specified color. The orbs must be initialized before this function may be used.
+ * Note that, when setting both orbs, using orbs_set is faster then setting the orbs individually because the values are
+ * only sorted once.
+ *
+ * @param num the number of the orb to set (0 or 1)
+ * @param red the red value for the specified orb
+ * @param green the green value for the specified orb
+ * @param blue the blue value for the specified orb
+ * @see 
+ */
+void orb_n_set (uint8_t num, uint8_t red, uint8_t green, uint8_t blue) {
+	REQUIRE_LOCK_OR_RETURN(orb_lock);
+	
+    set_orb_values (num, red, green, blue);
+    apply_orbs ();
+	
+	RELEASE_LOCK(orb_lock);
+}
+
+/**
+ * Set orb1 to the color specified. The orbs must be initialized before this function may be used. Note that, when
+ * setting both orbs, using orbs_set is faster then setting the orbs individually because the values are only sorted
+ * once.
+ *
+ * @param red the red component of the color
+ * @param green the green component of the color
+ * @param blue the blue component of the color
+ *
+ * @see orb_init
+ **/
+void orb1_set (uint8_t red, uint8_t green, uint8_t blue) {
+	REQUIRE_LOCK_OR_RETURN(orb_lock);
+	
+    set_orb_values (0, red, green, blue);
+    apply_orbs ();
+
+	RELEASE_LOCK(orb_lock);
+}
+
+/**
+ * Set orb2 to the color specified. The orbs must be initialized before this function may be used. Note that, when
+ * setting both orbs, using orbs_set is faster then setting the orbs individually because the values are only sorted
+ * once.
+ *
+ * @param red_led the red component of the color
+ * @param green_led the green component of the color
+ * @param blue_led the blue component of the color
+ *
+ * @see orb_init
+ **/
+void orb2_set (uint8_t red, uint8_t green, uint8_t blue) {
+	REQUIRE_LOCK_OR_RETURN(orb_lock);
+	
+    set_orb_values (1, red, green, blue);
+    apply_orbs ();
+
+	RELEASE_LOCK(orb_lock);
+}
+
+/**
+ * Set both orbs to the color specified. The orbs must be initialized before this function may be used.
+ *
+ * @param red_led the red component of the color
+ * @param green_led the green component of the color
+ * @param blue_led the blue component of the color
+ *
+ * @see orb_init, orb1_set, orb2_set
+ **/
+void orb_set (uint8_t red, uint8_t green, uint8_t blue) {
+	REQUIRE_LOCK_OR_RETURN(orb_lock);
+	
+    set_orb_values (0, red, green, blue);
+    set_orb_values (1, red, green, blue);
+    apply_orbs ();
+
+	RELEASE_LOCK(orb_lock);
+}
+
+/**
+ * Set the orbs to the respective values. The orbs must be initialized before this function may be used. Note that, when
+ * setting both orbs, this function is faster than calling orb1_set and orb2_set (or orb_n_set) because the values are
+ * only sorted once.
+ *
+ * @param red1
+ * @param green1
+ * @param blue1
+ * @param red2
+ * @param green2
+ * @param blue2
+ * @see orb1_set
+ * @see orb2_set
+ * @see orb_n_set
+ **/
+void orbs_set (
+    uint8_t red1, uint8_t green1, uint8_t blue1,
+    uint8_t red2, uint8_t green2, uint8_t blue2) {
+
+	REQUIRE_LOCK_OR_RETURN(orb_lock);
+
+    set_orb_values (0, red1, green1, blue1);
+    set_orb_values (1, red2, green2, blue2);
+    apply_orbs ();
+
+	RELEASE_LOCK(orb_lock);
+}
+
+
+// ******************************
+// ** Predefined color setting **
+// ******************************
+
+// This functions just call the corresponding orb*_set functions. If the orbs array is accessed in any other way, it
+// must be synchronized on orb_lock (REQUIRE_LOCK_OR_RETURN and RELEASE_LOCK)! Note that one synchronized function
+// cannot call another one with this lock implementation.
+
+// Macros for extracting a color.
+#define C_RED(col)   (((col & 0xE0) >> 5) * 36)
+#define C_GREEN(col) (((col & 0x1C) >> 2) * 36)
+#define C_BLUE(col)  (((col & 0x03)     ) * 85)
+
+/**
+ * Set the specified orb to the specified color. This function is intended to be used with the predefined colors.
+ *
+ * @param num the number of the orb to set (0 or 1)
+ * @param col the color to set the orbs to
+ **/
+void orb_n_set_color(uint8_t num, uint8_t col) {
+    orb_n_set(num, C_RED(col), C_GREEN(col), C_BLUE(col));
+}
+
+/**
+ * Set orb1 to the specified color. This function is intended to be used with the predefined colors.
+ *
+ * @param col the color to set the orbs to
+ **/
+void orb1_set_color(uint8_t col) {
+    orb1_set (C_RED(col), C_GREEN(col), C_BLUE(col));
+}
+
+/**
+ * Set orb2 to the specified color. This function is intended to be used with the predefined colors.
+ *
+ * @param col the color to set the orbs to
+ **/
+void orb2_set_color(uint8_t col) {
+    orb2_set(C_RED(col), C_GREEN(col), C_BLUE(col));
+}
+
+/**
+ * Set both orbs to the specified color. This function is intended to be used with the predefined colors.
+ *
+ * @param col the color to set the orbs to
+ **/
+void orb_set_color(uint8_t col) {
+    orb_set (C_RED(col), C_GREEN(col), C_BLUE(col));
+}
+
+/**
+ * Set the orbs to the respective color. This function is intended to be used with the predefined colors.
+ *
+ * @param col1 the color to set orb 1 to
+ * @param col2 the color to set orb 2 to
+ **/
+void orbs_set_color(uint8_t col1, uint8_t col2) {
+    orbs_set (C_RED(col1), C_GREEN(col1), C_BLUE(col1), C_RED(col2), C_GREEN(col2), C_BLUE(col2));
+}
+
+#undef C_BLUE
+#undef C_GREEN
+#undef C_RED2
+
+
+// ******************
+// ** Mode setting **
+// ******************
+
+/**
+ * Enables the orb timer. Note that you usually don't want to use this function directly. Instead, use orb_set_mode.
+ * @see orb_set_mode
+ **/
+void orb_enable_timer (void) {
+    // Use 8 bit TC0.
+    //
+    // Timer mode: We cannot use CTC mode because it can only clear on OCR0 (in contrast to the 16 bit timers which can
+    // also use the ICR for that) and OCR0 is already used for generating output compare interrupts. We also need
+    // immediate (non double buffered) update of OCR0, so the only mode left is "Normal".
+    //
+    // Note that for a timer counting from 0 to 255, there are 256 states and thus 257 output possibilities
+    // (0/256...256/256)! However, there are only 256 values in the byte used to specify the PWM value. Possible ways
+    // to deal with that:
+    //   1. use a 16 bit variable for the PWM value (memory waste, overhead)
+    //   2. use an additional flag for the 257th value (inconvenient)
+    //   3. use 1/256...256/256 (skip 0, never complete off)
+    //   4. use 0/256...256/256 (skip 256, never complete on)
+    //   5. skip a value somewhere in the middle
+    //   6. reload the timer after 254
+    // For this implementation, variant 4 was chosen.
+    //
+    // Using an 8 bit timer has the added advantage that all the comparisons are faster.
+    
+    // Normal mode, Compare match output off, Prescaler
+    TCCR0=_BV(CS02) | _BV(CS01); // 256, 120 Hz
+	// The next higher prescaler would be 1024 (30 Hz) which makes the orbs flicker visibly.
+
+    // Enable the interrupts
+    TIMSK|= _BV(OCIE0) | _BV(TOIE0);
+}
+
+/**
+ * Disables the orb timer. Note that you usually don't want to use this function directly. Instead, use orb_set_mode.
+ * @see orb_set_mode
+ **/
+void orb_disable_timer (void) {
+    // Disable the interrupts
+    TIMSK&=~( _BV(OCIE0) | _BV(TOIE0));
+}
+
+
+void orb_set_mode (orb_mode_t mode) {
+    // Set enable_orb_pwm to the appropriate value and disable or enable the timer.
+    if (mode==orb_mode_binary) {
+        orb_disable_timer ();
+
+        enable_orb_pwm=false;
+        apply_orbs ();
+    }
+    else { // orb_mode_pwm
+        enable_orb_pwm=true;
+        apply_orbs ();
+
+        orb_enable_timer ();
+    }
+}
+
+
+// ********************
+// ** Initialization **
+// ********************
+
+// Orb initialization code common to all modes.
+static void orb_init_common (void) {
+    // Enable the output ports and turn off the LEDs
+    ORBPORT |=  all_orbs_mask;
+    ORBDDR  |=  all_orbs_mask;
+
+    // Set all orbs to "off"
+    orb_set (0, 0, 0);
+    
+#ifdef LIGHTS_DEBUG
+    LIGHTS_DEBUG_INIT
+#endif
+}
+
+/**
+ * Initializes the orbs in PWM mode. One of the orb_init* functions must be called before the orbs can be used.
+ * 
+ * @see orb_init_pwm
+ **/
+void orb_init_binary (void) {
+    orb_init_common ();
+    orb_set_mode (orb_mode_binary);
+}
+
+/**
+ * Initializes the orbs in PWM mode. One of the orb_init* functions must be called before the orbs can be used.
+ * 
+ * @see orb_init_binary
+ **/
+void orb_init_pwm (void) {
+    orb_init_common ();
+    orb_set_mode (orb_mode_pwm);
+}
+
+/**
+ * Initializes the orbs in default mode. One of the orb_init* functions must be called before the orbs can be used. Use
+ * the orb_init_binary or orb_init_pwm function if you want one specific mode.
+ *
+ * @see orb_init_pwm
+ * @see orb_init_binary
+ **/
+void orb_init () {
+    orb_init_pwm ();
+}
Index: demos/hunter_prey_john/projects/libdragonfly/lights.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/lights.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/lights.h	(revision 1694)
@@ -0,0 +1,224 @@
+// FIXME remove
+typedef unsigned char uint8_t;
+
+
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file lights.h
+ * @brief Contains declarations for managing the orbs.
+ *
+ * Contains declarations for using the orbs and PWM.
+ *
+ * @author Colony Project, CMU Robotics Club
+ * Based on Firefly Library, by Tom Lauwers and Steven Shamlian
+ **/
+
+#ifndef _LIGHTS_H_
+#define _LIGHTS_H_
+
+/**
+ * @addtogroup orbs
+ * @{
+ **/
+
+/**
+ * Quick start: call orb_init_pwm or orb_init_binary, depending on which mode you want to use. Call orb*set or
+ * orb*set_color to set the orbs.
+ * 
+ * The orbs have two modes of operation: PWM mode and binary mode. In PWM mode, a pwm signal is generated by a hardware
+ * timer and the orbs can be set to a value of 0 through 255. In binary mode, the orbs can only be turned on or off and
+ * a value of 0 means "off" and any other value means "on". The mode can be chosen on initialization and can be changed
+ * at runtime using the orb_set_mode function.
+ *
+ * Operation (PWM mode): On timer overflow, all LEDs with a value>0 are turned on and the output compare value for the
+ * first LED is loaded. On compare match, the corresponding LED is turned off and the next output compare value is
+ * loaded. All masks are precomputed and sorted by time when setting the values.
+ *
+ * The data structure (pwm_t) containing the PWM times and masks is triple buffered. This is because the buffer the ISR
+ * is reading from may only be modified on timer overflow before the next PWM sequence is started, because otherwise the
+ * next OCR value might be sed to a value smaller than the current timer value, resulting in the remaining channels not
+ * being turned off in that PWM period (flash to on). When using two buffers, the page flip can only occur on a timer
+ * overflow for the same reason. So after writing a buffer and marking it for page flip, neither of the buffers could be
+ * modified because the front buffer is read by the ISR and the back buffer could be switched at any time. So the
+ * calling thread would have to be delayed by up to one full PWM period (8ms in the current implementation, but
+ * 20ms-50ms would be a reasonable value to expect here). To avoid this, triple buffering is used.
+ *
+ * The code for applying the orbs is fairly optimized. See the apply_orbs function for some time measurements and
+ * further nodes.
+ *
+ * The PWM frequency is 120Hz (8ms period time). The next lower frequency (determined by the prescaler) is 30 Hz which
+ * is too slow (orbs flicker).
+ *
+ * The orbs code is thread safe, which means that the functions may be called from another interrupt handler. If there
+ * are multiple concurrent calls to the orb*set* functions, one of them is ignored and the orbs are never left in an
+ * inconsistent state. For example, if the orbs are set to green by the main thread and to red by an interrupt handler,
+ * the resulting color will be either red or green, but never yellow.
+ * Thread safety is achieved by grabbing a lock at the beginning of all functions that modify the orb code and releasing
+ * the lock at the end. If the lock is already taken, the function just returns doing nothing.
+ *
+ * Some performance measurements:
+ *   - Time for setting new orb values (PWM mode):       35us-72us (depending on the degree to which the array is
+ *                                                                  already in the correct order)
+ *   - Time for setting new orb values (binary mode):        5.5us
+ *
+ *   - Interrupt time (PWM mode only):                         8us (overflow)
+ *                                                            10us (output compare)
+ *                                                             6us (last output compare)
+ *                                                            30us (output compare, all value equal)
+ *
+ *   - Maximum total interrupt time per period:               64us
+ *   - Maximum CPU usage for interrupts (PWM mode only):     <0.8%
+ *
+ *   - Maximum contiguous synchronized block:                 30us (output compare interrupt, all values equal)
+ *
+ * There are some potential optimizations left. See the source code for more information.
+ *
+ * A note on robustness: if the output compare interrupt is disabled for too long, either due to a long ISR or a long
+ * synchronized code block, the orbs will flicker to brighter values for being turned off too late. With software PWM,
+ * there's nothing at all to be done about that. The problem can be alleviated by using a lower PWM frequency, but then
+ * the orbs will start flickering all the time due to the low update frequency.
+ * Some measurements: with 100us synchronized blocks, the flickering is accepptably low. Longer synchronized blocks
+ * mean more flickering. At 1ms synchronized blocks, the flickering is quite bad, especially for low orb values. Note
+ * that orb value 0 never flickers at all because the corresponding channels are not turned on at all.
+ * Test code (note the _delay_us restrictions!)
+ *   orb_set (1,1,1); while (1) { SYNC { for (uint8_t m=0; m<10; ++m) { _delay_us(10); } } }
+ **/
+
+/** @} **/ //end addtogroup
+
+/**
+ * @addtogroup orbs
+ * @{
+ **/
+
+// ***** Predefined colors *****
+/** @brief Red **/
+#define RED       0xE0
+/** @brief Orange **/
+#define ORANGE    0xE4
+/** @brief Yellow **/
+#define YELLOW    0xE8
+/** @brief Lime **/
+#define LIME      0x68
+/** @brief Green **/
+#define GREEN     0x1C
+/** @brief Cyan **/
+#define CYAN      0x1F
+/** @brief Blue **/
+#define BLUE      0x03
+/** @brief Pink **/
+#define PINK      0xA6 
+/** @brief Purple **/
+#define PURPLE    0x41
+/** @brief Magenta **/
+#define MAGENTA   0xE3
+/** @brief White **/
+#define WHITE     0xFE
+/** @brief Turn the orb off **/
+#define ORB_OFF   0x00
+
+
+
+// ***** Initialization *****
+
+/** @brief Enables the orbs in default mode **/
+void orb_init(void);
+
+/** @brief Enables the orbs in binary mode **/
+void orb_init_binary (void);
+
+/** @brief Enables the orbs in PWM mode **/
+void orb_init_pwm (void);
+
+
+
+// ***** Mode setting *****
+
+/** Specification of the orb mode **/
+typedef uint8_t orb_mode_t;
+
+/** @brief PWM mode **/
+#define orb_mode_pwm 0
+
+/** @brief Binary mode **/
+#define orb_mode_binary 1
+
+
+/** @brief Switches the orbs to the specified mode **/
+void orb_set_mode (orb_mode_t mode);
+
+/** @brief Disables the orb timer, but does not change the mode **/
+void orb_disable_timer (void);
+
+/** @brief Enables the orb timer, but does not change the mode **/
+void orb_enable_timer (void);
+
+
+
+// ***** Setting RGB colors *****
+
+/** @brief set the specified orb to a specified color
+* 	@deprecated This function indexes from 0 instead of 1 **/
+void orb_n_set (uint8_t num, uint8_t red, uint8_t green, uint8_t blue);
+
+/** @brief Set both orbs to a specified color **/
+void orb_set(uint8_t red, uint8_t green, uint8_t blue);
+
+/** @brief Set orb1 to a specified color **/
+void orb1_set(uint8_t red_led, uint8_t green_led, uint8_t blue_led); 
+
+/** @brief Set orb2 to a specified color **/
+void orb2_set(uint8_t red_led, uint8_t green_led, uint8_t blue_led);
+
+void orbs_set (uint8_t red1, uint8_t green1, uint8_t blue1, uint8_t red2, uint8_t green2, uint8_t blue2);
+
+
+
+// ***** Settings predefined colors *****
+
+/** @brief set the specified orb to the specified color
+* 	@deprecated This function indexes from 0 instead of 1 **/
+void orb_n_set_color(uint8_t num, uint8_t col);
+
+/** @brief Set orb1 to a specified color **/
+void orb1_set_color(uint8_t col);
+
+/** @brief Set orb2 to a specified color **/
+void orb2_set_color(uint8_t col);
+
+/** @brief set the orbs to specified colors **/
+void orbs_set_color(uint8_t col1, uint8_t col2);
+
+/** @brief Set both orbs to a specified color **/
+void orb_set_color(uint8_t col);
+
+
+
+/** @} **/ //end addtogroup
+
+#endif
Index: demos/hunter_prey_john/projects/libdragonfly/Doxyfile
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/Doxyfile	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/Doxyfile	(revision 1694)
@@ -0,0 +1,1514 @@
+# Doxyfile 1.5.9
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file 
+# that follow. The default is UTF-8 which is also the encoding used for all 
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the 
+# iconv built into libc) for the transcoding. See 
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = libdragonfly
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 1.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = docs
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, 
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English 
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, 
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, 
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = 
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like regular Qt-style comments 
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
+# interpret the first line (until the first dot) of a Qt-style 
+# comment as the brief description. If set to NO, the comments 
+# will behave just like regular Qt-style comments (thus requiring 
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Java. For instance, namespaces will be presented as packages, qualified 
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 
+# sources. Doxygen will then generate output that is tailored for 
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses. 
+# With this tag you can assign which parser to use for a given extension. 
+# Doxygen has a built-in mapping, but you can override or extend it using this tag. 
+# The format is ext=language, where ext is a file extension, and language is one of 
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, 
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat 
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), 
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING      = 
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 
+# to include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also make the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to 
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
+# Doxygen will parse them like normal C++ but will assume all classes use public 
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter 
+# and setter methods for a property. Setting this option to YES (the default) 
+# will make doxygen to replace the get and set methods by a property in the 
+# documentation. This will only work if the methods are indeed getting or 
+# setting a simple type. If this is not the case, or you want to show the 
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 
+# is documented as struct, union, or enum with the name of the typedef. So 
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
+# with name TypeT. When disabled the typedef will appear as a member of a file, 
+# namespace, or class. And the struct will be named TypeS. This can typically 
+# be useful for C code in case the coding convention dictates that all compound 
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to 
+# determine which symbols to keep in memory and which to flush to disk. 
+# When the cache is full, less often used symbols will be written to disk. 
+# For small to medium size projects (<1000 input files) the default value is 
+# probably good enough. For larger projects a too small cache size can cause 
+# doxygen to be busy swapping symbols to and from disk most of the time 
+# causing a significant performance penality. 
+# If the system has enough physical memory increasing the cache will improve the 
+# performance by keeping more symbols in memory. Note that the value works on 
+# a logarithmic scale so increasing the size by one will rougly double the 
+# memory usage. The cache size is given by this formula: 
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, 
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be 
+# extracted and appear in the documentation as a namespace called 
+# 'anonymous_namespace{file}', where file will be replaced with the base 
+# name of the file that contains the anonymous namespace. By default 
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 
+# hierarchy of group names into alphabetical order. If set to NO (the default) 
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. 
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. 
+# This will remove the Files entry from the Quick Index and from the 
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the 
+# Namespaces page. 
+# This will remove the Namespaces entry from the Quick Index 
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from 
+# the version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by 
+# doxygen. The layout file controls the global structure of the generated output files 
+# in an output format independent way. The create the layout file that represents 
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a 
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name 
+# of the layout file.
+
+LAYOUT_FILE            = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = 
+
+# This tag can be used to specify the character encoding of the source files 
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
+# also the default input encoding. Doxygen uses libiconv (or the iconv built 
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS          = 
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
+# (namespaces, classes, functions, etc.) that should be excluded from the 
+# output. The symbol name can be a fully qualified name, a word, or if the 
+# wildcard * is used, a substring. Examples: ANamespace, AClass, 
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output. 
+# If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis. 
+# Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match. 
+# The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) 
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from 
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will 
+# link to the source code. 
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
+# documentation will contain sections that can be hidden and shown after the 
+# page has loaded. For this to work a browser that supports 
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files 
+# will be generated that can be used as input for Apple's Xcode 3 
+# integrated development environment, introduced with OSX 10.5 (Leopard). 
+# To create a documentation set, doxygen will generate a Makefile in the 
+# HTML output directory. Running make will produce the docset in that 
+# directory and running "make install" will install the docset in 
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 
+# it at startup. 
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 
+# feed. A documentation feed provides an umbrella under which multiple 
+# documentation sets from a single provider (such as a company or product suite) 
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 
+# should uniquely identify the documentation set bundle. This should be a 
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING 
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file 
+# content.
+
+CHM_INDEX_ENCODING     = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER 
+# are set, an additional index file will be generated that can be used as input for 
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated 
+# HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can 
+# be used to specify the file name of the resulting .qch file. 
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               = 
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = 
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. 
+# For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   = 
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see 
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  = 
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's 
+# filter section matches. 
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  = 
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can 
+# be used to specify the location of Qt's qhelpgenerator. 
+# If non-empty doxygen will try to run qhelpgenerator on the generated 
+# .qhp file.
+
+QHG_LOCATION           = 
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index 
+# structure should be generated to display hierarchical information. 
+# If the tag value is set to FRAME, a side panel will be generated 
+# containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature. Other possible values 
+# for this tag are: HIERARCHIES, which will generate the Groups, Directories, 
+# and Class Hierarchy pages using a tree view instead of an ordered list; 
+# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which 
+# disables this behavior completely. For backwards compatibility with previous 
+# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE 
+# respectively.
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# Use this tag to change the font size of Latex formulas included 
+# as images in the HTML documentation. The default is 10. Note that 
+# when you change the font size after a successful doxygen run you need 
+# to manually remove any form_*.png images from the HTML output directory 
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader. 
+# This is useful 
+# if you want to understand what is going on. 
+# On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#  
+# TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#  
+# TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links. 
+# Note that each tag file must have a unique name 
+# (where the name does NOT include the path) 
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc 
+# command. Doxygen will then run the mscgen tool (see 
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where 
+# the mscgen tool resides. If left empty the tool is assumed to be found in the 
+# default search path.
+
+MSCGEN_PATH            = 
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output 
+# directory and reference it in all dot files that doxygen generates. This 
+# font does not include all possible unicode characters however, so when you need 
+# these (or just want a differently looking font) you can specify the font name 
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font, 
+# which can be done by putting it in a standard location or by setting the 
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory 
+# containing the font.
+
+DOT_FONTNAME           = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. 
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the output directory to look for the 
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a 
+# different font using DOT_FONTNAME you can set the path where dot 
+# can find it using this tag.
+
+DOT_FONTPATH           = 
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then 
+# doxygen will generate a call dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable call graphs 
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 
+# doxygen will generate a caller dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable caller 
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include 
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif 
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
+# nodes that will be shown in the graph. If the number of nodes in a graph 
+# becomes larger than this value, doxygen will truncate the graph, which is 
+# visualized by representing a node as a red box. Note that doxygen if the 
+# number of direct children of the root node in a graph is already larger than 
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that the size of a graph can be further restricted by 
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, because dot on Windows does not 
+# seem to support this out of the box. Warning: Depending on the platform used, 
+# enabling this option may lead to badly anti-aliased labels on the edges of 
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Options related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO
Index: demos/hunter_prey_john/projects/libdragonfly/atomic.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/atomic.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/atomic.h	(revision 1694)
@@ -0,0 +1,309 @@
+/* This file is in the dragonfly library directory because it seems to be
+   missing from the AVR libc distribution */
+   
+/* Copyright (c) 2007 Dean Camera
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   * Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+   * Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+
+   * Neither the name of the copyright holders nor the names of
+     contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* $Id: atomic.h,v 1.3 2007/12/20 14:17:56 joerg_wunsch Exp $ */
+
+#ifndef _UTIL_ATOMIC_H_
+#define _UTIL_ATOMIC_H_ 1
+
+#include <avr/io.h>
+#include <avr/interrupt.h>
+
+#if !defined(__DOXYGEN__)
+/* Internal helper functions. */
+static __inline__ uint8_t __iSeiRetVal(void)
+{
+    sei();
+    return 1;
+}
+
+static __inline__ uint8_t __iCliRetVal(void)
+{
+    cli();
+    return 1;
+}
+
+static __inline__ void __iSeiParam(const uint8_t *__s)
+{
+    sei();
+    __asm__ volatile ("" ::: "memory");
+    (void)__s;
+}
+
+static __inline__ void __iCliParam(const uint8_t *__s)
+{
+    cli();
+    __asm__ volatile ("" ::: "memory");
+    (void)__s;
+}
+
+static __inline__ void __iRestore(const  uint8_t *__s)
+{
+    SREG = *__s;
+    __asm__ volatile ("" ::: "memory");
+}
+#endif	/* !__DOXYGEN__ */
+
+/** \file */
+/** \defgroup util_atomic <util/atomic.h> Atomically and Non-Atomically Executed Code Blocks
+
+    \code
+    #include <util/atomic.h>
+    \endcode
+
+    \note The macros in this header file require the ISO/IEC 9899:1999
+    ("ISO C99") feature of for loop variables that are declared inside
+    the for loop itself.  For that reason, this header file can only
+    be used if the standard level of the compiler (option --std=) is
+    set to either \c c99 or \c gnu99.
+
+    The macros in this header file deal with code blocks that are
+    guaranteed to be excuted Atomically or Non-Atmomically.  The term
+    "Atomic" in this context refers to the unability of the respective
+    code to be interrupted.
+
+    These macros operate via automatic manipulation of the Global
+    Interrupt Status (I) bit of the SREG register. Exit paths from
+    both block types are all managed automatically without the need
+    for special considerations, i. e. the interrupt status will be
+    restored to the same value it has been when entering the
+    respective block.
+
+    A typical example that requires atomic access is a 16 (or more)
+    bit variable that is shared between the main execution path and an
+    ISR.  While declaring such a variable as volatile ensures that the
+    compiler will not optimize accesses to it away, it does not
+    guarantee atomic access to it.  Assuming the following example:
+
+    \code
+#include <inttypes.h>
+#include <avr/interrupt.h>
+#include <avr/io.h>
+
+volatile uint16_t ctr;
+
+ISR(TIMER1_OVF_vect)
+{
+  ctr--;
+}
+
+...
+int
+main(void)
+{
+   ...
+   ctr = 0x200;
+   start_timer();
+   while (ctr != 0)
+     // wait
+       ;
+   ...
+}
+    \endcode
+
+    There is a chance where the main context will exit its wait loop
+    when the variable \c ctr just reached the value 0xFF.  This happens
+    because the compiler cannot natively access a 16-bit variable
+    atomically in an 8-bit CPU.  So the variable is for example at
+    0x100, the compiler then tests the low byte for 0, which succeeds.
+    It then proceeds to test the high byte, but that moment the ISR
+    triggers, and the main context is interrupted.  The ISR will
+    decrement the variable from 0x100 to 0xFF, and the main context
+    proceeds.  It now tests the high byte of the variable which is
+    (now) also 0, so it concludes the variable has reached 0, and
+    terminates the loop.
+
+    Using the macros from this header file, the above code can be
+    rewritten like:
+
+    \code
+#include <inttypes.h>
+#include <avr/interrupt.h>
+#include <avr/io.h>
+#include <util/atomic.h>
+
+volatile uint16_t ctr;
+
+ISR(TIMER1_OVF_vect)
+{
+  ctr--;
+}
+
+...
+int
+main(void)
+{
+   ...
+   ctr = 0x200;
+   start_timer();
+   sei();
+   uint16_t ctr_copy;
+   do
+   {
+     ATOMIC_BLOCK(ATOMIC_FORCEON)
+     {
+       ctr_copy = ctr;
+     }
+   }
+   while (ctr_copy != 0);
+   ...
+}
+    \endcode
+
+    This will install the appropriate interrupt protection before
+    accessing variable \c ctr, so it is guaranteed to be consistently
+    tested.  If the global interrupt state were uncertain before
+    entering the ATOMIC_BLOCK, it should be executed with the
+    parameter ATOMIC_RESTORESTATE rather than ATOMIC_FORCEON.
+
+*/
+
+/** \def ATOMIC_BLOCK(type)
+    \ingroup util_atomic
+
+    Creates a block of code that is guaranteed to be executed
+    atomically. Upon entering the block the Global Interrupt Status
+    flag in SREG is disabled, and re-enabled upon exiting the block
+    from any exit path.
+
+    Two possible macro parameters are permitted, ATOMIC_RESTORESTATE
+    and ATOMIC_FORCEON.
+*/
+#if defined(__DOXYGEN__)
+#define ATOMIC_BLOCK(type)
+#else
+#define ATOMIC_BLOCK(type) for ( type, __ToDo = __iCliRetVal(); \
+	                       __ToDo ; __ToDo = 0 )
+#endif	/* __DOXYGEN__ */
+
+/** \def NONATOMIC_BLOCK(type)
+    \ingroup util_atomic
+
+    Creates a block of code that is executed non-atomically. Upon
+    entering the block the Global Interrupt Status flag in SREG is
+    enabled, and disabled upon exiting the block from any exit
+    path. This is useful when nested inside ATOMIC_BLOCK sections,
+    allowing for non-atomic execution of small blocks of code while
+    maintaining the atomic access of the other sections of the parent
+    ATOMIC_BLOCK.
+
+    Two possible macro parameters are permitted,
+    NONATOMIC_RESTORESTATE and NONATOMIC_FORCEOFF.
+*/
+#if defined(__DOXYGEN__)
+#define NONATOMIC_BLOCK(type)
+#else
+#define NONATOMIC_BLOCK(type) for ( type, __ToDo = __iSeiRetVal(); \
+	                          __ToDo ;  __ToDo = 0 )
+#endif	/* __DOXYGEN__ */
+
+/** \def ATOMIC_RESTORESTATE
+    \ingroup util_atomic
+
+    This is a possible parameter for ATOMIC_BLOCK. When used, it will
+    cause the ATOMIC_BLOCK to restore the previous state of the SREG
+    register, saved before the Global Interrupt Status flag bit was
+    disabled. The net effect of this is to make the ATOMIC_BLOCK's
+    contents guaranteed atomic, without changing the state of the
+    Global Interrupt Status flag when execution of the block
+    completes.
+*/
+#if defined(__DOXYGEN__)
+#define ATOMIC_RESTORESTATE
+#else
+#define ATOMIC_RESTORESTATE uint8_t sreg_save \
+	__attribute__((__cleanup__(__iRestore))) = SREG
+#endif	/* __DOXYGEN__ */
+
+/** \def ATOMIC_FORCEON
+    \ingroup util_atomic
+
+    This is a possible parameter for ATOMIC_BLOCK. When used, it will
+    cause the ATOMIC_BLOCK to force the state of the SREG register on
+    exit, enabling the Global Interrupt Status flag bit. This saves on
+    flash space as the previous value of the SREG register does not
+    need to be saved at the start of the block.
+
+    Care should be taken that ATOMIC_FORCEON is only used when it is
+    known that interrupts are enabled before the block's execution or
+    when the side effects of enabling global interrupts at the block's
+    completion are known and understood.
+*/
+#if defined(__DOXYGEN__)
+#define ATOMIC_FORCEON
+#else
+#define ATOMIC_FORCEON uint8_t sreg_save \
+	__attribute__((__cleanup__(__iSeiParam))) = 0
+#endif	/* __DOXYGEN__ */
+
+/** \def NONATOMIC_RESTORESTATE
+    \ingroup util_atomic
+
+    This is a possible parameter for NONATOMIC_BLOCK. When used, it
+    will cause the NONATOMIC_BLOCK to restore the previous state of
+    the SREG register, saved before the Global Interrupt Status flag
+    bit was enabled. The net effect of this is to make the
+    NONATOMIC_BLOCK's contents guaranteed non-atomic, without changing
+    the state of the Global Interrupt Status flag when execution of
+    the block completes.
+*/
+#if defined(__DOXYGEN__)
+#define NONATOMIC_RESTORESTATE
+#else
+#define NONATOMIC_RESTORESTATE uint8_t sreg_save \
+	__attribute__((__cleanup__(__iRestore))) = SREG
+#endif	/* __DOXYGEN__ */
+
+/** \def NONATOMIC_FORCEOFF
+    \ingroup util_atomic
+
+    This is a possible parameter for NONATOMIC_BLOCK. When used, it
+    will cause the NONATOMIC_BLOCK to force the state of the SREG
+    register on exit, disabling the Global Interrupt Status flag
+    bit. This saves on flash space as the previous value of the SREG
+    register does not need to be saved at the start of the block.
+
+    Care should be taken that NONATOMIC_FORCEOFF is only used when it
+    is known that interrupts are disabled before the block's execution
+    or when the side effects of disabling global interrupts at the
+    block's completion are known and understood.
+*/
+#if defined(__DOXYGEN__)
+#define NONATOMIC_FORCEOFF
+#else
+#define NONATOMIC_FORCEOFF uint8_t sreg_save \
+	__attribute__((__cleanup__(__iCliParam))) = 0
+#endif	/* __DOXYGEN__ */
+
+#endif
Index: demos/hunter_prey_john/projects/libdragonfly/odometry.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/odometry.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/odometry.h	(revision 1694)
@@ -0,0 +1,56 @@
+
+/**
+ * @file odometry.h
+ * @brief Code for estimating the robots pose.
+ * 
+ * Offers simple position and orientation information.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef __ODOMETRY_C__
+#define __ODOMETRY_C__
+
+/**
+ * @addtogroup odometry 
+ * @{
+ **/
+
+//Odometry resolution, *64 microseconds.
+#define ODOMETRY_CLK 255u 
+#define TIME_SCALE 64
+
+//Wheel = 2.613 in.  
+//Circumference = 208.508133 mm
+//Distance per encoder click (circumference / 1024)  = 203.621224 um.
+//Robot width = 5.3745 in. = 136.5123 mm
+
+#define ROBOT_WIDTH_UM 137000  //um
+#define CLICK_DISTANCE_UM 204 //um
+
+#define DISTANCE_SCALE 2.10526316 //Magic constant.
+#define ANGLE_SCALE 1.12823207 //Magic constant.
+
+/** @brief Retrieve the robots estimated x position*/
+long odometry_dx(void);
+
+/** @brief Retrieve the robots estimated y position*/
+long odometry_dy(void);
+
+/** @brief Retrieve the robots estimated orientation*/
+double odometry_angle(void);
+
+/** @brief Initialize odometry. MUST be called before 
+ * the other functions work.**/
+void odometry_init(void);
+
+/** @brief Reset position and orientation to the origin facing
+ * the x axis.*/
+void odometry_reset(void);
+
+/** @brief Report estimated velocity [mm/s].*/
+long odometry_velocity(void);
+
+/**@}**/ //end group
+
+#endif
Index: demos/hunter_prey_john/projects/libdragonfly/reset.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/reset.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/reset.h	(revision 1694)
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * 
+ * @file reset.h
+ * @brief Contains function(s) for resetting the robots
+ * 
+ * @author Colony Project, CMU Robotics Club, James Kong
+ */
+
+#ifndef _RESET_H_
+#define _RESET_H_
+
+/**
+ * @addtogroup reset
+ * @{
+ **/
+ 
+/** @brief Reset the robot **/
+void reset(void);
+
+/**@}**/ //end group
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/dio.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/dio.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/dio.h	(revision 1694)
@@ -0,0 +1,348 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file dio.h
+ * @brief Definitions for digital input / output
+ *
+ * This file contains definitions and functions for dealing
+ * with digital input and output.
+ *
+ * @author Colony Project, CMU Robotics Club
+ * Based on Tom Lauwer's Firefly Library
+ **/
+
+#ifndef _DIO_H
+#define _DIO_H
+
+/*
+  these are ALL the pins
+  don't use unless you know what you're doing
+*/
+
+/*
+  DIO pins on new dragonfly boards are shown below:
+  -----------------------------------------------
+  | _PIN_E6 | _PIN_E7 | _PIN_D2 | _PIN_D3 | VCC |
+  -----------------------------------------------
+  | _PIN_E2 | _PIN_E3 | _PIN_E4 | _PIN_E5 | GND |
+  -----------------------------------------------
+*/
+
+/** @brief Port A **/
+#define _PORT_A 1
+/** @brief Port B **/
+#define _PORT_B 2
+/** @brief Port C **/
+#define _PORT_C 3
+/** @brief Port D **/
+#define _PORT_D 4
+/** @brief Port E **/
+#define _PORT_E 5
+/** @brief Port F **/
+#define _PORT_F 6
+/** @brief Port G **/
+#define _PORT_G 7
+
+/** @brief Pin A0 **/
+#define _PIN_A0 8
+/** @brief Pin A1 **/
+#define _PIN_A1 9
+/** @brief Pin A2 **/
+#define _PIN_A2 10
+/** @brief Pin A3 **/
+#define _PIN_A3 11
+/** @brief Pin A4 **/
+#define _PIN_A4 12
+/** @brief Pin A5 **/
+#define _PIN_A5 13
+/** @brief Pin A6 **/
+#define _PIN_A6 14 
+/** @brief Pin A7 **/
+#define _PIN_A7 15
+
+/** @brief Pin B0 **/
+#define _PIN_B0 16
+/** @brief Pin B1 **/
+#define _PIN_B1 17
+/** @brief Pin B2 **/
+#define _PIN_B2 18
+/** @brief Pin B3 **/
+#define _PIN_B3 19
+/** @brief Pin B4 **/
+#define _PIN_B4 20
+/** @brief Pin B5 **/
+#define _PIN_B5 21
+/** @brief Pin B6 **/
+#define _PIN_B6 22
+/** @brief Pin B7 **/
+#define _PIN_B7 23
+
+/** @brief Pin C0 **/
+#define _PIN_C0 24
+/** @brief Pin C1 **/
+#define _PIN_C1 25
+/** @brief Pin C2 **/
+#define _PIN_C2 26
+/** @brief Pin C3 **/
+#define _PIN_C3 27
+/** @brief Pin C4 **/
+#define _PIN_C4 28
+/** @brief Pin C5 **/
+#define _PIN_C5 29
+/** @brief Pin C6 **/
+#define _PIN_C6 30
+/** @brief Pin C7 **/
+#define _PIN_C7 31
+
+/** @brief Pin D0 **/
+#define _PIN_D0 32  // pin DIO6 on new dragonfly boards
+/** @brief Pin D1 **/
+#define _PIN_D1 33  // pin DIO7
+/** @brief Pin D2 **/
+#define _PIN_D2 34
+/** @brief Pin D3 **/
+#define _PIN_D3 35
+/** @brief Pin D4 **/
+#define _PIN_D4 36
+/** @brief Pin D5 **/
+#define _PIN_D5 37
+/** @brief Pin D6 **/
+#define _PIN_D6 38
+/** @brief Pin D7 **/
+#define _PIN_D7 39
+
+/** @brief Pin E0 **/
+#define _PIN_E0 40
+/** @brief Pin E1 **/
+#define _PIN_E1 41
+/** @brief Pin E2 **/
+#define _PIN_E2 42  // pin DIO0
+/** @brief Pin E3 **/
+#define _PIN_E3 43  // pin DIO1
+/** @brief Pin E4 **/
+#define _PIN_E4 44  // pin DIO2
+/** @brief Pin E5 **/
+#define _PIN_E5 45  // pin DIO3
+/** @brief Pin E6 **/
+#define _PIN_E6 46  // pin DIO4
+/** @brief Pin E7 **/
+#define _PIN_E7 47  // pin DIO5
+
+/** @brief Pin F0 **/
+#define _PIN_F0 48
+/** @brief Pin F1 **/
+#define _PIN_F1 49
+/** @brief Pin F2 **/
+#define _PIN_F2 50
+/** @brief Pin F3 **/
+#define _PIN_F3 51
+/** @brief Pin F4 **/
+#define _PIN_F4 52
+/** @brief Pin F5 **/
+#define _PIN_F5 53
+/** @brief Pin F6 **/
+#define _PIN_F6 54
+/** @brief Pin F7 **/
+#define _PIN_F7 55
+
+/** @brief Pin G0 **/
+#define _PIN_G0 56
+/** @brief Pin WR **/
+#define _PIN_WR 56
+/** @brief Pin G1 **/
+#define _PIN_G1 57
+/** @brief Pin RD **/
+#define _PIN_RD 57
+/** @brief Pin G2 **/
+#define _PIN_G2 58
+/** @brief Pin ALE **/
+#define _PIN_ALE 58
+/** @brief Pin G3 **/
+#define _PIN_G3 59
+/** @brief Pin TOSC2 **/
+#define _PIN_TOSC2 59
+/** @brief Pin G4 **/
+#define _PIN_G4 60
+/** @brief Pin TOSC1 **/
+#define _PIN_TOSC1 60
+//#define _PIN_G5 61
+//#define _PIN_G6 62
+//#define _PIN_G7 63
+
+/*
+  These are the header pins (the ones you can connect things to)
+  Feel free to use these
+*/
+
+/**
+ * @addtogroup dio
+ * @{
+ **/
+/** @brief Pin A0 **/
+#define PIN_A0 8
+/** @brief Pin A1 **/
+#define PIN_A1 9
+/** @brief Pin A2 **/
+#define PIN_A2 10
+/** @brief Pin A3 **/
+#define PIN_A3 11
+/** @brief Pin A4 **/
+#define PIN_A4 12
+/** @brief Pin A5 **/
+#define PIN_A5 13
+/** @brief Pin A6 **/
+#define PIN_A6 14 
+/** @brief Pin A7 **/
+#define PIN_A7 15
+
+/** @brief Pin SS **/
+#define PIN_SS 16
+/** @brief Pin SCK **/
+#define PIN_SCK 17
+/** @brief Pin MOSI **/
+#define PIN_MOSI 18
+/** @brief Pin MISO **/
+#define PIN_MISO 19
+/** @brief LCD Command Pin **/
+#define PIN_LCD_COMMAND 20
+
+/** @brief Pin C0 **/
+#define PIN_C0 24
+/** @brief Pin C1 **/
+#define PIN_C1 25
+/** @brief Pin C2 **/
+#define PIN_C2 26
+/** @brief Pin C3 **/
+#define PIN_C3 27
+/** @brief Pin C4 **/
+#define PIN_C4 28
+/** @brief Pin C5 **/
+#define PIN_C5 29
+/** @brief Pin C6 **/
+#define PIN_C6 30
+/** @brief Pin C7 **/
+#define PIN_C7 31
+
+/** @brief Pin SCL **/
+#define PIN_SCL 32
+/** @brief Pin SDA **/
+#define PIN_SDA 33
+
+/** @brief Pin RX0 **/
+#define PIN_RX0 40
+/** @brief Pin TX0 **/
+#define PIN_TX0 41
+/** @brief LCD Reset Pin **/
+#define PIN_LCD_RESET 42
+/** @brief Pin E6 **/
+#define PIN_E6 46
+/** @brief Pin EXT_DIO1 **/
+#define PIN_EXT_DIO1 46
+/** @brief Pin E7 **/
+#define PIN_E7 47
+/** @brief Pin EXT_DIO2 **/
+#define PIN_EXT_DIO2 48
+
+/** @brief Pin AN0 **/
+#define PIN_AN0 48
+/** @brief Pin ADC0 **/
+#define PIN_ADC0 48
+/** @brief Pin AN1 **/
+#define PIN_AN1 49
+/** @brief Pin ADC1 **/
+#define PIN_ADC1 49
+/** @brief Pin AN2 **/
+#define PIN_AN2 50
+/** @brief Pin ADC2 **/
+#define PIN_ADC2 50
+/** @brief Pin AN3 **/
+#define PIN_AN3 51
+/** @brief Pin ADC3 **/
+#define PIN_ADC3 51
+/** @brief Pin AN4 **/
+#define PIN_AN4 52
+/** @brief Pin ADC4 **/
+#define PIN_ADC4 52
+/** @brief Pin AN5 **/
+#define PIN_AN5 53
+/** @brief Pin ADC5 **/
+#define PIN_ADC5 53
+/** @brief Pin AN6 **/
+#define PIN_AN6 54
+/** @brief Pin ADC6 **/
+#define PIN_ADC6 54
+/** @brief Pin AN7 **/
+#define PIN_AN7 55
+/** @brief Pin ADC7 **/
+#define PIN_ADC7 55
+
+/** @brief Wheel Pin **/
+#define PIN_WHEEL 54
+/** @brief Battery Voltage Monitor Pin **/
+#define PIN_BATT 55
+
+/** @brief button1 Pin **/
+#define PIN_BTN1 56
+/** @brief button2 Pin **/
+#define PIN_BTN2 57
+
+/** @brief LED1 Pin **/
+#define PIN_LED1 58
+
+/* Buttons */
+/** @brief Button Pin **/
+#define PIN_BTN PING
+/** @brief button2 Pin **/
+#define BTN2 PING1
+/** @brief button1 Pin **/
+#define BTN1 PING0
+
+/** @brief Read a portpin. **/
+int digital_input(int);
+/** @brief Output to a portpin. **/
+void digital_output(int bit, int val);
+/** @brief Pullup a portpin. **/
+void digital_pull_up(int);
+
+/** @brief Check if button1 is pressed. **/
+int button1_read( void );
+/** @brief Check if button1 is clicked. **/
+int button1_click( void );
+/** @brief Wait until button1 is pressed. **/
+void button1_wait( void );
+
+/** @brief Check if button2 is pressed. **/
+int button2_read( void );
+/** @brief Check if button2 is clicked. **/
+int button2_click( void );
+/** @brief Wait until button2 is pressed. **/
+void button2_wait( void );
+
+/** @} **/ // end addtogroup
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/battery.c
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/battery.c	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/battery.c	(revision 1694)
@@ -0,0 +1,156 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file battery.c
+ * @brief Implementation for reading battery level
+ *
+ * Contains functions for reading the battery level.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#include "battery.h"
+#include "analog.h"
+
+//Constants for Battery
+//Constants determined experimentally 2/9/2007 - James Kong
+//See Battery8_data.xls for experiment data
+#define BATTERY_NEXT_READ_PRESCALAR 5
+#define MAX_LOW_COUNT 5
+
+//global variables
+int battery_low_count;
+
+/**
+ * @defgroup battery Battery
+ * @brief Functions for reading battery voltage.
+ * 
+ * Contains functions for checking the current
+ * voltage of the battery. Include battery.h to
+ * access these functions.
+ *
+ * @{
+ **/
+
+/**
+ * Returns the voltage of the battery as an analog8
+ * reading. 128 is approximately 5 volts. analog_init
+ * must be called before using this function.
+ *
+ * @return the voltage of the battery as an analog8
+ * reading
+ *
+ * @see analog_init, battery, analog8
+ **/
+int battery8(void)
+{
+  return analog8(BATT_PORT);
+}
+
+/**
+ * Returns the voltage of the battery in deciVolts.
+ * analog_init must be called before using this function.
+ *
+ * @return the voltage of the battery in deciVolts.
+ *
+ * @see analog_init, battery8
+ **/
+int battery(void)
+{
+  /* 5 volts is the max, 255 is the max 8bit number , *2 for the divider */
+        return analog8(BATT_PORT) * 500 >>7;
+}
+
+
+/**
+ * Checks if the battery is low. analog_init must be called before
+ * this function can be used. This function waits for several low
+ * battery readings in a row to avoid false positives.
+ *
+ * @return 1 if the battery is low, 0 otherwise
+ *
+ * @see analog_init
+ **/
+char battery_low(void)
+{
+  static char next_read = 0;
+  static char ret = 0;
+  
+  int batt_reading = battery8();
+
+  if(next_read == 0) 
+  {
+    if(batt_reading > BATTERY_LOWV)
+    {
+        ret = 0;
+        battery_low_count = 0;
+    }
+    else
+    {
+        battery_low_count++;
+        if( battery_low_count >= MAX_LOW_COUNT )
+        {
+            ret = 1;
+            battery_low_count = 0;
+        }
+    }
+    
+    next_read = BATTERY_NEXT_READ_PRESCALAR;
+  }
+  else next_read--;
+  
+  return ret;
+}
+
+/**
+ * Averages n_samples battery8 readings. This function may
+ * take a while to complete, and is only made available
+ * for convenience. analog_init must be called before this
+ * function may be used.
+ *
+ * @param n_samples the number of times to sample the battery voltage
+ *
+ * @return the average reading for the battery voltage, where 128
+ * is approximately 5 Volts.
+ *
+ * @see analog_init, battery
+ **/
+int battery8_avg(int n_samples)
+{
+  int i;
+  long int sum = 0;
+  
+  for(i = 0; i < n_samples; i++) 
+  {
+    sum += battery8();
+  }
+  
+  return (int)(sum / n_samples);
+}
+
+/** @} **/ //end defgroup
+
Index: demos/hunter_prey_john/projects/libdragonfly/move.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/move.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/move.h	(revision 1694)
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file move.h
+ * @brief Contains definitions for controlling robot motion
+ * 
+ * This file offers higher-level functions for robot motion.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _MOVE_H_
+#define _MOVE_H_
+
+/**
+ * @addtogroup move
+ * @{
+ **/
+
+/** @brief Move forwards **/
+#define FWD 0
+/** @brief Move backwards **/
+#define BCK 1
+
+/** @brief A slow speed **/
+#define SLOW_SPD 96
+/** @brief Half of the full speed **/
+#define HALF_SPD 128
+/** @brief A normal speed **/
+#define NRML_SPD 160
+/** @brief A fast speed **/
+#define FAST_SPD 192
+/** @brief The maximum speed **/
+#define FULL_SPD 255
+
+/** @brief A slow turning speed **/
+#define SLOW_TURN 64
+/** @brief A medium turning speed **/
+#define NRML_TURN 96
+/** @brief A high turning speed **/
+#define FAST_TURN 128
+
+/** @brief Move the robot at the specified velocity **/
+void move(int velocity, int omega);
+/** @brief Move the robot while avoiding obstacles **/
+void move_avoid(int velocity, int omega, int strength);
+
+/** @} **/
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/buzzer.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/buzzer.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/buzzer.h	(revision 1694)
@@ -0,0 +1,88 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file buzzer.h
+ * @brief Contains definitions for using the buzzer.
+ *
+ * Contains definitions for using the buzzer built into
+ * the colony robots.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _BUZZER_H_
+#define _BUZZER_H_
+
+/**
+ * @addtogroup buzzer
+ * @{
+ **/
+
+//Musical note definitions
+//Source: http://www.answers.com/topic/piano-key-frequencies
+/** @brief Middle C **/
+#define	C4	260 //Middle C
+/** @brief C# **/
+#define	C4s	277 //C sharp
+/** @brief D **/
+#define	D4	294
+/** @brief D# **/
+#define	D4s	311
+/** @brief E **/
+#define	E4	330
+/** @brief F **/
+#define	F4	349
+/** @brief F# **/
+#define	F4s	370
+/** @brief G **/
+#define	G4	392
+/** @brief G# **/
+#define	G4s	415
+/** @brief A **/
+#define	A4	440
+/** @brief A# **/
+#define	A4s	466
+/** @brief B **/
+#define	B4	494
+/** @brief C **/
+#define	C5	523
+
+/** @brief Initialize the buzzer. **/
+void buzzer_init(void);
+/** @brief Set the value the buzzer plays. **/
+void buzzer_set_val(unsigned int buzz_value);
+/** @brief Set the frequency the buzzer plays. **/
+void buzzer_set_freq(unsigned int buzz_freq);
+/** @brief Play a frequency for a specified time. **/
+void buzzer_chirp(unsigned int ms, unsigned int buzz_freq);
+/** @brief Turn the buzzer off. **/
+void buzzer_off(void); 
+
+/** @} **/ //end addtogroup
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/lcd.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/lcd.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/lcd.h	(revision 1694)
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file lcd.h
+ * @brief Contains definitions for dealing with the LCD screen.
+ * 
+ * Contains definitions and functions for dealing with the 
+ * LCD screen.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _LCD_H_
+#define _LCD_H_
+
+/**
+ * @addtogroup lcd
+ * @{
+ **/
+
+/** @brief Initialize the LCD screen **/
+void lcd_init(void);
+/** @brief Clear the LCD screen **/
+void lcd_clear_screen( void );
+/** @brief Print a char to the LCD screen **/
+void lcd_putc(char c);
+/** @brief Print a string to the LCD screen **/
+void lcd_puts(char *s);
+/** @brief Print an int to the LCD screen **/
+void lcd_puti(int value);
+/** @brief Set the current cursor position **/
+void lcd_gotoxy(int x, int y);
+
+/** @} **/
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/battery.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/battery.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/battery.h	(revision 1694)
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file battery.h
+ * @brief Definitions for checking battery voltage.
+ * 
+ * Contains definitions for checking the voltage of the 
+ * battery.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _BATTERY_H_
+#define _BATTERY_H_
+
+/**
+ * @addtogroup battery
+ * @{
+ **/
+
+/** @brief Normal battery voltage. (6 V) **/
+#define BATTERY_NORMALV 154
+/** @brief Charging battery voltage. (7 V) **/
+#define BATTERY_CHARINGV 179
+/** @brief Low battery voltage. ( < 6 V) **/
+#define BATTERY_LOWV 152
+
+/** @brief Read the battery voltage. **/
+int battery8(void);
+/** @brief Read the battery voltage in deciVolts. **/
+int battery(void);
+/** @brief Check if the battery is low. **/
+char battery_low(void);
+/** @brief Get an average battery voltage reading. **/
+int battery8_avg(int n_samples);
+
+/** @} **/ //end addtogroup
+
+#endif
+
Index: demos/hunter_prey_john/projects/libdragonfly/ring_buffer.h
===================================================================
--- demos/hunter_prey_john/projects/libdragonfly/ring_buffer.h	(nonexistent)
+++ demos/hunter_prey_john/projects/libdragonfly/ring_buffer.h	(revision 1694)
@@ -0,0 +1,142 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/** @file ring_buffer.h
+ * @brief Ring Buffer
+ *
+ * Include macros to create a ring buffer. Originally written for 15-410.
+ * Modified for use in ATMega128 serial driver
+ *
+ * @author Cornell Wright (cgwright)
+ * @author Jason P. Winters (jpwinter)
+ *
+ **/
+
+#ifndef _RING_BUFFER_H
+#define _RING_BUFFER_H
+
+/** @brief Creates the struct for a new ring buffer. This just expands to a
+ *	structure definition and thus should be invoked in the global context.
+ *
+ *	@param struct_name Name of the ring buffer struct.
+ *
+ *	@param size The size of the buffer to create.
+ *
+ *	@param type The type of object that the queue is to hold.
+ *
+ *	@param ... Name or names of the instance or instances of the ring buffer(s)
+ *	to be created.
+ */
+#define RING_BUFFER_NEW(struct_name, size, type, ...)	\
+	struct struct_name {	\
+		type queue[size];	\
+		uint8_t start;			\
+		uint8_t end;			\
+		uint8_t buffer_size;			\
+	} __VA_ARGS__
+
+
+/** @brief Initializes the ring buffer, setting its size to the correct value
+ *
+ *	@param buf The ring buffer to initialize.
+ *
+ *  @param size The size of the ring buffer (in array elements)
+ */
+#define RING_BUFFER_INIT(buf, size) 			\
+	do {										\
+		(buf).buffer_size = size;				\
+	} while(0)
+
+
+/** @brief Sets the specified ring buffer to be empty.
+ *
+ *	@param buf The ring buffer to make empty.
+ */
+#define RING_BUFFER_CLEAR(buf)	\
+	do {						\
+		(buf).start = 0;		\
+		(buf).end = 0;			\
+	} while (0)
+
+/** @brief Returns true if the ring buffer specified is empty.
+ *
+ *	@param buf The buffer to check emptiness of.
+ */
+#define RING_BUFFER_EMPTY(buf) ((buf).start == (buf).end)
+
+
+/** @brief Returns true if the ring buffer specified is full.
+ *
+ *	@param buf The buffer to check fullness of.
+ */
+#define RING_BUFFER_FULL(buf)	\
+		(((buf).end + 1) % (buf).buffer_size == (buf).start)
+
+
+/** @brief Adds val to ring buffer buf. Note that val must be of the type
+ *	used in creating the ring buffer to prevent the compiler from spewing
+ *	confusing errors. Also, this assumes that the ring buffer is not full.
+ *
+ *	@param buf The ring buffer to add to.
+ *	@param val The value to add.
+ */
+#define RING_BUFFER_ADD(buf, val)		\
+	do {								\
+		(buf).queue[(buf).end] = val;	\
+		(buf).end = ((buf).end + 1) % (buf).buffer_size;	\
+	} while (0)
+
+
+/** @brief Removes the value at the head of the ring buffer and puts it in
+ *	val_ret. Note that val_ret must be the same type used in creating the ring
+ *	buffer to prevent the compiler from spewing confusing errors. Also, this
+ *	assumes that the ring buffer is not empty.
+ *
+ *	@param buf The ring buffer to remove from.
+ *	@param val_ret Where to put the value removed from the head of the ring
+ *	buffer.
+ */
+#define RING_BUFFER_REMOVE(buf, val_ret)	\
+	do {	\
+		(val_ret) = (buf).queue[(buf).start];	\
+		(buf).start = ((buf).start + 1) % (buf).buffer_size;	\
+	} while (0)
+
+/** @brief Checks the value at the head of the ring buffer without removing it
+ *  and puts it into val_ret. Note that val_ret must be the same type used in
+ *  creating the ring buffer to prevent the compiler from spewing confusing
+ *  errors. Also, this assumes that the ring buffer is not empty.
+ *
+ *  @param buf The ring buffer to check from
+ *  @param val_ret where to put the value checked from the head of the ring
+ */
+ #define RING_BUFFER_PEEK(buf, val_ret)  \
+  do { \
+    (val_ret) = (buf).queue[(buf).start]; \
+  } while(0)
+
+#endif /* _RING_BUFFER_H */
+
Index: demos/hunter_prey_john/behavior/hunter_prey.c
===================================================================
--- demos/hunter_prey_john/behavior/hunter_prey.c	(nonexistent)
+++ demos/hunter_prey_john/behavior/hunter_prey.c	(revision 1694)
@@ -0,0 +1,43 @@
+#include "hunter_prey.h"
+#include <dragonfly_lib.h>
+
+#define TAG_TIME 3
+#define TAG_RANGE 150
+
+/**** This file should not be edited! ****/
+
+
+/*
+ * The criteria for tagging are the following:
+ *   * The max bom is betweed 1 and 7
+ *   * The front rangefinder reads less than TAG_RANGE
+ *   * -1 values from the rangefinder are ignored
+ *   * These conditions are met across TAG_TIME calls to this function
+ */
+
+unsigned char hunter_prey_tagged(int max_bom, int frontRange) {
+
+  static int onTarget = 0;
+
+  if(max_bom < 7 && max_bom > 1 && frontRange > 0 && frontRange < TAG_RANGE) {
+    if(onTarget == 0) {
+      onTarget = TAG_TIME;
+      usb_puts("On target!\n");
+    }
+    else {
+      if(--onTarget <= 0) {
+	onTarget = 0;
+	usb_puts("TAG!\n");
+	return 1;
+      }
+    }
+  }
+  else{
+    //don't reset onTarget because the robot got too close
+    if(frontRange > 0)
+      onTarget = 0;
+  }
+
+  return 0;
+
+}
Index: demos/hunter_prey_john/behavior/main.c
===================================================================
--- demos/hunter_prey_john/behavior/main.c	(nonexistent)
+++ demos/hunter_prey_john/behavior/main.c	(revision 1694)
@@ -0,0 +1,380 @@
+/*
+ * Hunter-Prey main.c File - Implementation of Hunter-Prey behavior which
+ * 		uses finite state machines to manage the behavior. A top level
+ * 		state machine controls the high level behavior switches between
+ * 		"hunter" and "prey" and manages the wireless communication. Two
+ * 		additional state machines control the behavior of the robot when
+ * 		it is in "prey" mode and when it is in "hunter" mode.
+ *
+ * Author: John Sexton, Colony Project, CMU Robotics Club
+ */
+
+#include <dragonfly_lib.h>
+#include <wl_basic.h>
+#include "hunter_prey.h"
+#include "encoders.h"
+
+#define WL_CHANNEL 					24
+
+#define BACK_THRESHOLD 			-1000
+#define TURN_DIST						1024
+#define IR_DIST_THRESHOLD		150
+#define WAIT_DELAY_MS				2000
+
+/* State Macros */
+
+/* Top Level FSM States */
+#define TOP_INIT						0
+#define TOP_HUNTER_HUNT			1
+#define TOP_HUNTER_TAG			2
+#define TOP_HUNTER_PURSUE		3
+#define TOP_PREY_AVOID			4
+#define TOP_HUNTER_WAIT			5
+#define TOP_ERROR						6
+
+/* Hunter FSM States */
+#define HUNTER_SPIRAL				0
+#define HUNTER_CHASE				1
+
+/* Prey FSM States */
+#define PREY_START_BACK			0
+#define PREY_BACKING				1
+#define PREY_TURN						2
+#define PREY_AVOID					3
+
+
+/* Function prototype declarations */
+int hunter_FSM(int, int, int);
+int prey_FSM(int);
+
+/* Variables used to receive packets */
+unsigned char* packet_data;
+int data_length;
+
+/*  Data buffer used to send packets */
+char send_buffer[2];
+
+int main(void)
+{
+
+    /* Initialize dragonfly board */
+    dragonfly_init(ALL_ON);
+		xbee_init();
+		encoders_init();
+
+    /* Initialize the basic wireless library */
+    wl_basic_init_default();
+
+    /* Set the XBee channel to assigned channel */
+    wl_set_channel(WL_CHANNEL);
+
+
+    /* ****** CODE HERE ******* */
+
+		/* Initialize state machines */
+		int state = TOP_INIT;
+		int hunter_state = HUNTER_SPIRAL;
+		int prey_state = PREY_AVOID;
+
+		int frontIR = 0;
+		int maxBOM = 0;
+		int robotID = get_robotid();
+		int oldTime = 0, curTime = 0;
+
+		while (1) {
+
+			/* Check if we've received a wireless packet */
+			packet_data = wl_basic_do_default(&data_length);
+
+			/* Top level state machines */
+			switch(state) {
+
+				case TOP_INIT:
+					orbs_set_color(RED, GREEN);
+					delay_ms(500);
+					orbs_set_color(GREEN, RED);
+					delay_ms(500);
+
+					/* Allow user to pick the starting behavior */
+					if (button1_read()) {
+						state = TOP_PREY_AVOID;
+						prey_state = PREY_AVOID;
+					} else {
+						state = TOP_HUNTER_HUNT;
+						hunter_state = HUNTER_SPIRAL;
+					}
+					break;
+				case TOP_HUNTER_HUNT:
+					orbs_set_color(RED, RED);
+
+					if (packet_data && data_length == 2
+							&& packet_data[0] == HUNTER_PREY_ACTION_ACK) {
+						/* If we've received an ACK, we need to wait */
+						state = TOP_HUNTER_WAIT;
+					} else {
+						/* Record some sensor readings and check if we can TAG */
+						bom_refresh(BOM_ALL);
+						frontIR = range_read_distance(IR2);
+						maxBOM = get_max_bom();
+						if (hunter_prey_tagged(maxBOM, frontIR)) {
+							state = TOP_HUNTER_TAG;
+						} else {
+							/* If we haven't tagged, then enter hunter FSM */
+							hunter_state = hunter_FSM(hunter_state, maxBOM, frontIR);
+						}
+					}
+					break;
+				case TOP_HUNTER_TAG:
+					orbs_set_color(RED, PURPLE);
+
+					if (packet_data && data_length == 2
+							&& packet_data[0] == HUNTER_PREY_ACTION_ACK) {
+						/* If we've received an ACK, then someone beat us to the TAG and
+ 						 * we need to wait. */
+						state = TOP_HUNTER_WAIT;
+					} else {
+						/* Prepare and send the TAG packet */
+						send_buffer[0] = HUNTER_PREY_ACTION_TAG;
+						send_buffer[1] = robotID;
+						wl_basic_send_global_packet(42, send_buffer, 2);
+
+						/* Record the time so we don't spam a TAG message on the network */
+						oldTime = rtc_get();
+						state = TOP_HUNTER_PURSUE;
+					}
+					break;
+				case TOP_HUNTER_PURSUE:
+					orbs_set_color(RED, BLUE);
+					curTime = rtc_get();
+					
+					if (packet_data && data_length == 2
+							&& packet_data[0] == HUNTER_PREY_ACTION_ACK) {
+						/* Check if we've received a new wireless packet */
+
+						if (packet_data[1] == robotID) {
+							/* We've been ACKed, so we can now become the prey */
+							state = TOP_PREY_AVOID;
+							prey_state = PREY_START_BACK;
+						} else {
+							/* If we get an ACK with a different robotID, then someone beat us
+							 * to the TAG, so we must wait */
+							state = TOP_HUNTER_WAIT;
+						}
+
+					} else if (curTime - oldTime > 1) {
+						/* If 1 second has ellapsed, return to normal hunting state (we can
+						 * TAG again now) */
+						state = TOP_HUNTER_HUNT;
+					} else if (oldTime > curTime) {
+						/* If for some reason the timer overflows, or the wireless library
+						 * (which is also using the same timer) resets the timer,
+						 * reinitialize the timer so that we don't wait too long for the
+						 * timer to catch back up. */
+						oldTime = curTime;
+					} else {
+						/* If no other behavioral changes need to be made, then continue
+						 * with the hunter FSM where we left off */
+						bom_refresh(BOM_ALL);
+						frontIR = range_read_distance(IR2);
+						maxBOM = get_max_bom();
+						hunter_state = hunter_FSM(hunter_state, maxBOM, frontIR);
+					}
+					break;
+				case TOP_PREY_AVOID:
+					orbs_set_color(GREEN, GREEN);
+					if (packet_data && data_length == 2
+							&& packet_data[0] == HUNTER_PREY_ACTION_TAG) {
+						/* Check if we've received a TAG yet. If so then send an ACK back */
+
+						send_buffer[0] = HUNTER_PREY_ACTION_ACK;
+						send_buffer[1] = packet_data[1];
+						wl_basic_send_global_packet(42, send_buffer, 2);
+						
+						state = TOP_HUNTER_WAIT;
+					} else {
+						/* If we haven't received a TAG yet, continue with prey FSM */
+						bom_on();
+						prey_state = prey_FSM(prey_state);
+					}					
+					break;
+				case TOP_HUNTER_WAIT:
+					/* Set orb colors and wait to give the prey the 5 second head start */
+					orbs_set_color(BLUE, BLUE);
+					bom_off();
+					motors_off();
+					delay_ms(WAIT_DELAY_MS);
+					state = TOP_HUNTER_HUNT;
+					hunter_state = HUNTER_SPIRAL;
+					break;
+				case TOP_ERROR:
+				default:
+					orbs_set_color(PURPLE, PURPLE);
+					state = TOP_ERROR;
+					while(1);
+					break;
+			}
+
+		}
+
+    /* ****** END HERE ******* */
+
+    while(1);
+
+    return 0;
+
+}
+
+
+/*
+ * prey_FSM - Prey finite state machine which starts by backing away, turning,
+ * 		and then running and avoiding obstacles.
+ *
+ * Arguments:
+ * 	prey_state - Current prey state.
+ *
+ * returns - The new state of the prey state machine.
+ */
+
+int prey_FSM(int prey_state) {
+
+	/* Variable to store the front rangefinder readings */
+	int rangeVals[3] = {0, 0, 0};
+
+	switch (prey_state) {
+
+		case PREY_START_BACK:
+			motor_l_set(BACKWARD, 255);
+			motor_r_set(BACKWARD, 255);
+			encoder_rst_dx(LEFT);
+			encoder_rst_dx(RIGHT);
+			return PREY_BACKING;
+			break;
+		case PREY_BACKING:
+			if (encoder_get_x(LEFT) < BACK_THRESHOLD
+											|| encoder_get_x(RIGHT) < BACK_THRESHOLD) {
+				motor_l_set(BACKWARD, 255);
+				motor_r_set(FORWARD, 255);
+				encoder_rst_dx(LEFT);
+				encoder_rst_dx(RIGHT);
+				return PREY_TURN;
+			} else {
+				return PREY_BACKING;
+			}
+			break;
+		case PREY_TURN:
+			if (encoder_get_x(LEFT) < -TURN_DIST
+											|| encoder_get_x(RIGHT) > TURN_DIST) {
+				return PREY_AVOID;				
+			} else {
+				return PREY_TURN;
+			}
+			break;
+		case PREY_AVOID:
+			rangeVals[0] = range_read_distance(IR1);
+			rangeVals[1] = range_read_distance(IR2);
+			rangeVals[2] = range_read_distance(IR3);
+
+			/* Drive away if we detect obstacles using the rangefinders */
+			if (rangeVals[1] > 0 && rangeVals[1] < IR_DIST_THRESHOLD) {
+				if (rangeVals[0] < rangeVals[2]) {
+					motor_l_set(FORWARD, 255);
+					motor_r_set(BACKWARD, 255);
+				} else {
+					motor_l_set(BACKWARD, 255);
+					motor_r_set(FORWARD, 255);
+				}
+				return PREY_AVOID;
+			} else if (rangeVals[0] > 0 && rangeVals[0] < IR_DIST_THRESHOLD) {
+				motor_l_set(FORWARD, 255);
+				motor_r_set(FORWARD, 170);
+				return PREY_AVOID;
+			} else if (rangeVals[2] > 0 && rangeVals[2] < IR_DIST_THRESHOLD) {
+				motor_l_set(FORWARD, 170);
+				motor_r_set(FORWARD, 255);
+				return PREY_AVOID;
+			} else {			
+				motor_l_set(FORWARD, 255);
+				motor_r_set(FORWARD, 255);
+				return PREY_AVOID;
+			}
+			break;
+		default:
+			return PREY_AVOID;
+			break;
+
+	}
+	
+	return prey_state;
+
+}
+
+
+/*
+ * hunter_FSM - Hunter finite state machine which defaults to spiraling
+ * 		outwards until the BOM can locate the prey. Once the BOM locates
+ * 		the prey, chase the prey as fast as possible.
+ *
+ * Arguments:
+ * 	hunter_state - Current hunter state.
+ * 	maxBOM - Current maximum BOM value.
+ * 	frontIR - Current front IR rangefinder reading value.
+ *
+ * returns - The new state of the hunter state machine.
+ */
+
+int hunter_FSM(int hunter_state, int maxBOM, int frontIR) {
+
+	switch(hunter_state) {
+
+		case HUNTER_SPIRAL:
+			if (maxBOM != -1) {
+				return HUNTER_CHASE;
+			} else {
+				motor_l_set(FORWARD, 170);
+				motor_r_set(FORWARD, 190);
+				return HUNTER_SPIRAL;
+			}
+			break;
+		case HUNTER_CHASE:
+						
+			if (maxBOM == -1) {
+				return HUNTER_CHASE;
+			} else if (maxBOM == 4) {
+				motor_l_set(FORWARD, 255);
+				motor_r_set(FORWARD, 255);
+				return HUNTER_CHASE;
+			} else if (maxBOM == 3) {
+				motor_l_set(FORWARD, 255);
+				motor_r_set(FORWARD, 240);
+				return HUNTER_CHASE;
+			} else if (maxBOM == 5) {
+				motor_l_set(FORWARD, 240);
+				motor_r_set(FORWARD, 255);
+				return HUNTER_CHASE;
+			} else if (maxBOM < 3) {
+				motor_l_set(FORWARD, 255);
+				motor_r_set(FORWARD, 170);
+				return HUNTER_CHASE;
+			} else if (maxBOM > 5 && maxBOM <= 8) {
+				motor_l_set(FORWARD, 170);
+				motor_r_set(FORWARD, 255);
+				return HUNTER_CHASE;
+			} else if (maxBOM > 8 && maxBOM < 12) {
+				motor_l_set(BACKWARD, 255);
+				motor_r_set(FORWARD, 255);
+				return HUNTER_CHASE;
+			} else {
+				motor_l_set(FORWARD, 255);
+				motor_r_set(BACKWARD, 255);
+				return HUNTER_CHASE;
+			}
+			break;
+		default:
+			return HUNTER_SPIRAL;
+			break;
+
+	}
+
+	return hunter_state;
+
+}
Index: demos/hunter_prey_john/behavior/hunter_prey.h
===================================================================
--- demos/hunter_prey_john/behavior/hunter_prey.h	(nonexistent)
+++ demos/hunter_prey_john/behavior/hunter_prey.h	(revision 1694)
@@ -0,0 +1,19 @@
+#ifndef _HUNTER_PREY_H
+#define _HUNTER_PREY_H
+
+#include <inttypes.h>
+
+/**** This file should not be edited! ****/
+
+/*
+ * The packet structure is 2 bytes
+ * byte 0 is the action, which is one of the values below
+ * byte 1 is the robot id
+ */
+
+#define HUNTER_PREY_ACTION_TAG 'T'
+#define HUNTER_PREY_ACTION_ACK 'A'
+
+unsigned char hunter_prey_tagged(int max_bom, int front_rangefinder);
+
+#endif
Index: demos/hunter_prey_john/behavior/Makefile
===================================================================
--- demos/hunter_prey_john/behavior/Makefile	(nonexistent)
+++ demos/hunter_prey_john/behavior/Makefile	(revision 1694)
@@ -0,0 +1,20 @@
+# this is a local makefile
+
+# Relative path to the root directory (containing lib directory)
+ifndef COLONYROOT
+COLONYROOT := ..
+
+# Target file name (without extension).
+TARGET = main
+
+# Uncomment this to use the wireless library
+USE_WIRELESS = 1
+
+# com1 = serial port. Use lpt1 to connect to parallel port.
+AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM4:'; else echo '/dev/ttyUSB0'; fi)
+
+else
+COLONYROOT := ../$(COLONYROOT)
+endif
+
+include $(COLONYROOT)/Makefile
\ No newline at end of file
Index: demos/hunter_prey_john/lib/include/libdragonfly/bom.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/bom.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/bom.h	(revision 1694)
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file bom.h
+ * @brief Definitions for using the BOM
+ * 
+ * This file contains definitions for using the Bearing and 
+ * Orientation Module (BOM).
+ *
+ * @author Colony Project, CMU Robotics Club
+ *
+ **/
+
+#ifndef _BOM_H
+#define _BOM_H
+
+/**
+ * @addtogroup bom
+ * @{
+ **/
+ 
+/** @brief Include all elements in the 16-bit bitfield **/
+#define BOM_ALL 0xFFFF
+
+/** @brief Original BOM - No Range, No Individual LED control **/
+#define BOM10     0
+
+/** @brief BOM 1.5 - No Range, Individual LED control **/
+#define BOM15   1
+
+/** @brief RBOM - Range, Individual LED control **/
+#define RBOM    2
+
+
+/** @brief Struct for storing x and y component vector data. Used by bom_get_vector() functions **/
+typedef struct vector {
+	int x;
+	int y;
+} Vector;
+
+
+/** @brief Initialize the bom according to bom type **/
+void bom_init(char type);
+
+/** @brief Refresh bom_val[] with new values from analog8.  analog_init and bom_init must be called for this to work. **/
+void bom_refresh(int bit_field);
+
+/** @brief Gets the bom reading from bom_val[which].  Call bom_refresh beforehand to read new bom values. **/
+int bom_get(int which);
+
+/** @brief Compares all the values in bom_val[] and returns the index to the highest value element. **/
+int bom_get_max(void);
+
+/** @brief Computes the net resultant BOM IR vector. **/
+int bom_get_vector(Vector*, int*);
+
+/** @brief Computes the normalized net resultant BOM IR vector. **/
+int bom_get_norm_vector(Vector*, int*);
+
+/** @brief Print snapshot of BOM intensity histogram over USB connection **/
+int bom_print_usb(int*);
+
+/** @brief Computes the weighted average of all the bom readings to estimate the position and distance of another robot. **/
+int bom_get_max10(int *dist);
+
+/** @brief Enables the selected bom leds on a BOM1.5 **/
+void bom_set_leds(int bit_field);
+
+/** @brief (DEPRECATED) Gets and compares all bom values.  Returns the index to the highest value element since last refresh. **/
+int get_max_bom(void);
+
+/** @brief Turns on all BOM leds, or turns on enabled leds on a BOM1.5. **/
+void bom_on(void);
+
+/** @brief Turns off all bom leds. **/
+void bom_off(void);
+
+/** @} **/
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/rangefinder.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/rangefinder.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/rangefinder.h	(revision 1694)
@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file rangefinder.h
+ * @brief Contains rangefinder declarations and functions
+ * 
+ * Contains functions and definitions for the use of
+ * IR rangefinders.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _RANGEFINDER_H_
+#define _RANGEFINDER_H_
+
+/**
+ * @addtogroup rangefinder
+ * @{
+ **/
+
+/** @brief IR Rangefinder 1 **/
+#define IR1 6
+/** @brief IR Rangefinder 2 **/
+#define IR2 5
+/** @brief IR Rangefinder 3 **/
+#define IR3 4
+/** @brief IR Rangefinder 4 **/
+#define IR4 3
+/** @brief IR Rangefinder 5 **/
+#define IR5 2
+/** @brief smallest meaningful rangefinder reading (logarithmic scale) **/
+#define MIN_IR_ADC8 27
+/** @brief largest meaningful rangefinder reading (logarithmic scale) **/
+#define MAX_IR_ADC8 98
+
+/** @brief Initialize the rangefinders **/
+void range_init(void);
+/** @brief Read the distance from a rangefinder **/
+int range_read_distance(int range_id);
+/** @brief Convert logarithmic-scale distance readings to a linear scale **/
+int linearize_distance(int value);
+
+/** @} **/ //end addtogroup
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/spi.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/spi.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/spi.h	(revision 1694)
@@ -0,0 +1,46 @@
+/**
+ * @file spi.h
+ * @brief Definitions for SPI
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+/**
+ * @addtogroup spi
+ * @{
+ **/
+
+#ifndef __SPI_H__
+#define __SPI_H__
+
+#define DOUBLE_SCK 1
+#define SPR0_BIT 1
+
+#define MASTER 1
+#define SLAVE 0
+
+#define MOSI _BV(PB2)
+#define MISO _BV(PB3)
+#define SS   _BV(PB0)
+#define SCLK _BV(PB1)
+
+typedef void (*spi_fun_recv_t)(char);
+typedef void (*spi_fun_recv_complete_t)(void);
+
+/** 
+* @brief Initialize SPI
+* 
+* @param spi_fun_recv_t The function that handles SPI data, byte for byte.
+* @param spi_fun_recv_complete_t  Called on a completed transmission - typically for cleaning up.
+*/
+void spi_init (spi_fun_recv_t, spi_fun_recv_complete_t);
+
+/** 
+* @brief Initialize SPI transfer.
+* 
+* @param char The number of bytes to transfer.
+*/
+void spi_transfer (char);
+
+/**@}**/ //end group
+
+#endif
Index: demos/hunter_prey_john/lib/include/libdragonfly/time.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/time.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/time.h	(revision 1694)
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file time.h
+ * @brief Contains time-related functions and definitions
+ *
+ * Contains functions and definitions for dealing with time,
+ * namely delay_ms and the realtime clock.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _TIME_H_
+#define _TIME_H_
+
+/*	Predefined times for prescale_opt in time.c.
+	To make you own, know that a pulse is 1/16th of a second. You cannot get less than this. To get more, you need
+	to know how many 16ths of a second are in the time you want. (Time_desired * 16 = prescaler_opt)
+*/
+/**
+ * @addtogroup time
+ * @{
+ **/
+/** @brief A sixteenth of a second **/
+#define SIXTEENTH_SECOND 1
+/** @brief An eighth of a second **/
+#define EIGTH_SECOND 2
+/** @brief A quarter of a second **/
+#define QUARTER_SECOND 4
+/** @brief Half of a second **/
+#define HALF_SECOND	8
+/** @brief One second **/
+#define SECOND 16
+/** @brief Two seconds **/
+#define TWO_SECOND 32
+/** @brief Four seconds **/
+#define FOUR_SECOND 64
+
+/** @brief Delay execution for the specified time **/
+void delay_ms(int ms) ;
+/** @brief Enable the realtime clock **/
+void rtc_init(int prescale_opt, void (*rtc_func)(void));
+/** @brief Reset the counter of the realtime clock **/
+void rtc_reset(void);
+/** @brief Get the value of the realtime clock. **/
+int rtc_get(void);
+
+/** @} **/
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/motor.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/motor.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/motor.h	(revision 1694)
@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file motor.h
+ * @brief Contains definitions for controlling the motors
+ *
+ * Contains definitions and functions for controlling
+ * the motors.
+ *
+ * @author Colony Project, CMU Robotics Club
+ * Based on Tom Lauwer's Firefly Library
+ **/
+
+#ifndef _MOTOR_H
+#define _MOTOR_H
+
+#include <avr/io.h>
+/**
+ * @addtogroup motors
+ * @{
+ **/
+
+/** @brief make the motors go forwards **/
+#define FORWARD 1
+/** @brief make the motors go backwards **/
+#define BACKWARD 0
+
+/** @brief Initialize the motors **/
+void motors_init(void);
+/** @brief Set speed and direction of motor1 
+ *  @deprecated use the left motor function instead. it's more intuitive and easier to read.**/
+void motor1_set(int direction, int speed);
+/** @brief Set speed and direction of motor2 
+ *  @deprecated use the right motor function instead. it's more intuitive and easier to read.**/
+void motor2_set(int direction, int speed);
+/** @brief Set speed and direction of left motor **/
+void motor_l_set(int direction, int speed);
+/** @brief Set speed and direction of right motor **/
+void motor_r_set(int direction, int speed);
+/** @brief Turn the motors off **/
+void motors_off(void);
+
+/**@}**/ // end addtogroup
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/analog.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/analog.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/analog.h	(revision 1694)
@@ -0,0 +1,138 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * 
+ * @file analog.h
+ * @brief Contains functions and definitions for using the ADC
+ * 
+ * Contains definitions and function prototypes for using the
+ * ADC to detect analog signals on pins AN0 - AN7.
+ * AN6 and AN7 are used for the wheel and battery.
+	
+ * The pins labeled E6 and E7 are external interrupt pins and are not related 
+ * to analog.
+	
+ * @author Colony Project, CMU Robotics Club, based on firefly
+ * originally taken from fwr analog file (author: Tom Lauwers)
+ * loop code written by Kevin Woo and James Kong
+ */
+
+#ifndef _ANALOG_H
+#define _ANALOG_H
+
+#include <inttypes.h>
+
+/**
+ * @addtogroup analog
+ * @{
+ **/
+
+/** @brief Analog port 0 **/
+#define AN0 0x00
+/** @brief Analog port 1 **/
+#define AN1 0x01
+/** @brief Analog port 2 **/
+#define AN2 0x02
+/** @brief Analog port 3 **/
+#define AN3 0x03
+/** @brief Analog port 4 **/
+#define AN4 0x04
+/** @brief Analog port 5 **/
+#define AN5 0x05
+/** @brief Analog port 6 **/
+#define AN6 0x06
+/** @brief Analog port 7 **/
+#define AN7 0x07
+/** @brief Analog port 8 **/
+#define AN8 0x08
+/** @brief Analog port 9 **/
+#define AN9 0x09
+/** @brief Analog port 10 **/
+#define AN10 0x0A
+/** @brief Analog port 11 **/
+#define AN11 0x0B
+/** @brief Analog port 12 **/
+#define AN12 0x0C
+/** @brief Analog port 13 **/
+#define AN13 0x0D
+/** @brief Analog port 14 **/
+#define AN14 0x0E
+/** @brief Analog port 15 **/
+#define AN15 0x0F
+
+/** @brief BOM_PORT analog port for BOM **/
+#define BOM_PORT AN0
+/** @brief EXT_MUX analog port **/
+#define EXT_MUX AN7
+/** @brief Analog port for the wheel **/
+#define WHEEL_PORT AN10
+/** @brief Analog port for the battery voltage detector **/
+#define BATT_PORT  AN11
+
+/** @brief Analog loop status. ADC conversion running. **/
+#define ADC_LOOP_RUNNING 1
+/** @brief Analog loop status.  No ADC conversion running.**/
+#define ADC_LOOP_STOPPED 0
+
+/** @brief Analog init parameter. Start the analog loop. **/
+#define ADC_START 1
+/** @brief Analog init parameter. Don't start the analog loop. **/
+#define ADC_STOP  0
+
+#define ADMUX_OPT 0x60
+
+/** @brief Struct to hold the value of a particular analog port **/
+typedef struct {
+  uint8_t adc8;
+  uint16_t adc10;
+} adc_t;
+
+
+/** @brief Initialize analog ports. Will start running a loop
+    if start_conversion is ADC_START.**/
+void analog_init(int start_conversion);
+/** @brief starts the analog loop. Doesn't do anything if the loop is already running. **/
+void analog_start_loop(void);
+/** @brief Stops the analog loop. Doesn't do anything if the loop is already stopped. **/
+void analog_stop_loop(void);
+/** @brief Returns the status of the analog loop. **/
+int analog_loop_status(void);
+/** @brief Returns an 8-bit analog value from the look up table. Use this instead of analog_get8. **/
+unsigned int analog8(int which);
+/** @brief Returns an 10-bit analog value from the look up table. Use this instead of analog_get10. **/
+unsigned int analog10(int which);
+/** @brief Read the position of the wheel. **/
+int wheel(void);
+/** @brief Read an 8-bit number from an analog port. Loop must be stopped for this to work. **/
+unsigned int analog_get8(int which);
+/** @brief Read a 10-bit number from an analog port. Loop must be stopped for this to work. **/
+unsigned int analog_get10(int which);
+
+
+/**@}**/ //end group
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/encoders.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/encoders.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/encoders.h	(revision 1694)
@@ -0,0 +1,86 @@
+/**
+ * 
+ * @file encoders.h
+ * @brief Contains functions for reading encoder values.
+ *
+ * Contains high and low level functions for reading encoders
+ * including reading out total distance covered, and 
+ * eventually velocity.
+ *	
+ * @author Colony Project, CMU Robotics Club
+*/
+
+/**
+ * @addtogroup encoders
+ * @{
+ **/
+
+#ifndef __ENCODERS_H__
+#define __ENCODERS_H__
+
+
+#ifndef LEFT
+	/** @brief Left wheel **/
+	#define LEFT 0
+#endif
+#ifndef RIGHT
+	/** @brief Right wheel **/
+	#define RIGHT 1
+#endif
+
+/** @brief Max value of valid encoder reading. **/
+#define ENCODER_MAX 1024
+
+/** @brief Magnet misaligned - likely distance from encoder problem. **/
+#define ENCODER_MAGNET_FAILURE 1025
+/** @brief Encoder misaligned - likely on XY plane. **/
+#define ENCODER_MISALIGNED 1027
+/** @brief Not enough time has passed - encoders not initialized in hardware. **/
+#define ENCODER_DATA_NOT_READY 1026
+
+/** @brief delay_ms argument after a full read is complete **/
+#define ENCODER_DELAY 20
+
+//Data invalid flags (hardware failure):
+#define OCF _BV(4)
+#define COF _BV(3)
+
+//Data invalid alarm (May be invalid):
+#define LIN _BV(2)
+
+#define MagINCn _BV(1)
+#define MagDECn _BV(0)
+
+/** @brief Buffer size **/
+#define BUFFER_SIZE 46
+
+#define ERR_VEL 1024
+
+/** @brief Initialize encoders. **/
+void encoders_init(void);
+/** @brief Read instantaneous encoder value. **/
+int encoder_read(char encoder);
+
+/** @brief Get total distance traveled.
+ *  @note  Simply calls encoder_get_dx.
+ **/
+int encoder_get_x(char encoder);
+
+/** @brief Get instantaneous velocity. **/
+int encoder_get_v(char encoder);
+
+/** @brief Get total distance traveled. **/
+int encoder_get_dx(char encoder);
+/** @brief Reset distance counter. **/
+void encoder_rst_dx(char encoder);
+/** @brief Get time count: The number of encoder reads that have occurred. **/
+int encoder_get_tc(void);
+/** @brief Reset the time count. **/
+void encoder_rst_tc(void);
+
+/** @brief Waits for the next n encoder reading, then returns. **/
+void encoder_wait( int nReadings );
+
+/**@}**/ //end group
+
+#endif
Index: demos/hunter_prey_john/lib/include/libdragonfly/dragonfly_lib.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/dragonfly_lib.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/dragonfly_lib.h	(revision 1694)
@@ -0,0 +1,118 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file dragonfly_lib.h
+ * @brief Contains other include files
+ * 
+ * Include this file for all the functionality of libdragonfly.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _DRAGONFLY_LIB_H_
+#define _DRAGONFLY_LIB_H_
+
+/**
+ * @addtogroup dragonfly
+ * @{
+ **/
+
+// Configuration definitions
+/** @brief Initialize analog **/
+#define ANALOG 0x01
+/** @brief Initialize serial communications **/
+#define SERIAL 0x02
+/** @brief Initialize USB communications **/
+#define USB    0x02
+/** @brief Initialize communications **/
+#define COMM   0x02
+/** @brief Initialize the orb **/
+#define ORB    0x04
+/** @brief Initialize the motors **/
+#define MOTORS 0x08
+/** @brief Initialize I2C **/
+#define I2C    0x20
+/** @brief Initialize the buzzer **/
+#define BUZZER 0x40
+/** @brief Initialize the LCD screen **/
+#define LCD    0x80
+/** @brief Initialize the rangefinders **/
+#define RANGE  0x0100
+/** @brief Initialize the BOM **/
+#define BOM  0x0200
+/** @brief Initilize encoders **/
+#define ENCODERS 0x400
+/** @brief Initialize everything  **/
+#define ALL_ON 0x07FF
+
+/** @brief Initialize the board **/
+void dragonfly_init(int config);
+
+/** @} **/ //end addtogroup
+
+#include <inttypes.h>
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include <util/twi.h>
+
+// This file is included from the libdragonfly directory because it seems to be
+// missing from the AVR libc distribution.
+#include "atomic.h"
+
+#include "analog.h"
+#include "dio.h"
+#include "time.h"
+#include "lcd.h"
+#include "lights.h"
+#include "motor.h"
+#include "serial.h"
+#include "buzzer.h"
+#include "rangefinder.h"
+#include "bom.h"
+#include "encoders.h"
+#include "move.h"
+#include "reset.h"
+#include "math.h"
+#include "eeprom.h"
+
+#include <stddef.h>
+#include <stdbool.h>
+
+/** @brief shortcut for ATOMIC_BLOCK(ATOMIC_RESTORESTATE) **/
+#define SYNC ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
+
+/** @brief atomically grab a lock if it is free, return otherwise **/
+#define REQUIRE_LOCK_OR_RETURN(LOCK) do { SYNC { if (LOCK) return; LOCK=1; } } while (0)
+
+/** @brief atomically release a lock **/
+#define RELEASE_LOCK(LOCK) do { LOCK=0; } while (0)
+
+
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/serial.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/serial.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/serial.h	(revision 1694)
@@ -0,0 +1,146 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file serial.h
+ * @brief Contains declarations for serial input and output
+ *
+ * Contains definitions for serial input and output.
+ *
+ * @author Colony Project, CMU Robotics Club
+ * Based on Tom Lauwer's Firefly Library
+ *
+ **/
+
+/*
+  serial.h - Contains definitions and function prototypes for the RS232 serial port
+  author(s): pkv
+  
+  Directions:
+  Call the initialization function for the serial port you wish to use.  Then, use
+  either the provided functions or the stdio functions (fprintf, etc) to read and
+  write characters to the serial ports.
+  
+  UART Mapping:
+  usb_*() -> UART0
+  xbee_*() -> UART1
+  
+  Options: (Add the following defines to your code to configure this library)
+  #define USB_BAUD { 115200 | 9600 } <= pick ONE value from in here
+  #define XBEE_BAUD { 115200 | 9600 } <= pick ONE value from in here
+  #define USE_STDIO
+  
+  Note: If you enable USE_STDIO, the first init function that is called will 
+  automatically be linked to stdin, stdout, and stderr.  To use the baud rate 
+  commands, add something like the following to your code:
+  
+  #define FOO_BAUD 9600
+  
+  **UNLESS YOU KNOW WHAT YOU ARE DOING, PLEASE DO NOT CHANGE THIS FILE**
+  Many, many other people use this file in their code.  If you change it, you will
+  probably break all of their nice code.  You should not need to change anything in
+  here, except to accomodate new hardware.
+*/
+
+#ifndef _SERIAL_H
+#define _SERIAL_H
+
+#include <inttypes.h>
+#include <avr/pgmspace.h>
+
+/**
+ * @defgroup usb USB Input / Output
+ * @brief Functions for USB input / output
+ *
+ * Low level functions for USB input and output.
+ *
+ * @{
+ **/
+
+// if no baud rate is defined for usb, default is set here
+#ifndef USB_BAUD
+/** @brief the USB baud rate **/
+#define USB_BAUD 115200
+#endif
+
+/** @brief Initialize the USB **/
+void usb_init(void);
+/** @brief Print a character to USB **/
+int usb_putc(char c);
+/** @brief Read a character from USB **/
+int usb_getc(void);
+/** @brief Read a character from USB without blocking **/
+int usb_getc_nb(char *c);
+/** @brief Print a string to USB **/
+int usb_puts(char *s);
+/** @brief Print a string from program space to USB **/
+void usb_puts_P (PGM_P s);
+/** @brief Print an integer to USB **/
+int usb_puti(int value);
+/** @brief Determine a hexadecimal digit **/
+uint8_t hex_digit (uint8_t value);
+/** @brief Print a fixed width hexadecimal representation to USB **/
+void usb_puth16 (uint16_t value);
+/** @brief Print a fixed width hexadecimal representation to USB **/
+void usb_puth8(uint8_t value);
+/** @brief Alias for usb_puth16 **/
+static inline void usb_puth (uint16_t value) { usb_puth16 (value); };
+
+
+/** @} **/ //end addtogroup
+
+/**
+ * @defgroup xbee XBee Input / Output
+ * @brief Functions for XBee input / output
+ *
+ * Low level functions for XBee input and output.
+ *
+ * @{
+ **/
+
+// if no baud rate is defined for usb, default is set here
+
+// if no baud rate is defined for xbee, default is set here
+#ifndef XBEE_BAUD
+/** @brief the XBee baud rate **/
+#define XBEE_BAUD 9600
+#endif
+
+/** @brief Initialize the XBee **/
+void xbee_init(void);
+/** @brief Print a character to the XBee **/
+int xbee_putc(char c);
+/** @brief Read a character from the XBee **/
+int xbee_getc(void);
+/** @brief Read a character from the XBee without blocking **/
+int xbee_getc_nb(char *c);
+
+
+
+/** @} **/ //end addtogroup
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/eeprom.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/eeprom.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/eeprom.h	(revision 1694)
@@ -0,0 +1,47 @@
+/**
+ * @file eeprom.h
+ * @brief handles eeprom storage for persistent data
+ *
+ * Contains functions and definitions for reading and writing to eeprom
+ *
+ * @author Colony Project, Brad Neuman
+ */
+ 
+ #ifndef _EEPROM_H_
+ #define _EEPROM_H_
+ 
+ #define EEPROM_ROBOT_ID_ADDR 0x10
+ #define EEPROM_BOM_TYPE_ADDR 0x14
+ 
+ /** @brief store a byte to eeproem
+  *  @return 0 if success, nonzero on failure
+  */
+ int eeprom_put_byte(unsigned int addr, unsigned char byte);
+ 
+ /** @brief reads a byte from eeprom
+  *
+  *  Pass it thge address and a pointer to a byte where the byte at the
+  *  address will be stored
+  *
+  *  @return 0 if successful (byte is set to the eeprom value at addr), 
+  *  nonzero if there was a problem
+   */
+ int eeprom_get_byte(unsigned int addr, unsigned char *byte);
+ 
+ /** @brief get stored robot ID
+  *
+  *  checks that EEPROM has been programed with an ID and returns it
+  *
+  *  @return the robot id, if it is stored. If it returns 0xFF it is probably invalid
+  */
+ unsigned char get_robotid(void);
+  
+   /** @brief get stored robot ID
+  *
+  * checks that EEPROM has been programed with an BOM type and returns it
+  *
+  *  @return the robot bom type as defined in bom.h, if it is stored. If it returns 0xFF it is probably invalid
+  */
+ unsigned char get_bom_type(void);
+ 
+ #endif
Index: demos/hunter_prey_john/lib/include/libdragonfly/dragonfly_defs.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/dragonfly_defs.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/dragonfly_defs.h	(revision 1694)
@@ -0,0 +1,93 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file dragonfly_def.h
+ * @brief Contains definitions for dragonfly library
+ * 
+ * Should be included in all dragonfly library source files.
+ * Does not need to be included by user programs.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _DRAGONFLY_DEFS_H_
+#define _DRAGONFLY_DEFS_H_
+
+/**
+ * @addtogroup dragonfly
+ * @{
+ **/
+ 
+//return value definitions
+/** @brief Error code for init failure **/
+#define ERROR_INIT_FAILED 1
+/** @brief Error code for duplicate init calls **/
+#define ERROR_INIT_ALREADY_INITD 2
+/** @brief Error code for not calling init **/
+#define ERROR_LIBRARY_NOT_INITD 3
+
+// Configuration definitions
+/** @brief Initialize analog **/
+#define ANALOG 0x01
+/** @brief Initialize serial communications **/
+#define SERIAL 0x02
+/** @brief Initialize USB communications **/
+#define USB    0x02
+/** @brief Initialize communications **/
+#define COMM   0x02
+/** @brief Initialize the orb **/
+#define ORB    0x04
+/** @brief Initialize the motors **/
+#define MOTORS 0x08
+/** @brief Initialize I2C **/
+#define I2C    0x20
+/** @brief Initialize the buzzer **/
+#define BUZZER 0x40
+/** @brief Initialize the LCD screen **/
+#define LCD    0x80
+/** @brief Initialize the rangefinders **/
+#define RANGE  0x0100
+/** @brief Initialize the BOM **/
+#define BOM  0x0200
+/** @brief Initilize encoders **/
+#define ENCODERS 0x400
+/** @brief Initialize everything  **/
+#define ALL_ON 0x07FF 
+ 
+ /** @} **/ //end addtogroup
+ 
+ /** @brief shortcut for ATOMIC_BLOCK(ATOMIC_RESTORESTATE) **/
+#define SYNC ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
+
+/** @brief atomically grab a lock if it is free, return otherwise **/
+#define REQUIRE_LOCK_OR_RETURN(LOCK) do { SYNC { if (LOCK) return; LOCK=1; } } while (0)
+
+/** @brief atomically release a lock **/
+#define RELEASE_LOCK(LOCK) do { LOCK=0; } while (0)
+
+
+#endif
\ No newline at end of file
Index: demos/hunter_prey_john/lib/include/libdragonfly/i2c.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/i2c.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/i2c.h	(revision 1694)
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/** @file i2c.h
+ *  @brief Header file for I2C
+ *
+ *  Contains functions for I2C.
+ *
+ *  @author Kevin Woo and Suresh Nidhiry, Colony Project, CMU Robotics Club
+ **/
+
+
+#ifndef _I2C_H_
+#define _I2C_H_
+
+/** @brief Address of slave receive handler function **/
+typedef void (*fun_srecv_t)(char);
+
+/** @brief Address of master receive handler function**/
+typedef int (*fun_mrecv_t)(char);
+
+/** @brief Address of slave send handler function**/
+typedef char (*fun_send_t)(void);
+
+int i2c_init(char addr, fun_mrecv_t master_recv, fun_srecv_t slave_recv, fun_send_t slave_send);
+int i2c_send(char dest, char* data, unsigned int bytes);
+int i2c_request(char dest);
+
+void i2c_packet_rec (char i2c_byte);
+void i2c_packet_sniff(char data);
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/lights.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/lights.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/lights.h	(revision 1694)
@@ -0,0 +1,224 @@
+// FIXME remove
+typedef unsigned char uint8_t;
+
+
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file lights.h
+ * @brief Contains declarations for managing the orbs.
+ *
+ * Contains declarations for using the orbs and PWM.
+ *
+ * @author Colony Project, CMU Robotics Club
+ * Based on Firefly Library, by Tom Lauwers and Steven Shamlian
+ **/
+
+#ifndef _LIGHTS_H_
+#define _LIGHTS_H_
+
+/**
+ * @addtogroup orbs
+ * @{
+ **/
+
+/**
+ * Quick start: call orb_init_pwm or orb_init_binary, depending on which mode you want to use. Call orb*set or
+ * orb*set_color to set the orbs.
+ * 
+ * The orbs have two modes of operation: PWM mode and binary mode. In PWM mode, a pwm signal is generated by a hardware
+ * timer and the orbs can be set to a value of 0 through 255. In binary mode, the orbs can only be turned on or off and
+ * a value of 0 means "off" and any other value means "on". The mode can be chosen on initialization and can be changed
+ * at runtime using the orb_set_mode function.
+ *
+ * Operation (PWM mode): On timer overflow, all LEDs with a value>0 are turned on and the output compare value for the
+ * first LED is loaded. On compare match, the corresponding LED is turned off and the next output compare value is
+ * loaded. All masks are precomputed and sorted by time when setting the values.
+ *
+ * The data structure (pwm_t) containing the PWM times and masks is triple buffered. This is because the buffer the ISR
+ * is reading from may only be modified on timer overflow before the next PWM sequence is started, because otherwise the
+ * next OCR value might be sed to a value smaller than the current timer value, resulting in the remaining channels not
+ * being turned off in that PWM period (flash to on). When using two buffers, the page flip can only occur on a timer
+ * overflow for the same reason. So after writing a buffer and marking it for page flip, neither of the buffers could be
+ * modified because the front buffer is read by the ISR and the back buffer could be switched at any time. So the
+ * calling thread would have to be delayed by up to one full PWM period (8ms in the current implementation, but
+ * 20ms-50ms would be a reasonable value to expect here). To avoid this, triple buffering is used.
+ *
+ * The code for applying the orbs is fairly optimized. See the apply_orbs function for some time measurements and
+ * further nodes.
+ *
+ * The PWM frequency is 120Hz (8ms period time). The next lower frequency (determined by the prescaler) is 30 Hz which
+ * is too slow (orbs flicker).
+ *
+ * The orbs code is thread safe, which means that the functions may be called from another interrupt handler. If there
+ * are multiple concurrent calls to the orb*set* functions, one of them is ignored and the orbs are never left in an
+ * inconsistent state. For example, if the orbs are set to green by the main thread and to red by an interrupt handler,
+ * the resulting color will be either red or green, but never yellow.
+ * Thread safety is achieved by grabbing a lock at the beginning of all functions that modify the orb code and releasing
+ * the lock at the end. If the lock is already taken, the function just returns doing nothing.
+ *
+ * Some performance measurements:
+ *   - Time for setting new orb values (PWM mode):       35us-72us (depending on the degree to which the array is
+ *                                                                  already in the correct order)
+ *   - Time for setting new orb values (binary mode):        5.5us
+ *
+ *   - Interrupt time (PWM mode only):                         8us (overflow)
+ *                                                            10us (output compare)
+ *                                                             6us (last output compare)
+ *                                                            30us (output compare, all value equal)
+ *
+ *   - Maximum total interrupt time per period:               64us
+ *   - Maximum CPU usage for interrupts (PWM mode only):     <0.8%
+ *
+ *   - Maximum contiguous synchronized block:                 30us (output compare interrupt, all values equal)
+ *
+ * There are some potential optimizations left. See the source code for more information.
+ *
+ * A note on robustness: if the output compare interrupt is disabled for too long, either due to a long ISR or a long
+ * synchronized code block, the orbs will flicker to brighter values for being turned off too late. With software PWM,
+ * there's nothing at all to be done about that. The problem can be alleviated by using a lower PWM frequency, but then
+ * the orbs will start flickering all the time due to the low update frequency.
+ * Some measurements: with 100us synchronized blocks, the flickering is accepptably low. Longer synchronized blocks
+ * mean more flickering. At 1ms synchronized blocks, the flickering is quite bad, especially for low orb values. Note
+ * that orb value 0 never flickers at all because the corresponding channels are not turned on at all.
+ * Test code (note the _delay_us restrictions!)
+ *   orb_set (1,1,1); while (1) { SYNC { for (uint8_t m=0; m<10; ++m) { _delay_us(10); } } }
+ **/
+
+/** @} **/ //end addtogroup
+
+/**
+ * @addtogroup orbs
+ * @{
+ **/
+
+// ***** Predefined colors *****
+/** @brief Red **/
+#define RED       0xE0
+/** @brief Orange **/
+#define ORANGE    0xE4
+/** @brief Yellow **/
+#define YELLOW    0xE8
+/** @brief Lime **/
+#define LIME      0x68
+/** @brief Green **/
+#define GREEN     0x1C
+/** @brief Cyan **/
+#define CYAN      0x1F
+/** @brief Blue **/
+#define BLUE      0x03
+/** @brief Pink **/
+#define PINK      0xA6 
+/** @brief Purple **/
+#define PURPLE    0x41
+/** @brief Magenta **/
+#define MAGENTA   0xE3
+/** @brief White **/
+#define WHITE     0xFE
+/** @brief Turn the orb off **/
+#define ORB_OFF   0x00
+
+
+
+// ***** Initialization *****
+
+/** @brief Enables the orbs in default mode **/
+void orb_init(void);
+
+/** @brief Enables the orbs in binary mode **/
+void orb_init_binary (void);
+
+/** @brief Enables the orbs in PWM mode **/
+void orb_init_pwm (void);
+
+
+
+// ***** Mode setting *****
+
+/** Specification of the orb mode **/
+typedef uint8_t orb_mode_t;
+
+/** @brief PWM mode **/
+#define orb_mode_pwm 0
+
+/** @brief Binary mode **/
+#define orb_mode_binary 1
+
+
+/** @brief Switches the orbs to the specified mode **/
+void orb_set_mode (orb_mode_t mode);
+
+/** @brief Disables the orb timer, but does not change the mode **/
+void orb_disable_timer (void);
+
+/** @brief Enables the orb timer, but does not change the mode **/
+void orb_enable_timer (void);
+
+
+
+// ***** Setting RGB colors *****
+
+/** @brief set the specified orb to a specified color
+* 	@deprecated This function indexes from 0 instead of 1 **/
+void orb_n_set (uint8_t num, uint8_t red, uint8_t green, uint8_t blue);
+
+/** @brief Set both orbs to a specified color **/
+void orb_set(uint8_t red, uint8_t green, uint8_t blue);
+
+/** @brief Set orb1 to a specified color **/
+void orb1_set(uint8_t red_led, uint8_t green_led, uint8_t blue_led); 
+
+/** @brief Set orb2 to a specified color **/
+void orb2_set(uint8_t red_led, uint8_t green_led, uint8_t blue_led);
+
+void orbs_set (uint8_t red1, uint8_t green1, uint8_t blue1, uint8_t red2, uint8_t green2, uint8_t blue2);
+
+
+
+// ***** Settings predefined colors *****
+
+/** @brief set the specified orb to the specified color
+* 	@deprecated This function indexes from 0 instead of 1 **/
+void orb_n_set_color(uint8_t num, uint8_t col);
+
+/** @brief Set orb1 to a specified color **/
+void orb1_set_color(uint8_t col);
+
+/** @brief Set orb2 to a specified color **/
+void orb2_set_color(uint8_t col);
+
+/** @brief set the orbs to specified colors **/
+void orbs_set_color(uint8_t col1, uint8_t col2);
+
+/** @brief Set both orbs to a specified color **/
+void orb_set_color(uint8_t col);
+
+
+
+/** @} **/ //end addtogroup
+
+#endif
Index: demos/hunter_prey_john/lib/include/libdragonfly/atomic.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/atomic.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/atomic.h	(revision 1694)
@@ -0,0 +1,309 @@
+/* This file is in the dragonfly library directory because it seems to be
+   missing from the AVR libc distribution */
+   
+/* Copyright (c) 2007 Dean Camera
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   * Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+   * Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+
+   * Neither the name of the copyright holders nor the names of
+     contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* $Id: atomic.h,v 1.3 2007/12/20 14:17:56 joerg_wunsch Exp $ */
+
+#ifndef _UTIL_ATOMIC_H_
+#define _UTIL_ATOMIC_H_ 1
+
+#include <avr/io.h>
+#include <avr/interrupt.h>
+
+#if !defined(__DOXYGEN__)
+/* Internal helper functions. */
+static __inline__ uint8_t __iSeiRetVal(void)
+{
+    sei();
+    return 1;
+}
+
+static __inline__ uint8_t __iCliRetVal(void)
+{
+    cli();
+    return 1;
+}
+
+static __inline__ void __iSeiParam(const uint8_t *__s)
+{
+    sei();
+    __asm__ volatile ("" ::: "memory");
+    (void)__s;
+}
+
+static __inline__ void __iCliParam(const uint8_t *__s)
+{
+    cli();
+    __asm__ volatile ("" ::: "memory");
+    (void)__s;
+}
+
+static __inline__ void __iRestore(const  uint8_t *__s)
+{
+    SREG = *__s;
+    __asm__ volatile ("" ::: "memory");
+}
+#endif	/* !__DOXYGEN__ */
+
+/** \file */
+/** \defgroup util_atomic <util/atomic.h> Atomically and Non-Atomically Executed Code Blocks
+
+    \code
+    #include <util/atomic.h>
+    \endcode
+
+    \note The macros in this header file require the ISO/IEC 9899:1999
+    ("ISO C99") feature of for loop variables that are declared inside
+    the for loop itself.  For that reason, this header file can only
+    be used if the standard level of the compiler (option --std=) is
+    set to either \c c99 or \c gnu99.
+
+    The macros in this header file deal with code blocks that are
+    guaranteed to be excuted Atomically or Non-Atmomically.  The term
+    "Atomic" in this context refers to the unability of the respective
+    code to be interrupted.
+
+    These macros operate via automatic manipulation of the Global
+    Interrupt Status (I) bit of the SREG register. Exit paths from
+    both block types are all managed automatically without the need
+    for special considerations, i. e. the interrupt status will be
+    restored to the same value it has been when entering the
+    respective block.
+
+    A typical example that requires atomic access is a 16 (or more)
+    bit variable that is shared between the main execution path and an
+    ISR.  While declaring such a variable as volatile ensures that the
+    compiler will not optimize accesses to it away, it does not
+    guarantee atomic access to it.  Assuming the following example:
+
+    \code
+#include <inttypes.h>
+#include <avr/interrupt.h>
+#include <avr/io.h>
+
+volatile uint16_t ctr;
+
+ISR(TIMER1_OVF_vect)
+{
+  ctr--;
+}
+
+...
+int
+main(void)
+{
+   ...
+   ctr = 0x200;
+   start_timer();
+   while (ctr != 0)
+     // wait
+       ;
+   ...
+}
+    \endcode
+
+    There is a chance where the main context will exit its wait loop
+    when the variable \c ctr just reached the value 0xFF.  This happens
+    because the compiler cannot natively access a 16-bit variable
+    atomically in an 8-bit CPU.  So the variable is for example at
+    0x100, the compiler then tests the low byte for 0, which succeeds.
+    It then proceeds to test the high byte, but that moment the ISR
+    triggers, and the main context is interrupted.  The ISR will
+    decrement the variable from 0x100 to 0xFF, and the main context
+    proceeds.  It now tests the high byte of the variable which is
+    (now) also 0, so it concludes the variable has reached 0, and
+    terminates the loop.
+
+    Using the macros from this header file, the above code can be
+    rewritten like:
+
+    \code
+#include <inttypes.h>
+#include <avr/interrupt.h>
+#include <avr/io.h>
+#include <util/atomic.h>
+
+volatile uint16_t ctr;
+
+ISR(TIMER1_OVF_vect)
+{
+  ctr--;
+}
+
+...
+int
+main(void)
+{
+   ...
+   ctr = 0x200;
+   start_timer();
+   sei();
+   uint16_t ctr_copy;
+   do
+   {
+     ATOMIC_BLOCK(ATOMIC_FORCEON)
+     {
+       ctr_copy = ctr;
+     }
+   }
+   while (ctr_copy != 0);
+   ...
+}
+    \endcode
+
+    This will install the appropriate interrupt protection before
+    accessing variable \c ctr, so it is guaranteed to be consistently
+    tested.  If the global interrupt state were uncertain before
+    entering the ATOMIC_BLOCK, it should be executed with the
+    parameter ATOMIC_RESTORESTATE rather than ATOMIC_FORCEON.
+
+*/
+
+/** \def ATOMIC_BLOCK(type)
+    \ingroup util_atomic
+
+    Creates a block of code that is guaranteed to be executed
+    atomically. Upon entering the block the Global Interrupt Status
+    flag in SREG is disabled, and re-enabled upon exiting the block
+    from any exit path.
+
+    Two possible macro parameters are permitted, ATOMIC_RESTORESTATE
+    and ATOMIC_FORCEON.
+*/
+#if defined(__DOXYGEN__)
+#define ATOMIC_BLOCK(type)
+#else
+#define ATOMIC_BLOCK(type) for ( type, __ToDo = __iCliRetVal(); \
+	                       __ToDo ; __ToDo = 0 )
+#endif	/* __DOXYGEN__ */
+
+/** \def NONATOMIC_BLOCK(type)
+    \ingroup util_atomic
+
+    Creates a block of code that is executed non-atomically. Upon
+    entering the block the Global Interrupt Status flag in SREG is
+    enabled, and disabled upon exiting the block from any exit
+    path. This is useful when nested inside ATOMIC_BLOCK sections,
+    allowing for non-atomic execution of small blocks of code while
+    maintaining the atomic access of the other sections of the parent
+    ATOMIC_BLOCK.
+
+    Two possible macro parameters are permitted,
+    NONATOMIC_RESTORESTATE and NONATOMIC_FORCEOFF.
+*/
+#if defined(__DOXYGEN__)
+#define NONATOMIC_BLOCK(type)
+#else
+#define NONATOMIC_BLOCK(type) for ( type, __ToDo = __iSeiRetVal(); \
+	                          __ToDo ;  __ToDo = 0 )
+#endif	/* __DOXYGEN__ */
+
+/** \def ATOMIC_RESTORESTATE
+    \ingroup util_atomic
+
+    This is a possible parameter for ATOMIC_BLOCK. When used, it will
+    cause the ATOMIC_BLOCK to restore the previous state of the SREG
+    register, saved before the Global Interrupt Status flag bit was
+    disabled. The net effect of this is to make the ATOMIC_BLOCK's
+    contents guaranteed atomic, without changing the state of the
+    Global Interrupt Status flag when execution of the block
+    completes.
+*/
+#if defined(__DOXYGEN__)
+#define ATOMIC_RESTORESTATE
+#else
+#define ATOMIC_RESTORESTATE uint8_t sreg_save \
+	__attribute__((__cleanup__(__iRestore))) = SREG
+#endif	/* __DOXYGEN__ */
+
+/** \def ATOMIC_FORCEON
+    \ingroup util_atomic
+
+    This is a possible parameter for ATOMIC_BLOCK. When used, it will
+    cause the ATOMIC_BLOCK to force the state of the SREG register on
+    exit, enabling the Global Interrupt Status flag bit. This saves on
+    flash space as the previous value of the SREG register does not
+    need to be saved at the start of the block.
+
+    Care should be taken that ATOMIC_FORCEON is only used when it is
+    known that interrupts are enabled before the block's execution or
+    when the side effects of enabling global interrupts at the block's
+    completion are known and understood.
+*/
+#if defined(__DOXYGEN__)
+#define ATOMIC_FORCEON
+#else
+#define ATOMIC_FORCEON uint8_t sreg_save \
+	__attribute__((__cleanup__(__iSeiParam))) = 0
+#endif	/* __DOXYGEN__ */
+
+/** \def NONATOMIC_RESTORESTATE
+    \ingroup util_atomic
+
+    This is a possible parameter for NONATOMIC_BLOCK. When used, it
+    will cause the NONATOMIC_BLOCK to restore the previous state of
+    the SREG register, saved before the Global Interrupt Status flag
+    bit was enabled. The net effect of this is to make the
+    NONATOMIC_BLOCK's contents guaranteed non-atomic, without changing
+    the state of the Global Interrupt Status flag when execution of
+    the block completes.
+*/
+#if defined(__DOXYGEN__)
+#define NONATOMIC_RESTORESTATE
+#else
+#define NONATOMIC_RESTORESTATE uint8_t sreg_save \
+	__attribute__((__cleanup__(__iRestore))) = SREG
+#endif	/* __DOXYGEN__ */
+
+/** \def NONATOMIC_FORCEOFF
+    \ingroup util_atomic
+
+    This is a possible parameter for NONATOMIC_BLOCK. When used, it
+    will cause the NONATOMIC_BLOCK to force the state of the SREG
+    register on exit, disabling the Global Interrupt Status flag
+    bit. This saves on flash space as the previous value of the SREG
+    register does not need to be saved at the start of the block.
+
+    Care should be taken that NONATOMIC_FORCEOFF is only used when it
+    is known that interrupts are disabled before the block's execution
+    or when the side effects of disabling global interrupts at the
+    block's completion are known and understood.
+*/
+#if defined(__DOXYGEN__)
+#define NONATOMIC_FORCEOFF
+#else
+#define NONATOMIC_FORCEOFF uint8_t sreg_save \
+	__attribute__((__cleanup__(__iCliParam))) = 0
+#endif	/* __DOXYGEN__ */
+
+#endif
Index: demos/hunter_prey_john/lib/include/libdragonfly/odometry.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/odometry.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/odometry.h	(revision 1694)
@@ -0,0 +1,56 @@
+
+/**
+ * @file odometry.h
+ * @brief Code for estimating the robots pose.
+ * 
+ * Offers simple position and orientation information.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef __ODOMETRY_C__
+#define __ODOMETRY_C__
+
+/**
+ * @addtogroup odometry 
+ * @{
+ **/
+
+//Odometry resolution, *64 microseconds.
+#define ODOMETRY_CLK 255u 
+#define TIME_SCALE 64
+
+//Wheel = 2.613 in.  
+//Circumference = 208.508133 mm
+//Distance per encoder click (circumference / 1024)  = 203.621224 um.
+//Robot width = 5.3745 in. = 136.5123 mm
+
+#define ROBOT_WIDTH_UM 137000  //um
+#define CLICK_DISTANCE_UM 204 //um
+
+#define DISTANCE_SCALE 2.10526316 //Magic constant.
+#define ANGLE_SCALE 1.12823207 //Magic constant.
+
+/** @brief Retrieve the robots estimated x position*/
+long odometry_dx(void);
+
+/** @brief Retrieve the robots estimated y position*/
+long odometry_dy(void);
+
+/** @brief Retrieve the robots estimated orientation*/
+double odometry_angle(void);
+
+/** @brief Initialize odometry. MUST be called before 
+ * the other functions work.**/
+void odometry_init(void);
+
+/** @brief Reset position and orientation to the origin facing
+ * the x axis.*/
+void odometry_reset(void);
+
+/** @brief Report estimated velocity [mm/s].*/
+long odometry_velocity(void);
+
+/**@}**/ //end group
+
+#endif
Index: demos/hunter_prey_john/lib/include/libdragonfly/dio.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/dio.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/dio.h	(revision 1694)
@@ -0,0 +1,348 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file dio.h
+ * @brief Definitions for digital input / output
+ *
+ * This file contains definitions and functions for dealing
+ * with digital input and output.
+ *
+ * @author Colony Project, CMU Robotics Club
+ * Based on Tom Lauwer's Firefly Library
+ **/
+
+#ifndef _DIO_H
+#define _DIO_H
+
+/*
+  these are ALL the pins
+  don't use unless you know what you're doing
+*/
+
+/*
+  DIO pins on new dragonfly boards are shown below:
+  -----------------------------------------------
+  | _PIN_E6 | _PIN_E7 | _PIN_D2 | _PIN_D3 | VCC |
+  -----------------------------------------------
+  | _PIN_E2 | _PIN_E3 | _PIN_E4 | _PIN_E5 | GND |
+  -----------------------------------------------
+*/
+
+/** @brief Port A **/
+#define _PORT_A 1
+/** @brief Port B **/
+#define _PORT_B 2
+/** @brief Port C **/
+#define _PORT_C 3
+/** @brief Port D **/
+#define _PORT_D 4
+/** @brief Port E **/
+#define _PORT_E 5
+/** @brief Port F **/
+#define _PORT_F 6
+/** @brief Port G **/
+#define _PORT_G 7
+
+/** @brief Pin A0 **/
+#define _PIN_A0 8
+/** @brief Pin A1 **/
+#define _PIN_A1 9
+/** @brief Pin A2 **/
+#define _PIN_A2 10
+/** @brief Pin A3 **/
+#define _PIN_A3 11
+/** @brief Pin A4 **/
+#define _PIN_A4 12
+/** @brief Pin A5 **/
+#define _PIN_A5 13
+/** @brief Pin A6 **/
+#define _PIN_A6 14 
+/** @brief Pin A7 **/
+#define _PIN_A7 15
+
+/** @brief Pin B0 **/
+#define _PIN_B0 16
+/** @brief Pin B1 **/
+#define _PIN_B1 17
+/** @brief Pin B2 **/
+#define _PIN_B2 18
+/** @brief Pin B3 **/
+#define _PIN_B3 19
+/** @brief Pin B4 **/
+#define _PIN_B4 20
+/** @brief Pin B5 **/
+#define _PIN_B5 21
+/** @brief Pin B6 **/
+#define _PIN_B6 22
+/** @brief Pin B7 **/
+#define _PIN_B7 23
+
+/** @brief Pin C0 **/
+#define _PIN_C0 24
+/** @brief Pin C1 **/
+#define _PIN_C1 25
+/** @brief Pin C2 **/
+#define _PIN_C2 26
+/** @brief Pin C3 **/
+#define _PIN_C3 27
+/** @brief Pin C4 **/
+#define _PIN_C4 28
+/** @brief Pin C5 **/
+#define _PIN_C5 29
+/** @brief Pin C6 **/
+#define _PIN_C6 30
+/** @brief Pin C7 **/
+#define _PIN_C7 31
+
+/** @brief Pin D0 **/
+#define _PIN_D0 32  // pin DIO6 on new dragonfly boards
+/** @brief Pin D1 **/
+#define _PIN_D1 33  // pin DIO7
+/** @brief Pin D2 **/
+#define _PIN_D2 34
+/** @brief Pin D3 **/
+#define _PIN_D3 35
+/** @brief Pin D4 **/
+#define _PIN_D4 36
+/** @brief Pin D5 **/
+#define _PIN_D5 37
+/** @brief Pin D6 **/
+#define _PIN_D6 38
+/** @brief Pin D7 **/
+#define _PIN_D7 39
+
+/** @brief Pin E0 **/
+#define _PIN_E0 40
+/** @brief Pin E1 **/
+#define _PIN_E1 41
+/** @brief Pin E2 **/
+#define _PIN_E2 42  // pin DIO0
+/** @brief Pin E3 **/
+#define _PIN_E3 43  // pin DIO1
+/** @brief Pin E4 **/
+#define _PIN_E4 44  // pin DIO2
+/** @brief Pin E5 **/
+#define _PIN_E5 45  // pin DIO3
+/** @brief Pin E6 **/
+#define _PIN_E6 46  // pin DIO4
+/** @brief Pin E7 **/
+#define _PIN_E7 47  // pin DIO5
+
+/** @brief Pin F0 **/
+#define _PIN_F0 48
+/** @brief Pin F1 **/
+#define _PIN_F1 49
+/** @brief Pin F2 **/
+#define _PIN_F2 50
+/** @brief Pin F3 **/
+#define _PIN_F3 51
+/** @brief Pin F4 **/
+#define _PIN_F4 52
+/** @brief Pin F5 **/
+#define _PIN_F5 53
+/** @brief Pin F6 **/
+#define _PIN_F6 54
+/** @brief Pin F7 **/
+#define _PIN_F7 55
+
+/** @brief Pin G0 **/
+#define _PIN_G0 56
+/** @brief Pin WR **/
+#define _PIN_WR 56
+/** @brief Pin G1 **/
+#define _PIN_G1 57
+/** @brief Pin RD **/
+#define _PIN_RD 57
+/** @brief Pin G2 **/
+#define _PIN_G2 58
+/** @brief Pin ALE **/
+#define _PIN_ALE 58
+/** @brief Pin G3 **/
+#define _PIN_G3 59
+/** @brief Pin TOSC2 **/
+#define _PIN_TOSC2 59
+/** @brief Pin G4 **/
+#define _PIN_G4 60
+/** @brief Pin TOSC1 **/
+#define _PIN_TOSC1 60
+//#define _PIN_G5 61
+//#define _PIN_G6 62
+//#define _PIN_G7 63
+
+/*
+  These are the header pins (the ones you can connect things to)
+  Feel free to use these
+*/
+
+/**
+ * @addtogroup dio
+ * @{
+ **/
+/** @brief Pin A0 **/
+#define PIN_A0 8
+/** @brief Pin A1 **/
+#define PIN_A1 9
+/** @brief Pin A2 **/
+#define PIN_A2 10
+/** @brief Pin A3 **/
+#define PIN_A3 11
+/** @brief Pin A4 **/
+#define PIN_A4 12
+/** @brief Pin A5 **/
+#define PIN_A5 13
+/** @brief Pin A6 **/
+#define PIN_A6 14 
+/** @brief Pin A7 **/
+#define PIN_A7 15
+
+/** @brief Pin SS **/
+#define PIN_SS 16
+/** @brief Pin SCK **/
+#define PIN_SCK 17
+/** @brief Pin MOSI **/
+#define PIN_MOSI 18
+/** @brief Pin MISO **/
+#define PIN_MISO 19
+/** @brief LCD Command Pin **/
+#define PIN_LCD_COMMAND 20
+
+/** @brief Pin C0 **/
+#define PIN_C0 24
+/** @brief Pin C1 **/
+#define PIN_C1 25
+/** @brief Pin C2 **/
+#define PIN_C2 26
+/** @brief Pin C3 **/
+#define PIN_C3 27
+/** @brief Pin C4 **/
+#define PIN_C4 28
+/** @brief Pin C5 **/
+#define PIN_C5 29
+/** @brief Pin C6 **/
+#define PIN_C6 30
+/** @brief Pin C7 **/
+#define PIN_C7 31
+
+/** @brief Pin SCL **/
+#define PIN_SCL 32
+/** @brief Pin SDA **/
+#define PIN_SDA 33
+
+/** @brief Pin RX0 **/
+#define PIN_RX0 40
+/** @brief Pin TX0 **/
+#define PIN_TX0 41
+/** @brief LCD Reset Pin **/
+#define PIN_LCD_RESET 42
+/** @brief Pin E6 **/
+#define PIN_E6 46
+/** @brief Pin EXT_DIO1 **/
+#define PIN_EXT_DIO1 46
+/** @brief Pin E7 **/
+#define PIN_E7 47
+/** @brief Pin EXT_DIO2 **/
+#define PIN_EXT_DIO2 48
+
+/** @brief Pin AN0 **/
+#define PIN_AN0 48
+/** @brief Pin ADC0 **/
+#define PIN_ADC0 48
+/** @brief Pin AN1 **/
+#define PIN_AN1 49
+/** @brief Pin ADC1 **/
+#define PIN_ADC1 49
+/** @brief Pin AN2 **/
+#define PIN_AN2 50
+/** @brief Pin ADC2 **/
+#define PIN_ADC2 50
+/** @brief Pin AN3 **/
+#define PIN_AN3 51
+/** @brief Pin ADC3 **/
+#define PIN_ADC3 51
+/** @brief Pin AN4 **/
+#define PIN_AN4 52
+/** @brief Pin ADC4 **/
+#define PIN_ADC4 52
+/** @brief Pin AN5 **/
+#define PIN_AN5 53
+/** @brief Pin ADC5 **/
+#define PIN_ADC5 53
+/** @brief Pin AN6 **/
+#define PIN_AN6 54
+/** @brief Pin ADC6 **/
+#define PIN_ADC6 54
+/** @brief Pin AN7 **/
+#define PIN_AN7 55
+/** @brief Pin ADC7 **/
+#define PIN_ADC7 55
+
+/** @brief Wheel Pin **/
+#define PIN_WHEEL 54
+/** @brief Battery Voltage Monitor Pin **/
+#define PIN_BATT 55
+
+/** @brief button1 Pin **/
+#define PIN_BTN1 56
+/** @brief button2 Pin **/
+#define PIN_BTN2 57
+
+/** @brief LED1 Pin **/
+#define PIN_LED1 58
+
+/* Buttons */
+/** @brief Button Pin **/
+#define PIN_BTN PING
+/** @brief button2 Pin **/
+#define BTN2 PING1
+/** @brief button1 Pin **/
+#define BTN1 PING0
+
+/** @brief Read a portpin. **/
+int digital_input(int);
+/** @brief Output to a portpin. **/
+void digital_output(int bit, int val);
+/** @brief Pullup a portpin. **/
+void digital_pull_up(int);
+
+/** @brief Check if button1 is pressed. **/
+int button1_read( void );
+/** @brief Check if button1 is clicked. **/
+int button1_click( void );
+/** @brief Wait until button1 is pressed. **/
+void button1_wait( void );
+
+/** @brief Check if button2 is pressed. **/
+int button2_read( void );
+/** @brief Check if button2 is clicked. **/
+int button2_click( void );
+/** @brief Wait until button2 is pressed. **/
+void button2_wait( void );
+
+/** @} **/ // end addtogroup
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/reset.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/reset.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/reset.h	(revision 1694)
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * 
+ * @file reset.h
+ * @brief Contains function(s) for resetting the robots
+ * 
+ * @author Colony Project, CMU Robotics Club, James Kong
+ */
+
+#ifndef _RESET_H_
+#define _RESET_H_
+
+/**
+ * @addtogroup reset
+ * @{
+ **/
+ 
+/** @brief Reset the robot **/
+void reset(void);
+
+/**@}**/ //end group
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/move.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/move.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/move.h	(revision 1694)
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file move.h
+ * @brief Contains definitions for controlling robot motion
+ * 
+ * This file offers higher-level functions for robot motion.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _MOVE_H_
+#define _MOVE_H_
+
+/**
+ * @addtogroup move
+ * @{
+ **/
+
+/** @brief Move forwards **/
+#define FWD 0
+/** @brief Move backwards **/
+#define BCK 1
+
+/** @brief A slow speed **/
+#define SLOW_SPD 96
+/** @brief Half of the full speed **/
+#define HALF_SPD 128
+/** @brief A normal speed **/
+#define NRML_SPD 160
+/** @brief A fast speed **/
+#define FAST_SPD 192
+/** @brief The maximum speed **/
+#define FULL_SPD 255
+
+/** @brief A slow turning speed **/
+#define SLOW_TURN 64
+/** @brief A medium turning speed **/
+#define NRML_TURN 96
+/** @brief A high turning speed **/
+#define FAST_TURN 128
+
+/** @brief Move the robot at the specified velocity **/
+void move(int velocity, int omega);
+/** @brief Move the robot while avoiding obstacles **/
+void move_avoid(int velocity, int omega, int strength);
+
+/** @} **/
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/lcd.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/lcd.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/lcd.h	(revision 1694)
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file lcd.h
+ * @brief Contains definitions for dealing with the LCD screen.
+ * 
+ * Contains definitions and functions for dealing with the 
+ * LCD screen.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _LCD_H_
+#define _LCD_H_
+
+/**
+ * @addtogroup lcd
+ * @{
+ **/
+
+/** @brief Initialize the LCD screen **/
+void lcd_init(void);
+/** @brief Clear the LCD screen **/
+void lcd_clear_screen( void );
+/** @brief Print a char to the LCD screen **/
+void lcd_putc(char c);
+/** @brief Print a string to the LCD screen **/
+void lcd_puts(char *s);
+/** @brief Print an int to the LCD screen **/
+void lcd_puti(int value);
+/** @brief Set the current cursor position **/
+void lcd_gotoxy(int x, int y);
+
+/** @} **/
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/battery.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/battery.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/battery.h	(revision 1694)
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file battery.h
+ * @brief Definitions for checking battery voltage.
+ * 
+ * Contains definitions for checking the voltage of the 
+ * battery.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _BATTERY_H_
+#define _BATTERY_H_
+
+/**
+ * @addtogroup battery
+ * @{
+ **/
+
+/** @brief Normal battery voltage. (6 V) **/
+#define BATTERY_NORMALV 154
+/** @brief Charging battery voltage. (7 V) **/
+#define BATTERY_CHARINGV 179
+/** @brief Low battery voltage. ( < 6 V) **/
+#define BATTERY_LOWV 152
+
+/** @brief Read the battery voltage. **/
+int battery8(void);
+/** @brief Read the battery voltage in deciVolts. **/
+int battery(void);
+/** @brief Check if the battery is low. **/
+char battery_low(void);
+/** @brief Get an average battery voltage reading. **/
+int battery8_avg(int n_samples);
+
+/** @} **/ //end addtogroup
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/buzzer.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/buzzer.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/buzzer.h	(revision 1694)
@@ -0,0 +1,88 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/**
+ * @file buzzer.h
+ * @brief Contains definitions for using the buzzer.
+ *
+ * Contains definitions for using the buzzer built into
+ * the colony robots.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _BUZZER_H_
+#define _BUZZER_H_
+
+/**
+ * @addtogroup buzzer
+ * @{
+ **/
+
+//Musical note definitions
+//Source: http://www.answers.com/topic/piano-key-frequencies
+/** @brief Middle C **/
+#define	C4	260 //Middle C
+/** @brief C# **/
+#define	C4s	277 //C sharp
+/** @brief D **/
+#define	D4	294
+/** @brief D# **/
+#define	D4s	311
+/** @brief E **/
+#define	E4	330
+/** @brief F **/
+#define	F4	349
+/** @brief F# **/
+#define	F4s	370
+/** @brief G **/
+#define	G4	392
+/** @brief G# **/
+#define	G4s	415
+/** @brief A **/
+#define	A4	440
+/** @brief A# **/
+#define	A4s	466
+/** @brief B **/
+#define	B4	494
+/** @brief C **/
+#define	C5	523
+
+/** @brief Initialize the buzzer. **/
+void buzzer_init(void);
+/** @brief Set the value the buzzer plays. **/
+void buzzer_set_val(unsigned int buzz_value);
+/** @brief Set the frequency the buzzer plays. **/
+void buzzer_set_freq(unsigned int buzz_freq);
+/** @brief Play a frequency for a specified time. **/
+void buzzer_chirp(unsigned int ms, unsigned int buzz_freq);
+/** @brief Turn the buzzer off. **/
+void buzzer_off(void); 
+
+/** @} **/ //end addtogroup
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libdragonfly/ring_buffer.h
===================================================================
--- demos/hunter_prey_john/lib/include/libdragonfly/ring_buffer.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libdragonfly/ring_buffer.h	(revision 1694)
@@ -0,0 +1,142 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+
+/** @file ring_buffer.h
+ * @brief Ring Buffer
+ *
+ * Include macros to create a ring buffer. Originally written for 15-410.
+ * Modified for use in ATMega128 serial driver
+ *
+ * @author Cornell Wright (cgwright)
+ * @author Jason P. Winters (jpwinter)
+ *
+ **/
+
+#ifndef _RING_BUFFER_H
+#define _RING_BUFFER_H
+
+/** @brief Creates the struct for a new ring buffer. This just expands to a
+ *	structure definition and thus should be invoked in the global context.
+ *
+ *	@param struct_name Name of the ring buffer struct.
+ *
+ *	@param size The size of the buffer to create.
+ *
+ *	@param type The type of object that the queue is to hold.
+ *
+ *	@param ... Name or names of the instance or instances of the ring buffer(s)
+ *	to be created.
+ */
+#define RING_BUFFER_NEW(struct_name, size, type, ...)	\
+	struct struct_name {	\
+		type queue[size];	\
+		uint8_t start;			\
+		uint8_t end;			\
+		uint8_t buffer_size;			\
+	} __VA_ARGS__
+
+
+/** @brief Initializes the ring buffer, setting its size to the correct value
+ *
+ *	@param buf The ring buffer to initialize.
+ *
+ *  @param size The size of the ring buffer (in array elements)
+ */
+#define RING_BUFFER_INIT(buf, size) 			\
+	do {										\
+		(buf).buffer_size = size;				\
+	} while(0)
+
+
+/** @brief Sets the specified ring buffer to be empty.
+ *
+ *	@param buf The ring buffer to make empty.
+ */
+#define RING_BUFFER_CLEAR(buf)	\
+	do {						\
+		(buf).start = 0;		\
+		(buf).end = 0;			\
+	} while (0)
+
+/** @brief Returns true if the ring buffer specified is empty.
+ *
+ *	@param buf The buffer to check emptiness of.
+ */
+#define RING_BUFFER_EMPTY(buf) ((buf).start == (buf).end)
+
+
+/** @brief Returns true if the ring buffer specified is full.
+ *
+ *	@param buf The buffer to check fullness of.
+ */
+#define RING_BUFFER_FULL(buf)	\
+		(((buf).end + 1) % (buf).buffer_size == (buf).start)
+
+
+/** @brief Adds val to ring buffer buf. Note that val must be of the type
+ *	used in creating the ring buffer to prevent the compiler from spewing
+ *	confusing errors. Also, this assumes that the ring buffer is not full.
+ *
+ *	@param buf The ring buffer to add to.
+ *	@param val The value to add.
+ */
+#define RING_BUFFER_ADD(buf, val)		\
+	do {								\
+		(buf).queue[(buf).end] = val;	\
+		(buf).end = ((buf).end + 1) % (buf).buffer_size;	\
+	} while (0)
+
+
+/** @brief Removes the value at the head of the ring buffer and puts it in
+ *	val_ret. Note that val_ret must be the same type used in creating the ring
+ *	buffer to prevent the compiler from spewing confusing errors. Also, this
+ *	assumes that the ring buffer is not empty.
+ *
+ *	@param buf The ring buffer to remove from.
+ *	@param val_ret Where to put the value removed from the head of the ring
+ *	buffer.
+ */
+#define RING_BUFFER_REMOVE(buf, val_ret)	\
+	do {	\
+		(val_ret) = (buf).queue[(buf).start];	\
+		(buf).start = ((buf).start + 1) % (buf).buffer_size;	\
+	} while (0)
+
+/** @brief Checks the value at the head of the ring buffer without removing it
+ *  and puts it into val_ret. Note that val_ret must be the same type used in
+ *  creating the ring buffer to prevent the compiler from spewing confusing
+ *  errors. Also, this assumes that the ring buffer is not empty.
+ *
+ *  @param buf The ring buffer to check from
+ *  @param val_ret where to put the value checked from the head of the ring
+ */
+ #define RING_BUFFER_PEEK(buf, val_ret)  \
+  do { \
+    (val_ret) = (buf).queue[(buf).start]; \
+  } while(0)
+
+#endif /* _RING_BUFFER_H */
+
Index: demos/hunter_prey_john/lib/include/libwireless/wl_basic.h
===================================================================
--- demos/hunter_prey_john/lib/include/libwireless/wl_basic.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libwireless/wl_basic.h	(revision 1694)
@@ -0,0 +1,65 @@
+/**
+ * @file wl_basic.h
+ * @brief High Level Wireless Packet Sending-Receiving Functions
+ *
+ * Abstracted wireless functionality for sending and receiving packets
+ *
+ * @author Christopher Mar, Colony Project, CMU Robotics Club
+ **/
+
+/**
+ * @defgroup wl_basic Wireless Basic
+ * @brief Wireless abstraction for easily sending and receing packets.
+ *
+ * A high level abstraction of the wireless library.
+ *
+ * This will allow you to easily send and receive packets.
+ *
+ * @{
+ **/
+
+#ifndef WL_BASIC_H
+#define WL_BASIC_H
+
+#include "wireless.h"
+
+/** @brief default wireless group for basic sending and receiving packets **/
+#define WL_BASIC_GROUP 8
+
+/** @brief PacketGroupHandler struct for Basic Group **/
+PacketGroupHandler wl_basic_group_handler;
+
+/**
+ * @brief struct that contains relevant packet information
+ **/
+struct PacketInfo {
+    char new_flag;
+    char type;
+    int source;
+    unsigned char* data;
+    int length;
+};
+
+/**
+ * @brief current packet information, correct after wl_basic_do()
+ **/
+struct PacketInfo current_packet;
+
+/** @brief init wireless for Basic Group **/
+int wl_basic_init( void (*handle_receive) (char type, int source, unsigned char* packet, int length) );
+/** @brief init wireless for Basic Group with default packet handling **/
+int wl_basic_init_default( void );
+/** @brief internal function to register a packet handler function **/
+void wl_basic_register_handler( void (*handle_receive) (char type, int source, unsigned char* packet, int length) );
+/** @brief send a packet to a single robot in Basic Group **/
+void wl_basic_send_robot_packet( char type, char* data, int len, int dest );
+/** @brief send a packet to all robots in Basic Group **/
+void wl_basic_send_global_packet( char type, char* data, int len );
+/** @brief internal default packet handler if none is specified on init **/
+void wl_basic_packet_receive_handler( char type, int source, unsigned char* packet, int length );
+/** @brief wrapper for wl_do() to return packet data buffer **/
+unsigned char* wl_basic_do_default( int *length );
+/** @} **/ // end defgroup
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libwireless/xbee.h
===================================================================
--- demos/hunter_prey_john/lib/include/libwireless/xbee.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libwireless/xbee.h	(revision 1694)
@@ -0,0 +1,101 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file xbee.h
+ * @brief Contains definitions for using the XBee
+ *
+ * Contains definitions for interfacing with the 
+ * XBee module, from either a robot or a computer.
+ * To use a robot, define ROBOT in wl_defs.h, and
+ * to use a computer, don't define ROBOT.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef XBEE_H
+#define XBEE_H
+
+/**
+ * The port to use the XBee from on the computer.
+ * Also, a backup port if the other is used.
+ **/
+#ifndef ROBOT
+#define XBEE_PORT_DEFAULT "/dev/ttyUSB1"
+#endif
+
+/**
+ * @defgroup xbee XBee
+ * @brief Interface with the XBee module
+ *
+ * Interface with the XBee module.
+ *
+ * @{
+ **/
+
+/*Definitions*/
+/**@brief Unset PAN, uses XBee default **/
+#define XBEE_PAN_DEFAULT 0xFFFF
+/**@brief Unset channel, uses XBee default **/
+#define XBEE_CHANNEL_DEFAULT 0
+/**@brief Broadcast to all robots in the PAN **/
+#define XBEE_BROADCAST 0xFFFF
+/**@brief No special options **/
+#define XBEE_OPTIONS_NONE 0x00
+/**@brief Do not receive a TX_STATUS message from this packet **/
+#define XBEE_OPTIONS_DISABLE_RESPONSE 0x01
+/**@brief Send the packet to all PANS **/
+#define XBEE_OPTIONS_BROADCAST_ALL_PANS 0x04
+/**@brief A transmit status packet **/
+#define XBEE_TX_STATUS 0x89
+/**@brief A packet received from another XBee **/
+#define XBEE_RX 0x81
+
+/**@brief Initialize the XBee library **/
+int xbee_lib_init(void);
+/**@brief Uninitialize the XBee library **/
+void xbee_terminate(void);
+/**@brief Get a packet from the XBee **/
+int xbee_get_packet(unsigned char* packet);
+/**@brief Send a packet to the XBee **/
+int xbee_send_packet(char* packet, int len, int dest, char options, char frame);
+/**@brief Set the PAN ID for the XBee **/
+int xbee_set_pan_id(int id);
+/**@brief Get the XBee's PAN ID **/
+unsigned int xbee_get_pan_id(void);
+/**@brief Set the channel the XBee is currently using **/
+int xbee_set_channel(int channel);
+/**@brief Get the channel the XBee is currently using **/
+int xbee_get_channel(void);
+/**@brief Get the XBee's 16-bit address **/
+unsigned int xbee_get_address(void);
+/**@brief Set the com port on a computer, undefined on the robot**/
+void xbee_set_com_port(char* port);
+/**@brief Reset XBee **/
+int xbee_reset(void);
+
+/**@}**/ //end defgroup
+
+#endif
Index: demos/hunter_prey_john/lib/include/libwireless/sensor_matrix.h
===================================================================
--- demos/hunter_prey_john/lib/include/libwireless/sensor_matrix.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libwireless/sensor_matrix.h	(revision 1694)
@@ -0,0 +1,101 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file sensor_matrix.h
+ * @brief Definitions for sensor matrices
+ *
+ * Contains functions and declarations for using sensor matrices.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef SENSOR_MATRIX_H
+#define SENSOR_MATRIX_H
+
+
+/**
+ * @defgroup sensormatrix Sensor Matrix
+ * @brief the robot sensor matrix
+ *
+ * These functions and structures are used for localization
+ * to determine the relative directions of robots.
+ *
+ * @{
+ **/
+
+#define MAXIMUM_XBEE_ID		0x10
+#define READING_UNKNOWN		0xFF
+
+/**
+ * @struct SensorMatrix
+ *
+ * A sensor matrix.
+ **/
+//TODO: the order of member variables in this struct should be changed in case the compile packs the struct
+// In order to achieve the best packing, the variables should be listed in order of decreasing memory size.
+// Thus, pointers should be first, followed by int, followed by char.
+typedef struct
+{
+	/**
+	 * The number of robots in the token ring.
+	 **/
+	int numJoined;
+	/**
+	 * The element representing a robot is true if that robot
+	 * is in the token ring and false otherwise.
+	 **/
+	unsigned char joined[MAXIMUM_XBEE_ID];
+
+	// on the bayboard, we don't include the matrix to save memory.
+#ifndef BAYBOARD
+	/**
+	 * The matrix. Each row represents the readings of one
+	 * robot.
+	 **/
+	unsigned char matrix[MAXIMUM_XBEE_ID][MAXIMUM_XBEE_ID];
+#endif
+} SensorMatrix;
+
+/**@brief Create a sensor matrix **/
+void sensor_matrix_create(void);
+/**@brief Set a reading in a sensor matrix **/
+void sensor_matrix_set_reading(int observer, int robot, int reading);
+/**@brief Get a reading in a sensor matrix **/
+int sensor_matrix_get_reading(int observer, int robot);
+/**@brief Set whether the robot is in the token ring **/
+void sensor_matrix_set_in_ring(int robot, int in);
+/**@brief Get whether the robot is in the sensor ring **/
+int sensor_matrix_get_in_ring(int robot);
+/**@brief Get the number of robots which have joined the token ring **/
+int sensor_matrix_get_joined(void);
+/**@brief Get the maximum size of the sensor matrix **/
+int sensor_matrix_get_size(void);
+
+/** @} **/ //end defgroup
+
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libwireless/wireless.h
===================================================================
--- demos/hunter_prey_john/lib/include/libwireless/wireless.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libwireless/wireless.h	(revision 1694)
@@ -0,0 +1,164 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file wireless.h
+ * @brief Contains definitions for the wireless library.
+ *
+ * Contains functions for the wireless library.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef WIRELESS_H
+#define WIRELESS_H
+
+//Note: If this is raised above 16, we will need to do
+//something about frame numbers for TX Status packets.
+/**
+ * The maximum number of packet groups.
+ **/
+//TODO: a PacketGroupHandler is at least 10 bytes (I don't know if function pointers are 2 bytes
+// or 4 bytes).  That means that in the c file, your array of packet groups is at least 160 bytes.
+// Normally that might be fine (the robot's avr chips have 4k SRAM), but austin's chip only has
+// 1k SRAM, so if this number can be reduced or if the size of the struct could be reduced, that would be a plus.
+#define WL_MAX_PACKET_GROUPS 16
+
+/**
+ * @defgroup wireless Wireless
+ * @brief Wireless definitions.
+ *
+ * Contains functions and definitions for dealing with wireless functionality.<br><br>
+ *
+ * The wireless library provides a modular method for dealing with
+ * wireless packets, by allowing packet groups to be registered.
+ * A packet group is a collection of packets which share a packet
+ * group code. Each packet in the group also has a type. A packet
+ * group code and type are sent with each packet. When a packet
+ * with a group code registered in the wireless library is
+ * received, the corresponding event handler is called. The
+ * event handler uses the packet type and other information
+ * stored in the packet to respond.<br><br>
+ *
+ * This architecture allows different wireless functionality to be
+ * defined and handled separately, making it simpler and more
+ * efficient to take advantage of the XBee's wireless functionality.
+ *
+ * @{
+ **/
+
+/**
+ * @struct PacketGroupHandler
+ * A PacketGroupHandler represents a packet group, and is used to
+ * register a packet group with the wireless library. It contains
+ * handlers for various events which can occur related to a packet
+ * group.
+ **/
+//TODO: the order of member variables in this struct should be changed in case the compile packs the struct
+// In order to achieve the best packing, the variables should be listed in order of decreasing memory size.
+// Thus, pointers should be first, followed by int, followed by char.
+typedef struct
+{
+	/**
+	 * The group code for this packet group. This number
+	 * must be unique. The maximum number of packet groups
+	 * is defined by WL_MAX_PACKET_GROUPS.
+	 **/
+  //TODO: if this number must be less than or equal to WL_MAX_PACKET_GROUPS, don't you only need
+  // one byte for it and it can be made an unsigned char?
+	unsigned int groupCode;
+
+	/**
+	 * Called every half second (not in interrupt,
+	 * but in wl_do).
+	 **/
+	void (*timeout_handler) (void);
+
+	/**
+	 * Called when a transmit status packet is received
+	 * from the XBee where the first four bits of the frame
+	 * are  the group code.
+	 *
+	 * @param frame the last four bits of the frame
+	 * @param received is true if we received an ack, 0 if
+	 * we did not.
+	 **/
+	void (*handle_response) (int frame, int received);
+
+	/**
+	 * Called when we receive a packet from this group.
+	 *
+	 * @param type the packet type
+	 * @param source the 16-bit address of the XBee this
+	 * packet was sent from
+	 * @param packet the packet received
+	 * @param length the length of the packet
+	 **/
+	void (*handle_receive) (char type, int source, unsigned char* packet, int length);
+
+	/**
+	 * Called for any cleanup when the network is turned off.
+	 **/
+	void (*unregister) (void);
+
+} PacketGroupHandler;
+
+/**@brief Initialize the wireless library **/
+int wl_init(void);
+/**@brief Uninitialize the wireless library **/
+void wl_terminate(void);
+/**@brief Perform wireless library functionality **/
+void wl_do(void);
+/**@brief Register a packet group with the wireless library **/
+void wl_register_packet_group(PacketGroupHandler* h);
+/**@brief Unregister a packet group with the wireless library **/
+void wl_unregister_packet_group(PacketGroupHandler* h);
+
+/**@brief Send a packet to a specific robot in any PAN **/
+int wl_send_robot_to_robot_global_packet(char group, char type, char* data, int len, int dest, char frame);
+/**@brief Send a packet to a specific robot in our PAN **/
+int wl_send_robot_to_robot_packet(char group, char type, char* data, int len, int dest, char frame);
+/**@brief Send a packet to all robots **/
+int wl_send_global_packet(char group, char type, char* data, int len, char frame);
+/**@brief Send a packet to all robots in our PAN **/
+void wl_send_pan_packet(char group, char type, char* data, int len, char frame);
+
+/**@brief Set the PAN we are using **/
+int wl_set_pan(int pan);
+/**@brief Get the PAN we are using **/
+int wl_get_pan(void);
+/**@brief Set the channel we are using **/
+int wl_set_channel(int channel);
+/**@brief Get the channel we are using **/
+int wl_get_channel(void);
+/**@brief Get the 16-bit address of the XBee module **/
+int wl_get_xbee_id(void);
+/**@brief Set the com port on a computer, undefined on the robot.**/
+void wl_set_com_port(char* port);
+
+/** @} **/ // end defgroup
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libwireless/wl_token_ring.h
===================================================================
--- demos/hunter_prey_john/lib/include/libwireless/wl_token_ring.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libwireless/wl_token_ring.h	(revision 1694)
@@ -0,0 +1,85 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file wl_token_ring.h
+ * @brief Declarations for the token ring packet group
+ * 
+ * Contains declarations for the token ring packet group.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef WL_TOKEN_RING_H
+#define WL_TOKEN_RING_H
+
+/**
+ * @defgroup tokenring Token Ring
+ * @brief Wireless library token ring implementation
+ *
+ * This packet group is used to form a token ring, which
+ * keeps track of the relative directions of the robots
+ * from one another.
+ *
+ * @{
+ **/
+
+/**@brief Register the token ring group with the wireless library.**/
+int wl_token_ring_register(void);
+/**@brief Unregister the token ring group with the wirelss library.**/
+void wl_token_ring_unregister(void);
+/**@brief Set the functions called to turn the bom on and off.**/
+void wl_token_ring_set_bom_functions(void (*on_function) (void), void (*off_function) (void),
+  int (*max_bom_function) (void));
+
+/**@brief Join the token ring **/
+int wl_token_ring_join(void);
+/**@brief Leave the token ring **/
+void wl_token_ring_leave(void);
+
+/**@brief Return the number of robots in the token ring **/
+int wl_token_get_robots_in_ring(void);
+/**@brief Return whether a given robot is in the token ring **/
+int wl_token_is_robot_in_ring(int robot);
+
+/**@brief Begin iterating through robots in the token ring **/
+void wl_token_iterator_begin(void);
+/**@brief Returns whether there are more robots to iterate through **/
+int wl_token_iterator_has_next(void);
+/**@brief Returns the ID of the next robot in the token ring **/
+int wl_token_iterator_next(void);
+
+/**@brief Return the latest BOM reading between two robots **/
+int wl_token_get_sensor_reading(int source, int dest);
+/**@brief Return the latest BOM reading between us and another robot **/
+int wl_token_get_my_sensor_reading(int dest);
+/**@brief Return the number of robots in the sensor matrix.*/
+int wl_token_get_num_robots(void);
+/**@brief Return the number of non-null elements in the sensor matrix*/
+int wl_token_get_matrix_size(void);
+
+/** @} **/ //end token ring group
+
+#endif
Index: demos/hunter_prey_john/lib/include/libwireless/wl_defs.h
===================================================================
--- demos/hunter_prey_john/lib/include/libwireless/wl_defs.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libwireless/wl_defs.h	(revision 1694)
@@ -0,0 +1,97 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file wl_defs.h
+ * @brief Definitions for Wireless
+ *
+ * Contains definitions for wireless packet groups, packet types,
+ * debugging information, etc.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef WL_DEFS_H
+#define WL_DEFS_H
+
+//comment out this line if using a computer hooked up to an xbee
+//#define ROBOT
+
+//uncomment this line for debug information
+//#define WL_DEBUG
+
+// Packet Groups and Types
+
+// Error group
+#define WL_ERROR_GROUP 1
+
+#define WL_ERROR_STRING_TYPE 1
+
+// Token Ring group
+#define WL_TOKEN_RING_GROUP 2
+
+#define WL_TOKEN_PASS 1
+#define WL_TOKEN_SENSOR_MATRIX 2
+#define WL_TOKEN_BOM_ON 3
+#define WL_TOKEN_JOIN 4
+#define WL_TOKEN_JOIN_ACCEPT 5
+
+// timing constants
+#ifndef FIREFLY
+#define BOM_DELAY 100
+#else
+#define BOM_DELAY 200
+#endif
+
+#define DEATH_DELAY 4
+#define JOIN_DELAY 8
+
+#ifdef WL_DEBUG
+
+#ifdef ROBOT
+#include <serial.h>
+#endif
+
+#ifdef ROBOT
+#define WL_DEBUG_PRINT( s ) usb_puts( s )
+#else
+#define WL_DEBUG_PRINT( s ) printf( s )
+#endif
+
+#ifdef ROBOT
+#define WL_DEBUG_PRINT_INT( i ) usb_puti(i)
+#else
+#define WL_DEBUG_PRINT_INT( i ) printf("%i", i)
+#endif
+
+#else
+
+#define WL_DEBUG_PRINT( s )
+#define WL_DEBUG_PRINT_INT( i )
+
+#endif
+
+#endif
+
Index: demos/hunter_prey_john/lib/include/libwireless/wl_error_group.h
===================================================================
--- demos/hunter_prey_john/lib/include/libwireless/wl_error_group.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libwireless/wl_error_group.h	(revision 1694)
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file wl_error_group.h
+ * @brief Error Packets
+ *
+ * A packet group for sending error packets.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef WL_ERROR_GROUP_H
+#define WL_ERROR_GROUP_H
+
+/**
+ * @file wl_error_group.h
+ * @brief A packet group for error messages.
+ *
+ * A packet group for sending and receiving error
+ * messages.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+/**
+ * @defgroup wlerror Error Packets
+ * @brief Functions for sending and receiving error packets
+ * 
+ * Functions for sending and receiving error packets.
+ * 
+ * @{
+ **/
+
+/**@brief Register this packet group with the wireless library **/
+void wl_error_register(void);
+/**@brief Unregister this packet group with the wireless library **/
+void wl_error_unregister(void);
+/**@brief Send a string in an error packet **/
+void wl_error_send_string(char* str);
+
+/** @} **/ // end defgroup
+
+#endif
Index: demos/hunter_prey_john/lib/include/libwireless/queue.h
===================================================================
--- demos/hunter_prey_john/lib/include/libwireless/queue.h	(nonexistent)
+++ demos/hunter_prey_john/lib/include/libwireless/queue.h	(revision 1694)
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2007 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ **/
+
+/**
+ * @file queue.h
+ * @brief A queue implementation
+ * 
+ * Implements a queue, a first in, first out data structure.
+ *
+ * @author Brian Coltin, Colony Project, CMU Robotics Club
+ **/
+
+#ifndef WIRELESS_QUEUE_H
+#define WIRELESS_QUEUE_H
+
+#ifndef ROBOT
+#include <pthread.h>
+#endif
+
+struct node_def;
+
+/**
+ * @defgroup queue Queue
+ * @brief A queue implementation
+ * 
+ * A queue implementation.
+ *
+ * @{
+ **/
+
+/**
+ * @struct Queue
+ * Represents a queue, a first in, first out data structure.
+ **/
+typedef struct
+{
+	/**
+	 * The head of the queue, the next item to be removed.
+	 **/
+	struct node_def* head;
+	/**
+	 * The tail of the queue, the last item added.
+	 **/
+	struct node_def* tail;
+	/**
+	 * The number of elements in the queue.
+	 **/
+	int size;
+	
+#ifndef ROBOT
+	pthread_mutex_t lock;
+#endif
+} Queue;
+
+/** @brief Create a new queue **/
+Queue* queue_create(void);
+/** @brief Destroy a queue **/
+void queue_destroy(Queue* q);
+/** @brief Add an element to a queue **/
+int queue_add(Queue* q, void* item);
+/** @brief Remove an element from a queue **/
+void* queue_remove(Queue* q);
+/** @brief Remove all instances of a given element from a queue **/
+void queue_remove_all(Queue* q, void* item);
+/** @brief Get the size of a queue **/
+int queue_size(Queue* q);
+/** @brief Check if the queue is empty **/
+int queue_is_empty(Queue* q);
+
+/** @} **/
+
+
+#endif
Index: demos/hunter_prey_john/Makefile
===================================================================
--- demos/hunter_prey_john/Makefile	(nonexistent)
+++ demos/hunter_prey_john/Makefile	(revision 1694)
@@ -0,0 +1,568 @@
+# This is the root makefile
+#
+# Make global makefile changes here
+#
+###################################
+
+# Relative path to the root directory (containing lib directory)
+ifndef COLONYROOT
+COLONYROOT := .
+else
+COLONYROOT := $(COLONYROOT)
+endif
+
+# Hey Emacs, this is a -*- makefile -*-
+#----------------------------------------------------------------------------
+# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
+#
+# Released to the Public Domain
+#
+# Additional material for this makefile was written by:
+# Peter Fleury
+# Tim Henigan
+# Colin O'Flynn
+# Reiner Patommel
+# Markus Pfaff
+# Sander Pool
+# Frederik Rouleau
+#
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device, using avrdude.
+#                Please customize the avrdude settings below first!
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+#              with avr-gdb or avr-insight as the front end for debugging.
+#
+# make library = Build the library, then make software
+#
+# make demo = copy this directory and all subdirectories to the demos folder
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+#                   bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+#if you want your code to work on the Firefly++ and not Firefly+
+#then add the -DFFPP line to CDEFS
+CDEFS =
+#-DFFPP
+
+# MCU name
+MCU = atmega128
+
+# Processor frequency.
+#     This will define a symbol, F_CPU, in all source code files equal to the
+#     processor frequency. You can then use this symbol in your source code to
+#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+#     automatically to create a 32-bit value in your source code.
+F_CPU = 8000000
+
+# Output format. (can be srec, ihex, binary)
+FORMAT = ihex
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = $(wildcard *.c)
+
+# List Assembler source files here.
+#     Make them always end in a capital .S.  Files ending in a lowercase .s
+#     will not be considered source files but generated files (assembler
+#     output from the compiler), and will be deleted upon "make clean"!
+#     Even though the DOS/Win* filesystem matches both .s and .S the same,
+#     it will preserve the spelling of the filenames, and gcc itself does
+#     care about how the name is spelled on its command-line.
+ASRC =
+
+# Optimization level, can be [0, 1, 2, 3, s].
+#     0 = turn off optimization. s = optimize for size.
+#     (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+OPT = s
+
+# Debugging format.
+#     Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
+#     AVR Studio 4.10 requires dwarf-2.
+#     AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
+DEBUG =
+
+# Compiler flag to set the C Standard level.
+#     c89   = "ANSI" C
+#     gnu89 = c89 plus GCC extensions
+#     c99   = ISO C99 standard (not yet fully implemented)
+#     gnu99 = c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+# Place -D or -U options here
+CDEFS += -DF_CPU=$(F_CPU)UL
+CDEFS += -DFFP
+# for wireless library
+ifdef USE_WIRELESS
+	CDEFS += -DROBOT
+endif
+
+# Place -I, -L options here
+CINCS = -I$(COLONYROOT)/lib/include/libdragonfly
+CINCS += -L$(COLONYROOT)/lib/bin
+ifdef USE_WIRELESS
+  CINCS += -I$(COLONYROOT)/lib/include/libwireless
+endif
+
+#---------------- Compiler Options ----------------
+#  -g*:          generate debugging information
+#  -O*:          optimization level
+#  -f...:        tuning, see GCC manual and avr-libc documentation
+#  -Wall...:     warning level
+#  -Wa,...:      tell GCC to pass this to the assembler.
+#    -adhlns...: create assembler listing
+CFLAGS =
+# CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS) $(CINCS)
+CFLAGS += -O$(OPT)
+CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
+CFLAGS += -Wall -Wstrict-prototypes
+CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
+CFLAGS += $(CSTANDARD)
+
+#---------------- Assembler Options ----------------
+#  -Wa,...:   tell GCC to pass this to the assembler.
+#  -ahlms:    create listing
+#  -gstabs:   have the assembler create line number information; note that
+#             for use in COFF files, additional information about filenames
+#             and function names needs to be present in the assembler source
+#             files -- see avr-libc docs [FIXME: not yet described there]
+ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
+
+
+#---------------- Library Options ----------------
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+# If this is left blank, then it will use the Standard printf version.
+PRINTF_LIB =
+#PRINTF_LIB = $(PRINTF_LIB_MIN)
+#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
+
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+# If this is left blank, then it will use the Standard scanf version.
+SCANF_LIB =
+#SCANF_LIB = $(SCANF_LIB_MIN)
+#SCANF_LIB = $(SCANF_LIB_FLOAT)
+
+MATH_LIB = -lm
+
+#---------------- External Memory Options ----------------
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+#---------------- Linker Options ----------------
+#  -Wl,...:     tell GCC to pass this to linker.
+#    -Map:      create map file
+#    --cref:    add cross reference to  map file
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS += $(EXTMEMOPTS)
+LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+ifdef USE_WIRELESS
+	LDFLAGS += -lwireless
+endif
+LDFLAGS += -ldragonfly
+
+
+
+#---------------- Programming Options (avrdude) ----------------
+
+# Programming hardware: alf avr910 avrisp bascom bsd
+# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
+#
+# Type: avrdude -c ?
+# to get a full listing.
+#
+AVRDUDE_PROGRAMMER = avrisp
+
+# programmer connected to serial device
+
+AVRDUDE_WRITE_FLASH = -b 57600 -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level.  Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+#don't check for device signature
+AVRDUDE_FLAGS += -F
+
+
+
+#---------------- Debugging Options ----------------
+
+# For simulavr only - target MCU frequency.
+DEBUG_MFREQ = $(F_CPU)
+
+# Set the DEBUG_UI to either gdb or insight.
+# DEBUG_UI = gdb
+DEBUG_UI = insight
+
+# Set the debugging back-end to either avarice, simulavr.
+DEBUG_BACKEND = avarice
+#DEBUG_BACKEND = simulavr
+
+# GDB Init Filename.
+GDBINIT_FILE = __avr_gdbinit
+
+# When using avarice settings for the JTAG
+JTAG_DEV = /dev/com1
+
+# Debugging port used to communicate between GDB / avarice / simulavr.
+DEBUG_PORT = 4242
+
+# Debugging host used to communicate between GDB / avarice / simulavr, normally
+#     just set to localhost unless doing some sort of crazy debugging when
+#     avarice is running on a different computer.
+DEBUG_HOST = localhost
+
+
+
+#============================================================================
+
+
+# Define programs and commands.
+SHELL = sh
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+REMOVEDIR = rm -rf
+COPY = cp
+WINSHELL = cmd
+
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = -------- begin --------
+MSG_END = --------  end  --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for Flash:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_LIBRARY_BUILD = Building library:
+MSG_LIBRARY_CHECK = Checking if we need to rebuild the library:
+
+
+
+# Define all object files.
+OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
+
+# Define all listing files.
+LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)
+
+
+# Compiler flags to generate dependency files.
+GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
+
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+
+
+
+# Default target.
+all: begin gccversion lib sizebefore build sizeafter checksize end
+
+build: elf hex eep lss sym
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+
+
+
+# Eye candy.
+# AVR Studio 3.x does not check make's exit code but relies on
+# the following magic strings to be generated by the compile job.
+begin:
+	@echo
+	@echo $(MSG_BEGIN)
+
+end:
+	@echo $(MSG_END)
+	@echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) -A $(TARGET).elf
+AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)
+
+# Check RAM size (make sure under 4 kB)
+AWK = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'gawk'; else echo 'awk'; fi)
+DATASIZE = avr-size -A main.elf | grep 'data' | $(AWK) '{ print $$2 }' > 1.tmp
+BSSSIZE = avr-size -A main.elf | grep 'bss' | $(AWK) '{ print $$2 }' > 2.tmp
+ADD = expr `cat 1.tmp` + `cat 2.tmp` > 3.tmp
+CLEANSIZE = rm 1.tmp 2.tmp 3.tmp
+checksize:
+	@$(DATASIZE)
+	@$(BSSSIZE)
+	@$(ADD)
+	@if test `cat 3.tmp` -gt 4096; \
+	then echo "RAM size exceeded.  Make .data or .bss smaller.";echo;exit 1; \
+	else echo ".data and .bss size fine";echo; fi
+	@$(CLEANSIZE)
+
+# Display size before
+sizebefore:
+	@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
+	$(AVRMEM) 2>/dev/null; echo; fi
+
+# Display size after
+sizeafter:
+	@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
+	$(AVRMEM) 2>/dev/null; echo; fi
+
+
+
+# Display compiler version information.
+gccversion :
+	@$(CC) --version
+  
+  
+# Build the library
+library:
+	@echo $(MSG_LIBRARY_BUILD)
+	make clean -C $(COLONYROOT)/projects/libdragonfly
+	make dist -C $(COLONYROOT)/projects/libdragonfly
+ifdef USE_WIRELESS
+	make clean -C $(COLONYROOT)/projects/libwireless/lib
+	make dist -C $(COLONYROOT)/projects/libwireless/lib
+endif
+
+# Check if library needs to be built
+lib:
+	@echo $(MSG_LIBRARY_CHECK)
+	make dist -C $(COLONYROOT)/projects/libdragonfly
+ifdef USE_WIRELESS
+	make dist -C $(COLONYROOT)/projects/libwireless/lib
+endif
+
+
+# Program the device.
+program: $(TARGET).hex $(TARGET).eep
+	$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+
+# Generate avr-gdb config/init file which does the following:
+#     define the reset signal, load the target file, connect to target, and set
+#     a breakpoint at main().
+gdb-config:
+	@$(REMOVE) $(GDBINIT_FILE)
+	@echo define reset >> $(GDBINIT_FILE)
+	@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
+	@echo end >> $(GDBINIT_FILE)
+	@echo file $(TARGET).elf >> $(GDBINIT_FILE)
+	@echo target remote $(DEBUG_HOST):$(DEBUG_PORT)  >> $(GDBINIT_FILE)
+ifeq ($(DEBUG_BACKEND),simulavr)
+	@echo load  >> $(GDBINIT_FILE)
+endif
+	@echo break main >> $(GDBINIT_FILE)
+
+debug: gdb-config $(TARGET).elf
+ifeq ($(DEBUG_BACKEND), avarice)
+	@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
+	@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
+	$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
+	@$(WINSHELL) /c pause
+
+else
+	@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
+	$(DEBUG_MFREQ) --port $(DEBUG_PORT)
+endif
+	@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
+
+
+
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT=$(OBJCOPY) --debugging \
+--change-section-address .data-0x800000 \
+--change-section-address .bss-0x800000 \
+--change-section-address .noinit-0x800000 \
+--change-section-address .eeprom-0x810000
+
+
+coff: $(TARGET).elf
+	@echo
+	@echo $(MSG_COFF) $(TARGET).cof
+	$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+	@echo
+	@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
+	$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
+
+
+
+# Create final output files (.hex, .eep) from ELF output file.
+%.hex: %.elf
+	@echo
+	@echo $(MSG_FLASH) $@
+	$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+%.eep: %.elf
+	@echo
+	@echo $(MSG_EEPROM) $@
+	-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+	--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+	@echo
+	@echo $(MSG_EXTENDED_LISTING) $@
+	$(OBJDUMP) -h -S $< > $@
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+	@echo
+	@echo $(MSG_SYMBOL_TABLE) $@
+	$(NM) -n $< > $@
+
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(OBJ)
+%.elf: $(OBJ)
+	@echo
+	@echo $(MSG_LINKING) $@
+	$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+%.o : %.c
+	@echo
+	@echo $(MSG_COMPILING) $<
+	$(CC) -c $(ALL_CFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files.
+%.s : %.c
+	$(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+%.o : %.S
+	@echo
+	@echo $(MSG_ASSEMBLING) $<
+	$(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+# Create preprocessed source for use in sending a bug report.
+%.i : %.c
+	$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list end
+
+clean_list :
+	@echo
+	@echo $(MSG_CLEANING)
+	$(REMOVE) $(TARGET).hex
+	$(REMOVE) $(TARGET).eep
+	$(REMOVE) $(TARGET).cof
+	$(REMOVE) $(TARGET).elf
+	$(REMOVE) $(TARGET).map
+	$(REMOVE) $(TARGET).sym
+	$(REMOVE) $(TARGET).lss
+	$(REMOVE) $(OBJ)
+	$(REMOVE) $(LST)
+	$(REMOVE) $(SRC:.c=.s)
+	$(REMOVE) $(SRC:.c=.d)
+	$(REMOVEDIR) .dep
+
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all begin finish end sizebefore sizeafter gccversion \
+build elf hex eep lss sym coff extcoff \
+clean clean_list program debug gdb-config
+
+# copy to demo folder
+DEMO_NAME := $(shell sh -c 'echo $${PWD\#\#*/}')
+demo:
+	@echo "Copying to demo folder..."
+	@echo "$(DEMO_NAME)"
+	@make clean
+	@mkdir $(COLONYROOT)/../demos/$(DEMO_NAME)
+	@mkdir $(COLONYROOT)/../demos/$(DEMO_NAME)/behavior
+	@mkdir $(COLONYROOT)/../demos/$(DEMO_NAME)/projects
+#	@mkdir $(COLONYROOT)/../demos/$(DEMO_NAME)/lib
+	@cp -R * $(COLONYROOT)/../demos/$(DEMO_NAME)/behavior/
+	@cp -R $(COLONYROOT)/code/projects/libdragonfly $(COLONYROOT)/../demos/$(DEMO_NAME)/projects/
+	@cp -R $(COLONYROOT)/code/projects/libwireless $(COLONYROOT)/../demos/$(DEMO_NAME)/projects/
+	@cp -R $(COLONYROOT)/code/lib $(COLONYROOT)/../demos/$(DEMO_NAME)
+	@cp $(COLONYROOT)/../demos/inerMakefile $(COLONYROOT)/../demos/$(DEMO_NAME)/Makefile
+
