Struct ross_protocol::ross_frame::RossFrame[][src]

pub struct RossFrame {
    pub not_error_flag: bool,
    pub start_frame_flag: bool,
    pub multi_frame_flag: bool,
    pub frame_id: RossFrameId,
    pub device_address: u16,
    pub data_len: u8,
    pub data: [u8; 8],
}
Expand description

Ross compatible representation of a CAN frame

Fields

not_error_flag: bool

If this bit is low, the frame is considered to be an error frame

start_frame_flag: bool

If this bit is high, the frame is considered to be the first frame of a packet

multi_frame_flag: bool

If this bit is high, the frame is considered to be only a part of a packet

frame_id: RossFrameId

Either the last or the current frame id inside current packet, depending on start_frame_flag

device_address: u16

Transmitting device’s address

data_len: u8

Length of frame data

data: [u8; 8]

Frame data

Implementations

Converts a bxcan frame to a ross frame

This is the extended id structure for a ross frame: bit 0: NOT_ERROR_FLAG (if this bit is low, the frame is considered to be an error frame) bit 1: START_FRAME_FLAG (if this bit is high, the frame is considered to be the first frame of a packet) bit 2: MULTI_FRAME_FLAG (if this bit is high, the frame is considered to be only a part of a packet) bits 3 - 7: RESERVED (reserved for future use) bits 8 - 11: LAST_FRAME_ID (most significant nibble (0xf00) of the last frame id) FRAME_ID (most significant nibble (0xf00) of the current frame id) bits 12 - 27 DEVICE_ADDRESS (transmitting device’s address)

Converts a ross frame to a bxcan frame

Converts a USART frame to a ross frame

This is the structure for a USART frame: byte 0: bit 0: NOT_ERROR_FLAG (if this bit is low, the frame is considered to be an error frame) bit 1: START_FRAME_FLAG (if this bit is high, the frame is considered to be the first frame of a packet) bit 2: MULTI_FRAME_FLAG (if this bit is high, the frame is considered to be only a part of a packet)s bit 3: RESERVED (reserved for future use) bits 4 - 7: LAST_FRAME_ID (most significant nibble (0xf00) of the last frame id) FRAME_ID (most significant nibble (0xf00) of the current frame id)

byte 1: LAST_FRAME_ID (least significant byte (0x0ff) of the last frame id) FRAME_ID (least significant byte (0x0ff) of the current frame id)

byte 2: DEVICE_ADDRESS (most significant byte (0xff00) of the device address) byte 3: DEVICE_ADDRESS (least significant byte (0x00ff) of the device address)

byte 4: DATA_LEN (length of frame data) bytes 5 - 12: DATA (frame data)

Converts a ross frame to a USART frame

Trait Implementations

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Performs the conversion.

Performs the conversion.

Should always be Self

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.