Trait grand_central_m4::sercom::v2::spi::Length [−][src]
pub trait Length: 'static + Sealed + Unsigned {
type Word: 'static;
fn configure(sercom: &RegisterBlock) { ... }
}
Expand description
Type-level enum representing the SPI transaction length, in bytes
This trait acts as both a type-level enum, forming a type class for transaction lengths, as well as a type-level function mapping the corresponding word size.
As mentioned in the OpMode
documentation, this module chooses to always
operate in 32-bit extension mode. The LENGTH counter is used to control the
number of byes in each SPI transaction.
The SPI transaction length is represented in the type domain using
Unsigned
types from the [typenum
] crate. The length can be set
statically, using a length from U1
to U255
, or it can be set
dynamically, using the DynLength
marker type. The static Length
types can be imported from the lengths
submodule.
The SPI transaction length affects the word size for the embedded HAL traits, as well as other aspects of the SPI API. Transaction lengths of 1-4 only require a single read/write of the DATA register, so they behave differently than longer transaction lengths.