public class SPI extends SensorBase
Modifier and Type | Class and Description |
---|---|
static class |
SPI.Port |
kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPDPChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond
Modifier and Type | Method and Description |
---|---|
void |
free()
Free the resources used by this object
|
int |
read(boolean initiate,
byte[] dataReceived,
int size)
Read a word from the receive FIFO.
|
void |
setChipSelectActiveHigh()
Configure the chip select line to be active high.
|
void |
setChipSelectActiveLow()
Configure the chip select line to be active low.
|
void |
setClockActiveHigh()
Configure the clock output line to be active high.
|
void |
setClockActiveLow()
Configure the clock output line to be active low.
|
void |
setClockRate(int hz)
Configure the rate of the generated clock signal.
|
void |
setLSBFirst()
Configure the order that bits are sent and received on the wire
to be least significant bit first.
|
void |
setMSBFirst()
Configure the order that bits are sent and received on the wire
to be most significant bit first.
|
void |
setSampleDataOnFalling()
Configure that the data is stable on the falling edge and the data
changes on the rising edge.
|
void |
setSampleDataOnRising()
Configure that the data is stable on the rising edge and the data
changes on the falling edge.
|
int |
transaction(byte[] dataToSend,
byte[] dataReceived,
int size)
Perform a simultaneous read/write transaction with the device
|
int |
write(byte[] dataToSend,
int size)
Write data to the slave device.
|
checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, getDefaultSolenoidModule, setDefaultSolenoidModule
public SPI(SPI.Port port)
port
- the physical SPI portpublic void free()
free
in class SensorBase
public final void setClockRate(int hz)
hz
- The clock rate in Hertz.public final void setMSBFirst()
public final void setLSBFirst()
public final void setClockActiveLow()
public final void setClockActiveHigh()
public final void setSampleDataOnFalling()
public final void setSampleDataOnRising()
public final void setChipSelectActiveHigh()
public final void setChipSelectActiveLow()
public int write(byte[] dataToSend, int size)
public int read(boolean initiate, byte[] dataReceived, int size)
initiate
- If true, this function pushes "0" into the
transmit buffer and initiates a transfer.
If false, this function assumes that data is
already in the receive FIFO from a previous write.public int transaction(byte[] dataToSend, byte[] dataReceived, int size)
dataToSend
- The data to be written out to the devicedataReceived
- Buffer to receive data from the devicesize
- The length of the transaction, in bytesCopyright © 2015. All rights reserved.