aboutsummaryrefslogtreecommitdiffstats
path: root/print.c
diff options
context:
space:
mode:
authorGravatar tmk <nobody@nowhere>2010-10-24 03:27:43 +0900
committerGravatar tmk <nobody@nowhere>2010-10-24 03:33:08 +0900
commit4acc38751e9c8e90921773e6e5f5a100b0729d98 (patch)
treee8e650c6c0557871f55c39b6449a0cc2479fbf58 /print.c
parentbf92bdd7fa9938c162c29e565d245e5609e4a912 (diff)
downloadqmk_firmware-4acc38751e9c8e90921773e6e5f5a100b0729d98.tar.gz
switch debug on/off by pressing 4 keys on booting time
Diffstat (limited to 'print.c')
-rw-r--r--print.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/print.c b/print.c
index 5395fa348..59b4bca18 100644
--- a/print.c
+++ b/print.c
@@ -27,8 +27,12 @@
#include <avr/pgmspace.h>
#include "print.h"
+
+bool print_enable = false;
+
void print_P(const char *s)
{
+ if (!print_enable) return;
char c;
while (1) {
@@ -41,17 +45,20 @@ void print_P(const char *s)
void phex1(unsigned char c)
{
+ if (!print_enable) return;
usb_debug_putchar(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);
}
@@ -59,6 +66,7 @@ void phex16(unsigned int i)
void pbin(unsigned char c)
{
+ if (!print_enable) return;
for (int i = 7; i >= 0; i--) {
usb_debug_putchar((c & (1<<i)) ? '1' : '0');
}
@@ -66,6 +74,7 @@ void pbin(unsigned char c)
void pbin_reverse(unsigned char c)
{
+ if (!print_enable) return;
for (int i = 0; i < 8; i++) {
usb_debug_putchar((c & (1<<i)) ? '1' : '0');
}