Class SpiDevice

java.lang.Object
com.codename1.hardware.SpiDevice

public final class SpiDevice extends Object
A device on an SPI bus, opened through Hardware.openSpi(int, int, int, int, int).
  • Method Details

    • getBus

      public int getBus()
      The SPI controller number.
    • getChipSelect

      public int getChipSelect()
      The chip-select line.
    • transfer

      public byte[] transfer(byte[] tx) throws HardwareException

      Clocks tx out and returns the bytes clocked in at the same time.

      Throws
      • HardwareException: when the transfer fails or the device is closed
      Throws:
      HardwareException
    • transfer

      public void transfer(byte[] tx, byte[] rx) throws HardwareException

      Clocks tx out while filling rx; both must be the same length, and may be the same array.

      Throws
      • HardwareException: when the transfer fails or the device is closed
      Throws:
      HardwareException
    • close

      public void close()
      Releases the device. Closing twice is harmless.