Class LinuxFsSpi

All Implemented Interfaces:
Describable, Identity, Lifecycle, Extension, IO<Spi,SpiConfig,SpiProvider>, IODataReader, IODataWriter, Spi, AutoCloseable, Readable

public class LinuxFsSpi extends SpiBase implements Spi
SPI implementation that uses JNA bindings to the Linux SPI device (i.e. /dev/spidev0.0). Only supports writing but it works to drive an SSD1306 OLED display.
Since:
10/3/24.
Author:
mpilone
See Also:
  • Constructor Details

  • Method Details

    • open

      public void open()
      Specified by:
      open in interface Spi
      Overrides:
      open in class SpiBase
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Spi
      Overrides:
      close in class SpiBase
    • transfer

      public int transfer(byte[] write, int writeOffset, byte[] read, int readOffset, int numberOfBytes)
      Specified by:
      transfer in interface Spi
    • read

      public int read()
      Specified by:
      read in interface IODataReader
    • read

      public int read(byte[] read, int offset, int length)
      Specified by:
      read in interface IODataReader
    • write

      public int write(byte b)
      Specified by:
      write in interface IODataWriter
    • write

      public int write(byte[] data, int offset, int length)
      Specified by:
      write in interface IODataWriter