|
|
@ -8,7 +8,7 @@ |
|
|
|
#if USE_DEBUG_UART |
|
|
|
#if USE_DEBUG_UART |
|
|
|
|
|
|
|
|
|
|
|
// debug printf
|
|
|
|
// debug printf
|
|
|
|
int _DO_PRINTF(const char *format, ...) |
|
|
|
void _DO_PRINTF(const char *format, ...) |
|
|
|
{ |
|
|
|
{ |
|
|
|
va_list args; |
|
|
|
va_list args; |
|
|
|
int len; |
|
|
|
int len; |
|
|
@ -25,8 +25,6 @@ int _DO_PRINTF(const char *format, ...) |
|
|
|
|
|
|
|
|
|
|
|
_write_r(NULL, 2, dbg_buf, (size_t) len); |
|
|
|
_write_r(NULL, 2, dbg_buf, (size_t) len); |
|
|
|
va_end(args); |
|
|
|
va_end(args); |
|
|
|
|
|
|
|
|
|
|
|
return len; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -34,19 +32,10 @@ int _DO_PRINTF(const char *format, ...) |
|
|
|
* @param string - buffer to print |
|
|
|
* @param string - buffer to print |
|
|
|
* @param len - number of bytes to print |
|
|
|
* @param len - number of bytes to print |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void PUTSN(const char *string, size_t len) |
|
|
|
void PUTSN(const char *string, uint16_t len) |
|
|
|
{ |
|
|
|
|
|
|
|
if (len == 0) len = strlen(string); |
|
|
|
|
|
|
|
_write_r(NULL, 2, string, (size_t) len); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Puts a newline |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
void PUTNL(void) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
_write_r(NULL, 2, "\r\n", 2); |
|
|
|
if (len == 0) len = (uint16_t) strlen(string); |
|
|
|
|
|
|
|
debug_write(string, len); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -54,22 +43,11 @@ void PUTNL(void) |
|
|
|
* @param string - string to print, zero-terminated |
|
|
|
* @param string - string to print, zero-terminated |
|
|
|
* @return number of characters printed |
|
|
|
* @return number of characters printed |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
int PUTS(const char *string) |
|
|
|
void PUTS(const char *string) |
|
|
|
{ |
|
|
|
{ |
|
|
|
size_t len = strlen(string); |
|
|
|
size_t len = strlen(string); |
|
|
|
_write_r(NULL, 2, string, len); |
|
|
|
debug_write(string, (uint16_t) len); |
|
|
|
return (int) len; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Print one character to debug uart |
|
|
|
|
|
|
|
* @param ch - character ASCII code |
|
|
|
|
|
|
|
* @return the character code |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
int PUTCHAR(int ch) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_write_r(NULL, 2, &ch, 1); |
|
|
|
|
|
|
|
return ch; // or EOF
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|