tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/spi.go (about)

     1  package drivers
     2  
     3  // SPI represents a SPI bus. It is implemented by the machine.SPI type.
     4  type SPI interface {
     5  	// Tx transmits the given buffer w and receives at the same time the buffer r.
     6  	// The two buffers must be the same length. The only exception is when w or r are nil,
     7  	// in which case Tx only transmits (without receiving) or only receives (while sending 0 bytes).
     8  	Tx(w, r []byte) error
     9  
    10  	// Transfer writes a single byte out on the SPI bus and receives a byte at the same time.
    11  	// If you want to transfer multiple bytes, it is more efficient to use Tx instead.
    12  	Transfer(b byte) (byte, error)
    13  }