Abstract interface for configuring a SPI bus, and initiating data transfers using it.
A concrete implementation of this interface class must be defined in order to use pw_spi with a specific target.
Initiator configures the SPI bus to communicate with a defined set of common bus parameters that include:
These bus configuration parameters are aggregated in the pw::spi::Config structure, and passed to the pw::spi::Initiator via its Configure method.
Public Member Functions | |
| Status | Configure (const Config &config) |
| Status | WriteRead (ConstByteSpan write_buffer, ByteSpan read_buffer) |
Configures the SPI bus to communicate with responders using a given set of properties, including the clock polarity, clock phase, bit-order, and bits-per-word.
OkStatus() on success, and implementation-specific values on failure.
|
privatepure virtual |
Implemented in pw::spi::MockInitiator.
|
inline |
Performs a synchronous read/write operation on the SPI bus. Data from the write_buffer object is written to the bus, while the read_buffer is populated with incoming data on the bus. The operation will ensure that all requested data is written-to and read-from the bus. In the event the read buffer is smaller than the write buffer (or zero-size), any additional input bytes are discarded. In the event the write buffer is smaller than the read buffer (or zero size), the output is padded with 0-bits for the remainder of the transfer.
OkStatus() on success, and implementation-specific values on failure.