Skip to main content

TwaiConfiguration

Struct TwaiConfiguration 

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

An inactive TWAI peripheral in the “Reset”/configuration state.

Implementations§

Source§

impl<'d, Dm> TwaiConfiguration<'d, Dm>
where Dm: DriverMode,

Source

pub fn set_filter(&mut self, filter: impl Filter)

Sets up the acceptance filter on the device.

NOTE: On a bus with mixed 11-bit and 29-bit packet id’s, an 11-bit filter match against a 29-bit frame and vice versa may occur. Applications should verify the id again once a frame has been received to make sure it is the expected value.

A const {} block can ensure that the filter is parsed during program compilation.

The filter is not applied to the peripheral until Self::start is called.

ESP32C3 Reference Manual

Source

pub fn set_error_warning_limit(&mut self, limit: u8)

Sets the error warning threshold.

In the case when any of an error counter value exceeds the threshold, or all the error counter values are below the threshold, an error warning interrupt will be triggered (given the enable signal is valid).

Source

pub fn start(self) -> Twai<'d, Dm>

Puts the peripheral into Operation Mode, allowing the transmission and reception of packets using the new object.

Source§

impl<'d> TwaiConfiguration<'d, Blocking>

Source

pub fn new( peripheral: impl Instance + 'd, rx_pin: impl PeripheralInput<'d>, tx_pin: impl PeripheralOutput<'d>, baud_rate: BaudRate, mode: TwaiMode, ) -> Self

Creates a new instance of TwaiConfiguration.

A transceiver is required to connect to the TWAI bus.

Source

pub fn new_no_transceiver( peripheral: impl Instance + 'd, rx_pin: impl PeripheralInput<'d>, tx_pin: impl PeripheralOutput<'d>, baud_rate: BaudRate, mode: TwaiMode, ) -> Self

Creates a new instance of TwaiConfiguration meant to connect two ESP32s directly.

A transceiver is not required when following the description in the twai.rs example.

Source

pub fn into_async(self) -> TwaiConfiguration<'d, Async>

Converts the configuration into an async configuration.

Source

pub fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Available on crate feature unstable only.

Registers an interrupt handler for the TWAI peripheral.

Replaces any previously registered interrupt handlers.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

impl<'d> TwaiConfiguration<'d, Async>

Source

pub fn into_blocking(self) -> TwaiConfiguration<'d, Blocking>

Converts the configuration into a blocking configuration.

Trait Implementations§

Source§

impl InterruptConfigurable for TwaiConfiguration<'_, Blocking>

Available on crate feature unstable only.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Registers an interrupt handler for the peripheral. Read more

Auto Trait Implementations§

§

impl<'d, Dm> !UnwindSafe for TwaiConfiguration<'d, Dm>

§

impl<'d, Dm> Freeze for TwaiConfiguration<'d, Dm>
where PhantomData<Dm>: Freeze,

§

impl<'d, Dm> RefUnwindSafe for TwaiConfiguration<'d, Dm>
where PhantomData<Dm>: RefUnwindSafe,

§

impl<'d, Dm> Send for TwaiConfiguration<'d, Dm>
where PhantomData<Dm>: Send,

§

impl<'d, Dm> Sync for TwaiConfiguration<'d, Dm>
where PhantomData<Dm>: Sync,

§

impl<'d, Dm> Unpin for TwaiConfiguration<'d, Dm>
where PhantomData<Dm>: Unpin,

§

impl<'d, Dm> UnsafeUnpin for TwaiConfiguration<'d, 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.