uart_rx_enable

Function uart_rx_enable 

Source
pub unsafe extern "C" fn uart_rx_enable(
    dev: *const device,
    buf: *mut u8,
    len: usize,
    timeout: i32,
) -> i32
Expand description

@brief Start receiving data through UART.

Function sets given buffer as first buffer for receiving and returns immediately. After that event handler, set using @ref uart_callback_set, is called with #UART_RX_RDY or #UART_RX_BUF_REQUEST events.

@param dev UART device instance. @param buf Pointer to receive buffer. @param len Buffer length. @param timeout Inactivity period after receiving at least a byte which triggers #UART_RX_RDY event. Given in microseconds. @ref SYS_FOREVER_US disables timeout. See @ref uart_event_type for details.

@retval 0 If successful. @retval -ENOTSUP If API is not enabled. @retval -EBUSY RX already in progress. @retval -errno Other negative errno value in case of failure.