java.lang.Object
com.pi4j.common.IdentityBase
com.pi4j.io.IOBase<Spi,SpiConfig,SpiProvider>
com.pi4j.io.spi.SpiBase
com.pi4j.plugin.pigpio.provider.spi.PiGpioSpi
- All Implemented Interfaces:
Describable,Identity,Lifecycle,Extension,IO<Spi,,SpiConfig, SpiProvider> IODataReader,IODataWriter,Spi,AutoCloseable,Readable
PiGpioSpi class.
- Version:
- $Id: $Id
- Author:
- Robert Savage (http://www.savagehomeautomation.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intprotected final PiGpioprotected static intprotected static intFields 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 -
Constructor Summary
ConstructorsConstructorDescriptionPiGpioSpi(PiGpio piGpio, SpiProvider provider, SpiConfig config) Constructor for PiGpioSpi. -
Method Summary
Methods inherited from class com.pi4j.io.IOBase
config, context, describe, description, 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, write
-
Field Details
-
piGpio
-
handle
protected final int handle -
SPI_BUS_MASK
protected static int SPI_BUS_MASK -
SPI_MODE_MASK
protected static int SPI_MODE_MASK
-
-
Constructor Details
-
PiGpioSpi
Constructor for PiGpioSpi.
- Parameters:
piGpio- aPiGpioobject.provider- aSpiProviderobject.config- aSpiConfigobject. ------------------------------------------------------------------ spiFlags consists of the least significant 22 bits. ------------------------------------------------------------------ 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 b b b b b b R T n n n n W A u2 u1 u0 p2 p1 p0 m m [mm] defines the SPI mode. Warning: modes 1 and 3 do not appear to work on the auxiliary SPI. Mode POL PHA 0 0 0 1 0 1 2 1 0 3 1 1 [px] is 0 if CEx is active low (default) and 1 for active high. [ux] is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise. [A] is 0 for the main SPI, 1 for the auxiliary SPI. [W] is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main SPI only. [nnnn] defines the number of bytes (0-15) to write before switching the MOSI line to MISO to read data. This field is ignored if W is not set. Main SPI only. [T] is 1 if the least significant bit is transmitted on MOSI first, the default (0) shifts the most significant bit out first. Auxiliary SPI only. [R] is 1 if the least significant bit is received on MISO first, the default (0) receives the most significant bit first. Auxiliary SPI only. [bbbbbb] defines the word size in bits (0-32). The default (0) sets 8 bits per word. Auxiliary SPI only.
-
-
Method Details
-
initialize
- Specified by:
initializein interfaceLifecycle- Overrides:
initializein classIOBase<Spi,SpiConfig, SpiProvider> - Throws:
InitializeException
-
close
-
transfer
-
write
public int write(byte b) - Specified by:
writein interfaceIODataWriter
-
write
public int write(byte[] data, int offset, int length) - Specified by:
writein interfaceIODataWriter
-
read
public int read()- Specified by:
readin interfaceIODataReader
-
read
public int read(byte[] buffer, int offset, int length) - Specified by:
readin interfaceIODataReader
-