#[repr(C, packed(1))]pub struct GsHostFrame {
pub echo_id: u32,
pub can_id: u32,
pub can_dlc: u8,
pub channel: u8,
pub flags: u8,
pub reserved: u8,
pub data: [u8; 8],
}Expand description
A CAN frame as transmitted over USB bulk endpoints.
Wire format used by both the Linux gs_usb driver and candleLight firmware.
Must be #[repr(C, packed)] for correct binary compatibility.
Fields§
§echo_id: u32Echo ID: host→device frames carry a sequence number echoed back in device→host TX-complete frames.
can_id: u32CAN identifier (11-bit or 29-bit depending on flags).
can_dlc: u8Data Length Code (0–8 for classic CAN, 0–64 for CAN-FD).
channel: u8Channel number (0 for single-channel devices).
flags: u8Flags (see gs_can_flag).
reserved: u8Reserved, must be 0.
data: [u8; 8]CAN data payload (classic CAN uses only first 8 bytes).
Implementations§
Source§impl GsHostFrame
impl GsHostFrame
Sourcepub fn from_bytes(bytes: &[u8]) -> Self
pub fn from_bytes(bytes: &[u8]) -> Self
Create a new frame from its raw bytes.
§Safety
bytes must be at least 20 bytes and contain a valid GsHostFrame
wire encoding.
Trait Implementations§
Auto Trait Implementations§
impl Forget for GsHostFrame
impl Freeze for GsHostFrame
impl Move for GsHostFrame
impl RefUnwindSafe for GsHostFrame
impl Send for GsHostFrame
impl Sync for GsHostFrame
impl Unpin for GsHostFrame
impl UnsafeUnpin for GsHostFrame
impl UnwindSafe for GsHostFrame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more