Skip to main content

CanFdRx

Struct CanFdRx 

Source
pub struct CanFdRx<'a, Dm: DriverMode> { /* private fields */ }
Expand description

Receiving half of a split controller.

Borrows the driver, which keeps the configuration and the teardown. See CanFd::split.

Implementations§

Source§

impl<Dm: DriverMode> CanFdRx<'_, Dm>

Source

pub fn rx_frame_count(&self) -> u16

Returns the number of complete frames waiting in the RX buffer.

Source

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

Reads one frame from the RX buffer.

§Errors

Error::RxBufferEmpty when no complete frame is waiting.

Source

pub fn flush_rx(&mut self)

Discards everything in the RX buffer.

Source

pub fn rx_buffer_size_words(&self) -> u16

Returns the size of the RX buffer in 32-bit words.

Source

pub fn rx_buffer_free_words(&self) -> u16

Returns the free space in the RX buffer in 32-bit words.

Source

pub fn rx_overrun(&self) -> bool

Returns whether the RX buffer has overrun and dropped a frame (TRM 38.3.9.4).

Source

pub fn clear_rx_overrun(&mut self)

Clears the RX buffer overrun flag.

Source

pub fn error_state(&self) -> ErrorState

Returns the current fault confinement state; see CanFd::error_state.

Source

pub fn receive_error_count(&self) -> u16

Returns the receive error counter.

Source

pub fn transmit_error_count(&self) -> u16

Returns the transmit error counter.

Source§

impl CanFdRx<'_, Async>

Source

pub async fn receive_async(&mut self) -> Frame

Waits until a frame is received, then reads it.

§Cancellation Safety

This future is cancel-safe. A frame stays in the hardware RX buffer until it is read, so dropping the future loses nothing.

Trait Implementations§

Source§

impl<Dm: DriverMode> Debug for CanFdRx<'_, Dm>

Available on crate feature unstable only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, Dm> !RefUnwindSafe for CanFdRx<'a, Dm>

§

impl<'a, Dm> !UnwindSafe for CanFdRx<'a, Dm>

§

impl<'a, Dm> Freeze for CanFdRx<'a, Dm>
where PhantomData<Dm>: Freeze,

§

impl<'a, Dm> Send for CanFdRx<'a, Dm>
where PhantomData<Dm>: Send,

§

impl<'a, Dm> Sync for CanFdRx<'a, Dm>
where PhantomData<Dm>: Sync,

§

impl<'a, Dm> Unpin for CanFdRx<'a, Dm>
where PhantomData<Dm>: Unpin,

§

impl<'a, Dm> UnsafeUnpin for CanFdRx<'a, Dm>
where PhantomData<Dm>: 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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.