pub trait FDCANPack: Encode + Clone {
const FDCAN_BYTES: FDCANLength;
const FDCAN_ID: u16;
}Expand description
Prerequisite trait for FDCAN Packages
Sets the ID and number of bytes for a CAN package. Note that associated constants do not increase the size of a struct’s memory.
Required Associated Constants§
Sourceconst FDCAN_BYTES: FDCANLength
const FDCAN_BYTES: FDCANLength
The length of the package in bytes, can be up to 64 bytes.
pub structs must be a certain size for FDCAN to transfer The following package sizes (in bytes) are 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 20, 24, 32, 48, 64.
Sourceconst FDCAN_ID: u16
const FDCAN_ID: u16
12 bit ID
Reserved IDs up to 0x01F
0x010 = 0b00000010000
0x01F = 0b00000011111
To receive all can filter ids within this range you must set the mask to 0x7F0 = 0b11111110000
because you care that the bits [10:4] of the can id are exactly the same as bits [10:4] in 0x010/0x01F but the last four bits [3:0] can be 0 or 1 The same logic will be applied henceforth
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.