public class MCP23S17GpioProvider extends GpioProviderBase implements GpioProvider
This GPIO provider implements the MCP23S17 SPI GPIO expansion board as native Pi4J GPIO pins. More information about the board can be found here: * http://ww1.microchip.com/downloads/en/DeviceDoc/21952b.pdf
The MCP23S17 is connected via SPI connection to the Raspberry Pi and provides 16 GPIO pins that can be used for either digital input or digital output pins.
| Modifier and Type | Field and Description |
|---|---|
static byte |
DEFAULT_ADDRESS |
static String |
DESCRIPTION |
static String |
NAME |
static byte |
READ_FLAG |
static int |
SPI_SPEED |
static byte |
WRITE_FLAG |
cache, isshutdown, listeners| Constructor and Description |
|---|
MCP23S17GpioProvider(byte spiAddress,
int spiChannel) |
MCP23S17GpioProvider(byte spiAddress,
int spiChannel,
int spiSpeed) |
| Modifier and Type | Method and Description |
|---|---|
void |
export(Pin pin,
PinMode mode) |
PinMode |
getMode(Pin pin) |
String |
getName() |
PinPullResistance |
getPullResistance(Pin pin) |
PinState |
getState(Pin pin) |
protected byte |
read(byte register) |
void |
setMode(Pin pin,
PinMode mode) |
void |
setPullResistance(Pin pin,
PinPullResistance resistance) |
void |
setState(Pin pin,
PinState state) |
void |
shutdown() |
void |
unexport(Pin pin) |
protected void |
write(byte register,
byte data) |
addListener, dispatchPinAnalogValueChangeEvent, dispatchPinDigitalStateChangeEvent, getPinCache, getPwm, getValue, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setPwm, setValueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddListener, getPwm, getValue, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setPwm, setValuepublic static final String NAME
public static final String DESCRIPTION
public static final byte DEFAULT_ADDRESS
public static final int SPI_SPEED
public static final byte WRITE_FLAG
public static final byte READ_FLAG
public MCP23S17GpioProvider(byte spiAddress,
int spiChannel)
throws IOException
IOExceptionpublic MCP23S17GpioProvider(byte spiAddress,
int spiChannel,
int spiSpeed)
throws IOException
IOExceptionprotected void write(byte register,
byte data)
protected byte read(byte register)
public String getName()
getName in interface GpioProvidergetName in class GpioProviderBasepublic void export(Pin pin, PinMode mode)
export in interface GpioProviderexport in class GpioProviderBasepublic void unexport(Pin pin)
unexport in interface GpioProviderunexport in class GpioProviderBasepublic void setMode(Pin pin, PinMode mode)
setMode in interface GpioProvidersetMode in class GpioProviderBasepublic PinMode getMode(Pin pin)
getMode in interface GpioProvidergetMode in class GpioProviderBasepublic void setState(Pin pin, PinState state)
setState in interface GpioProvidersetState in class GpioProviderBasepublic PinState getState(Pin pin)
getState in interface GpioProvidergetState in class GpioProviderBasepublic void setPullResistance(Pin pin, PinPullResistance resistance)
setPullResistance in interface GpioProvidersetPullResistance in class GpioProviderBasepublic PinPullResistance getPullResistance(Pin pin)
getPullResistance in interface GpioProvidergetPullResistance in class GpioProviderBasepublic void shutdown()
shutdown in interface GpioProvidershutdown in class GpioProviderBaseCopyright © 2012-2013 Pi4J. All Rights Reserved.