Index: trunk/cardbox/uart.h
===================================================================
--- trunk/cardbox/uart.h	(revision 205)
+++ trunk/cardbox/uart.h	(nonexistent)
@@ -1,61 +0,0 @@
-/********
- * This file is part of Tooltron.
- *
- * Tooltron is free software: you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Tooltron is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * Lesser GNU General Public License for more details.
- * You should have received a copy of the Lesser GNU General Public License
- * along with Tooltron.  If not, see <http://www.gnu.org/licenses/>.
- *
- * Copyright 2009 Kevin Woo <kwoo@2ndt.com>
- *
- ********/
-/** @file uart.h
- *
- *	@brief Initializes UART functions using the UART hardware module
- *
- *	@author Kevin Woo (kwoo)
- */
-
-#ifndef UART_H
-#define UART_H
-
-#include <avr/io.h>
-#include <avr/interrupt.h>
-#include <stdint.h>
-/** **/
-#define UART_TX_OFF 0
-#define UART_TX_ON 1
-
-/** @brief RX Pin for the UART **/
-#define RX		_BV(PORTD0)
-#define TX		_BV(PORTD1)
-#define TX_EN	_BV(PORTD5)
-
-/** @brief The most recently received byte **/
-extern uint8_t received_byte;
-/** @brief If the value in received_byte has been read or not **/
-extern uint8_t byte_ready;
-
-/** @brief Initializes the UART registers and sets it to the buad rate 
- *         which msut be the value that is defined in the datasheet 
- *         for any particular speed (ie: 51 -> 9600bps)
- **/
-void init_uart(uint16_t baud);
-/** @brief Gets latest byte and returns it in output_byte. If the byte 
- *         was already read, returns -1 otherwise it returns 0 
- **/
-int8_t uart_get_byte(uint8_t *output_byte);
-/** @brief Sends a character array of size size. If we are currently 
- *         transmitting it will block until the the current transmit 
- *         is done. 
- **/
-void uart_send_byte(uint8_t data);
-void uart_toggle_transmit(uint8_t state);
-#endif
Index: trunk/cardbox/uart.c
===================================================================
--- trunk/cardbox/uart.c	(revision 205)
+++ trunk/cardbox/uart.c	(nonexistent)
@@ -1,85 +0,0 @@
-/********
- * This file is part of Tooltron.
- *
- * Tooltron is free software: you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Tooltron is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * Lesser GNU General Public License for more details.
- * You should have received a copy of the Lesser GNU General Public License
- * along with Tooltron.  If not, see <http://www.gnu.org/licenses/>.
- *
- * Copyright 2009 Kevin Woo <kwoo@2ndt.com>
- *
- ********/
-/** @file uart.c
- *	
- *	@brief Implements UART functionality in hardware
- *
- *	@author Kevin Woo (kwoo)
- */
-
-#include "uart.h"
-#include <util/delay.h>
-#include <stdint.h>
-
-uint8_t received_byte;     //Byte received
-uint8_t byte_ready;        //New byte has been received
-
-void init_uart(uint16_t baud) {
-	// Set baud rate
-	UBRRH = (uint8_t)(baud>>8);
-	UBRRL = (uint8_t)baud;
-	
-	// Enable RX/TX and RX/TX Interrupt
-	UCSRB = _BV(RXCIE) | _BV(RXEN) | _BV(TXCIE) | _BV(TXEN);
- 
-	// Enable the TXEN pin as output
-	DDRD |= TX_EN;
-
-    // Initialize receive variables
-    byte_ready = 0;
-    received_byte = 0x0;
-}
-
-int8_t uart_get_byte(uint8_t *output_byte) {
-	if (byte_ready) {
-		byte_ready = 0;
-		*output_byte = received_byte;
-		return 0;
-	} else {
-		return -1;
-	}
-}
-
-void uart_send_byte(uint8_t data) {
-	//Waits until current transmit is done
-    while (!(UCSRA & _BV(UDRE)));
-
-    // Enable writes and send
-	uart_toggle_transmit(UART_TX_ON);
-    UDR = data;
-	return;
-}
-
-void uart_toggle_transmit(uint8_t state) {
-	if (state == UART_TX_ON) {
-		PORTD |= TX_EN;
-	} else {
-		PORTD &= ~TX_EN;
-	}
-}
-
-ISR(USART_RX_vect) {
-    received_byte = UDR;
-    byte_ready = 1;    
-}
-
-ISR(USART_TX_vect) {
-    // Re-enable reads
-    uart_toggle_transmit(UART_TX_OFF);
-}
Index: trunk/cardbox/rs485_int.c
===================================================================
--- trunk/cardbox/rs485_int.c	(nonexistent)
+++ trunk/cardbox/rs485_int.c	(revision 206)
@@ -0,0 +1,85 @@
+/********
+ * This file is part of Tooltron.
+ *
+ * Tooltron is free software: you can redistribute it and/or modify
+ * it under the terms of the Lesser GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Tooltron is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * Lesser GNU General Public License for more details.
+ * You should have received a copy of the Lesser GNU General Public License
+ * along with Tooltron.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2009 Kevin Woo <kwoo@2ndt.com>
+ *
+ ********/
+/** @file uart.c
+ *	
+ *	@brief Implements UART functionality in hardware
+ *
+ *	@author Kevin Woo (kwoo)
+ */
+
+#include "uart.h"
+#include <util/delay.h>
+#include <stdint.h>
+
+uint8_t received_byte;     //Byte received
+uint8_t byte_ready;        //New byte has been received
+
+void init_uart(uint16_t baud) {
+	// Set baud rate
+	UBRRH = (uint8_t)(baud>>8);
+	UBRRL = (uint8_t)baud;
+	
+	// Enable RX/TX and RX/TX Interrupt
+	UCSRB = _BV(RXCIE) | _BV(RXEN) | _BV(TXCIE) | _BV(TXEN);
+ 
+	// Enable the TXEN pin as output
+	DDRD |= TX_EN;
+
+    // Initialize receive variables
+    byte_ready = 0;
+    received_byte = 0x0;
+}
+
+int8_t uart_get_byte(uint8_t *output_byte) {
+	if (byte_ready) {
+		byte_ready = 0;
+		*output_byte = received_byte;
+		return 0;
+	} else {
+		return -1;
+	}
+}
+
+void uart_send_byte(uint8_t data) {
+	//Waits until current transmit is done
+    while (!(UCSRA & _BV(UDRE)));
+
+    // Enable writes and send
+	uart_toggle_transmit(UART_TX_ON);
+    UDR = data;
+	return;
+}
+
+void uart_toggle_transmit(uint8_t state) {
+	if (state == UART_TX_ON) {
+		PORTD |= TX_EN;
+	} else {
+		PORTD &= ~TX_EN;
+	}
+}
+
+ISR(USART_RX_vect) {
+    received_byte = UDR;
+    byte_ready = 1;    
+}
+
+ISR(USART_TX_vect) {
+    // Re-enable reads
+    uart_toggle_transmit(UART_TX_OFF);
+}
Index: trunk/cardbox/main.c
===================================================================
--- trunk/cardbox/main.c	(revision 205)
+++ trunk/cardbox/main.c	(revision 206)
@@ -17,7 +17,7 @@
  *
  ********/
 #include <util/delay.h>
-#include "serial.h"
+#include "uart.h"
 #include <avr/interrupt.h>
 #include <avr/io.h>
 
Index: trunk/cardbox/rs485_int.h
===================================================================
--- trunk/cardbox/rs485_int.h	(nonexistent)
+++ trunk/cardbox/rs485_int.h	(revision 206)
@@ -0,0 +1,67 @@
+/********
+ * This file is part of Tooltron.
+ *
+ * Tooltron is free software: you can redistribute it and/or modify
+ * it under the terms of the Lesser GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Tooltron is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * Lesser GNU General Public License for more details.
+ * You should have received a copy of the Lesser GNU General Public License
+ * along with Tooltron.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2009 Kevin Woo <kwoo@2ndt.com>
+ *
+ ********/
+/** @file uart.h
+ *
+ *	@brief Initializes UART functions using the UART hardware module
+ *
+ *	@author Kevin Woo (kwoo)
+ */
+
+#ifndef UART_H
+#define UART_H
+
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <stdint.h>
+/** **/
+#define UART_TX_OFF 0
+#define UART_TX_ON 1
+
+/** @brief RX Pin for the UART **/
+#define RX		_BV(PORTD0)
+#define TX		_BV(PORTD1)
+#define TX_EN	_BV(PORTD5)
+
+/**
+ * @brief This si the value to pass into UBRR tos et the baudrate.
+ * @note this assumes an 8MHz system clock
+ */
+#define BAUD9600    51
+
+/** @brief The most recently received byte **/
+extern uint8_t received_byte;
+/** @brief If the value in received_byte has been read or not **/
+extern uint8_t byte_ready;
+
+/** @brief Initializes the UART registers and sets it to the buad rate 
+ *         which msut be the value that is defined in the datasheet 
+ *         for any particular speed (ie: 51 -> 9600bps)
+ **/
+void init_uart(uint16_t baud);
+/** @brief Gets latest byte and returns it in output_byte. If the byte 
+ *         was already read, returns -1 otherwise it returns 0 
+ **/
+int8_t uart_get_byte(uint8_t *output_byte);
+/** @brief Sends a character array of size size. If we are currently 
+ *         transmitting it will block until the the current transmit 
+ *         is done. 
+ **/
+void uart_send_byte(uint8_t data);
+void uart_toggle_transmit(uint8_t state);
+#endif
