From b292e0201280efa1c3b8ec67c23a7a64d2f3595c Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 7 Sep 2012 14:59:34 +0100 Subject: [PATCH] Sensinode putdec() debugging --- platform/sensinode/debug.c | 15 +++++++++++++++ platform/sensinode/debug.h | 1 + 2 files changed, 16 insertions(+) diff --git a/platform/sensinode/debug.c b/platform/sensinode/debug.c index b1e3a2710..390c2ff06 100644 --- a/platform/sensinode/debug.c +++ b/platform/sensinode/debug.c @@ -44,3 +44,18 @@ putbin(uint8_t c) } } /*---------------------------------------------------------------------------*/ +void +putdec(uint8_t c) +{ + uint8_t div; + uint8_t hassent = 0; + for(div = 100; div > 0; div /= 10) { + uint8_t disp = c / div; + c %= div; + if((disp != 0) || (hassent) || (div == 1)) { + hassent = 1; + putchar('0'+disp); + } + } +} +/*---------------------------------------------------------------------------*/ diff --git a/platform/sensinode/debug.h b/platform/sensinode/debug.h index 4c5dc135b..94eaa4f51 100644 --- a/platform/sensinode/debug.h +++ b/platform/sensinode/debug.h @@ -50,5 +50,6 @@ void putchar(char c); void putstring(char *s); void puthex(uint8_t c); void putbin(uint8_t c); +void putdec(uint8_t c); #endif /* DEBUG_H_ */