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_bufferwas cancelled and the buffer was not fully received.rx_lencontains how many words were received.Err(SIZE): The buffer could only be partially received.rx_lencontains how many words were received.Err(FAIL): The reception failed in some way:errormay 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_wordwas cancelled and the word was not received:wordshould be ignored.Err(FAIL): The reception failed in some way andwordshould be ignored.errormay contain further information on the sort of error.