public class SpiDeviceImpl extends Object implements SpiDevice
| Modifier and Type | Field and Description |
|---|---|
protected SpiChannel |
channel |
protected SpiMode |
mode |
DEFAULT_SPI_MODE, DEFAULT_SPI_SPEED, MAX_SUPPORTED_BYTES| Constructor and Description |
|---|
SpiDeviceImpl(SpiChannel channel)
Creates the SPI Device at the given SPI and input channel
(A default speed of 1 MHz will be used)
|
SpiDeviceImpl(SpiChannel channel,
int speed)
Creates the SPI Device at the given spi and input channel
|
SpiDeviceImpl(SpiChannel channel,
int speed,
SpiMode mode)
Creates the SPI Device at the given spi and input channel
|
SpiDeviceImpl(SpiChannel channel,
SpiMode mode)
Creates the SPI Device at the given SPI and input channel
(A default speed of 1 MHz will be used)
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
write(byte... data)
Attempts to read/write data through this SPI device
|
byte[] |
write(byte[] data,
int start,
int length)
Attempts to read/write data through this SPI device
|
ByteBuffer |
write(ByteBuffer data)
Attempts to read/write data through this SPI device
|
byte[] |
write(InputStream input)
Attempts to read/write data through this SPI device
|
int |
write(InputStream input,
OutputStream output)
Attempts to read/write data through this SPI device
|
short[] |
write(short... data)
Attempts to read/write data through this SPI device
|
short[] |
write(short[] data,
int start,
int length)
Attempts to read/write data through this SPI device
|
String |
write(String data,
Charset charset)
Attempts to read/write data through this SPI device
|
String |
write(String data,
String charset)
Attempts to read/write data through this SPI device
|
protected final SpiChannel channel
public SpiDeviceImpl(SpiChannel channel, int speed, SpiMode mode) throws IOException
channel - spi channel to usespeed - spi speed/rate (in Hertz) for channel to communicate at
(range is 500kHz - 32MHz)mode - spi mode (see http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Mode_numbers)IOExceptionpublic SpiDeviceImpl(SpiChannel channel, int speed) throws IOException
channel - spi channel to usespeed - spi speed/rate (in Hertz) for channel to communicate at
(range is 500kHz - 32MHz)IOExceptionpublic SpiDeviceImpl(SpiChannel channel, SpiMode mode) throws IOException
channel - spi channel to usemode - spi mode (see http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Mode_numbers)IOExceptionpublic SpiDeviceImpl(SpiChannel channel) throws IOException
channel - spi channel to useIOExceptionpublic String write(String data, String charset) throws IOException
SpiDevicewrite in interface SpiDevicedata - bytes (encoded in string) to write to the SPI devicecharset - character encoding for bytes in stringIOExceptionpublic String write(String data, Charset charset) throws IOException
SpiDevicewrite in interface SpiDevicedata - bytes (encoded in string) to write to the SPI devicecharset - character encoding for bytes in stringIOExceptionpublic ByteBuffer write(ByteBuffer data) throws IOException
SpiDevicewrite in interface SpiDevicedata - bytes to write to the SPI deviceIOExceptionpublic byte[] write(InputStream input) throws IOException
SpiDevicewrite in interface SpiDeviceinput - input stream to read from to get
bytes to write to the SPI deviceIOExceptionpublic int write(InputStream input, OutputStream output) throws IOException
SpiDevicewrite in interface SpiDeviceinput - input stream to read from to get
bytes to write to the SPI deviceoutput - output stream to write bytes
read from the SPI deviceIOExceptionpublic byte[] write(byte... data) throws IOException
SpiDevicewrite in interface SpiDevicedata - bytes to write to the SPI deviceIOExceptionpublic short[] write(short... data) throws IOException
SpiDevicewrite in interface SpiDevicedata - bytes to write to the SPI device (Note: short value should not exceed 255.)IOExceptionpublic byte[] write(byte[] data, int start, int length) throws IOException
SpiDevicewrite in interface SpiDevicedata - bytes to write to the SPI devicestart - start index position in the data buffer to start writing fromlength - length of bytes to write from the data bufferIOExceptionpublic short[] write(short[] data, int start, int length) throws IOException
SpiDevicewrite in interface SpiDevicedata - bytes to write to the SPI devicestart - start index position in the data buffer to start writing fromlength - length of bytes to write from the data bufferIOExceptionCopyright © 2012–2019 Pi4J. All rights reserved.