public class SPIConfig
extends java.lang.Object
SPIConfig class encapsulates the configuration parameters of an
SPI device.SPI,
SPIBitOrder,
SPIChipSelect,
SPIClockMode| Constructor | Description |
|---|---|
SPIConfig(SPIClockMode clockMode,
int clockFrequency,
int wordLength) |
Creates a new
SPIConfig with the specified configuration. |
SPIConfig(SPIClockMode clockMode,
SPIChipSelect chipSelect,
SPIBitOrder bitOrder,
int clockFrequency,
int wordLength) |
Creates a new
SPIConfig with the specified configuration. |
| Modifier and Type | Method | Description |
|---|---|---|
SPIBitOrder |
getBitOrder() |
Gets the configured bit ordering.
|
SPIChipSelect |
getChipSelect() |
Gets the configured chip select active level.
|
int |
getClockFrequency() |
Gets the clock frequency in Hz.
|
SPIClockMode |
getClockMode() |
Gets the configured clock mode.
|
int |
getWordLength() |
Gets the word length.
|
public SPIConfig(SPIClockMode clockMode, int clockFrequency, int wordLength)
SPIConfig with the specified configuration.clockMode - The clock mode, one of SPIClockMode.CPOL_0_CPHA_0,
SPIClockMode.CPOL_0_CPHA_1,
SPIClockMode.CPOL_1_CPHA_0, or
SPIClockMode.CPOL_1_CPHA_1.clockFrequency - The clock frequency in Hz.wordLength - The word length.java.lang.IllegalArgumentException - If clockFrequency < 1 or
if wordLength < 1.java.lang.NullPointerException - If clockMode == null.SPIClockModepublic SPIConfig(SPIClockMode clockMode, SPIChipSelect chipSelect, SPIBitOrder bitOrder, int clockFrequency, int wordLength)
SPIConfig with the specified configuration.clockMode - The clock mode, one of SPIClockMode.CPOL_0_CPHA_0,
SPIClockMode.CPOL_0_CPHA_1,
SPIClockMode.CPOL_1_CPHA_0, or
SPIClockMode.CPOL_1_CPHA_1.chipSelect - The chip select active level, one of
SPIChipSelect.ACTIVE_HIGH,
SPIChipSelect.ACTIVE_LOW, or
SPIChipSelect.NOT_CONTROLLED.bitOrder - The bit ordering, one of SPIBitOrder.MSB_FIRST or
SPIBitOrder.LSB_FIRST.clockFrequency - The clock frequency in Hz.wordLength - The word length.java.lang.IllegalArgumentException - If clockFrequency < 1 or
if wordLength < 1.java.lang.NullPointerException - If clockMode == null or
if chipSelect == null or
if bitOrder == null.SPIClockMode,
SPIChipSelect,
SPIBitOrderpublic SPIClockMode getClockMode()
SPIClockMode.CPOL_0_CPHA_0,
SPIClockMode.CPOL_0_CPHA_1,
SPIClockMode.CPOL_1_CPHA_0, or
SPIClockMode.CPOL_1_CPHA_1.SPIClockModepublic SPIChipSelect getChipSelect()
SPIChipSelect.ACTIVE_HIGH,
SPIChipSelect.ACTIVE_LOW, or
SPIChipSelect.NOT_CONTROLLED.SPIChipSelectpublic SPIBitOrder getBitOrder()
SPIBitOrder.MSB_FIRST or
SPIBitOrder.LSB_FIRST.SPIBitOrderpublic int getClockFrequency()
public int getWordLength()