Index: trunk/code/projects/libwireless/lib/sensor_matrix.h
===================================================================
--- trunk/code/projects/libwireless/lib/sensor_matrix.h	(revision 886)
+++ trunk/code/projects/libwireless/lib/sensor_matrix.h	(revision 887)
@@ -64,15 +64,19 @@
 	 **/
 	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];
-	/**
-	 * The element representing a robot is true if that robot
-	 * is in the token ring and false otherwise.
-	 **/
-	unsigned char joined[MAXIMUM_XBEE_ID];
+#endif
 } SensorMatrix;
 
 /**@brief Create a sensor matrix **/
Index: trunk/code/projects/libwireless/lib/xbee.c
===================================================================
--- trunk/code/projects/libwireless/lib/xbee.c	(revision 886)
+++ trunk/code/projects/libwireless/lib/xbee.c	(revision 887)
@@ -83,7 +83,6 @@
 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);
 
@@ -213,8 +212,12 @@
 #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);
@@ -730,7 +733,7 @@
 				buffer_first = 0;
 			// check if buffer is empty
 			if (buffer_first == buffer_last) {
-				return 0;
+				return -1;
 			}
 		} while (arrival_buf[buffer_first++] != XBEE_FRAME_START);
 
@@ -762,7 +765,7 @@
 
 		// check if buffer is empty
 		if (buffer_first == buffer_last) {
-			return 0;
+			return -1;
 		}
 		xbee_buf[currentBufPos++] = arrival_buf[buffer_first++];
 		if (buffer_first == XBEE_BUFFER_SIZE) {
@@ -780,11 +783,11 @@
 
 	//we will take care of the packet
 	if (xbee_handle_packet(xbee_buf + 3, len) != 0) {
-		return 0;
+		return -1;
 	}
 
 	if (dest == NULL) {
-		return 0;
+		return -1;
 	}
 
 	int i;
Index: trunk/code/projects/libwireless/lib/Makefile
===================================================================
--- trunk/code/projects/libwireless/lib/Makefile	(revision 886)
+++ trunk/code/projects/libwireless/lib/Makefile	(revision 887)
@@ -1,7 +1,6 @@
 ############################
 ### Update this Section ####
 ############################
-
 COLONYROOT = ../../../..
 
 # Target file name (without extension).
@@ -9,6 +8,7 @@
 COLONET_TARGET = libwireless_colonet
 
 ############################
+# don't touch this unless you know what you're doing.
 
 CDEFS = 
 
@@ -179,6 +179,12 @@
 	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../../../../code/lib/include/libbayboard \
+			-L../../../../code/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)
Index: trunk/code/projects/libwireless/lib/sensor_matrix.c
===================================================================
--- trunk/code/projects/libwireless/lib/sensor_matrix.c	(revision 886)
+++ trunk/code/projects/libwireless/lib/sensor_matrix.c	(revision 887)
@@ -55,8 +55,10 @@
 	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
 	}
 }
 
@@ -69,6 +71,7 @@
  */
 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.");
@@ -76,6 +79,7 @@
 	}
 
 	m.matrix[observer][robot] = (unsigned char)reading;
+#endif
 }
 
 /**
@@ -88,10 +92,14 @@
  **/
 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
 }
 
 /**
Index: trunk/code/projects/libwireless/lib/wireless.c
===================================================================
--- trunk/code/projects/libwireless/lib/wireless.c	(revision 886)
+++ trunk/code/projects/libwireless/lib/wireless.c	(revision 887)
@@ -40,14 +40,12 @@
 #include "wl_defs.h"
 
 #ifndef ROBOT
-#include <sys/time.h>
-#include <signal.h>
+	#include <sys/time.h>
+	#include <signal.h>
 #else
-#include <time.h>
-#ifndef FIREFLY
-#include <bom.h>
+	#include <time.h>
+	#include <bom.h>
 #endif
-#endif
 
 /*Function Prototypes*/
 
@@ -117,7 +115,12 @@
 #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
 
