Struct canadensis_can::Frame
source · pub struct Frame<I> { /* private fields */ }
Expand description
CAN or CAN FD data frame with up to 64 bytes of data and an extended 29-bit ID
RTR/Error frames are not used and therefore not modeled here. CAN frames with 11-bit ID are not used by Cyphal/CAN and so they are not supported by the library.
Loopback
Each frame has a loopback flag.
For an outgoing frame, if loopback is true the driver should place a copy of this frame in the received frame path (as if it had been received on the bus) with the copy’s timestamp set to the time the frame was transmitted.
For an incoming frame, if loopback is true this frame was not actually received from another device. The frame timestamp is the time the original frame was sent.
This is useful for time synchronization.
Implementations§
source§impl<I> Frame<I>
impl<I> Frame<I>
sourcepub fn new(timestamp: I, id: CanId, data: &[u8]) -> Self
pub fn new(timestamp: I, id: CanId, data: &[u8]) -> Self
Creates a frame
The loopback flag is set to false.
Panics
This function will panic if the length of data is greater than FRAME_CAPACITY.
sourcepub fn set_timestamp(&mut self, timestamp: I)
pub fn set_timestamp(&mut self, timestamp: I)
Sets the timestamp
sourcepub fn set_loopback(&mut self, loopback: bool)
pub fn set_loopback(&mut self, loopback: bool)
Sets the loopback flag