Class SpiDevice

java.lang.Object
com.diozero.api.SpiDevice
All Implemented Interfaces:
DeviceInterface, SpiDeviceInterface, Closeable, AutoCloseable

public class SpiDevice
extends Object
implements SpiDeviceInterface
Serial Peripheral Interface device
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  SpiDevice.Builder
    I2C device builder.
  • Constructor Summary

    Constructors
    Constructor Description
    SpiDevice​(int chipSelect)  
    SpiDevice​(int controller, int chipSelect)  
    SpiDevice​(int controller, int chipSelect, int frequency, SpiClockMode mode, boolean lsbFirst)  
  • Method Summary

    Modifier and Type Method Description
    static SpiDevice.Builder builder​(int chipSelect)
    Construct a new SPI device builder instance using the specified chip select value
    void close()
    Close this device
    int getChipSelect()
    Get the SPI Chip Select
    int getController()
    Get the SPI controller
    String getKey()
    Get the unique device identifier for this device
    boolean isOpen()
    Check if this device is open or closed
    void write​(byte... txBuffer)
    Write the entire contents of data to the device
    void write​(byte[] txBuffer, int txOffset, int length)
    Write length bytes from data starting at offset
    byte[] writeAndRead​(byte... out)
    Write the data to the device then read data.length bytes from the device

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait