Link Search Menu Expand Document

Serial Peripheral Interface (SPI) Devices

class com.diozero.api.SpiDevice (controller, chipSelect, frequency, mode, lsbFirst) source ΒΆ

Class for reading / writing to SPI devices.

  • controller (int) - SPI controller.

  • chipSelect (int) - Chip Select, aka Chip Enable.

  • frequency (int) - SPI frequency in HZ.

  • mode (SpiClockMode) - SPI clock mode to be used, 1 for each combination of Clock Polarity / Clock Phase. See Wikiepedia for further information.

  • lsbFirst (boolean) - Byte order to use in communication.

write (out)

: Write data to the device.

  • out (ByteBuffer) - the data to write.

ByteBuffer writeAndRead (out)

: Write and then read data to the device in the same transaction. The number of bytes read is the same as that written. Maximum output buffer size is 2048 bytes.

  • out (ByteBuffer) - the data to write.