X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=print.c;h=d9152971b99c8818ebf1bf5a7dea2c8a273554f5;hb=6d45e05ede8ea1a96df9a04d58a7d7ede51afd9b;hp=2f0617c64f49d391c212577703bc8e7ba11d0262;hpb=8cfb3712d58e4a88029dfd00111714e91939005e;p=max%2Ftmk_keyboard.git diff --git a/print.c b/print.c index 2f0617c6..d9152971 100644 --- a/print.c +++ b/print.c @@ -21,38 +21,43 @@ * THE SOFTWARE. */ -// Version 1.0: Initial Release - #include #include - #include "print.h" +#include "sendchar.h" + + +bool print_enable = false; void print_P(const char *s) { + if (!print_enable) return; char c; while (1) { c = pgm_read_byte(s++); if (!c) break; - if (c == '\n') usb_debug_putchar('\r'); - usb_debug_putchar(c); + if (c == '\n') sendchar('\r'); + sendchar(c); } } void phex1(unsigned char c) { - usb_debug_putchar(c + ((c < 10) ? '0' : 'A' - 10)); + if (!print_enable) return; + sendchar(c + ((c < 10) ? '0' : 'A' - 10)); } void phex(unsigned char c) { + if (!print_enable) return; phex1(c >> 4); phex1(c & 15); } void phex16(unsigned int i) { + if (!print_enable) return; phex(i >> 8); phex(i); } @@ -60,7 +65,16 @@ void phex16(unsigned int i) void pbin(unsigned char c) { - for (int i=7; i>=0; i--) { - usb_debug_putchar((c & (1<= 0; i--) { + sendchar((c & (1<