RAII object providing exclusive access to the SPI device. Enables thread-safe Read
, Write
, and WriteRead
operations, as well as composite operations consisting of multiple, uninterrupted transfers, with configurable chip select behavior.
Public Member Functions | |
Transaction (Transaction &&other) | |
Transaction objects are moveable but not copyable. | |
Transaction & | operator= (Transaction &&other) |
Transaction (const Transaction &)=delete | |
Transaction & | operator= (const Transaction &)=delete |
Status | Read (ByteSpan read_buffer) |
Status | Write (ConstByteSpan write_buffer) |
Status | WriteRead (ConstByteSpan write_buffer, ByteSpan read_buffer) |
Synchronously reads data from the SPI responder until the provided read_buffer
is full.
OkStatus()
on success, and implementation-specific values on failure.
|
inline |
Synchronously writes the contents of write_buffer
to the SPI responder.
OkStatus()
on success, and implementation-specific values on failure.
|
inline |
Performs a synchronous read/write transfer 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.