Contiki 2.6

debug.c

Go to the documentation of this file.
00001 /**
00002  * \file
00003  *
00004  *   Definition of some debugging functions for the sensinode port.
00005  *
00006  *   This file is bankable.
00007  *
00008  *   putstring() and puthex() are from msp430/watchdog.c
00009  *
00010  * \author
00011  *         George Oikonomou - <oikonomou@users.sourceforge.net>
00012  */
00013 
00014 #include "cc2430_sfr.h"
00015 #include "8051def.h"
00016 #include "debug.h"
00017 
00018 static const char hexconv[] = "0123456789abcdef";
00019 static const char binconv[] = "01";
00020 
00021 /*---------------------------------------------------------------------------*/
00022 void
00023 putstring(char *s)
00024 {
00025   while(*s) {
00026     putchar(*s++);
00027   }
00028 }
00029 /*---------------------------------------------------------------------------*/
00030 void
00031 puthex(uint8_t c)
00032 {
00033   putchar(hexconv[c >> 4]);
00034   putchar(hexconv[c & 0x0f]);
00035 }
00036 /*---------------------------------------------------------------------------*/
00037 void
00038 putbin(uint8_t c)
00039 {
00040   unsigned char i = 0x80;
00041   while(i) {
00042     putchar(binconv[(c & i) != 0]);
00043     i >>= 1;
00044   }
00045 }
00046 /*---------------------------------------------------------------------------*/