kernel::hil::uart

Trait TransmitClient

Source
pub trait TransmitClient {
    // Required method
    fn transmitted_buffer(
        &self,
        tx_buffer: &'static mut [u8],
        tx_len: usize,
        rval: Result<(), ErrorCode>,
    );

    // Provided method
    fn transmitted_word(&self, _rval: Result<(), ErrorCode>) { ... }
}
Expand description

Trait implemented by a UART transmitter to receive callbacks when operations complete.

Required Methods§

Source

fn transmitted_buffer( &self, tx_buffer: &'static mut [u8], tx_len: usize, rval: Result<(), ErrorCode>, )

A call to Transmit::transmit_buffer completed.

A call to Transmit::transmit_word or Transmit::transmit_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 tx_len argument specifies how many words were transmitted. If the transmission was successful, tx_len in the callback will be the same as tx_len in the initiating call.

rval indicates whether the buffer was successfully transmitted. Possible rval values:

  • Ok(()): The full buffer was successfully transmitted.
  • Err(CANCEL): The call to Transmit::transmit_buffer was cancelled and the buffer was not fully transmitted. tx_len contains how many words were transmitted.
  • Err(SIZE): The buffer could only be partially transmitted. tx_len contains how many words were transmitted.
  • Err(FAIL): The transmission failed in some way.

Provided Methods§

Source

fn transmitted_word(&self, _rval: Result<(), ErrorCode>)

A call to Transmit::transmit_word completed.

A call to Transmit::transmit_word or Transmit::transmit_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 the word was successfully transmitted. Possible rval values:

  • Ok(()): The word was successfully transmitted.
  • Err(CANCEL): The call to Transmit::transmit_word was cancelled and the word was not transmitted.
  • Err(FAIL): The transmission failed in some way.

Implementors§