Struct TwaiConfiguration

Source
pub struct TwaiConfiguration<'d, Dm: DriverMode> { /* private fields */ }
Available on crate feature unstable only.
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)

Set up the acceptance filter on the device.

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

You may use a const {} block to 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)

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

Put 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<RX: PeripheralInput, TX: PeripheralOutput>( peripheral: impl Peripheral<P = impl Instance> + 'd, rx_pin: impl Peripheral<P = RX> + 'd, tx_pin: impl Peripheral<P = TX> + 'd, baud_rate: BaudRate, mode: TwaiMode, ) -> Self

Create a new instance of TwaiConfiguration

You will need to use a transceiver to connect to the TWAI bus

Source

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

Create a new instance of TwaiConfiguration meant to connect two ESP32s directly

You don’t need a transceiver by following the description in the twai.rs example

Source

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

Convert the configuration into an async configuration.

Source

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

Registers an interrupt handler for the TWAI peripheral.

Note that this will replace 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>

Convert the configuration into a blocking configuration.

Trait Implementations§

Source§

impl InterruptConfigurable for TwaiConfiguration<'_, Blocking>

§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> Freeze for TwaiConfiguration<'d, Dm>

§

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

§

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

§

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

§

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

§

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

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.