Expand description
Trait representing CAN peripheral identity
Types implementing this trait are expected to be used as a marker types that
serve the purpose of identifying specific instances of CAN peripherals
available on the platform (as there might be more than one). It only conveys
where the CAN peripheral HW register is located, not necessarily that it
can be accessed. The latter is expressed by the Dependencies
trait.
It is also useful for associating Dependencies
with specific CanId
and setting up additional type constraints preventing application developers
from constructing CAN abstractions with incompatible sets of dependencies.
More details in Dependencies
documentation.
Safety
CanId::ADDRESS
points to the start of a valid HW register of a CAN
peripheral
Examples
use mcan_core::CanId;
pub enum Can0 {}
unsafe impl CanId for Can0 {
const ADDRESS: *const () = 0xDEAD0000 as *const _;
}
pub enum Can1 {}
unsafe impl CanId for Can1 {
const ADDRESS: *const () = 0xBEEF0000 as *const _;
}