dbg-printf.c

00001 #include <stdio.h>
00002 #include <debug-uart.h>
00003 #include <string.h>
00004 #include <strformat.h>
00005 
00006 static StrFormatResult
00007 write_str(void *user_data, const char *data, unsigned int len)
00008 {
00009   if (len > 0) dbg_send_bytes((unsigned char*)data, len);
00010   return STRFORMAT_OK;
00011 }
00012 
00013 
00014 static StrFormatContext ctxt =
00015   {
00016     write_str,
00017     NULL
00018   };
00019 int
00020 printf(const char *fmt, ...)
00021 {
00022   int res;
00023   va_list ap;
00024   va_start(ap, fmt);
00025   res = format_str_v(&ctxt, fmt, ap);
00026   va_end(ap);
00027   return res;
00028 }
00029 
00030 

Generated on Mon Apr 11 14:23:35 2011 for Contiki 2.5 by  doxygen 1.6.1