Index: serial.c
===================================================================
--- serial.c	(revision 1495)
+++ serial.c	(revision 1496)
@@ -34,13 +34,8 @@
  **/
 
 #include <avr/io.h>
-
-#include "dragonfly_defs.h"
 #include "serial.h"
 
-unsigned char usb_initd=0;
-unsigned char xbee_initd=0;
-
 #ifdef USE_STDIO
 
 #include <stdio.h>
@@ -62,15 +57,10 @@
  * This must be called before any other usb function
  * may be used.
  **/
-int usb_init() {
+void usb_init() {
   //Set baud rate
   // - 115200 (both wired and wireless) is UBRR=8, U2X=1
   // - 9600 is U2X =1, UBRR = 107.
-
-  if(usb_initd) {
-    return ERROR_INIT_ALREADY_INITD;
-  }
-
 #if (USB_BAUD == 115200)
   UBRR0H = 0x00;
   UBRR0L = 8;
@@ -80,7 +70,7 @@
   UBRR0L = 103;
   UCSR0A |= _BV(U2X0);
 #else //Baud rate is defined in the header file, we should not get here
-  return 0;
+  return;
 #endif
 
   /*Enable receiver and transmitter */
@@ -94,10 +84,6 @@
   /* Open the stdio stream corresponding to this port */
   usb_fd = fdevopen(usb_putc, usb_getc);
 #endif
-
-  usb_initd = 1;
-  return 0;
-
 }
 
 /**
@@ -105,12 +91,7 @@
  * This must be called before any other xbee function
  * may be used.
  **/
-int xbee_init() {
-
-  if(xbee_initd) {
-    return ERROR_INIT_ALREADY_INITD;
-  }
-
+void xbee_init() {
   //Set baud rate
   // - 115200 (both wired and wireless) is UBRR=8, U2X=1
   // - 9600 is U2X =1, UBRR = 107.
@@ -123,7 +104,7 @@
   UBRR1L = 103;
   UCSR1A |= _BV(U2X1);
 #else //Baud rate is defined in the header file, we should not get here
-  return 0;
+  return;
 #endif
 
   //Enable receiver and transmitter
@@ -137,10 +118,6 @@
   /* Open the stdio stream corresponding to this port */
   xbee_fd = fdevopen(xbee_putc, xbee_getc);
 #endif
-
-  xbee_initd = 1;
-  return 0;
-
 }
 
 /**
@@ -150,10 +127,6 @@
  * @return 0 for success, nonzero for failure
  **/
 int usb_putc(char c) {
-
-  if(!usb_initd)
-    return ERROR_LIBRARY_NOT_INITD;
-
   // Wait until buffer is clear for sending
   loop_until_bit_is_set(UCSR0A, UDRE0);
 	
@@ -169,10 +142,6 @@
  * @return 0 for success, nonzero for failure
  **/
 int xbee_putc(char c) {
-
-  if(!xbee_initd)
-    return ERROR_LIBRARY_NOT_INITD;
-
   // Wait until buffer is clear for sending
   loop_until_bit_is_set(UCSR1A, UDRE1);
 	
@@ -189,10 +158,6 @@
  **/
 int usb_puts(char *s) {
   char *t = s;
-
-  if(!usb_initd)
-    return ERROR_LIBRARY_NOT_INITD;
-
   while (*t != 0) {
     usb_putc(*t);
     t++;
@@ -204,21 +169,14 @@
  * Sends a sequence of characters from program space over USB.
  *
  * @param s the string to send
- *
- * @return 0 if init succesfull, an error code otherwise
  **/
-int usb_puts_P (PGM_P s) {
+void usb_puts_P (PGM_P s) {
     char buf;
-
-    if(!usb_initd)
-      return ERROR_LIBRARY_NOT_INITD;
 	
     while (memcpy_P (&buf, s, sizeof (char)), buf!=0) {
         usb_putc (buf);
         s++;
     }
-
-    return 0;
 }
 
 
@@ -228,15 +186,11 @@
  * 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, -1 on error
+ * @return the first character in the usb buffer
  *
  * @see usb_init, usb_getc_nb
  **/
 int usb_getc(void) {
-
-  if(!usb_initd)
-    return -1;
-
   // Wait for the receive buffer to be filled
   loop_until_bit_is_set(UCSR0A, RXC0);
 	
@@ -250,15 +204,11 @@
  * received. xbee_init must be called before this function
  * may be used.
  * 
- * @return the first character in the xbee buffer, -1 on error
+ * @return the first character in the xbee buffer
  * 
  * @see xbee_init, xbee_getc_nb
  **/
 int xbee_getc(void) {
-
-  if(!usb_initd)
-    return -1;
-
   // Wait for the receive buffer to be filled
   loop_until_bit_is_set(UCSR1A, RXC1);
 	
@@ -274,15 +224,11 @@
  * @param c the received character. This will be set if a character has
  * been received.
  * 
- * @return -1 if no character is available, 0 otherwise, positive for error
+ * @return -1 if no character is available, 0 otherwise
  * 
  * @see usb_init, usb_getc
  **/
 int usb_getc_nb(char *c) {
-
-  if(!usb_initd)
-    return ERROR_LIBRARY_NOT_INITD;
-
   // check if the receive buffer is filled
   if (UCSR0A & _BV(RXC0)) {
     // Read the receive buffer
@@ -302,14 +248,11 @@
  * @param c the received character. This will be set if a character has
  * been received.
  * 
- * @return -1 if no character is available, 0 otherwise, positive for error
+ * @return -1 if no character is available, 0 otherwise
  *
  * @see xbee_init, xbee_getc
  **/
 int xbee_getc_nb(char *c) {
-  if(!xbee_initd)
-    return ERROR_LIBRARY_NOT_INITD;
-
   // check if the receive buffer is filled
   if (UCSR1A & _BV(RXC1)) {
     // Read the receive buffer
@@ -341,10 +284,6 @@
 int usb_puti(int value ) {
   unsigned char usb_data[6]={'0','0','0','0','0','0' }, position=sizeof(usb_data), radix=10; 
 
-  if(!usb_initd)
-    return ERROR_LIBRARY_NOT_INITD;
-
-
   /* convert int to ascii  */ 
   if(value<0) { 
     usb_putc('-'); 
@@ -390,20 +329,13 @@
  * @param value the value to print
  * 
  * @see usb_init, usb_puti, usb_puts, usb_puth8, hex_digit
- *
- * @return 0 if init succesfull, an error code otherwise
  **/
-int usb_puth16 (uint16_t value)
+void usb_puth16 (uint16_t value)
 {
-    if(!usb_initd)
-      return ERROR_LIBRARY_NOT_INITD;
-
     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));
-
-    return 0;
 }
 
 /**
@@ -414,17 +346,10 @@
  * @param value the value to print
  * 
  * @see usb_init, usb_puti, usb_puts, usb_puth16, hex_digit
- *
- * @return 0 if init succesfull, an error code otherwise
  **/
-int usb_puth8(uint8_t value)
+void usb_puth8(uint8_t value)
 {
-    if(!usb_initd)
-      return ERROR_LIBRARY_NOT_INITD;
-
     usb_putc (hex_digit ((value)>>4 &0xF));
     usb_putc (hex_digit ( value     &0xF));
-
-    return 0;
 }
 
