public class

SPIConfig

extends Object
java.lang.Object
   ↳ com.digi.android.spi.SPIConfig

Class Overview

The SPIConfig class encapsulates the configuration parameters of an SPI device.

See also:

Summary

Public Constructors
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.
Public Methods
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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public SPIConfig (SPIClockMode clockMode, int clockFrequency, int wordLength)

Creates a new SPIConfig with the specified configuration.

Parameters
clockMode SPIClockMode: 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 int: The clock frequency in Hz.
wordLength int: The word length.
Throws
IllegalArgumentException If clockFrequency < 1 or if wordLength < 1.
NullPointerException If clockMode == null.

See also:

public SPIConfig (SPIClockMode clockMode, SPIChipSelect chipSelect, SPIBitOrder bitOrder, int clockFrequency, int wordLength)

Creates a new SPIConfig with the specified configuration.

Parameters
clockMode SPIClockMode: 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 SPIChipSelect: The chip select active level, one of SPIChipSelect.ACTIVE_HIGH, SPIChipSelect.ACTIVE_LOW, or SPIChipSelect.NOT_CONTROLLED.
bitOrder SPIBitOrder: The bit ordering, one of SPIBitOrder.MSB_FIRST or SPIBitOrder.LSB_FIRST.
clockFrequency int: The clock frequency in Hz.
wordLength int: The word length.
Throws
IllegalArgumentException If clockFrequency < 1 or if wordLength < 1.
NullPointerException If clockMode == null or if chipSelect == null or if bitOrder == null.

Public Methods

public SPIBitOrder getBitOrder ()

Gets the configured bit ordering.

Returns
SPIBitOrder The bit ordering, one of SPIBitOrder.MSB_FIRST or SPIBitOrder.LSB_FIRST.

See also:

public SPIChipSelect getChipSelect ()

Gets the configured chip select active level.

Returns
SPIChipSelect The chip select active level, one of SPIChipSelect.ACTIVE_HIGH, SPIChipSelect.ACTIVE_LOW, or SPIChipSelect.NOT_CONTROLLED.

See also:

public int getClockFrequency ()

Gets the clock frequency in Hz.

Returns
int The clock frequency in Hz.

public SPIClockMode getClockMode ()

Gets the configured clock mode.

Returns
SPIClockMode 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.

See also:

public int getWordLength ()

Gets the word length.

Returns
int The word length.