Expand description

Interface for CAN peripherals.

Defines multiple traits for different purposes.

The Configure trait is used to configure the communication mode and bit timing parameters of the CAN peripheral. The ConfigureFd trait is an advanced feature that can be implemented for peripherals that support flexible data messages. These 2 traits represent synchronous actions and do not need a client in order to confirm to the capsule that the action is finished.

The Controller trait is used to enable and disable the device. In order to be able to enable the device, the bit timing parameters and the communication mode must be previously set, and in order to disable the device, it must be enabled. This trait defines asynchronous behaviours and because of that, the ControllerClient trait is used to confirm to the capsule that the action is finished.

The Filter trait is used to configure filter banks for receiving messages. The action is synchronous.

The Transmit trait is used to asynchronously send a message on the CAN bus. The device must be previously enabled. The TransmitClient trait is used to notify the capsule when the transmission is done or when there was en error captured during the transmission.

The Receive trait is used to asynchronously receive messages on the CAN bus. The ReceiveClient trait is used to notify the capsule when a message was received, when the receiving process was aborted and anytime an error occurs.

Structs

This structure defines the parameters for the timing mode
This structure defines the parameters to configure a filter bank

Enums

Defines the error codes received from the CAN peripheral
The identifier can be standard (11 bits) or extended (29 bits)
The filter can be configured to filter the messages by matching an identifier or by bitwise matching multiple identifiers.
The peripheral can be configured to work in the following modes:
The Scale Bits structure defines the 2 possible widths of the filter bank
Defines the possible states of the peripheral

Constants

Traits

Convenience type for capsules that configure, send and receive data using the CAN peripheral
The Configure trait is used to configure the CAN peripheral 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.
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.
The Controller trait is used to enable and disable the CAN peripheral. The enable process applies the settings that were previously provided to the driver using the Configure trait.
Client interface for capsules that implement the Controller trait.
The Filter trait is used to enable and disable a filter bank.
The Receive trait is used to interact with the CAN driver through receive requests only.
Client interface for capsules that implement the Receive trait.
The StandardBitTiming trait is used to calculate the optimum timing parameters for a given bitrate and the clock’s frequency.
The Transmit trait is used to interact with the CAN driver through transmission requests only.
Client interface for capsules that implement the Transmit trait.