Package com.pi4j.io.gpio.impl
Class GpioControllerImpl
- java.lang.Object
-
- com.pi4j.io.gpio.impl.GpioControllerImpl
-
- All Implemented Interfaces:
GpioController
public class GpioControllerImpl extends Object implements GpioController
-
-
Constructor Summary
Constructors Constructor Description GpioControllerImpl()
Default ConstructorGpioControllerImpl(GpioProvider provider)
Default Constructor
-
Method Summary
-
-
-
Constructor Detail
-
GpioControllerImpl
public GpioControllerImpl()
Default Constructor
-
GpioControllerImpl
public GpioControllerImpl(GpioProvider provider)
Default Constructor
-
-
Method Detail
-
getProvisionedPins
public Collection<GpioPin> getProvisionedPins()
- Specified by:
getProvisionedPins
in interfaceGpioController
-
getProvisionedPin
public GpioPin getProvisionedPin(Pin pin)
- Specified by:
getProvisionedPin
in interfaceGpioController
-
getProvisionedPin
public GpioPin getProvisionedPin(String name)
- Specified by:
getProvisionedPin
in interfaceGpioController
-
unexportAll
public void unexportAll()
Description copied from interface:GpioController
Unexport all GPIO pins that have been provisioned by Pi4J in the context of this program.- Specified by:
unexportAll
in interfaceGpioController
-
export
public void export(PinMode mode, GpioPin... pin)
- Specified by:
export
in interfaceGpioController
-
export
public void export(PinMode mode, PinState defaultState, GpioPin... pin)
- Specified by:
export
in interfaceGpioController
-
isExported
public boolean isExported(GpioPin... pin)
- Specified by:
isExported
in interfaceGpioController
- Parameters:
pin
-- Returns:
A value of 'true' is returned if the requested pin is exported.
-
unexport
public void unexport(GpioPin... pin)
Description copied from interface:GpioController
Unexport a GPIO pin by GpioPin instance. This method will unexport an existing provisoned pin- Specified by:
unexport
in interfaceGpioController
- Parameters:
pin
- provisioned GPIO pin instance
-
unexport
public void unexport(Pin... pin)
Description copied from interface:GpioController
Unexport a GPIO pin by Pin instance. This method will explicitly unexport any Pin whether it has been provisioned in Pi4J or not.- Specified by:
unexport
in interfaceGpioController
- Parameters:
pin
- GPIO pin instance (i.e. RaspiPin.GPIO_00)
-
getMode
public PinMode getMode(GpioPin pin)
- Specified by:
getMode
in interfaceGpioController
-
isMode
public boolean isMode(PinMode mode, GpioPin... pin)
- Specified by:
isMode
in interfaceGpioController
-
setMode
public void setMode(PinMode mode, GpioPin... pin)
- Specified by:
setMode
in interfaceGpioController
-
setPullResistance
public void setPullResistance(PinPullResistance resistance, GpioPin... pin)
- Specified by:
setPullResistance
in interfaceGpioController
-
getPullResistance
public PinPullResistance getPullResistance(GpioPin pin)
- Specified by:
getPullResistance
in interfaceGpioController
-
isPullResistance
public boolean isPullResistance(PinPullResistance resistance, GpioPin... pin)
- Specified by:
isPullResistance
in interfaceGpioController
-
high
public void high(GpioPinDigitalOutput... pin)
- Specified by:
high
in interfaceGpioController
-
low
public void low(GpioPinDigitalOutput... pin)
- Specified by:
low
in interfaceGpioController
-
isHigh
public boolean isHigh(GpioPinDigital... pin)
- Specified by:
isHigh
in interfaceGpioController
-
isLow
public boolean isLow(GpioPinDigital... pin)
- Specified by:
isLow
in interfaceGpioController
-
toggle
public void toggle(GpioPinDigitalOutput... pin)
- Specified by:
toggle
in interfaceGpioController
-
pulse
public void pulse(long milliseconds, GpioPinDigitalOutput... pin)
- Specified by:
pulse
in interfaceGpioController
-
setState
public void setState(PinState state, GpioPinDigitalOutput... pin)
- Specified by:
setState
in interfaceGpioController
-
setState
public void setState(boolean state, GpioPinDigitalOutput... pin)
- Specified by:
setState
in interfaceGpioController
-
getState
public PinState getState(GpioPinDigital pin)
- Specified by:
getState
in interfaceGpioController
-
isState
public boolean isState(PinState state, GpioPinDigital... pin)
- Specified by:
isState
in interfaceGpioController
-
setValue
public void setValue(double value, GpioPinAnalogOutput... pin)
- Specified by:
setValue
in interfaceGpioController
-
getValue
public double getValue(GpioPinAnalog pin)
- Specified by:
getValue
in interfaceGpioController
-
addListener
public void addListener(GpioPinListener listener, GpioPinInput... pin)
- Specified by:
addListener
in interfaceGpioController
-
addListener
public void addListener(GpioPinListener[] listeners, GpioPinInput... pin)
- Specified by:
addListener
in interfaceGpioController
-
removeListener
public void removeListener(GpioPinListener listener, GpioPinInput... pin)
- Specified by:
removeListener
in interfaceGpioController
-
removeListener
public void removeListener(GpioPinListener[] listeners, GpioPinInput... pin)
- Specified by:
removeListener
in interfaceGpioController
-
removeAllListeners
public void removeAllListeners()
- Specified by:
removeAllListeners
in interfaceGpioController
-
addTrigger
public void addTrigger(GpioTrigger trigger, GpioPinInput... pin)
- Specified by:
addTrigger
in interfaceGpioController
-
addTrigger
public void addTrigger(GpioTrigger[] triggers, GpioPinInput... pin)
- Specified by:
addTrigger
in interfaceGpioController
-
removeTrigger
public void removeTrigger(GpioTrigger trigger, GpioPinInput... pin)
- Specified by:
removeTrigger
in interfaceGpioController
-
removeTrigger
public void removeTrigger(GpioTrigger[] triggers, GpioPinInput... pin)
- Specified by:
removeTrigger
in interfaceGpioController
-
removeAllTriggers
public void removeAllTriggers()
- Specified by:
removeAllTriggers
in interfaceGpioController
-
provisionPin
public GpioPin provisionPin(GpioProvider provider, Pin pin, PinMode mode)
- Specified by:
provisionPin
in interfaceGpioController
-
provisionPin
public GpioPin provisionPin(GpioProvider provider, Pin pin, String name, PinMode mode)
- Specified by:
provisionPin
in interfaceGpioController
-
provisionPin
public GpioPin provisionPin(GpioProvider provider, Pin pin, String name, PinMode mode, PinState defaultState)
- Specified by:
provisionPin
in interfaceGpioController
-
provisionPin
public GpioPin provisionPin(Pin pin, String name, PinMode mode)
- Specified by:
provisionPin
in interfaceGpioController
-
provisionPin
public GpioPin provisionPin(Pin pin, PinMode mode)
- Specified by:
provisionPin
in interfaceGpioController
-
provisionDigitalMultipurposePin
public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(GpioProvider provider, Pin pin, String name, PinMode mode)
- Specified by:
provisionDigitalMultipurposePin
in interfaceGpioController
-
provisionDigitalMultipurposePin
public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(GpioProvider provider, Pin pin, PinMode mode)
- Specified by:
provisionDigitalMultipurposePin
in interfaceGpioController
-
provisionDigitalMultipurposePin
public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(Pin pin, String name, PinMode mode)
- Specified by:
provisionDigitalMultipurposePin
in interfaceGpioController
-
provisionDigitalMultipurposePin
public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(Pin pin, PinMode mode)
- Specified by:
provisionDigitalMultipurposePin
in interfaceGpioController
-
provisionDigitalMultipurposePin
public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(GpioProvider provider, Pin pin, PinMode mode, PinPullResistance resistance)
- Specified by:
provisionDigitalMultipurposePin
in interfaceGpioController
-
provisionDigitalMultipurposePin
public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(GpioProvider provider, Pin pin, String name, PinMode mode, PinPullResistance resistance)
- Specified by:
provisionDigitalMultipurposePin
in interfaceGpioController
-
provisionDigitalMultipurposePin
public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(Pin pin, String name, PinMode mode, PinPullResistance resistance)
- Specified by:
provisionDigitalMultipurposePin
in interfaceGpioController
-
provisionDigitalMultipurposePin
public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(Pin pin, PinMode mode, PinPullResistance resistance)
- Specified by:
provisionDigitalMultipurposePin
in interfaceGpioController
-
provisionDigitalInputPin
public GpioPinDigitalInput provisionDigitalInputPin(GpioProvider provider, Pin pin, String name)
- Specified by:
provisionDigitalInputPin
in interfaceGpioController
-
provisionDigitalInputPin
public GpioPinDigitalInput provisionDigitalInputPin(GpioProvider provider, Pin pin)
- Specified by:
provisionDigitalInputPin
in interfaceGpioController
-
provisionDigitalInputPin
public GpioPinDigitalInput provisionDigitalInputPin(Pin pin, String name)
- Specified by:
provisionDigitalInputPin
in interfaceGpioController
-
provisionDigitalInputPin
public GpioPinDigitalInput provisionDigitalInputPin(Pin pin)
- Specified by:
provisionDigitalInputPin
in interfaceGpioController
-
provisionDigitalInputPin
public GpioPinDigitalInput provisionDigitalInputPin(GpioProvider provider, Pin pin, PinPullResistance resistance)
- Specified by:
provisionDigitalInputPin
in interfaceGpioController
-
provisionDigitalInputPin
public GpioPinDigitalInput provisionDigitalInputPin(GpioProvider provider, Pin pin, String name, PinPullResistance resistance)
- Specified by:
provisionDigitalInputPin
in interfaceGpioController
-
provisionDigitalInputPin
public GpioPinDigitalInput provisionDigitalInputPin(Pin pin, String name, PinPullResistance resistance)
- Specified by:
provisionDigitalInputPin
in interfaceGpioController
-
provisionDigitalInputPin
public GpioPinDigitalInput provisionDigitalInputPin(Pin pin, PinPullResistance resistance)
- Specified by:
provisionDigitalInputPin
in interfaceGpioController
-
provisionDigitalOutputPin
public GpioPinDigitalOutput provisionDigitalOutputPin(GpioProvider provider, Pin pin, String name)
- Specified by:
provisionDigitalOutputPin
in interfaceGpioController
-
provisionDigitalOutputPin
public GpioPinDigitalOutput provisionDigitalOutputPin(GpioProvider provider, Pin pin)
- Specified by:
provisionDigitalOutputPin
in interfaceGpioController
-
provisionDigitalOutputPin
public GpioPinDigitalOutput provisionDigitalOutputPin(Pin pin, String name)
- Specified by:
provisionDigitalOutputPin
in interfaceGpioController
-
provisionDigitalOutputPin
public GpioPinDigitalOutput provisionDigitalOutputPin(Pin pin)
- Specified by:
provisionDigitalOutputPin
in interfaceGpioController
-
provisionDigitalOutputPin
public GpioPinDigitalOutput provisionDigitalOutputPin(GpioProvider provider, Pin pin, PinState defaultState)
- Specified by:
provisionDigitalOutputPin
in interfaceGpioController
-
provisionDigitalOutputPin
public GpioPinDigitalOutput provisionDigitalOutputPin(GpioProvider provider, Pin pin, String name, PinState defaultState)
- Specified by:
provisionDigitalOutputPin
in interfaceGpioController
-
provisionDigitalOutputPin
public GpioPinDigitalOutput provisionDigitalOutputPin(Pin pin, String name, PinState defaultState)
- Specified by:
provisionDigitalOutputPin
in interfaceGpioController
-
provisionDigitalOutputPin
public GpioPinDigitalOutput provisionDigitalOutputPin(Pin pin, PinState defaultState)
- Specified by:
provisionDigitalOutputPin
in interfaceGpioController
-
provisionAnalogInputPin
public GpioPinAnalogInput provisionAnalogInputPin(GpioProvider provider, Pin pin, String name)
- Specified by:
provisionAnalogInputPin
in interfaceGpioController
-
provisionAnalogInputPin
public GpioPinAnalogInput provisionAnalogInputPin(GpioProvider provider, Pin pin)
- Specified by:
provisionAnalogInputPin
in interfaceGpioController
-
provisionAnalogInputPin
public GpioPinAnalogInput provisionAnalogInputPin(Pin pin, String name)
- Specified by:
provisionAnalogInputPin
in interfaceGpioController
-
provisionAnalogInputPin
public GpioPinAnalogInput provisionAnalogInputPin(Pin pin)
- Specified by:
provisionAnalogInputPin
in interfaceGpioController
-
provisionAnalogOutputPin
public GpioPinAnalogOutput provisionAnalogOutputPin(GpioProvider provider, Pin pin, String name)
- Specified by:
provisionAnalogOutputPin
in interfaceGpioController
-
provisionAnalogOutputPin
public GpioPinAnalogOutput provisionAnalogOutputPin(GpioProvider provider, Pin pin)
- Specified by:
provisionAnalogOutputPin
in interfaceGpioController
-
provisionAnalogOutputPin
public GpioPinAnalogOutput provisionAnalogOutputPin(Pin pin, String name)
- Specified by:
provisionAnalogOutputPin
in interfaceGpioController
-
provisionAnalogOutputPin
public GpioPinAnalogOutput provisionAnalogOutputPin(Pin pin)
- Specified by:
provisionAnalogOutputPin
in interfaceGpioController
-
provisionAnalogOutputPin
public GpioPinAnalogOutput provisionAnalogOutputPin(GpioProvider provider, Pin pin, double defaultValue)
- Specified by:
provisionAnalogOutputPin
in interfaceGpioController
-
provisionAnalogOutputPin
public GpioPinAnalogOutput provisionAnalogOutputPin(GpioProvider provider, Pin pin, String name, double defaultValue)
- Specified by:
provisionAnalogOutputPin
in interfaceGpioController
-
provisionAnalogOutputPin
public GpioPinAnalogOutput provisionAnalogOutputPin(Pin pin, String name, double defaultValue)
- Specified by:
provisionAnalogOutputPin
in interfaceGpioController
-
provisionAnalogOutputPin
public GpioPinAnalogOutput provisionAnalogOutputPin(Pin pin, double defaultValue)
- Specified by:
provisionAnalogOutputPin
in interfaceGpioController
-
provisionPwmOutputPin
public GpioPinPwmOutput provisionPwmOutputPin(GpioProvider provider, Pin pin, String name)
- Specified by:
provisionPwmOutputPin
in interfaceGpioController
-
provisionPwmOutputPin
public GpioPinPwmOutput provisionPwmOutputPin(GpioProvider provider, Pin pin)
- Specified by:
provisionPwmOutputPin
in interfaceGpioController
-
provisionPwmOutputPin
public GpioPinPwmOutput provisionPwmOutputPin(Pin pin, String name)
- Specified by:
provisionPwmOutputPin
in interfaceGpioController
-
provisionPwmOutputPin
public GpioPinPwmOutput provisionPwmOutputPin(Pin pin)
- Specified by:
provisionPwmOutputPin
in interfaceGpioController
-
provisionPwmOutputPin
public GpioPinPwmOutput provisionPwmOutputPin(GpioProvider provider, Pin pin, int defaultValue)
- Specified by:
provisionPwmOutputPin
in interfaceGpioController
-
provisionPwmOutputPin
public GpioPinPwmOutput provisionPwmOutputPin(GpioProvider provider, Pin pin, String name, int defaultValue)
- Specified by:
provisionPwmOutputPin
in interfaceGpioController
-
provisionPwmOutputPin
public GpioPinPwmOutput provisionPwmOutputPin(Pin pin, String name, int defaultValue)
- Specified by:
provisionPwmOutputPin
in interfaceGpioController
-
provisionPwmOutputPin
public GpioPinPwmOutput provisionPwmOutputPin(Pin pin, int defaultValue)
- Specified by:
provisionPwmOutputPin
in interfaceGpioController
-
provisionSoftPwmOutputPin
public GpioPinPwmOutput provisionSoftPwmOutputPin(GpioProvider provider, Pin pin, String name)
- Specified by:
provisionSoftPwmOutputPin
in interfaceGpioController
-
provisionSoftPwmOutputPin
public GpioPinPwmOutput provisionSoftPwmOutputPin(GpioProvider provider, Pin pin)
- Specified by:
provisionSoftPwmOutputPin
in interfaceGpioController
-
provisionSoftPwmOutputPin
public GpioPinPwmOutput provisionSoftPwmOutputPin(Pin pin, String name)
- Specified by:
provisionSoftPwmOutputPin
in interfaceGpioController
-
provisionSoftPwmOutputPin
public GpioPinPwmOutput provisionSoftPwmOutputPin(Pin pin)
- Specified by:
provisionSoftPwmOutputPin
in interfaceGpioController
-
provisionSoftPwmOutputPin
public GpioPinPwmOutput provisionSoftPwmOutputPin(GpioProvider provider, Pin pin, int defaultValue)
- Specified by:
provisionSoftPwmOutputPin
in interfaceGpioController
-
provisionSoftPwmOutputPin
public GpioPinPwmOutput provisionSoftPwmOutputPin(GpioProvider provider, Pin pin, String name, int defaultValue)
- Specified by:
provisionSoftPwmOutputPin
in interfaceGpioController
-
provisionSoftPwmOutputPin
public GpioPinPwmOutput provisionSoftPwmOutputPin(Pin pin, String name, int defaultValue)
- Specified by:
provisionSoftPwmOutputPin
in interfaceGpioController
-
provisionSoftPwmOutputPin
public GpioPinPwmOutput provisionSoftPwmOutputPin(Pin pin, int defaultValue)
- Specified by:
provisionSoftPwmOutputPin
in interfaceGpioController
-
unprovisionPin
public void unprovisionPin(GpioPin... pin)
- Specified by:
unprovisionPin
in interfaceGpioController
-
setShutdownOptions
public void setShutdownOptions(GpioPinShutdown options, GpioPin... pin)
- Specified by:
setShutdownOptions
in interfaceGpioController
-
setShutdownOptions
public void setShutdownOptions(Boolean unexport, GpioPin... pin)
- Specified by:
setShutdownOptions
in interfaceGpioController
-
setShutdownOptions
public void setShutdownOptions(Boolean unexport, PinState state, GpioPin... pin)
- Specified by:
setShutdownOptions
in interfaceGpioController
-
setShutdownOptions
public void setShutdownOptions(Boolean unexport, PinState state, PinPullResistance resistance, GpioPin... pin)
- Specified by:
setShutdownOptions
in interfaceGpioController
-
setShutdownOptions
public void setShutdownOptions(Boolean unexport, PinState state, PinPullResistance resistance, PinMode mode, GpioPin... pin)
- Specified by:
setShutdownOptions
in interfaceGpioController
-
isShutdown
public boolean isShutdown()
This method returns TRUE if the GPIO controller has been shutdown.- Specified by:
isShutdown
in interfaceGpioController
- Returns:
- shutdown state
-
shutdown
public void shutdown()
This method can be called to forcefully shutdown all GPIO controller monitoring, listening, and task threads/executors.- Specified by:
shutdown
in interfaceGpioController
-
-