riot_sys

Function uart_init

Source
pub unsafe extern "C" fn uart_init(
    uart: uart_t,
    baud: u32,
    rx_cb: uart_rx_cb_t,
    arg: *mut c_void,
) -> c_int
Expand description

@brief Initialize a given UART device

The UART device will be initialized with the following configuration:

  • 8 data bits
  • no parity
  • 1 stop bit
  • symbol rate as given

If no callback parameter is given (rx_cb := NULL), the UART will be initialized in TX only mode.

@param[in] uart UART device to initialize @param[in] baud desired symbol rate in baud @param[in] rx_cb receive callback, executed in interrupt context once for every byte that is received (RX buffer filled), set to NULL for TX only mode @param[in] arg optional context passed to the callback functions

@retval 0 Success @retval -ENODEV Invalid UART device @retval -ENOTSUP Unsupported symbol rate @retval <0 On other errors