Rev 1738 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1637 | ingob | 1 | #include "main.h" |
2 | #include "debug.h" |
||
3 | |||
4 | #ifdef DEBUG // only include functions if DEBUG is defined in main.h |
||
5 | |||
6 | #warning : "### DEBUG-Funktion aktiv ###" |
||
7 | |||
8 | |||
9 | |||
10 | unsigned char Debug_BufPtr = 0; |
||
11 | struct str_Debug tDebug; |
||
12 | unsigned char SendDebugOutput = 0; |
||
13 | |||
14 | // function called from _printf_P to output character |
||
15 | void Debug_Putchar(char c) |
||
16 | { |
||
17 | if (!SendDebugOutput) |
||
18 | { |
||
19 | tDebug.Text[Debug_BufPtr++] = c; // copy character to buffer |
||
20 | if (Debug_BufPtr > 30) Debug_BufPtr = 30; // avoid buffer overflow |
||
21 | } |
||
22 | } |
||
23 | |||
24 | void DebugSend(unsigned char cmd) |
||
25 | { |
||
26 | if (!SendDebugOutput) |
||
27 | { |
||
28 | tDebug.Cmd = cmd; |
||
29 | tDebug.Text[Debug_BufPtr] = '\0'; // end of text marker |
||
30 | Debug_BufPtr = 0; // set bufferindex to 0 |
||
31 | SendDebugOutput = 1; // set flag to trasmit data the next time in serial transmit function |
||
32 | } |
||
33 | } |
||
34 | #endif |
||
35 | |||
36 | /* |
||
37 | add the following code block to the serial transmit function |
||
38 | |||
39 | #ifdef DEBUG // only include functions if DEBUG is defined |
||
40 | if(SendDebugOutput && UebertragungAbgeschlossen) |
||
41 | { |
||
42 | SendOutData('0', FC_ADDRESS, 1, (unsigned char *) &tDebug, sizeof(tDebug)); |
||
43 | SendDebugOutput = 0; |
||
44 | } |
||
45 | #endif |
||
46 | |||
47 | */ |
||
48 |