Index: trunk/code/lib/include/libdragonfly/math.h
===================================================================
--- trunk/code/lib/include/libdragonfly/math.h	(nonexistent)
+++ trunk/code/lib/include/libdragonfly/math.h	(revision 88)
@@ -0,0 +1,22 @@
+/**
+ * 
+ * @file math.h
+ * @brief Contains math function(s)
+ * 
+ * @author Colony Project, CMU Robotics Club, James Kong
+*/
+
+#ifndef _MATH_H_
+#define _MATH_H_
+
+/**
+ * @addtogroup math
+ * @{
+ **/
+ 
+/** @brief absolute value **/
+int abs_int(int x);
+
+/**@}**/ //end group
+
+#endif
Index: trunk/code/lib/include/libdragonfly/reset.h
===================================================================
--- trunk/code/lib/include/libdragonfly/reset.h	(nonexistent)
+++ trunk/code/lib/include/libdragonfly/reset.h	(revision 88)
@@ -0,0 +1,23 @@
+/**
+ * 
+ * @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: trunk/code/lib/include/libdragonfly/ring_buffer.h
===================================================================
--- trunk/code/lib/include/libdragonfly/ring_buffer.h	(nonexistent)
+++ trunk/code/lib/include/libdragonfly/ring_buffer.h	(revision 88)
@@ -0,0 +1,115 @@
+/** @file 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)
+ *
+ *	@bugs Could not create buffer of non byte-sized elements due to modding with sizeof(queue).  
+ * 		  Fixed 3/2/07, Felix Duvallet and Brad Neuman
+ */
+
+#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: trunk/code/lib/src/libdragonfly/reset.c
===================================================================
--- trunk/code/lib/src/libdragonfly/reset.c	(nonexistent)
+++ trunk/code/lib/src/libdragonfly/reset.c	(revision 88)
@@ -0,0 +1,35 @@
+/*
+reset.h - contains reset() function that resets the AVR
+author: James Kong
+
+Last Modified:
+
+3.7.2007 - James
+    created reset.c
+*/
+
+#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: trunk/code/lib/src/libdragonfly/math.c
===================================================================
--- trunk/code/lib/src/libdragonfly/math.c	(nonexistent)
+++ trunk/code/lib/src/libdragonfly/math.c	(revision 88)
@@ -0,0 +1,25 @@
+#include "math.h"
+
+/**
+ * @defgroup math Math
+ * Function(s) for performing math operations
+ *
+ * @{
+ **/
+
+/**
+ * finds the absolute value of x
+ * 
+ * @param x the int of which we want to take its absolute value
+ * 
+ * @return the absolute value of x
+ **/
+int abs_int (int x) {
+
+  if(x < 0)
+    return -x;
+    
+  return x;
+}
+
+/**@}**/ //end defgroup
