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§
- BitTiming
- This structure defines the parameters for the timing mode
- Filter
Parameters - This structure defines the parameters to configure a filter bank
Enums§
- Error
- Defines the error codes received from the CAN peripheral
- Id
- The identifier can be standard (11 bits) or extended (29 bits)
- Identifier
Mode - The filter can be configured to filter the messages by matching an identifier or by bitwise matching multiple identifiers.
- Operation
Mode - The peripheral can be configured to work in the following modes:
- Scale
Bits - The Scale Bits structure defines the 2 possible widths of the filter bank
- State
- Defines the possible states of the peripheral
Constants§
Traits§
- Can
- Convenience type for capsules that configure, send and receive data using the CAN peripheral
- CanFd
- Configure
- The
Configuretrait is used to configure the CAN peripheral and to prepare it for transmission and reception of data. - Configure
Fd - The
ConfigureFdtrait is used to configure the CAN peripheral for CanFD and to prepare it for transmission and reception of data. - Controller
- The
Controllertrait is used to enable and disable the CAN peripheral. The enable process applies the settings that were previously provided to the driver using theConfiguretrait. - Controller
Client - Client interface for capsules that implement the
Controllertrait. - Filter
- The
Filtertrait is used to enable and disable a filter bank. - Receive
- The
Receivetrait is used to interact with the CAN driver through receive requests only. - Receive
Client - Client interface for capsules that implement the
Receivetrait. - Standard
BitTiming - The
StandardBitTimingtrait is used to calculate the optimum timing parameters for a given bitrate and the clock’s frequency. - Transmit
- The
Transmittrait is used to interact with the CAN driver through transmission requests only. - Transmit
Client - Client interface for capsules that implement the
Transmittrait.