Contiki 2.5
dbg-printf.c
1 #include <stdio.h>
2 #include <debug-uart.h>
3 #include <string.h>
4 #include <strformat.h>
5 
6 static StrFormatResult
7 write_str(void *user_data, const char *data, unsigned int len)
8 {
9  if (len > 0) dbg_send_bytes((unsigned char*)data, len);
10  return STRFORMAT_OK;
11 }
12 
13 
14 static StrFormatContext ctxt =
15  {
16  write_str,
17  NULL
18  };
19 int
20 printf(const char *fmt, ...)
21 {
22  int res;
23  va_list ap;
24  va_start(ap, fmt);
25  res = format_str_v(&ctxt, fmt, ap);
26  va_end(ap);
27  return res;
28 }
29 
30