pub trait Transmit<const PACKET_SIZE: usize> {
    const PACKET_SIZE: usize = PACKET_SIZE;

    fn set_client(
        client: Option<&'static dyn TransmitClient<PACKET_SIZE>>
    ); fn send(
        id: Id,
        buffer: &'static mut [u8; PACKET_SIZE],
        len: usize
    ) -> Result<(), (ErrorCode, &'static mut [u8; PACKET_SIZE])>; }
Expand description

The Transmit trait is used to interact with the CAN driver through transmission requests only.

The CAN peripheral must be configured first, in order to be able to send data.

Provided Associated Constants

Required Methods

Set the client to be used for callbacks of the Transmit implementation.

Sends a buffer using the CAN bus.

In most cases, this function should be called after the peripheral was previously configures and at least one filter has been enabled.

  • id - The identifier of the message (standard or extended)
  • buffer - Data to be written on the bus
  • len - Length of the current message
Return values:
  • Ok() - The transmission request was successful and the caller will receive a for the transmit_complete callback function call
  • Err(ErrorCode, &'static mut [u8]) - a tuple with the error that occurred during the transmission request and the buffer that was provided as an argument to the function