public class MCP23008Old extends AbstractDeviceFactory implements GpioDeviceFactoryInterface, InputEventListener<DigitalInputEvent>, GpioExpander
The MCP23X08 consists of multiple 8-bit configuration registers for input, output and polarity selection. The system master can enable the I/Os as either inputs or outputs by writing the I/O configuration bits (IODIRA/B). The data for each input or output is kept in the corresponding input or output register. The polarity of the Input Port register can be inverted with the Polarity Inversion register. All registers can be read by the system master.
The interrupt output can be configured to activate under two conditions (mutually exclusive):
The Interrupt Capture register captures port values at the time of the interrupt, thereby saving the condition that caused the interrupt.
The Power-on Reset (POR) sets the registers to their default values and initializes the device state machine.
The hardware address pins are used to determine the device address.
Modifier and Type | Class and Description |
---|---|
static class |
MCP23008Old.InterruptMode |
static class |
MCP23008Old.MCP23008DigitalInputDevice |
static class |
MCP23008Old.MCP23008DigitalOutputDevice |
closed, deviceStates
Constructor and Description |
---|
MCP23008Old() |
MCP23008Old(int interruptGpio) |
MCP23008Old(int controller,
int address,
int interruptGpioNumber) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
closePin(int gpio) |
GpioDigitalInputDeviceInterface |
createDigitalInputDevice(String key,
PinInfo pinInfo,
GpioPullUpDown pud,
GpioEventTrigger trigger) |
GpioDigitalInputOutputDeviceInterface |
createDigitalInputOutputDevice(String key,
PinInfo pinInfo,
DeviceMode mode) |
GpioDigitalOutputDeviceInterface |
createDigitalOutputDevice(String key,
PinInfo pinInfo,
boolean initialValue) |
BoardPinInfo |
getBoardPinInfo() |
String |
getName() |
boolean |
getValue(int gpio) |
void |
setDirections(int port,
byte directions) |
void |
setValue(int gpio,
boolean value) |
void |
setValues(int port,
byte values) |
void |
valueChanged(DigitalInputEvent event) |
createPinKey, deviceClosed, deviceOpened, getDevice, isClosed, isDeviceOpened
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
provisionDigitalInputDevice, provisionDigitalInputOutputDevice, provisionDigitalOutputDevice
createPinKey, deviceClosed, deviceOpened, isClosed, isDeviceOpened
public MCP23008Old() throws RuntimeIOException
RuntimeIOException
public MCP23008Old(int interruptGpio) throws RuntimeIOException
RuntimeIOException
public MCP23008Old(int controller, int address, int interruptGpioNumber) throws RuntimeIOException
RuntimeIOException
public String getName()
getName
in interface DeviceFactoryInterface
public GpioDigitalInputDeviceInterface createDigitalInputDevice(String key, PinInfo pinInfo, GpioPullUpDown pud, GpioEventTrigger trigger)
createDigitalInputDevice
in interface GpioDeviceFactoryInterface
public GpioDigitalOutputDeviceInterface createDigitalOutputDevice(String key, PinInfo pinInfo, boolean initialValue)
createDigitalOutputDevice
in interface GpioDeviceFactoryInterface
public GpioDigitalInputOutputDeviceInterface createDigitalInputOutputDevice(String key, PinInfo pinInfo, DeviceMode mode)
createDigitalInputOutputDevice
in interface GpioDeviceFactoryInterface
public boolean getValue(int gpio) throws RuntimeIOException
RuntimeIOException
public void setValue(int gpio, boolean value) throws RuntimeIOException
RuntimeIOException
public void setDirections(int port, byte directions)
setDirections
in interface GpioExpander
public void setValues(int port, byte values)
setValues
in interface GpioExpander
public void close() throws RuntimeIOException
close
in interface GpioExpander
close
in interface DeviceFactoryInterface
close
in interface Closeable
close
in interface AutoCloseable
close
in class AbstractDeviceFactory
RuntimeIOException
public void closePin(int gpio) throws RuntimeIOException
RuntimeIOException
public void valueChanged(DigitalInputEvent event)
valueChanged
in interface InputEventListener<DigitalInputEvent>
public BoardPinInfo getBoardPinInfo()
getBoardPinInfo
in interface DeviceFactoryInterface
Copyright © 2016–2017 mattjlewis. All rights reserved.