| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 6 | kaklik | |
| 2 | #include <avr/io.h> |
||
| 3 | #include <stdarg.h> |
||
| 4 | |||
| 5 | #include "debug.h" |
||
| 6 | #include "lcd.h" |
||
| 7 | #include "rprintf.h" |
||
| 8 | #include "timer.h" |
||
| 9 | #include "osc.h" |
||
| 10 | |||
| 11 | |||
| 12 | u08 debugMode = 0; |
||
| 13 | u08 lcdDebugX; |
||
| 14 | u08 lcdDebugY; |
||
| 15 | |||
| 16 | void debugInitLCD(u08 x, u08 y) { |
||
| 17 | lcdInit(); |
||
| 18 | lcdClear(); |
||
| 19 | |||
| 20 | lcdDebugX = x; |
||
| 21 | lcdDebugY = y; |
||
| 22 | |||
| 23 | debugMode |= DEBUG_MODE_LCD; |
||
| 24 | |||
| 25 | debug(PSTR("LCD Debug init()")); |
||
| 26 | } |
||
| 27 | |||
| 28 | void debugInitOSC(void) { |
||
| 29 | oscInit(); |
||
| 30 | debugMode |= DEBUG_MODE_OSC; |
||
| 31 | } |
||
| 32 | |||
| 33 | void debug(const char PROGMEM *fmt) { |
||
| 34 | int code; |
||
| 35 | |||
| 36 | if (debugMode & DEBUG_MODE_OSC) { |
||
| 37 | oscSendMessageString("/debug",fmt); |
||
| 38 | } |
||
| 39 | if (debugMode & DEBUG_MODE_LCD) { |
||
| 40 | rprintfInit(&lcdDataWrite); |
||
| 41 | lcdGotoXY(lcdDebugX,lcdDebugY); |
||
| 42 | rprintf1RamRom(STRING_IN_ROM, fmt); |
||
| 43 | } |
||
| 44 | |||
| 45 | } |
||
| 46 | |||
| 47 | // debugFlush assumes that timerInit() have been called already |
||
| 48 | void debugFlash(const u08 port, const u08 pin) { |
||
| 49 | sbi(DDR(port), pin); |
||
| 50 | cbi(port, pin); |
||
| 51 | timerPause(500); |
||
| 52 | sbi(port, pin); |
||
| 53 | } |
||
| 54 | |||
| 55 |
Powered by WebSVN v2.8.3