Sensinode putdec() debugging

This commit is contained in:
George Oikonomou 2012-09-07 14:59:34 +01:00
parent 95b9d4ee29
commit b292e02012
2 changed files with 16 additions and 0 deletions

View file

@ -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);
}
}
}
/*---------------------------------------------------------------------------*/

View file

@ -50,5 +50,6 @@ void putchar(char c);
void putstring(char *s); void putstring(char *s);
void puthex(uint8_t c); void puthex(uint8_t c);
void putbin(uint8_t c); void putbin(uint8_t c);
void putdec(uint8_t c);
#endif /* DEBUG_H_ */ #endif /* DEBUG_H_ */