Contiki 3.x
putchar.c
Go to the documentation of this file.
1 /**
2  * \file
3  * hardware-specific putchar() routine for sensinode motes
4  *
5  * \author
6  * George Oikonomou - <oikonomou@users.sourceforge.net>
7  */
8 
9 #include "contiki-conf.h"
10 #include "dev/uart1.h"
11 
12 /*---------------------------------------------------------------------------*/
13 void
14 putchar(char c)
15 {
16 #if SLIP_ARCH_CONF_ENABLE
17 #define SLIP_END 0300
18  static char debug_frame = 0;
19 
20  if(!debug_frame) { /* Start of debug output */
21  uart1_writeb(SLIP_END);
22  uart1_writeb('\r'); /* Type debug line == '\r' */
23  debug_frame = 1;
24  }
25 #endif
26 
27  uart1_writeb((char)c);
28 
29 #if SLIP_ARCH_CONF_ENABLE
30  /*
31  * Line buffered output, a newline marks the end of debug output and
32  * implicitly flushes debug output.
33  */
34  if(c == '\n') {
35  uart1_writeb(SLIP_END);
36  debug_frame = 0;
37  }
38 #endif
39 }