public abstract class MCP23xxx extends AbstractDeviceFactory implements GpioDeviceFactoryInterface, PwmOutputDeviceFactoryInterface, InputEventListener<DigitalInputEvent>, GpioExpander
Modifier and Type | Field and Description |
---|---|
static int |
INTERRUPT_GPIO_NOT_SET |
closed, deviceStates
Constructor and Description |
---|
MCP23xxx(int numPorts,
String deviceName) |
MCP23xxx(int numPorts,
String deviceName,
int interruptGpio) |
MCP23xxx(int numPorts,
String deviceName,
int interruptGpioA,
int interruptGpioB) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
closeGpio(int gpio) |
GpioDigitalInputDeviceInterface |
createDigitalInputDevice(String key,
PinInfo pin_info,
GpioPullUpDown pud,
GpioEventTrigger trigger) |
GpioDigitalInputOutputDeviceInterface |
createDigitalInputOutputDevice(String key,
PinInfo pin_info,
DeviceMode mode) |
GpioDigitalOutputDeviceInterface |
createDigitalOutputDevice(String key,
PinInfo pin_info,
boolean initialValue) |
PwmOutputDeviceInterface |
createPwmOutputDevice(String key,
PinInfo pinInfo,
int pwmFrequency,
float initialValue) |
int |
getBoardPwmFrequency() |
protected abstract int |
getDefValReg(int port) |
protected abstract int |
getGPIntEnReg(int port) |
protected abstract int |
getGPIOReg(int port) |
protected abstract int |
getGPPullUpReg(int port) |
protected abstract int |
getIntCapReg(int port) |
protected abstract int |
getIntConReg(int port) |
protected abstract int |
getIntFReg(int port) |
protected abstract int |
getIOConReg(int port) |
protected abstract int |
getIODirReg(int port) |
protected abstract int |
getIPolReg(int port) |
String |
getName() |
protected abstract int |
getOLatReg(int port) |
boolean |
getValue(int gpio) |
byte |
getValues(int port) |
protected void |
initialise() |
protected abstract byte |
readByte(int register) |
void |
setBoardPwmFrequency(int frequency) |
void |
setDirections(int port,
byte directions) |
protected void |
setInputMode(int gpio,
GpioPullUpDown pud,
GpioEventTrigger trigger) |
protected void |
setOutputMode(int gpio) |
void |
setValue(int gpio,
boolean value) |
void |
setValues(int port,
byte values) |
void |
valueChanged(DigitalInputEvent event) |
protected abstract void |
writeByte(int register,
byte value) |
createPinKey, deviceClosed, deviceOpened, getDevice, isClosed, isDeviceOpened
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
provisionDigitalInputDevice, provisionDigitalInputOutputDevice, provisionDigitalOutputDevice
provisionPwmOutputDevice
createPinKey, deviceClosed, deviceOpened, getBoardPinInfo, isClosed, isDeviceOpened
public static final int INTERRUPT_GPIO_NOT_SET
public MCP23xxx(int numPorts, String deviceName) throws RuntimeIOException
RuntimeIOException
public MCP23xxx(int numPorts, String deviceName, int interruptGpio) throws RuntimeIOException
RuntimeIOException
public MCP23xxx(int numPorts, String deviceName, int interruptGpioA, int interruptGpioB) throws RuntimeIOException
RuntimeIOException
public final String getName()
getName
in interface DeviceFactoryInterface
protected final void initialise()
public GpioDigitalInputDeviceInterface createDigitalInputDevice(String key, PinInfo pin_info, GpioPullUpDown pud, GpioEventTrigger trigger)
createDigitalInputDevice
in interface GpioDeviceFactoryInterface
public GpioDigitalOutputDeviceInterface createDigitalOutputDevice(String key, PinInfo pin_info, boolean initialValue)
createDigitalOutputDevice
in interface GpioDeviceFactoryInterface
public GpioDigitalInputOutputDeviceInterface createDigitalInputOutputDevice(String key, PinInfo pin_info, DeviceMode mode)
createDigitalInputOutputDevice
in interface GpioDeviceFactoryInterface
public PwmOutputDeviceInterface createPwmOutputDevice(String key, PinInfo pinInfo, int pwmFrequency, float initialValue)
createPwmOutputDevice
in interface PwmOutputDeviceFactoryInterface
public int getBoardPwmFrequency()
getBoardPwmFrequency
in interface PwmOutputDeviceFactoryInterface
public void setBoardPwmFrequency(int frequency)
setBoardPwmFrequency
in interface PwmOutputDeviceFactoryInterface
protected void setInputMode(int gpio, GpioPullUpDown pud, GpioEventTrigger trigger)
protected void setOutputMode(int gpio)
public boolean getValue(int gpio) throws RuntimeIOException
RuntimeIOException
public void setValue(int gpio, boolean value) throws RuntimeIOException
RuntimeIOException
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 closeGpio(int gpio) throws RuntimeIOException
RuntimeIOException
public void valueChanged(DigitalInputEvent event)
valueChanged
in interface InputEventListener<DigitalInputEvent>
protected abstract int getIODirReg(int port)
protected abstract int getIPolReg(int port)
protected abstract int getGPIntEnReg(int port)
protected abstract int getDefValReg(int port)
protected abstract int getIntConReg(int port)
protected abstract int getIOConReg(int port)
protected abstract int getGPPullUpReg(int port)
protected abstract int getIntFReg(int port)
protected abstract int getIntCapReg(int port)
protected abstract int getGPIOReg(int port)
protected abstract int getOLatReg(int port)
protected abstract byte readByte(int register)
protected abstract void writeByte(int register, byte value)
public final void setDirections(int port, byte directions)
setDirections
in interface GpioExpander
public byte getValues(int port)
public final void setValues(int port, byte values)
setValues
in interface GpioExpander
Copyright © 2016–2017 mattjlewis. All rights reserved.