[−][src]Struct bxcan::Can
Interface to a CAN peripheral.
Implementations
impl<I> Can<I> where
I: Instance,
[src]
I: Instance,
pub fn new(instance: I) -> Self
[src]
Creates a CAN interface, taking ownership of the raw peripheral.
pub fn instance(&mut self) -> &mut I
[src]
Returns a reference to the peripheral instance.
This allows accessing HAL-specific data stored in the instance type.
pub fn configure<F>(&mut self, f: F) where
F: FnOnce(&mut CanConfig<I>),
[src]
F: FnOnce(&mut CanConfig<I>),
Configure bit timings and silent/loop-back mode.
Acutal configuration happens on the CanConfig
that is passed to the
closure. It must be done this way because those configuration bits can
only be set if the CAN controller is in a special init mode.
Puts the peripheral in sleep mode afterwards. Can::enable()
must be
called to exit sleep mode and start reception and transmission.
pub fn set_automatic_wakeup(&mut self, enabled: bool)
[src]
Configures the automatic wake-up feature.
pub fn enable(&mut self) -> Result<(), Infallible>
[src]
Start reception and transmission.
Waits for 11 consecutive recessive bits to sync to the CAN bus.
pub fn sleep(&mut self)
[src]
Puts the peripheral in a sleep mode to save power.
Reception and transmission is disabled.
pub fn enable_interrupt(&mut self, interrupt: Interrupt)
[src]
Starts listening for a CAN interrupt.
pub fn enable_interrupts(&mut self, interrupts: Interrupts)
[src]
Starts listening for a set of CAN interrupts.
pub fn disable_interrupt(&mut self, interrupt: Interrupt)
[src]
Stops listening for a CAN interrupt.
pub fn disable_interrupts(&mut self, interrupts: Interrupts)
[src]
Stops listening for a set of CAN interrupts.
pub fn clear_wakeup_interrupt(&mut self)
[src]
Clears the pending flag of Interrupt::Wakeup
.
pub fn transmit(&mut self, frame: &Frame) -> Result<Option<Frame>, Infallible>
[src]
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))
.
pub fn is_transmitter_idle(&self) -> bool
[src]
Returns true
if no frame is pending for transmission.
pub fn receive(&mut self) -> Result<Frame, ()>
[src]
Returns a received frame if available.
Returns Err
when a frame was lost due to buffer overrun.
pub fn split_by_ref(&mut self) -> (&mut Tx<I>, &mut Rx<I>)
[src]
Splits this Can
instance into transmitting and receiving halves, by reference.
pub fn split(self) -> (Tx<I>, Rx<I>)
[src]
Consumes this Can
instance and splits it into transmitting and receiving halves.
impl<I: FilterOwner> Can<I>
[src]
pub fn modify_filters(&mut self) -> MasterFilters<'_, I>
[src]
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.
Auto Trait Implementations
impl<I> RefUnwindSafe for Can<I> where
I: RefUnwindSafe,
I: RefUnwindSafe,
impl<I> Send for Can<I> where
I: Send,
I: Send,
impl<I> Sync for Can<I> where
I: Sync,
I: Sync,
impl<I> Unpin for Can<I> where
I: Unpin,
I: Unpin,
impl<I> UnwindSafe for Can<I> where
I: UnwindSafe,
I: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,