Class LinuxFsSpi
java.lang.Object
com.pi4j.common.IdentityBase
com.pi4j.io.IOBase<Spi, SpiConfig, SpiProvider>
com.pi4j.io.spi.SpiBase
com.pi4j.plugin.linuxfs.provider.spi.LinuxFsSpi
- All Implemented Interfaces:
Describable,Identity,Lifecycle,Extension,IO<Spi, SpiConfig, SpiProvider>,IODataReader,IODataWriter,Spi,AutoCloseable,Readable
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class com.pi4j.common.IdentityBase
description, id, metadata, nameFields inherited from interface com.pi4j.io.spi.Spi
DEFAULT_BAUD, DEFAULT_BUS, DEFAULT_CHIP_SELECT, DEFAULT_MODE, DEFAULT_READ_LSB_FIRST, DEFAULT_WRITE_LSB_FIRST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidopen()intread()intread(byte[] read, int offset, int length) inttransfer(byte[] write, int writeOffset, byte[] read, int readOffset, int numberOfBytes) intwrite(byte b) intwrite(byte[] data, int offset, int length) write SPI_BUFFSIZ most often is set to 4096.Methods inherited from class com.pi4j.io.IOBase
config, context, describe, description, initialize, name, provider, shutdownMethods inherited from class com.pi4j.common.IdentityBase
description, id, metadata, nameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.pi4j.common.Identity
description, getDescription, getId, getMetadata, getName, id, metadata, nameMethods inherited from interface com.pi4j.io.IODataReader
getInputStream, in, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, readByte, readByteBuffer, readByteBuffer, readCharArray, readCharArray, readCharArray, readCharArray, readCharBuffer, readCharBuffer, readCharBuffer, readCharBuffer, readNBytes, readNBytes, readString, readString, readString, readStringMethods inherited from interface com.pi4j.io.IODataWriter
getOutputStream, out, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, writeMethods inherited from interface com.pi4j.common.Lifecycle
initialize, shutdown
-
Constructor Details
-
LinuxFsSpi
-
-
Method Details
-
open
-
close
-
transfer
-
read
public int read()- Specified by:
readin interfaceIODataReader
-
read
public int read(byte[] read, int offset, int length) - Specified by:
readin interfaceIODataReader
-
write
public int write(byte b) - Specified by:
writein interfaceIODataWriter
-
write
public int write(byte[] data, int offset, int length) write SPI_BUFFSIZ most often is set to 4096. See initialize() This implementation can write blocks greater than 4096 byte 'however', read and understand how this is accomplished. A write of data no greater than 4096 bytes is accomplished with a single SPI write operation. So CE line low, write bytes, CE line high A write greater than 4096 bytes will be segmented to multiple writes each 4096 bytes in length, the last write is the MOD value. So, CE line low, write first 4096 bytes CE line high. This pattern will repeat until the last bytes length MOD 4096 are written. This means multiple SPI transaction with you SPI device. If CE line toggling creates problems with your SPI device your application can use a vacant GPIO configured as an Output pin and your application keep the CE pin low during the duration of the call to spi,write.- Specified by:
writein interfaceIODataWriter- Parameters:
data- data array of bytes to be writtenoffset- offset in data buffer to start atlength- number of bytes to be written- Returns:
-