Trait kernel::hil::can::ConfigureFd

source ·
pub trait ConfigureFd: Configure {
    // Required methods
    fn set_payload_bit_timing(
        &self,
        payload_bit_timing: BitTiming
    ) -> Result<(), ErrorCode>;
    fn get_payload_bit_timing(&self) -> Result<BitTiming, ErrorCode>;
    fn get_frame_size() -> usize;
}
Expand description

The ConfigureFd trait is used to configure the CAN peripheral for CanFD and to prepare it for transmission and reception of data. The peripheral cannot transmit or receive frames if it is not previously configured and enabled.

In order to configure the peripheral, the following steps are required:

  • Call set_bit_timing to configure the timing settings
  • Call set_operation_mode to configure the testing mode
  • (Optional) Call set_automatic_retransmission and/or set_wake_up to configure the behaviour of the peripheral
  • To apply the settings and be able to use the peripheral, call enable (from the Controller trait)

Required Methods§

source

fn set_payload_bit_timing( &self, payload_bit_timing: BitTiming ) -> Result<(), ErrorCode>

Configures the CAN FD peripheral with the given arguments. This function is supposed to be called before the enable function. This function is synchronous as the driver should only store the arguments, and should not configure the hardware.

§Arguments:
  • payload_bit_timing - A BitTiming structure to define the bit timing settings for the frame payload
§Return values:
  • Ok() - The parameters were stored.
  • Err(ErrorCode) - Indicates the error because of which the request cannot be completed - ErrorCode::NOSUPPORT indicates that payload timing is not supported
source

fn get_payload_bit_timing(&self) -> Result<BitTiming, ErrorCode>

Returns the current timing parameters for the CAN peripheral.

§Return values:
  • Ok(BitTiming) - The current timing for the frame payload given to the peripheral
  • Err(ErrorCode) - Indicates the error because of which the request cannot be completed - ErrorCode::NOSUPPORT indicates that payload timing is not supported
source

fn get_frame_size() -> usize

Returns the maximum accepted frame size in bytes.

  • for CanFD BRS this should be 8 bytes
  • for CanFD Full this should be 64 bytes

Object Safety§

This trait is not object safe.

Implementors§