]> git.llucax.com Git - z.facultad/66.09/etherled.git/blob - pruebas/sdcc/8051_dp8390_echo_server/debug.h
9d70530ca312d5010d7d62daf5698ac3f4f2a904
[z.facultad/66.09/etherled.git] / pruebas / sdcc / 8051_dp8390_echo_server / debug.h
1 // vim: set et sw=4 sts=4 :     
2
3 #ifndef _DEBUG_H_
4 #define _DEBUG_H_
5
6 #ifdef DEBUG
7
8 #include "types.h"
9 #include "leds.h"
10
11 #define sleep(t)                        \
12     do                                  \
13     {                                   \
14         uint16 i;                       \
15         byte j;                         \
16         for (i = 0; i < 0xffff; ++i)    \
17             for (j = 0; j < t; ++j);    \
18     }                                   \
19     while (0)
20
21 #define print(w)   \
22     do              \
23     {               \
24         leds(w);    \
25         sleep(8);   \
26     }               \
27     while (0)
28
29 #define printb(bh, bl)  \
30     do                  \
31     {                   \
32         ledsb(bh, bl);  \
33         sleep(8);       \
34     }                   \
35     while (0)
36
37 #else // NO DEBUG
38
39 #define sleep(t) ;
40 #define print(w) ;
41 #define printb(b1, b2) ;
42
43 #endif // DEBUG
44
45 #endif // _DEBUG_H_