Enable radio stats in sensor cgi as default
[contiki-2.x.git] / cpu / avr / dev / debug.c
blob9e4fec4e76450ce2ad3e33ca8e52ca9bba347616
2 #include "compiler.h"
3 #include "delay.h"
5 #include <avr/pgmspace.h>
7 /*-----------------------------------------------------------------------------------*/
8 static void
9 delay(void)
11 unsigned char i;
12 for(i = 0; i < 1; ++i) {
13 Delay_10ms(1);
16 /*-----------------------------------------------------------------------------------*/
17 static char buffer[40];
18 static prog_char hextab[] =
19 {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
20 /*-----------------------------------------------------------------------------------*/
21 static void
22 print_buffer(unsigned char len)
24 unsigned char i;
26 for(i = 0; i < len; ++i) {
27 delay();
28 UDR0 = buffer[i];
31 /*-----------------------------------------------------------------------------------*/
32 void
33 debug_print8(unsigned char v)
35 /* buffer[0] = v / 100 + '0';
36 buffer[1] = (v / 10) % 10 + '0';
37 buffer[2] = v % 10 + '0';
38 buffer[3] = ' ';
39 buffer[4] = PRG_RDB(hextab + (v >> 4));
40 buffer[5] = PRG_RDB(hextab + (v & 0x0f));
41 buffer[6] = '\n';
42 print_buffer(7);*/
44 /*-----------------------------------------------------------------------------------*/
45 void
46 debug_print16(unsigned short v)
48 /* buffer[0] = v / 10000 + '0';
49 buffer[1] = (v / 1000) % 10 + '0';
50 buffer[2] = (v / 100) % 10 + '0';
51 buffer[3] = (v / 10) % 10 + '0';
52 buffer[4] = v % 10 + '0';
53 buffer[5] = ' ';
54 buffer[6] = PRG_RDB(hextab + ((v & 0xf000) >> 12));
55 buffer[7] = PRG_RDB(hextab + ((v & 0x0f00) >> 8));
56 buffer[8] = PRG_RDB(hextab + ((v & 0xf0) >> 4));
57 buffer[9] = PRG_RDB(hextab + (v & 0x0f));
58 buffer[10] = '\n';
59 print_buffer(11);*/
61 /*-----------------------------------------------------------------------------------*/
62 void
63 debug_print(prog_char *str)
65 /* unsigned char i;
67 for(i = 0; PRG_RDB(str + i) != 0; ++i) {
68 buffer[i] = PRG_RDB(str + i);
70 print_buffer(i);*/
72 /*-----------------------------------------------------------------------------------*/