BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
6360daf
Branches
Tags
master
mips_sys
fw
debug.c
added debug output functions
Stefan Schuermans
commited
6360daf
at 2012-04-05 21:31:40
debug.c
Blame
History
Raw
#include "debug.h" #include "format.h" #include "macros.h" #include "uart.h" /** * @brief print a character to debug output * @param[in] chr character to print */ void debug_chr(char chr) { uart_tx((unsigned char)chr); } /** * @brief print a string to debug output * @param[in] str string to print */ void debug_str(const char *str) { while (*str) debug_chr(*str++); } /** * @brief print an unsigned integer in decimal to debug output * @param[in] uint unsigned integer value * @param[in] cnt number of digits */ void debug_uint_dec(unsigned int uint, unsigned int cnt) { char buf[11]; if (cnt > count(buf) - 1) cnt = count(buf) - 1; format_uint2dec(uint, cnt, buf); buf[cnt] = 0; debug_str(buf); } /** * @brief print an unsigned integer in hexdecimal to debug output * @param[in] uint unsigned integer value * @param[in] cnt number of digits */ void debug_uint_hex(unsigned int uint, unsigned int cnt) { char buf[9]; if (cnt > count(buf) - 1) cnt = count(buf) - 1; format_uint2hex(uint, cnt, buf); buf[cnt] = 0; debug_str(buf); }