pub struct TwaiConfiguration<'d, Dm: DriverMode> { /* private fields */ }
unstable
only.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)
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.
Sourcepub fn set_error_warning_limit(&mut self, limit: u8)
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§impl<'d> TwaiConfiguration<'d, Blocking>
impl<'d> TwaiConfiguration<'d, Blocking>
Sourcepub 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
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
Sourcepub 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
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
Sourcepub fn into_async(self) -> TwaiConfiguration<'d, Async>
pub fn into_async(self) -> TwaiConfiguration<'d, Async>
Convert the configuration into an async configuration.
Sourcepub fn set_interrupt_handler(&mut self, handler: InterruptHandler)
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>
impl<'d> TwaiConfiguration<'d, Async>
Sourcepub fn into_blocking(self) -> TwaiConfiguration<'d, Blocking>
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.
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.