Interface SpiDeviceInterface

All Superinterfaces:
AutoCloseable, DeviceInterface
All Known Subinterfaces:
InternalSpiDeviceInterface
All Known Implementing Classes:
DefaultNativeSpiDevice, SpiDevice

public interface SpiDeviceInterface
extends DeviceInterface
  • Method Summary

    Modifier and Type Method Description
    int getChipSelect()
    Get the SPI Chip Select
    int getController()
    Get the SPI controller
    void write​(byte... data)
    Write the entire contents of data to the device
    void write​(byte[] data, int offset, int length)
    Write length bytes from data starting at offset
    byte[] writeAndRead​(byte... data)
    Write the data to the device then read data.length bytes from the device

    Methods inherited from interface com.diozero.api.DeviceInterface

    close
  • Method Details

    • getController

      int getController()
      Get the SPI controller
      Returns:
      the SPI controller
    • getChipSelect

      int getChipSelect()
      Get the SPI Chip Select
      Returns:
      the SPI chip select
    • write

      void write​(byte... data) throws RuntimeIOException
      Write the entire contents of data to the device
      Parameters:
      data - the data to write
      Throws:
      RuntimeIOException - if an I/O error occurs
    • write

      void write​(byte[] data, int offset, int length) throws RuntimeIOException
      Write length bytes from data starting at offset
      Parameters:
      data - the data to write.
      offset - the start offset in the data.
      length - the number of bytes to write.
      Throws:
      RuntimeIOException - if an I/O error occurs
    • writeAndRead

      byte[] writeAndRead​(byte... data) throws RuntimeIOException
      Write the data to the device then read data.length bytes from the device
      Parameters:
      data - the data to write.
      Returns:
      the data read from the device, same length as the data written.
      Throws:
      RuntimeIOException - if an I/O error occurs