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,
impl<'d, Dm> TwaiConfiguration<'d, Dm>where
Dm: DriverMode,
Sourcepub fn set_filter(&mut self, filter: impl Filter)
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.
Sourcepub fn set_error_warning_limit(&mut self, limit: u8)
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§impl<'d> TwaiConfiguration<'d, Blocking>
impl<'d> TwaiConfiguration<'d, Blocking>
Sourcepub fn new(
peripheral: impl Instance + 'd,
rx_pin: impl PeripheralInput<'d>,
tx_pin: impl PeripheralOutput<'d>,
baud_rate: BaudRate,
mode: TwaiMode,
) -> Self
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.
Sourcepub fn new_no_transceiver(
peripheral: impl Instance + 'd,
rx_pin: impl PeripheralInput<'d>,
tx_pin: impl PeripheralOutput<'d>,
baud_rate: BaudRate,
mode: TwaiMode,
) -> Self
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.
Sourcepub fn into_async(self) -> TwaiConfiguration<'d, Async>
pub fn into_async(self) -> TwaiConfiguration<'d, Async>
Converts the configuration into an async configuration.
Sourcepub fn set_interrupt_handler(&mut self, handler: InterruptHandler)
Available on crate feature unstable only.
pub fn set_interrupt_handler(&mut self, handler: InterruptHandler)
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>
impl<'d> TwaiConfiguration<'d, Async>
Sourcepub fn into_blocking(self) -> TwaiConfiguration<'d, Blocking>
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.
impl InterruptConfigurable for TwaiConfiguration<'_, Blocking>
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.