uart_callback_set

Function uart_callback_set 

Source
pub unsafe extern "C" fn uart_callback_set(
    dev: *const device,
    callback: Option<unsafe extern "C" fn(*const device, *mut uart_event, *mut c_void)>,
    user_data: *mut c_void,
) -> i32
Expand description

@brief Set event handler function.

Since it is mandatory to set callback to use other asynchronous functions, it can be used to detect if the device supports asynchronous API. Remaining API does not have that detection.

@param dev UART device instance. @param callback Event handler. @param user_data Data to pass to event handler function.

@retval 0 If successful. @retval -ENOSYS If not supported by the device. @retval -ENOTSUP If API not enabled.