Contiki 2.5
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
cpu
avr
dev
debug.c
1
2
#include "
compiler.h
"
3
#include "delay.h"
4
5
#include <avr/pgmspace.h>
6
7
/*-----------------------------------------------------------------------------------*/
8
static
void
9
delay(
void
)
10
{
11
unsigned
char
i;
12
for
(i = 0; i < 1; ++i) {
13
Delay_10ms(1);
14
}
15
}
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)
23
{
24
unsigned
char
i;
25
26
for
(i = 0; i < len; ++i) {
27
delay();
28
UDR0 = buffer[i];
29
}
30
}
31
/*-----------------------------------------------------------------------------------*/
32
void
33
debug_print8(
unsigned
char
v)
34
{
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);*/
43
}
44
/*-----------------------------------------------------------------------------------*/
45
void
46
debug_print16(
unsigned
short
v)
47
{
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);*/
60
}
61
/*-----------------------------------------------------------------------------------*/
62
void
63
debug_print(prog_char *str)
64
{
65
/* unsigned char i;
66
67
for(i = 0; PRG_RDB(str + i) != 0; ++i) {
68
buffer[i] = PRG_RDB(str + i);
69
}
70
print_buffer(i);*/
71
}
72
/*-----------------------------------------------------------------------------------*/
Generated on Fri Aug 30 2013 12:34:08 for Contiki 2.5 by
1.8.3.1