Struct bxcan::Can [−][src]
pub struct Can<I: Instance> { /* fields omitted */ }
Expand description
Interface to a bxCAN peripheral.
Implementations
Creates a CanBuilder
for constructing a CAN interface.
Returns a reference to the peripheral instance.
This allows accessing HAL-specific data stored in the instance type.
Disables the CAN interface and returns back the raw peripheral it was created from.
The peripheral is disabled by setting RESET
in CAN_MCR
, which causes the peripheral to
enter sleep mode.
Configure bit timings and silent/loop-back mode.
Calling this method will enter initialization mode.
Configures the automatic wake-up feature.
This is turned off by default.
When turned on, an incoming frame will cause the peripheral to wake up from sleep and
receive the frame. If enabled, Interrupt::Wakeup
will also be triggered by the incoming
frame.
Leaves initialization mode and enables the peripheral (non-blocking version).
Usually, it is recommended to call CanConfig::enable
instead. This method is only needed
if you want non-blocking initialization.
If this returns WouldBlock
, the peripheral will enable itself
in the background. The peripheral is enabled and ready to use when this method returns
successfully.
Puts the peripheral in a sleep mode to save power.
While in sleep mode, an incoming CAN frame will trigger Interrupt::Wakeup
if enabled.
Wakes up from sleep mode.
Note that this will not trigger Interrupt::Wakeup
, only reception of an incoming CAN
frame will cause that interrupt.
Starts listening for a CAN interrupt.
Starts listening for a set of CAN interrupts.
Stops listening for a CAN interrupt.
Stops listening for a set of CAN interrupts.
Clears the pending flag of Interrupt::Sleep
.
Clears the pending flag of Interrupt::Wakeup
.
Clears the “Request Completed” (RQCP) flag of a transmit mailbox.
Returns the Mailbox
whose flag was cleared. If no mailbox has the flag set, returns
None
.
Once this function returns None
, a pending Interrupt::TransmitMailboxEmpty
is
considered acknowledged.
Clears a pending TX interrupt (Interrupt::TransmitMailboxEmpty
).
This does not return the mailboxes that have finished tranmission. If you need that
information, call Can::clear_request_completed_flag
instead.
Puts a CAN frame in a free transmit mailbox for transmission on the bus.
Frames are transmitted to the bus based on their priority (identifier).
Transmit order is preserved for frames with identical identifiers.
If all transmit mailboxes are full, a higher priority frame replaces the
lowest priority frame, which is returned as Ok(Some(frame))
.
Returns true
if no frame is pending for transmission.
Attempts to abort the sending of a frame that is pending in a mailbox.
If there is no frame in the provided mailbox, or its transmission succeeds before it can be
aborted, this function has no effect and returns false
.
If there is a frame in the provided mailbox, and it is canceled successfully, this function
returns true
.
Returns a received frame if available.
Returns Err
when a frame was lost due to buffer overrun.
Splits this Can
instance into transmitting and receiving halves, by reference.
Accesses the filter banks owned by this CAN peripheral.
To modify filters of a slave peripheral, modify_filters
has to be called on the master
peripheral instead.