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