"uartprintf.h"
and "uartprintf.c"
to your project."uartprintf.h"
in your main and/or other source file where you want to use the uartprintf()
function.main()
function call void uartprintf_init(uint32_t baudRate, uint32_t wordLength, uint32_t stopBits, uint32_t parity)
by specifing serial comunication parameters.uartprintf_init(115200 , UART_WORDLENGTH_9B, UART_STOPBITS_1, UART_PARITY_ODD)
uartprintf_init()
function a default configuration will be automatically set when calling uartprintf()
for the first time in your program. (This is discuraged when you also want to enable UART reception because you will be listening on serial port only after initialization)]void uartprintf_charreceived(char rxchar)
void uartprintf_linereceived(char* rxline)
'\0'
string termination literal char)]"\r"
or "\n"
or "\r\n"
or "\n\r"
combination are recognized as linebreaks]uartprintf(const char* format, ...)
limits'\0'
string termination literal char)uartprintf()
function is 127These limits can be changed by acting on these defines in "uartprintf.h"
file:
#define _UARTPRINTF_MAX_BUFF
N+1 max consecutive calls
#define _UARTPRINTF_MAX_STR
Max resulting string length
#define _UARTPRINTF_RXLINE_MAX_STR
Max received line length