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