public abstract class AbstractDigitalInput extends AbstractPinFeature implements DigitalInput
| Constructor and Description |
|---|
AbstractDigitalInput(Pin pin) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInterruptListener(InterruptListener listener)
Adds an interrupt listener to the digital input.
|
boolean |
areInterruptsEnabled()
This method checks whether interrupts are currently enabled.
|
void |
clearInterruptListeners()
Removes all interrupt listeners that are currently registered.
|
void |
disableInterrupts()
This method disables interrupt events on this input.
|
protected abstract void |
disableInterruptsImpl() |
void |
enableInterrupts()
This method enables interrupt events on this input.
|
protected abstract void |
enableInterruptsImpl() |
void |
fireInterruptEvent(InterruptEventArgs args)
Fire interrupt event.
|
int |
getInterruptDebounceMs()
Returns the maximum time that is used for debouncing
interrupts.
|
List<InterruptListener> |
getInterruptListeners()
Gets a list of all the registered interrupt listeners.
|
Edge |
getInterruptTrigger()
Gets the interrupt trigger that is currently set.
|
String |
getName() |
Signal |
readDebounced(int debounceTime)
Reads the signal on the pin debounced.
|
void |
removeInterruptListener(InterruptListener listener)
Removes an interrupt listener from the digital input.
|
void |
setInterruptDebounceMs(int milliSeconds)
If the edges of interrupts should be debounced before calling
the interrupt event handlers, then the maximum time that
should be used for debouncing can be specified here.
|
void |
setInterruptTrigger(Edge edge)
Sets the interrupt trigger.
|
activate, blockPin, getPin, isActivatedFeature, isBlocking, isSetup, isTorndownOnShutdown, setTeardownOnShutdown, setup, setupImpl, teardown, teardownImpl, toString, unblockPinclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitreadactivate, blockPin, getPin, isActivatedFeature, isBlocking, isSetup, isTorndownOnShutdown, setTeardownOnShutdown, setup, teardown, unblockPinpublic AbstractDigitalInput(Pin pin)
public String getName()
getName in interface PinFeaturepublic void setInterruptTrigger(Edge edge)
DigitalInputEdge that is
used for interrupt detection. Interrupts can either trigger on a
rising edge, a falling edge,
or on both edges.
The default value is both edges.setInterruptTrigger in interface DigitalInputedge - the edge that is used for triggering interrupts on this input.public void setInterruptDebounceMs(int milliSeconds)
DigitalInputsetInterruptDebounceMs in interface DigitalInputmilliSeconds - The maximum time that is used for debouncingpublic int getInterruptDebounceMs()
DigitalInputgetInterruptDebounceMs in interface DigitalInputpublic Edge getInterruptTrigger()
DigitalInputgetInterruptTrigger in interface DigitalInputpublic void addInterruptListener(InterruptListener listener)
DigitalInputaddInterruptListener in interface DigitalInputlistener - the listener that is to be added.public void removeInterruptListener(InterruptListener listener)
DigitalInputremoveInterruptListener in interface DigitalInputlistener - the listener that is to be removed.public List<InterruptListener> getInterruptListeners()
DigitalInputgetInterruptListeners in interface DigitalInputpublic void clearInterruptListeners()
DigitalInputclearInterruptListeners in interface DigitalInputpublic void fireInterruptEvent(InterruptEventArgs args)
DigitalInputfireInterruptEvent in interface DigitalInputargs - the argspublic Signal readDebounced(int debounceTime)
DigitalInputreadDebounced in interface DigitalInputdebounceTime - this is the time that is used for debouncing
in the worst case. When the input is still bouncing after the
specified period, then the return value will not be reliable.public boolean areInterruptsEnabled()
DigitalInputdisableInterrupts() to disable
interrupts and DigitalInput.enableInterrupts() to enable them.areInterruptsEnabled in interface DigitalInputpublic void enableInterrupts()
DigitalInputenableInterrupts in interface DigitalInputpublic void disableInterrupts()
DigitalInputInterruptListener's
interruptRequest
method.disableInterrupts in interface DigitalInputprotected abstract void enableInterruptsImpl()
protected abstract void disableInterruptsImpl()
Copyright © 2015 silverspoon.io. All rights reserved.