Struct esp32c3_hal::twai::Twai

source ·
pub struct Twai<'d, T> { /* private fields */ }
Expand description

An active TWAI peripheral in Normal Mode.

In this mode, the TWAI controller can transmit and receive messages including error signals (such as error and overload frames).

Implementations§

Stop the peripheral, putting it into reset mode and enabling reconfiguration.

Check if the controller is in a bus off state.

Get the number of messages that the peripheral has available in the receive FIFO.

Note that this may not be the number of valid messages in the receive FIFO due to fifo overflow/overrun.

Clear the receive FIFO, discarding any valid, partial, or invalid packets.

This is typically used to clear an overrun receive FIFO.

TODO: Not sure if this needs to be guarded against Bus Off or other error states.

Trait Implementations§

Transmit a frame.

Because of how the TWAI registers are set up, we have to do some assembly of bytes. Note that these registers serve a filter configuration role when the device is in configuration mode so patching the svd files to improve this may be non-trivial.

ESP32C3 Reference Manual

NOTE: TODO: This may not work if using the self reception/self test functionality. See notes 1 and 2 in the “Frame Identifier” section of the reference manual.

Return a received frame if there are any available.

Associated frame type.
Associated error type.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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