Asynchronous UART communication

Hello Everyone
Greetings of the day…!!

I want to achieve asynchronous UART communication, I understand by using mgos_uart_set_dispatcher
the call back get triggered when data is in an input buffer or space available in the output buffer

is this the API to achieve asynchronous UART or if there is a better way please let me know

Lokesh CJ

AFAIK that one is the only API available from mOS
You can check the rx available chars to tell it apart from room available to tx.

@scaprile Thank you for your response

I have achieved asynchrnous UART as below:

call back function defnition for ```

void uart_dispatcher_cb(int uart_no, void *arg)
        mgos_uart_read(UART_INTERFACE_ZERO, &dataBuff, sizeof(dataBuff));

I just want to know is this the efficent way of handling it?