Main Page   Compound List   File List   Compound Members   File Members  

debug.c

Go to the documentation of this file.
00001 
00002 #include <io.h>
00003 #include <stdarg.h>
00004 
00005 #include "debug.h"
00006 #include "lcd.h"
00007 #include "rprintf.h"
00008 #include "timer.h"
00009 #include "osc.h"
00010 
00011 
00012 u08 debugMode = 0;
00013 u08 lcdDebugX;
00014 u08 lcdDebugY;
00015 
00016 void debugInitLCD(u08 x, u08 y) {
00017         lcdInit();
00018         lcdClear();
00019 
00020         lcdDebugX = x;
00021         lcdDebugY = y;
00022 
00023         debugMode |= DEBUG_MODE_LCD;
00024         
00025         debug(PSTR("LCD Debug init()"));
00026 }
00027 
00028 void debugInitOSC(void) {
00029         oscInit();
00030         debugMode |= DEBUG_MODE_OSC;
00031 }
00032 
00033 void debug(const char PROGMEM *fmt) {
00034         int code;
00035 
00036         if (debugMode & DEBUG_MODE_OSC) {
00037                 oscSendMessageString("/debug",fmt);
00038         }
00039         if (debugMode & DEBUG_MODE_LCD) {
00040                 rprintfInit(&lcdDataWrite);
00041                 lcdGotoXY(lcdDebugX,lcdDebugY);
00042                 rprintf1RamRom(STRING_IN_ROM, fmt);
00043         }
00044 
00045 }
00046 
00047 // debugFlush assumes that timerInit() have been called already
00048 void debugFlash(const u08 port, const u08 pin) {
00049         sbi(DDR(port), pin);
00050         cbi(port, pin);
00051         timerPause(500);
00052         sbi(port, pin);
00053 }
00054 
00055 

Generated at Mon Oct 14 00:10:51 2002 for avrlib by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001