cc253x: add putdec debug function

This commit is contained in:
Philippe Rétornaz 2012-08-24 09:43:43 +02:00 committed by George Oikonomou
parent 48d99f15c8
commit 780e62d7e8
2 changed files with 16 additions and 0 deletions

View file

@ -40,3 +40,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);
}
}
}

View file

@ -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__ */