exp: golang.org/x/exp/io/spi/driver Index | Files

package driver

import "golang.org/x/exp/io/spi/driver"

Package driver contains interfaces to be implemented by various SPI implementations.

Index

Package Files

driver.go

Constants

const (
    Mode = iota
    Bits
    Speed
    Order
    Delay
)

type Conn

type Conn interface {
    // Configure configures the SPI device.
    //
    // Available configuration keys are:
    //  - Mode, the SPI mode (valid values are 0, 1, 2 and 3).
    //  - Bits, bits per word (default is 8-bit per word).
    //  - Speed, the max clock speed (in Hz).
    //  - Order, bit order to be used in transfers. Zero value represents
    //    the MSB-first, non-zero values represent LSB-first encoding.
    //  - Delay, the pause time between frames (in usecs).
    //    Some SPI devices require a minimum amount of wait time after
    //    each frame write. If set, Delay amount of usecs are inserted after
    //    each write.
    //
    // SPI devices can override these values.
    Configure(k, v int) error

    // Transfer transfers tx and reads into rx.
    Transfer(tx, rx []byte) error

    // Close frees the underlying resources and closes the connection.
    Close() error
}

Conn is a connection to an SPI device. TODO(jbd): Extend the interface to query configuration values.

type Opener

type Opener interface {
    Open(bus, chip int) (Conn, error)
}

Opener is an interface to be implemented by the SPI driver to open a connection an SPI device with the specified bus and chip number.

Package driver is imported by 1 packages. Updated 6 days ago. Refresh now. Tools for package owners.