Contiki-NG
arch
cpu
msp430
dev
uart0-putchar.c
1
/*---------------------------------------------------------------------------*/
2
#include "contiki.h"
3
#include "dev/uart0.h"
4
5
#include <string.h>
6
/*---------------------------------------------------------------------------*/
7
#define SLIP_END 0300
8
#undef putchar
9
/*---------------------------------------------------------------------------*/
10
int
11
putchar(
int
c)
12
{
13
#if SLIP_ARCH_CONF_ENABLED
14
static
char
debug_frame = 0;
15
16
if
(!debug_frame) {
/* Start of debug output */
17
uart0_writeb(SLIP_END);
18
uart0_writeb(
'\r'
);
/* Type debug line == '\r' */
19
debug_frame = 1;
20
}
21
#endif
/* SLIP_ARCH_CONF_ENABLED */
22
23
/* Need to also print '\n' because for example COOJA will not show
24
any output before line end */
25
uart0_writeb((
char
)c);
26
27
#if SLIP_ARCH_CONF_ENABLED
28
/*
29
* Line buffered output, a newline marks the end of debug output and
30
* implicitly flushes debug output.
31
*/
32
if
(c ==
'\n'
) {
33
uart0_writeb(SLIP_END);
34
debug_frame = 0;
35
}
36
#endif
/* SLIP_ARCH_CONF_ENABLED */
37
return
c;
38
}
39
/*---------------------------------------------------------------------------*/
Generated on Sat May 30 2020 17:03:55 for Contiki-NG by
1.8.13