public class GpioPinImpl extends Object implements GpioPin, GpioPinDigitalInput, GpioPinDigitalOutput, GpioPinDigitalMultipurpose, GpioPinAnalogInput, GpioPinAnalogOutput, GpioPinPwmOutput, GpioPinInput, GpioPinOutput
Modifier and Type | Field and Description |
---|---|
protected int |
NO_DEBOUCE |
Constructor and Description |
---|
GpioPinImpl(GpioController gpio,
GpioProvider provider,
Pin pin) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(GpioPinListener... listener) |
void |
addListener(List<? extends GpioPinListener> listeners) |
void |
addTrigger(GpioTrigger... trigger) |
void |
addTrigger(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) |
void |
clearProperties() |
void |
export(PinMode mode) |
void |
export(PinMode mode,
PinState defaultState) |
int |
getDebounce(PinState state)
Gets the configured debounce delay interval (in milliseconds) for the given pin state.
|
Collection<GpioPinListener> |
getListeners() |
PinMode |
getMode() |
String |
getName() |
Pin |
getPin() |
Map<String,String> |
getProperties() |
String |
getProperty(String key) |
String |
getProperty(String key,
String defaultValue) |
GpioProvider |
getProvider() |
PinPullResistance |
getPullResistance() |
int |
getPwm()
If this is a hardware PWM pin, the value will be between a range of 0 to 1024.
|
GpioPinShutdown |
getShutdownOptions() |
PinState |
getState() |
Object |
getTag() |
Collection<GpioTrigger> |
getTriggers() |
double |
getValue() |
boolean |
hasDebounce(PinState state)
Determines if a debounce delay interval has been configured for the given pin state.
|
boolean |
hasListener(GpioPinListener... listener) |
boolean |
hasProperty(String key) |
void |
high() |
boolean |
isExported() |
boolean |
isHigh() |
boolean |
isLow() |
boolean |
isMode(PinMode mode) |
boolean |
isPullResistance(PinPullResistance resistance) |
boolean |
isState(PinState state) |
void |
low() |
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,
Callable<Void> callback) |
Future<?> |
pulse(long duration,
Callable<Void> callback,
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,
TimeUnit timeUnit) |
void |
removeAllListeners() |
void |
removeAllTriggers() |
void |
removeListener(GpioPinListener... listener) |
void |
removeListener(List<? extends GpioPinListener> listeners) |
void |
removeProperty(String key) |
void |
removeTrigger(GpioTrigger... trigger) |
void |
removeTrigger(List<? extends GpioTrigger> triggers) |
void |
setDebounce(int debounce)
Sets the debounce delay interval (in milliseconds) for all pin states.
|
void |
setDebounce(int debounce,
PinState... state)
Sets the debounce delay interval (in milliseconds) for the specified pin state.
|
void |
setMode(PinMode mode) |
void |
setName(String name) |
void |
setProperty(String key,
String value) |
void |
setPullResistance(PinPullResistance resistance) |
void |
setPwm(int value)
Set the PWM value/rate to toggle the GPIO pin.
|
void |
setPwmRange(int range)
This sets the range register in the PWM generator.
|
void |
setShutdownOptions(Boolean unexport) |
void |
setShutdownOptions(Boolean unexport,
PinState state) |
void |
setShutdownOptions(Boolean unexport,
PinState state,
PinPullResistance resistance) |
void |
setShutdownOptions(Boolean unexport,
PinState state,
PinPullResistance resistance,
PinMode mode) |
void |
setShutdownOptions(GpioPinShutdown options) |
void |
setState(boolean state) |
void |
setState(PinState state) |
void |
setTag(Object tag) |
void |
setValue(double value) |
void |
setValue(Number value) |
void |
toggle() |
String |
toString() |
void |
unexport() |
protected final int NO_DEBOUCE
public GpioPinImpl(GpioController gpio, GpioProvider provider, Pin pin)
public GpioProvider getProvider()
getProvider
in interface GpioPin
public void setProperty(String key, String value)
setProperty
in interface GpioPin
public boolean hasProperty(String key)
hasProperty
in interface GpioPin
public String getProperty(String key, String defaultValue)
getProperty
in interface GpioPin
public String getProperty(String key)
getProperty
in interface GpioPin
public Map<String,String> getProperties()
getProperties
in interface GpioPin
public void removeProperty(String key)
removeProperty
in interface GpioPin
public void clearProperties()
clearProperties
in interface GpioPin
public boolean isExported()
isExported
in interface GpioPin
public void setPullResistance(PinPullResistance resistance)
setPullResistance
in interface GpioPin
public PinPullResistance getPullResistance()
getPullResistance
in interface GpioPin
public boolean isPullResistance(PinPullResistance resistance)
isPullResistance
in interface GpioPin
public void high()
high
in interface GpioPinDigitalOutput
public void low()
low
in interface GpioPinDigitalOutput
public void toggle()
toggle
in interface GpioPinDigitalOutput
public Future<?> blink(long delay)
blink
in interface GpioPinDigitalOutput
public Future<?> blink(long delay, TimeUnit timeUnit)
blink
in interface GpioPinDigitalOutput
public Future<?> blink(long delay, PinState blinkState)
blink
in interface GpioPinDigitalOutput
public Future<?> blink(long delay, PinState blinkState, TimeUnit timeUnit)
blink
in interface GpioPinDigitalOutput
public Future<?> blink(long delay, long duration)
blink
in interface GpioPinDigitalOutput
public Future<?> blink(long delay, long duration, TimeUnit timeUnit)
blink
in interface GpioPinDigitalOutput
public Future<?> blink(long delay, long duration, PinState blinkState)
blink
in interface GpioPinDigitalOutput
public Future<?> blink(long delay, long duration, PinState blinkState, TimeUnit timeUnit)
blink
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, TimeUnit timeUnit)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, Callable<Void> callback)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, Callable<Void> callback, TimeUnit timeUnit)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, PinState pulseState)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, PinState pulseState, TimeUnit timeUnit)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, PinState pulseState, Callable<Void> callback)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, PinState pulseState, Callable<Void> callback, TimeUnit timeUnit)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, boolean blocking)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, boolean blocking, TimeUnit timeUnit)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, boolean blocking, Callable<Void> callback)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, boolean blocking, Callable<Void> callback, TimeUnit timeUnit)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, PinState pulseState, boolean blocking)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, PinState pulseState, boolean blocking, TimeUnit timeUnit)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, PinState pulseState, boolean blocking, Callable<Void> callback, TimeUnit timeUnit)
pulse
in interface GpioPinDigitalOutput
public Future<?> pulse(long duration, PinState pulseState, boolean blocking, Callable<Void> callback)
pulse
in interface GpioPinDigitalOutput
public void setState(PinState state)
setState
in interface GpioPinDigitalOutput
public void setState(boolean state)
setState
in interface GpioPinDigitalOutput
public boolean isHigh()
isHigh
in interface GpioPinDigital
public boolean isLow()
isLow
in interface GpioPinDigital
public PinState getState()
getState
in interface GpioPinDigital
public boolean isState(PinState state)
isState
in interface GpioPinDigital
public boolean hasDebounce(PinState state)
GpioPinDigitalInput
hasDebounce
in interface GpioPinDigitalInput
state
- the pin state to test for debounce delay.public int getDebounce(PinState state)
GpioPinDigitalInput
getDebounce
in interface GpioPinDigitalInput
state
- the pin state to get the configured debounce delay interval.public void setDebounce(int debounce, PinState... state)
GpioPinDigitalInput
setDebounce
in interface GpioPinDigitalInput
debounce
- The debounce delay interval in milliseconds.state
- The pin states to apply the debounce delay interval to.public void setDebounce(int debounce)
GpioPinDigitalInput
setDebounce
in interface GpioPinDigitalInput
debounce
- The debounce delay interval in milliseconds.public void setValue(double value)
setValue
in interface GpioPinAnalogOutput
public void setValue(Number value)
setValue
in interface GpioPinAnalogOutput
public double getValue()
getValue
in interface GpioPinAnalog
public void setPwm(int value)
GpioPinPwmOutput
setPwm
in interface GpioPinPwmOutput
public void setPwmRange(int range)
GpioPinPwmOutput
setPwmRange
in interface GpioPinPwmOutput
public int getPwm()
GpioPinPwm
getPwm
in interface GpioPinPwm
public void addListener(GpioPinListener... listener)
addListener
in interface GpioPin
addListener
in interface GpioPinAnalogInput
listener
- gpio pin listener interfacepublic void addListener(List<? extends GpioPinListener> listeners)
addListener
in interface GpioPin
addListener
in interface GpioPinAnalogInput
public Collection<GpioPinListener> getListeners()
getListeners
in interface GpioPin
getListeners
in interface GpioPinAnalogInput
public boolean hasListener(GpioPinListener... listener)
hasListener
in interface GpioPin
hasListener
in interface GpioPinAnalogInput
public void removeListener(GpioPinListener... listener)
removeListener
in interface GpioPin
removeListener
in interface GpioPinAnalogInput
public void removeListener(List<? extends GpioPinListener> listeners)
removeListener
in interface GpioPin
removeListener
in interface GpioPinAnalogInput
public void removeAllListeners()
removeAllListeners
in interface GpioPin
removeAllListeners
in interface GpioPinAnalogInput
public Collection<GpioTrigger> getTriggers()
getTriggers
in interface GpioPinAnalogInput
getTriggers
in interface GpioPinInput
public void addTrigger(GpioTrigger... trigger)
addTrigger
in interface GpioPinAnalogInput
addTrigger
in interface GpioPinInput
public void addTrigger(List<? extends GpioTrigger> triggers)
addTrigger
in interface GpioPinAnalogInput
addTrigger
in interface GpioPinInput
public void removeTrigger(GpioTrigger... trigger)
removeTrigger
in interface GpioPinAnalogInput
removeTrigger
in interface GpioPinInput
trigger
- GPIO trigger interfacepublic void removeTrigger(List<? extends GpioTrigger> triggers)
removeTrigger
in interface GpioPinAnalogInput
removeTrigger
in interface GpioPinInput
public void removeAllTriggers()
removeAllTriggers
in interface GpioPinAnalogInput
removeAllTriggers
in interface GpioPinInput
public GpioPinShutdown getShutdownOptions()
getShutdownOptions
in interface GpioPin
public void setShutdownOptions(GpioPinShutdown options)
setShutdownOptions
in interface GpioPin
public void setShutdownOptions(Boolean unexport)
setShutdownOptions
in interface GpioPin
public void setShutdownOptions(Boolean unexport, PinState state)
setShutdownOptions
in interface GpioPin
public void setShutdownOptions(Boolean unexport, PinState state, PinPullResistance resistance)
setShutdownOptions
in interface GpioPin
public void setShutdownOptions(Boolean unexport, PinState state, PinPullResistance resistance, PinMode mode)
setShutdownOptions
in interface GpioPin
Copyright © 2012–2019 Pi4J. All rights reserved.