Contiki 2.6

putchar.c

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