Trait kernel::hil::uart::ReceiveClient
source · pub trait ReceiveClient {
// Required method
fn received_buffer(
&self,
rx_buffer: &'static mut [u8],
rx_len: usize,
rval: Result<(), ErrorCode>,
error: Error,
);
// Provided method
fn received_word(
&self,
_word: u32,
_rval: Result<(), ErrorCode>,
_error: Error,
) { ... }
}
Expand description
Trait implemented by a UART receiver to receive callbacks when operations complete.
Required Methods§
sourcefn received_buffer(
&self,
rx_buffer: &'static mut [u8],
rx_len: usize,
rval: Result<(), ErrorCode>,
error: Error,
)
fn received_buffer( &self, rx_buffer: &'static mut [u8], rx_len: usize, rval: Result<(), ErrorCode>, error: Error, )
A call to Receive::receive_buffer
completed.
A call to Receive::receive_word
or Receive::receive_buffer
made
within this callback SHOULD NOT return Err(BUSY)
. When this callback
is made the UART should be ready to receive another call.
The rx_len
argument specifies how many words were received. If the
receive was successful, rx_len
in the callback will be the same
as rx_len
in the initiating call.
rval
indicates whether a buffer was successfully received. Possible
rval
values:
Ok(())
: The full buffer was successfully received.Err(CANCEL)
: The call toReceive::receive_buffer
was cancelled and the buffer was not fully received.rx_len
contains how many words were received.Err(SIZE)
: The buffer could only be partially received.rx_len
contains how many words were received.Err(FAIL)
: The reception failed in some way:error
may contain further information.
Provided Methods§
sourcefn received_word(&self, _word: u32, _rval: Result<(), ErrorCode>, _error: Error)
fn received_word(&self, _word: u32, _rval: Result<(), ErrorCode>, _error: Error)
A call to Receive::receive_word
completed.
A call to Receive::receive_word
or Receive::receive_buffer
made
within this callback SHOULD NOT return Err(BUSY)
. When this callback
is made the UART should be ready to receive another call.
rval
indicates whether a word was successfully received. Possible
rval
values:
Ok(())
: The word was successfully received.Err(CANCEL)
: The call toReceive::receive_word
was cancelled and the word was not received:word
should be ignored.Err(FAIL)
: The reception failed in some way andword
should be ignored.error
may contain further information on the sort of error.