From 9a106537f64fe61af6048b41262f002ce6a716d9 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 19 Mar 2013 14:08:40 +0900 Subject: Add NO_PRINT and NO_DEBUG config options. - NO_PRINT: disable print.h API(also disable debug.h) - NO_DEBUG: disable debug.h API --- common/print.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'common/print.c') diff --git a/common/print.c b/common/print.c index 08d211f206..329f835125 100644 --- a/common/print.c +++ b/common/print.c @@ -27,12 +27,17 @@ #include "print.h" -#define sendchar(c) do { if (print_enable && print_sendchar_func) (print_sendchar_func)(c); } while (0) +#ifndef NO_PRINT +#define sendchar(c) do { if (print_sendchar_func) (print_sendchar_func)(c); } while (0) -int8_t (*print_sendchar_func)(uint8_t) = 0; -bool print_enable = true; +static int8_t (*print_sendchar_func)(uint8_t) = 0; + +void print_set_sendchar(int8_t (*sendchar_func)(uint8_t)) +{ + print_sendchar_func = sendchar_func; +} /* print string stored in data memory(SRAM) * print_P("hello world"); @@ -184,3 +189,5 @@ void print_bin_reverse32(uint32_t data) print_bin_reverse8(data>>16); print_bin_reverse8(data>>24); } + +#endif -- cgit v1.2.3