Skip to content

[Discussion] Read and Ignore traits for blocking SPI operations #52

Closed
@austinglaser

Description

@austinglaser

Currently, there are the blocking::spi::Transfer and blocking::spi::Write traits. However, there times when one might want to read data out of a slave, without caring about what gets transmitted -- a blocking::spi::Read

This could be done with the blocking::spi::Transfer trait, but a separate trait provides two advantages:

  • No need to allocate a dummy buffer to pass in as words
  • An implementer of blocking::spi::Read could allow the MOSI pin to be optional

Going even further, there are times when a driver simply requires some clock cycles on the bus -- but will not be shifting meaningful data either in or out. This may seem like a corner case, but I've encountered this exact situation when configuring an ice40 FPGA. For reference, see page 19 of the programming and configuration manual. It's also a requirement for some commodity SPI flash devices.

This could be served by a blocking::spi::Ignore trait, which just takes a number of bytes to ignore.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions