pub trait Length: 'static + Sealed + Unsigned {
    type Word: 'static;
}
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 Length to the corresponding Word size.

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. All valid Length types are re-exported in this module.

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 have an AtomicSize behave differently than longer transaction lengths.

Associated Types

Word size for the transaction length

For lengths 1-4, this type is u8, u16 or u32. For longer transactions, this type is [u8, Self::USIZE].

Implementations on Foreign Types

Implementors