root / analog_exp / debug.c @ 168:bfc84ee2839b
History | View | Annotate | Download (473 Bytes)
1 | #include <stdio.h> |
---|---|
2 | |
3 | #include "uart.h" |
4 | #include "debug.h" |
5 | |
6 | #ifdef DEBUG
|
7 | static FILE uart_stream = FDEV_SETUP_STREAM(
|
8 | uart_putchar_f, |
9 | uart_getchar_f, |
10 | _FDEV_SETUP_RW |
11 | ); |
12 | #endif
|
13 | |
14 | void debug_setup(void) { |
15 | #ifdef DEBUG
|
16 | stdout = &uart_stream; |
17 | stderr = &uart_stream; |
18 | uart_setup(); |
19 | #endif
|
20 | } |
21 | |
22 | #ifdef DEBUG
|
23 | void debug_printf(const char *fmt, ...) { |
24 | va_list args; |
25 | va_start(args, fmt); |
26 | vfprintf_P(&uart_stream, fmt, args); |
27 | va_end(args); |
28 | } |
29 | #endif
|
30 |