pub struct EspTwaiFrame { /* private fields */ }Expand description
A RAM buffer for a TWAI frame.
Mirror image of the 13 TWAI_DATA_x_REG registers.
Implementations§
Source§impl EspTwaiFrame
impl EspTwaiFrame
Sourcepub fn is_remote_request(&self) -> bool
pub fn is_remote_request(&self) -> bool
Remote Transmission Request (RTR): specifies whether content is a data frame or a remote request frame (on-demand polling).
Note: Remote request frames do not have a data payload, no matter their DLC.
Sourcepub fn is_self_reception(&self) -> bool
pub fn is_self_reception(&self) -> bool
Self Reception (SR): indicates whether content was sent by us (using the TWAI_SELF_RX_SEQ command) or received from the bus.
Sourcepub fn data_length_code(&self) -> usize
pub fn data_length_code(&self) -> usize
Data Length Code (DLC): specifies the number of data bytes for a data frame, or the number of data bytes requested by a remote frame.
Note: although no frame can have a payload longer than 8, the DLC can be greater than 8 in rare cases (payload length then is still 8).
Sourcepub fn data_length(&self) -> usize
pub fn data_length(&self) -> usize
Length of the data payload: 0 for a RTR frame, 8 if DLC > 8.
Sourcepub fn identifier(&self) -> Id
pub fn identifier(&self) -> Id
Frame Identifier: 11-bit long for a SFF frame, 29-bit long for an EFF frame.
Sourcepub fn data(&self) -> &[u8]
pub fn data(&self) -> &[u8]
Frame Data: data payload, 0 to 8 bytes long.
Returns a reference to a slice:
- empty in case of a Remote Transmission Request
- 8 bytes long in case DLC > 8
Sourcepub fn new(id: impl Into<Id>, data: &[u8]) -> Option<Self>
pub fn new(id: impl Into<Id>, data: &[u8]) -> Option<Self>
Create a new EspTwaiFrame with the specified ID and data payload.
Sourcepub fn new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>
pub fn new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>
Create a new EspTwaiFrame for a transmission request with the
specified ID and data length (DLC).
Sourcepub fn new_self_reception(id: impl Into<Id>, data: &[u8]) -> Option<Self>
pub fn new_self_reception(id: impl Into<Id>, data: &[u8]) -> Option<Self>
Create a new EspTwaiFrame ready for self-reception with the specified
ID and data payload.
Trait Implementations§
Source§impl Clone for EspTwaiFrame
Available on crate feature unstable only.
impl Clone for EspTwaiFrame
unstable only.Source§fn clone(&self) -> EspTwaiFrame
fn clone(&self) -> EspTwaiFrame
1.0.0 (const: unstable)§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for EspTwaiFrame
unstable only.Source§impl Debug for EspTwaiFrame
Available on crate feature unstable only.
impl Debug for EspTwaiFrame
unstable only.Source§impl Frame for EspTwaiFrame
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 Frame for EspTwaiFrame
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 new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>
fn new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>
Source§fn is_extended(&self) -> bool
fn is_extended(&self) -> bool
Source§fn is_remote_frame(&self) -> bool
fn is_remote_frame(&self) -> bool
Source§fn dlc(&self) -> usize
fn dlc(&self) -> usize
Source§fn is_standard(&self) -> bool
fn is_standard(&self) -> bool
Source§fn is_data_frame(&self) -> bool
fn is_data_frame(&self) -> bool
Auto Trait Implementations§
impl Freeze for EspTwaiFrame
impl RefUnwindSafe for EspTwaiFrame
impl Send for EspTwaiFrame
impl Sync for EspTwaiFrame
impl Unpin for EspTwaiFrame
impl UnsafeUnpin for EspTwaiFrame
impl UnwindSafe for EspTwaiFrame
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)