pub trait CheckBufLen: AnySpi {
    const LEN: usize = _;
    const STEP: usize = _;

    fn len(&self) -> usize { ... }
    fn step(&self) -> usize { ... }
    fn check_buf_len(&self, buf: &impl AsRef<[u8]>) { ... }
}
Expand description

Trait used to verify the SpiFuture buffer length

Provided Associated Constants

Spi transaction length

Step size through the SpiFuture buffer

This is equal to the number of bytes sent in each write to the SPI DATA register. It is zero for an Spi with [DynLength].

Provided Methods

Return the Spi transaction length

In most cases, this returns the corresponding constant. For SAMx5x chips with [DynLength], this returns the result of [Spi::get_dyn_length].

Return the step size through the SpiFuture buffer

In most cases, this returns the corresponding constant. For SAMx5x chips with [DynLength], this returns a result calculated from Self::len.

Check that the buffer has a valid length

If the transaction length is greater than four, then the size of the buffer must equal the transaction length. If the transaction length is less than or equal to four, then the size of the buffer must be an integer multiple of the transaction length.

Both of these statements apply regardless of whether the Spi has a [DynLength].

Implementors