|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--SPI400EM
This class is a thin wrapper over a SPI native library for the DS400em's SPI device This is a master only implementation. Data rate is either 1 or 2 MHz, depending on whether "divide" is set to one or not respectively
| Constructor Summary | |
SPI400EM()
Construct an SPI object with default configuration state which includes: No clock divider Use SS line 0 CPOL = 0 CPOL = 1 |
|
SPI400EM(boolean divide,
int ss_channel,
boolean CPOL,
boolean CPHA)
Construct an SPI object with all configuration state specified. |
|
| Method Summary | |
void |
setPhase(boolean CPHA)
Select the Phase of the SCLK line. |
void |
setPolarity(boolean CPOL)
Select the Polarity of the SCLK line. |
void |
SlaveSelectChannel(int ss_channel)
Change the SS line used for communication. |
int |
xmit(byte[] ba,
int off,
int len)
Write len bytes of data to MOSI. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SPI400EM()
public SPI400EM(boolean divide,
int ss_channel,
boolean CPOL,
boolean CPHA)
divide - Use internal clock divider of 2 - true/falsess_channel - SS channel to use, 0 through 2, 3 is the "off" state
setting ss_channel to 3 will result in SS 3 being always on.CPOL - set to true or false selects the polarity of the clockCPHA - set to true or false selects the phase of the clock| Method Detail |
public int xmit(byte[] ba,
int off,
int len)
len bytes of data to MOSI. Return data
simultaneously read from MISO. Source data is contained
in ba starting at off. Read data is returned
in the same positions within the array.
ba - source byte array, contains data to be written to the SPI slaveoff - starting offset into balen - number of bytes to writepublic void SlaveSelectChannel(int ss_channel)
ss_channel - The SS channel to use 0-2public void setPolarity(boolean CPOL)
true,
the SCLK will idle high, otherwise the SCLK will idle low
CPOL - set to true forces SCLK to idle highpublic void setPhase(boolean CPHA)
true,
the SCLK will transition at the start of bit timing
CPHA - set to true forces SCLK to transition at start of bit timing
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||