Package com.pi4j.io.gpio.impl
Class GpioPinImpl
- java.lang.Object
- 
- com.pi4j.io.gpio.impl.GpioPinImpl
 
- 
- All Implemented Interfaces:
- GpioPin,- GpioPinAnalog,- GpioPinAnalogInput,- GpioPinAnalogOutput,- GpioPinDigital,- GpioPinDigitalInput,- GpioPinDigitalMultipurpose,- GpioPinDigitalOutput,- GpioPinInput,- GpioPinOutput,- GpioPinPwm,- GpioPinPwmOutput
 
 public class GpioPinImpl extends Object implements GpioPin, GpioPinDigitalInput, GpioPinDigitalOutput, GpioPinDigitalMultipurpose, GpioPinAnalogInput, GpioPinAnalogOutput, GpioPinPwmOutput, GpioPinInput, GpioPinOutput 
- 
- 
Field SummaryFields Modifier and Type Field Description protected intNO_DEBOUCE
 - 
Constructor SummaryConstructors Constructor Description GpioPinImpl(GpioController gpio, GpioProvider provider, Pin pin)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(GpioPinListener... listener)voidaddListener(List<? extends GpioPinListener> listeners)voidaddTrigger(GpioTrigger... trigger)voidaddTrigger(List<? extends GpioTrigger> triggers)Future<?>blink(long delay)Future<?>blink(long delay, long duration)Future<?>blink(long delay, long duration, PinState blinkState)Future<?>blink(long delay, long duration, PinState blinkState, TimeUnit timeUnit)Future<?>blink(long delay, long duration, TimeUnit timeUnit)Future<?>blink(long delay, PinState blinkState)Future<?>blink(long delay, PinState blinkState, TimeUnit timeUnit)Future<?>blink(long delay, TimeUnit timeUnit)voidclearProperties()voidexport(PinMode mode)voidexport(PinMode mode, PinState defaultState)intgetDebounce(PinState state)Gets the configured debounce delay interval (in milliseconds) for the given pin state.Collection<GpioPinListener>getListeners()PinModegetMode()StringgetName()PingetPin()Map<String,String>getProperties()StringgetProperty(String key)StringgetProperty(String key, String defaultValue)GpioProvidergetProvider()PinPullResistancegetPullResistance()intgetPwm()If this is a hardware PWM pin, the value will be between a range of 0 to 1024.GpioPinShutdowngetShutdownOptions()PinStategetState()ObjectgetTag()Collection<GpioTrigger>getTriggers()doublegetValue()booleanhasDebounce(PinState state)Determines if a debounce delay interval has been configured for the given pin state.booleanhasListener(GpioPinListener... listener)booleanhasProperty(String key)voidhigh()booleanisExported()booleanisHigh()booleanisLow()booleanisMode(PinMode mode)booleanisPullResistance(PinPullResistance resistance)booleanisState(PinState state)voidlow()Future<?>pulse(long duration)Future<?>pulse(long duration, boolean blocking)Future<?>pulse(long duration, boolean blocking, Callable<Void> callback)Future<?>pulse(long duration, boolean blocking, Callable<Void> callback, TimeUnit timeUnit)Future<?>pulse(long duration, boolean blocking, TimeUnit timeUnit)Future<?>pulse(long duration, PinState pulseState)Future<?>pulse(long duration, PinState pulseState, boolean blocking)Future<?>pulse(long duration, PinState pulseState, boolean blocking, Callable<Void> callback)Future<?>pulse(long duration, PinState pulseState, boolean blocking, Callable<Void> callback, TimeUnit timeUnit)Future<?>pulse(long duration, PinState pulseState, boolean blocking, TimeUnit timeUnit)Future<?>pulse(long duration, PinState pulseState, Callable<Void> callback)Future<?>pulse(long duration, PinState pulseState, Callable<Void> callback, TimeUnit timeUnit)Future<?>pulse(long duration, PinState pulseState, TimeUnit timeUnit)Future<?>pulse(long duration, Callable<Void> callback)Future<?>pulse(long duration, Callable<Void> callback, TimeUnit timeUnit)Future<?>pulse(long duration, TimeUnit timeUnit)voidpulseSync(long duration)voidpulseSync(long duration, PinState pulseState)voidpulseSync(long duration, PinState pulseState, TimeUnit timeUnit)voidpulseSync(long duration, TimeUnit timeUnit)voidremoveAllListeners()voidremoveAllTriggers()voidremoveListener(GpioPinListener... listener)voidremoveListener(List<? extends GpioPinListener> listeners)voidremoveProperty(String key)voidremoveTrigger(GpioTrigger... trigger)voidremoveTrigger(List<? extends GpioTrigger> triggers)voidsetDebounce(int debounce)Sets the debounce delay interval (in milliseconds) for all pin states.voidsetDebounce(int debounce, PinState... state)Sets the debounce delay interval (in milliseconds) for the specified pin state.voidsetMode(PinMode mode)voidsetName(String name)voidsetProperty(String key, String value)voidsetPullResistance(PinPullResistance resistance)voidsetPwm(int value)Set the PWM value/rate to toggle the GPIO pin.voidsetPwmRange(int range)This sets the range register in the PWM generator.voidsetShutdownOptions(GpioPinShutdown options)voidsetShutdownOptions(Boolean unexport)voidsetShutdownOptions(Boolean unexport, PinState state)voidsetShutdownOptions(Boolean unexport, PinState state, PinPullResistance resistance)voidsetShutdownOptions(Boolean unexport, PinState state, PinPullResistance resistance, PinMode mode)voidsetState(boolean state)voidsetState(PinState state)voidsetTag(Object tag)voidsetValue(double value)voidsetValue(Number value)voidtoggle()StringtoString()voidunexport()
 
- 
- 
- 
Field Detail- 
NO_DEBOUCEprotected final int NO_DEBOUCE - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
GpioPinImplpublic GpioPinImpl(GpioController gpio, GpioProvider provider, Pin pin) 
 
- 
 - 
Method Detail- 
getProviderpublic GpioProvider getProvider() - Specified by:
- getProviderin interface- GpioPin
 
 - 
setPropertypublic void setProperty(String key, String value) - Specified by:
- setPropertyin interface- GpioPin
 
 - 
hasPropertypublic boolean hasProperty(String key) - Specified by:
- hasPropertyin interface- GpioPin
 
 - 
getPropertypublic String getProperty(String key, String defaultValue) - Specified by:
- getPropertyin interface- GpioPin
 
 - 
getPropertypublic String getProperty(String key) - Specified by:
- getPropertyin interface- GpioPin
 
 - 
getPropertiespublic Map<String,String> getProperties() - Specified by:
- getPropertiesin interface- GpioPin
 
 - 
removePropertypublic void removeProperty(String key) - Specified by:
- removePropertyin interface- GpioPin
 
 - 
clearPropertiespublic void clearProperties() - Specified by:
- clearPropertiesin interface- GpioPin
 
 - 
isExportedpublic boolean isExported() - Specified by:
- isExportedin interface- GpioPin
 
 - 
setPullResistancepublic void setPullResistance(PinPullResistance resistance) - Specified by:
- setPullResistancein interface- GpioPin
 
 - 
getPullResistancepublic PinPullResistance getPullResistance() - Specified by:
- getPullResistancein interface- GpioPin
 
 - 
isPullResistancepublic boolean isPullResistance(PinPullResistance resistance) - Specified by:
- isPullResistancein interface- GpioPin
 
 - 
highpublic void high() - Specified by:
- highin interface- GpioPinDigitalOutput
 
 - 
lowpublic void low() - Specified by:
- lowin interface- GpioPinDigitalOutput
 
 - 
togglepublic void toggle() - Specified by:
- togglein interface- GpioPinDigitalOutput
 
 - 
blinkpublic Future<?> blink(long delay) - Specified by:
- blinkin interface- GpioPinDigitalOutput
 
 - 
blinkpublic Future<?> blink(long delay, TimeUnit timeUnit) - Specified by:
- blinkin interface- GpioPinDigitalOutput
 
 - 
blinkpublic Future<?> blink(long delay, PinState blinkState) - Specified by:
- blinkin interface- GpioPinDigitalOutput
 
 - 
blinkpublic Future<?> blink(long delay, PinState blinkState, TimeUnit timeUnit) - Specified by:
- blinkin interface- GpioPinDigitalOutput
 
 - 
blinkpublic Future<?> blink(long delay, long duration) - Specified by:
- blinkin interface- GpioPinDigitalOutput
 
 - 
blinkpublic Future<?> blink(long delay, long duration, TimeUnit timeUnit) - Specified by:
- blinkin interface- GpioPinDigitalOutput
 
 - 
blinkpublic Future<?> blink(long delay, long duration, PinState blinkState) - Specified by:
- blinkin interface- GpioPinDigitalOutput
 
 - 
blinkpublic Future<?> blink(long delay, long duration, PinState blinkState, TimeUnit timeUnit) - Specified by:
- blinkin interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, TimeUnit timeUnit) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, Callable<Void> callback) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, Callable<Void> callback, TimeUnit timeUnit) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, PinState pulseState) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, PinState pulseState, TimeUnit timeUnit) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, PinState pulseState, Callable<Void> callback) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, PinState pulseState, Callable<Void> callback, TimeUnit timeUnit) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, boolean blocking) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, boolean blocking, TimeUnit timeUnit) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, boolean blocking, Callable<Void> callback) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, boolean blocking, Callable<Void> callback, TimeUnit timeUnit) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, PinState pulseState, boolean blocking) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, PinState pulseState, boolean blocking, TimeUnit timeUnit) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, PinState pulseState, boolean blocking, Callable<Void> callback, TimeUnit timeUnit) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulsepublic Future<?> pulse(long duration, PinState pulseState, boolean blocking, Callable<Void> callback) - Specified by:
- pulsein interface- GpioPinDigitalOutput
 
 - 
pulseSyncpublic void pulseSync(long duration) throws InterruptedException- Specified by:
- pulseSyncin interface- GpioPinDigitalOutput
- Throws:
- InterruptedException
 
 - 
pulseSyncpublic void pulseSync(long duration, TimeUnit timeUnit) throws InterruptedException- Specified by:
- pulseSyncin interface- GpioPinDigitalOutput
- Throws:
- InterruptedException
 
 - 
pulseSyncpublic void pulseSync(long duration, PinState pulseState) throws InterruptedException- Specified by:
- pulseSyncin interface- GpioPinDigitalOutput
- Throws:
- InterruptedException
 
 - 
pulseSyncpublic void pulseSync(long duration, PinState pulseState, TimeUnit timeUnit) throws InterruptedException- Specified by:
- pulseSyncin interface- GpioPinDigitalOutput
- Throws:
- InterruptedException
 
 - 
setStatepublic void setState(PinState state) - Specified by:
- setStatein interface- GpioPinDigitalOutput
 
 - 
setStatepublic void setState(boolean state) - Specified by:
- setStatein interface- GpioPinDigitalOutput
 
 - 
isHighpublic boolean isHigh() - Specified by:
- isHighin interface- GpioPinDigital
 
 - 
isLowpublic boolean isLow() - Specified by:
- isLowin interface- GpioPinDigital
 
 - 
getStatepublic PinState getState() - Specified by:
- getStatein interface- GpioPinDigital
 
 - 
isStatepublic boolean isState(PinState state) - Specified by:
- isStatein interface- GpioPinDigital
 
 - 
hasDebouncepublic boolean hasDebounce(PinState state) Description copied from interface:GpioPinDigitalInputDetermines if a debounce delay interval has been configured for the given pin state.- Specified by:
- hasDebouncein interface- GpioPinDigitalInput
- Parameters:
- state- the pin state to test for debounce delay.
- Returns:
- 'true' if the specified ping state has been configured with a debounce delay; else return 'false'.
 
 - 
getDebouncepublic int getDebounce(PinState state) Description copied from interface:GpioPinDigitalInputGets the configured debounce delay interval (in milliseconds) for the given pin state.- Specified by:
- getDebouncein interface- GpioPinDigitalInput
- Parameters:
- state- the pin state to get the configured debounce delay interval.
- Returns:
- the debounce delay interval (in milliseconds) for the specified pin state.
 
 - 
setDebouncepublic void setDebounce(int debounce, PinState... state)Description copied from interface:GpioPinDigitalInputSets the debounce delay interval (in milliseconds) for the specified pin state.- Specified by:
- setDebouncein interface- GpioPinDigitalInput
- Parameters:
- debounce- The debounce delay interval in milliseconds.
- state- The pin states to apply the debounce delay interval to.
 
 - 
setDebouncepublic void setDebounce(int debounce) Description copied from interface:GpioPinDigitalInputSets the debounce delay interval (in milliseconds) for all pin states.- Specified by:
- setDebouncein interface- GpioPinDigitalInput
- Parameters:
- debounce- The debounce delay interval in milliseconds.
 
 - 
setValuepublic void setValue(double value) - Specified by:
- setValuein interface- GpioPinAnalogOutput
 
 - 
setValuepublic void setValue(Number value) - Specified by:
- setValuein interface- GpioPinAnalogOutput
 
 - 
getValuepublic double getValue() - Specified by:
- getValuein interface- GpioPinAnalog
 
 - 
setPwmpublic void setPwm(int value) Description copied from interface:GpioPinPwmOutputSet the PWM value/rate to toggle the GPIO pin. If this is a hardware PWM pin, the value should be between a range of 0 to 1024. If this is a software emulated PWM pin, the value should be between a range of 0 to 100.- Specified by:
- setPwmin interface- GpioPinPwmOutput
 
 - 
setPwmRangepublic void setPwmRange(int range) Description copied from interface:GpioPinPwmOutputThis sets the range register in the PWM generator. The default is 1024 for hardware PWM. The default is 100 for software emulated PWM.- Specified by:
- setPwmRangein interface- GpioPinPwmOutput
 
 - 
getPwmpublic int getPwm() Description copied from interface:GpioPinPwmIf this is a hardware PWM pin, the value will be between a range of 0 to 1024. If this is a software emulated PWM pin, the value will be between a range of 0 to 100.- Specified by:
- getPwmin interface- GpioPinPwm
- Returns:
- the value currently set for the PWM output
 
 - 
addListenerpublic void addListener(GpioPinListener... listener) - Specified by:
- addListenerin interface- GpioPin
- Specified by:
- addListenerin interface- GpioPinAnalogInput
- Parameters:
- listener- gpio pin listener interface
 
 - 
addListenerpublic void addListener(List<? extends GpioPinListener> listeners) - Specified by:
- addListenerin interface- GpioPin
- Specified by:
- addListenerin interface- GpioPinAnalogInput
 
 - 
getListenerspublic Collection<GpioPinListener> getListeners() - Specified by:
- getListenersin interface- GpioPin
- Specified by:
- getListenersin interface- GpioPinAnalogInput
 
 - 
hasListenerpublic boolean hasListener(GpioPinListener... listener) - Specified by:
- hasListenerin interface- GpioPin
- Specified by:
- hasListenerin interface- GpioPinAnalogInput
 
 - 
removeListenerpublic void removeListener(GpioPinListener... listener) - Specified by:
- removeListenerin interface- GpioPin
- Specified by:
- removeListenerin interface- GpioPinAnalogInput
 
 - 
removeListenerpublic void removeListener(List<? extends GpioPinListener> listeners) - Specified by:
- removeListenerin interface- GpioPin
- Specified by:
- removeListenerin interface- GpioPinAnalogInput
 
 - 
removeAllListenerspublic void removeAllListeners() - Specified by:
- removeAllListenersin interface- GpioPin
- Specified by:
- removeAllListenersin interface- GpioPinAnalogInput
 
 - 
getTriggerspublic Collection<GpioTrigger> getTriggers() - Specified by:
- getTriggersin interface- GpioPinAnalogInput
- Specified by:
- getTriggersin interface- GpioPinInput
 
 - 
addTriggerpublic void addTrigger(GpioTrigger... trigger) - Specified by:
- addTriggerin interface- GpioPinAnalogInput
- Specified by:
- addTriggerin interface- GpioPinInput
 
 - 
addTriggerpublic void addTrigger(List<? extends GpioTrigger> triggers) - Specified by:
- addTriggerin interface- GpioPinAnalogInput
- Specified by:
- addTriggerin interface- GpioPinInput
 
 - 
removeTriggerpublic void removeTrigger(GpioTrigger... trigger) - Specified by:
- removeTriggerin interface- GpioPinAnalogInput
- Specified by:
- removeTriggerin interface- GpioPinInput
- Parameters:
- trigger- GPIO trigger interface
 
 - 
removeTriggerpublic void removeTrigger(List<? extends GpioTrigger> triggers) - Specified by:
- removeTriggerin interface- GpioPinAnalogInput
- Specified by:
- removeTriggerin interface- GpioPinInput
 
 - 
removeAllTriggerspublic void removeAllTriggers() - Specified by:
- removeAllTriggersin interface- GpioPinAnalogInput
- Specified by:
- removeAllTriggersin interface- GpioPinInput
 
 - 
getShutdownOptionspublic GpioPinShutdown getShutdownOptions() - Specified by:
- getShutdownOptionsin interface- GpioPin
 
 - 
setShutdownOptionspublic void setShutdownOptions(GpioPinShutdown options) - Specified by:
- setShutdownOptionsin interface- GpioPin
 
 - 
setShutdownOptionspublic void setShutdownOptions(Boolean unexport) - Specified by:
- setShutdownOptionsin interface- GpioPin
 
 - 
setShutdownOptionspublic void setShutdownOptions(Boolean unexport, PinState state) - Specified by:
- setShutdownOptionsin interface- GpioPin
 
 - 
setShutdownOptionspublic void setShutdownOptions(Boolean unexport, PinState state, PinPullResistance resistance) - Specified by:
- setShutdownOptionsin interface- GpioPin
 
 - 
setShutdownOptionspublic void setShutdownOptions(Boolean unexport, PinState state, PinPullResistance resistance, PinMode mode) - Specified by:
- setShutdownOptionsin interface- GpioPin
 
 
- 
 
-