mynewt-core
mynewt-core copied to clipboard
hw/drivers: Lack of simple UART string transmit API
Currently, there is no easy way to send a full string over a UART interface. You have to send each character manually, like this:
char *str = "Hello World!";
char *ptr = str;
while (*ptr) {
hal_uart_blocking_tx(MY_UART, *ptr++);
}
hal_uart_blocking_tx(MY_UART, '\n');
For the console, there is console_printf(), but there isnt similar function for general UARTs.
Proposal:
Add function, for example:
void hal_uart_transmit(int uart, char *str);
that would send the whole string over the selected UART.
Example usage:
hal_uart_transmit(1, "Hello World!\n");
can this be assigned to me.