Contiki 2.6

putchar.c

Go to the documentation of this file.
00001 /**
00002  * \file
00003  *         hardware-specific putchar() routine for sensinode motes
00004  *
00005  * \author
00006  *         George Oikonomou - <oikonomou@users.sourceforge.net>
00007  */
00008 
00009 #include "contiki-conf.h"
00010 #include "dev/uart1.h"
00011 
00012 /*---------------------------------------------------------------------------*/
00013 void
00014 putchar(char c)
00015 {
00016 #if SLIP_ARCH_CONF_ENABLE
00017 #define SLIP_END     0300
00018   static char debug_frame = 0;
00019 
00020   if(!debug_frame) {            /* Start of debug output */
00021     uart1_writeb(SLIP_END);
00022     uart1_writeb('\r');     /* Type debug line == '\r' */
00023     debug_frame = 1;
00024   }
00025 #endif
00026 
00027   uart1_writeb((char)c);
00028 
00029 #if SLIP_ARCH_CONF_ENABLE
00030   /*
00031    * Line buffered output, a newline marks the end of debug output and
00032    * implicitly flushes debug output.
00033    */
00034   if(c == '\n') {
00035     uart1_writeb(SLIP_END);
00036     debug_frame = 0;
00037   }
00038 #endif
00039 }