[][src]Struct bxcan::Can

pub struct Can<I: Instance> { /* fields omitted */ }

Interface to a CAN peripheral.

Implementations

impl<I> Can<I> where
    I: Instance
[src]

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]

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 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

impl<I> Send for Can<I> where
    I: Send

impl<I> Sync for Can<I> where
    I: Sync

impl<I> Unpin for Can<I> where
    I: Unpin

impl<I> UnwindSafe for Can<I> where
    I: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.