Class SysFsDeviceFactory
java.lang.Object
com.diozero.internal.provider.AbstractDeviceFactory
com.diozero.internal.provider.BaseNativeDeviceFactory
com.diozero.internal.provider.sysfs.SysFsDeviceFactory
- All Implemented Interfaces:
AnalogInputDeviceFactoryInterface
,AnalogOutputDeviceFactoryInterface
,DeviceFactoryInterface
,GpioDeviceFactoryInterface
,I2CDeviceFactoryInterface
,NativeDeviceFactoryInterface
,PwmOutputDeviceFactoryInterface
,SpiDeviceFactoryInterface
,java.io.Closeable
,java.lang.AutoCloseable
public class SysFsDeviceFactory extends BaseNativeDeviceFactory
-
Field Summary
Fields inherited from class com.diozero.internal.provider.AbstractDeviceFactory
closed, deviceStates
Fields inherited from interface com.diozero.internal.provider.SpiDeviceFactoryInterface
DEFAULT_SPI_BUFFER_SIZE, SPI_PREFIX
-
Constructor Summary
Constructors Constructor Description SysFsDeviceFactory()
-
Method Summary
Modifier and Type Method Description void
close()
AnalogInputDeviceInterface
createAnalogInputDevice(java.lang.String key, PinInfo pinInfo)
AnalogOutputDeviceInterface
createAnalogOutputDevice(java.lang.String key, PinInfo pinInfo)
GpioDigitalInputDeviceInterface
createDigitalInputDevice(java.lang.String key, PinInfo pinInfo, GpioPullUpDown pud, GpioEventTrigger trigger)
GpioDigitalInputOutputDeviceInterface
createDigitalInputOutputDevice(java.lang.String key, PinInfo pinInfo, DeviceMode mode)
GpioDigitalOutputDeviceInterface
createDigitalOutputDevice(java.lang.String key, PinInfo pinInfo, boolean initialValue)
I2CDeviceInterface
createI2CDevice(java.lang.String key, int controller, int address, int addressSize, int clockFrequency)
PwmOutputDeviceInterface
createPwmOutputDevice(java.lang.String key, PinInfo pinInfo, int pwmFrequency, float initialValue)
SpiDeviceInterface
createSpiDevice(java.lang.String key, int controller, int chipSelect, int frequency, SpiClockMode spiClockMode, boolean lsbFirst)
int
getBoardPwmFrequency()
java.lang.String
getName()
boolean
isExported(int gpio)
Check if this pin is exported by checking the existance of /sys/class/gpio/gpioxxx/void
setBoardPwmFrequency(int pwmFrequency)
Methods inherited from class com.diozero.internal.provider.BaseNativeDeviceFactory
getBoardInfo, getBoardPinInfo, getVRef, initialiseBoardInfo, registerDeviceFactory
Methods inherited from class com.diozero.internal.provider.AbstractDeviceFactory
createI2CKey, createPinKey, createSpiKey, deviceClosed, deviceOpened, getDevice, getDevice, isClosed, isDeviceOpened
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.provider.AnalogInputDeviceFactoryInterface
provisionAnalogInputDevice
Methods inherited from interface com.diozero.internal.provider.AnalogOutputDeviceFactoryInterface
provisionAnalogOutputDevice
Methods inherited from interface com.diozero.internal.provider.DeviceFactoryInterface
createI2CKey, createPinKey, createSpiKey, deviceClosed, deviceOpened, getDevice, getDevice, isClosed, isDeviceOpened
Methods inherited from interface com.diozero.internal.provider.GpioDeviceFactoryInterface
provisionDigitalInputDevice, provisionDigitalInputOutputDevice, provisionDigitalOutputDevice
Methods inherited from interface com.diozero.internal.provider.I2CDeviceFactoryInterface
provisionI2CDevice
Methods inherited from interface com.diozero.internal.provider.PwmOutputDeviceFactoryInterface
provisionPwmOutputDevice
Methods inherited from interface com.diozero.internal.provider.SpiDeviceFactoryInterface
getSpiBufferSize, provisionSpiDevice
-
Constructor Details
-
SysFsDeviceFactory
public SysFsDeviceFactory()
-
-
Method Details
-
close
public void close()- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceDeviceFactoryInterface
- Overrides:
close
in classBaseNativeDeviceFactory
-
isExported
public boolean isExported(int gpio)Check if this pin is exported by checking the existance of /sys/class/gpio/gpioxxx/- Parameters:
gpio
- GPIO pin- Returns:
- Returns true if this pin is currently exported
-
getName
public java.lang.String getName() -
getBoardPwmFrequency
public int getBoardPwmFrequency() -
setBoardPwmFrequency
public void setBoardPwmFrequency(int pwmFrequency) -
createDigitalInputDevice
public GpioDigitalInputDeviceInterface createDigitalInputDevice(java.lang.String key, PinInfo pinInfo, GpioPullUpDown pud, GpioEventTrigger trigger) throws RuntimeIOException- Throws:
RuntimeIOException
-
createDigitalOutputDevice
public GpioDigitalOutputDeviceInterface createDigitalOutputDevice(java.lang.String key, PinInfo pinInfo, boolean initialValue) throws RuntimeIOException- Throws:
RuntimeIOException
-
createDigitalInputOutputDevice
public GpioDigitalInputOutputDeviceInterface createDigitalInputOutputDevice(java.lang.String key, PinInfo pinInfo, DeviceMode mode) throws RuntimeIOException- Throws:
RuntimeIOException
-
createPwmOutputDevice
public PwmOutputDeviceInterface createPwmOutputDevice(java.lang.String key, PinInfo pinInfo, int pwmFrequency, float initialValue) throws RuntimeIOException- Throws:
RuntimeIOException
-
createAnalogInputDevice
public AnalogInputDeviceInterface createAnalogInputDevice(java.lang.String key, PinInfo pinInfo) throws RuntimeIOException- Throws:
RuntimeIOException
-
createAnalogOutputDevice
public AnalogOutputDeviceInterface createAnalogOutputDevice(java.lang.String key, PinInfo pinInfo) throws RuntimeIOException- Throws:
RuntimeIOException
-
createSpiDevice
public SpiDeviceInterface createSpiDevice(java.lang.String key, int controller, int chipSelect, int frequency, SpiClockMode spiClockMode, boolean lsbFirst) throws RuntimeIOException- Throws:
RuntimeIOException
-
createI2CDevice
public I2CDeviceInterface createI2CDevice(java.lang.String key, int controller, int address, int addressSize, int clockFrequency) throws RuntimeIOException- Throws:
RuntimeIOException
-