Skip to content

hw/drivers: Lack of simple UART string transmit API #3487

@wiktorkwiatkowski

Description

@wiktorkwiatkowski

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");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions