Skip to main content

Can

Struct Can 

Source
pub struct Can<'d, T: Instance, M: Mode> { /* private fields */ }

Implementations§

Source§

impl<'d, T: Instance> Can<'d, T, Async>

Source

pub fn new_async<const REMAP: u8>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T, REMAP>>, tx: Peri<'d, impl TxPin<T, REMAP>>, _irq: impl Binding<T::ReceiveInterrupt, ReceiveInterruptHandler<T>> + Binding<T::TransmitInterrupt, TransmitInterruptHandler<T>> + 'd, fifo: CanFifo, mode: CanMode, bitrate: u32, config: Config, ) -> Result<Self, CanInitError>

Source

pub async fn receive(&self) -> Result<CanFrame, CanError>

Source

pub async fn transmit(&mut self, frame: &CanFrame) -> Result<(), CanError>

Source§

impl<'d, T: Instance> Can<'d, T, Blocking>

Source

pub fn new_blocking<const REMAP: u8>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T, REMAP>>, tx: Peri<'d, impl TxPin<T, REMAP>>, fifo: CanFifo, mode: CanMode, bitrate: u32, config: Config, ) -> Result<Self, CanInitError>

Source§

impl<'d, T: Instance> Can<'d, T, NonBlocking>

Source

pub fn new_nb<const REMAP: u8>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T, REMAP>>, tx: Peri<'d, impl TxPin<T, REMAP>>, fifo: CanFifo, mode: CanMode, bitrate: u32, config: Config, ) -> Result<Self, CanInitError>

Source

pub fn try_recv(&self) -> Result<CanFrame, CanError>

Try to read the next message from the queue. If there are no messages, an error is returned.

Source§

impl<'d, T: Instance, M: Mode> Can<'d, T, M>

Source

pub fn add_filter<BIT: BitMode, MODE: FilterMode>( &self, filter: CanFilter<BIT, MODE>, )

Each filter bank consists of 2 32-bit registers CAN_FxR0 and CAN_FxR1

Source

pub fn transmit_status(&self) -> TxStatus

Retrieves status of the last frame transmission

Trait Implementations§

Source§

impl<'d, T> Can for Can<'d, T, NonBlocking>
where T: Instance,

These trait methods are only usable within the embedded_can context. Under normal use of the Can instance,

Source§

fn transmit( &mut self, frame: &Self::Frame, ) -> Result<Option<Self::Frame>, Self::Error>

Puts a frame in the transmit buffer to be sent on the bus.

If the transmit buffer is full, this function will try to replace a pending lower priority frame and return the frame that was replaced. Returns Err(WouldBlock) if the transmit buffer is full and no frame can be replaced.

Source§

fn receive(&mut self) -> Result<Self::Frame, Self::Error>

Returns a received frame if available.

Source§

type Frame = CanFrame

Associated frame type.
Source§

type Error = CanError

Associated error type.
Source§

impl<'d, T> Can for Can<'d, T, Blocking>
where T: Instance,

Source§

fn transmit(&mut self, frame: &Self::Frame) -> Result<(), Self::Error>

Puts a frame in the transmit buffer. Blocks until space is available in the transmit buffer.

Source§

fn receive(&mut self) -> Result<Self::Frame, Self::Error>

Blocks until a frame was received or an error occured.

Source§

type Frame = CanFrame

Associated frame type.
Source§

type Error = CanError

Associated error type.

Auto Trait Implementations§

§

impl<'d, T, M> !UnwindSafe for Can<'d, T, M>

§

impl<'d, T, M> Freeze for Can<'d, T, M>
where T: Freeze,

§

impl<'d, T, M> RefUnwindSafe for Can<'d, T, M>
where T: RefUnwindSafe, M: RefUnwindSafe,

§

impl<'d, T, M> Send for Can<'d, T, M>
where T: Send, M: Send,

§

impl<'d, T, M> Sync for Can<'d, T, M>
where T: Sync, M: Sync,

§

impl<'d, T, M> Unpin for Can<'d, T, M>
where T: Unpin, M: Unpin,

§

impl<'d, T, M> UnsafeUnpin for Can<'d, T, M>
where T: UnsafeUnpin,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.