Subversion Repositories NaviCtrl

Rev

Rev 308 | Details | Compare with Previous | 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
 
254 killagreg 9
#ifdef DEBUG    // only include functions if DEBUG is defined in main.h
249 ingob 10
 
11
#warning : "### DEBUG-Funktion aktiv ###"
12
 
13
 
14
 
254 killagreg 15
u8 Debug_BufPtr = 0;
16
Debug_t  tDebug;
17
u8 SendDebugOutput = 0;
249 ingob 18
 
19
// function called from _printf_P to output character
20
void Debug_Putchar(char c)
21
{
22
        if (!SendDebugOutput)
23
        {
254 killagreg 24
                tDebug.Text[Debug_BufPtr++] = c;                                                                        // copy character to buffer
25
                if (Debug_BufPtr > 30) Debug_BufPtr = 30;                                                       // avoid buffer overflow
249 ingob 26
        }
27
}
28
 
254 killagreg 29
void DebugSend(u8 cmd)
249 ingob 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