Package com.diozero.devices
Class PCF8574
java.lang.Object
com.diozero.internal.spi.AbstractDeviceFactory
com.diozero.devices.PCF8574
- All Implemented Interfaces:
GpioExpander
,DeviceFactoryInterface
,GpioDeviceFactoryInterface
,Closeable
,AutoCloseable
public class PCF8574 extends AbstractDeviceFactory implements GpioDeviceFactoryInterface, GpioExpander
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PCF8574.PCF8574BoardPinInfo
-
Field Summary
Fields inherited from class com.diozero.internal.spi.AbstractDeviceFactory
closed, deviceStates
-
Constructor Summary
Constructors Constructor Description PCF8574(int controller, int address)
PCF8574(I2CDeviceFactoryInterface deviceFactory, int controller, int address)
-
Method Summary
Modifier and Type Method Description void
close()
Close this device factory including all devices that have been provisioned by it.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()
Get information about pins that can be provisioned by this device factory.String
getName()
Get the name of this device factoryboolean
getValue(int gpio)
byte
getValues(int port)
void
setDirections(int port, byte directions)
Set the directions for all pins on this port using the specified directions bit mask.void
setInputMode(int gpio)
void
setOutputMode(int gpio)
void
setValue(int gpio, boolean value)
void
setValues(int port, byte values)
Set the output value for a pins on this port.Methods inherited from class com.diozero.internal.spi.AbstractDeviceFactory
createI2CKey, createPinKey, createSerialKey, createSpiKey, deviceClosed, deviceOpened, getDevice, isClosed, isDeviceOpened, reopen
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.diozero.internal.spi.DeviceFactoryInterface
createI2CKey, createPinKey, createSerialKey, createSpiKey, deviceClosed, deviceOpened, getDevice, isClosed, isDeviceOpened, reopen, start
Methods inherited from interface com.diozero.internal.spi.GpioDeviceFactoryInterface
provisionDigitalInputDevice, provisionDigitalInputOutputDevice, provisionDigitalOutputDevice
-
Constructor Details
-
PCF8574
public PCF8574(int controller, int address) -
PCF8574
-
-
Method Details
-
createDigitalInputDevice
public GpioDigitalInputDeviceInterface createDigitalInputDevice(String key, PinInfo pinInfo, GpioPullUpDown pud, GpioEventTrigger trigger) throws RuntimeIOException- Specified by:
createDigitalInputDevice
in interfaceGpioDeviceFactoryInterface
- Throws:
RuntimeIOException
-
createDigitalOutputDevice
public GpioDigitalOutputDeviceInterface createDigitalOutputDevice(String key, PinInfo pinInfo, boolean initialValue) throws RuntimeIOException- Specified by:
createDigitalOutputDevice
in interfaceGpioDeviceFactoryInterface
- Throws:
RuntimeIOException
-
createDigitalInputOutputDevice
public GpioDigitalInputOutputDeviceInterface createDigitalInputOutputDevice(String key, PinInfo pinInfo, DeviceMode mode) throws RuntimeIOException- Specified by:
createDigitalInputOutputDevice
in interfaceGpioDeviceFactoryInterface
- Throws:
RuntimeIOException
-
setDirections
public void setDirections(int port, byte directions)Description copied from interface:GpioExpander
Set the directions for all pins on this port using the specified directions bit mask. 0 = output, 1 = input- Specified by:
setDirections
in interfaceGpioExpander
- Parameters:
port
- the bank of up to 8 GPIOsdirections
- bit mask specifying the directions for up to 8 GPIOs. 0 = output, 1 = input
-
getValues
public byte getValues(int port) -
setValues
public void setValues(int port, byte values)Description copied from interface:GpioExpander
Set the output value for a pins on this port.- Specified by:
setValues
in interfaceGpioExpander
- Parameters:
port
- the bank of up to 8 GPIOsvalues
- bit mask specifying on/off values. 1 = on, 0 = off
-
getValue
public boolean getValue(int gpio) -
setValue
public void setValue(int gpio, boolean value) -
close
public void close()Description copied from interface:DeviceFactoryInterface
Close this device factory including all devices that have been provisioned by it.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceDeviceFactoryInterface
- Specified by:
close
in interfaceGpioExpander
- Overrides:
close
in classAbstractDeviceFactory
-
setInputMode
public void setInputMode(int gpio) -
setOutputMode
public void setOutputMode(int gpio) -
getName
Description copied from interface:DeviceFactoryInterface
Get the name of this device factory- Specified by:
getName
in interfaceDeviceFactoryInterface
- Returns:
- the name of this device factory
-
closePin
public void closePin(int gpio) -
getBoardPinInfo
Description copied from interface:DeviceFactoryInterface
Get information about pins that can be provisioned by this device factory.- Specified by:
getBoardPinInfo
in interfaceDeviceFactoryInterface
- Returns:
-