public abstract class InterruptableSensorBase extends SensorBase
Modifier and Type | Class and Description |
---|---|
static class |
InterruptableSensorBase.WaitResult |
Modifier and Type | Field and Description |
---|---|
protected int |
m_interrupt
The interrupt resource.
|
protected boolean |
m_isSynchronousInterrupt
Flags if the interrupt being allocated is synchronous.
|
kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPCMModules, kPDPChannels, kPDPModules, kPwmChannels, kRelayChannels, kSolenoidChannels, kSystemClockTicksPerMicrosecond
Constructor and Description |
---|
InterruptableSensorBase()
Create a new InterrupatableSensorBase.
|
Modifier and Type | Method and Description |
---|---|
protected void |
allocateInterrupts(boolean watcher)
Allocate the interrupt
|
void |
cancelInterrupts()
Cancel interrupts on this device.
|
void |
disableInterrupts()
Disable Interrupts without without deallocating structures.
|
void |
enableInterrupts()
Enable interrupts to occur on this input.
|
abstract int |
getAnalogTriggerTypeForRouting()
If this is an analog trigger.
|
abstract int |
getPortHandleForRouting()
The channel routing number.
|
double |
readFallingTimestamp()
Return the timestamp for the falling interrupt that occurred most recently.
|
double |
readRisingTimestamp()
Return the timestamp for the rising interrupt that occurred most recently.
|
void |
requestInterrupts()
Request one of the 8 interrupts synchronously on this digital input.
|
void |
requestInterrupts(InterruptHandlerFunction<?> handler)
Request one of the 8 interrupts asynchronously on this digital input.
|
void |
setUpSourceEdge(boolean risingEdge,
boolean fallingEdge)
Set which edge to trigger interrupts on.
|
InterruptableSensorBase.WaitResult |
waitForInterrupt(double timeout)
In synchronous mode, wait for the defined interrupt to occur.
|
InterruptableSensorBase.WaitResult |
waitForInterrupt(double timeout,
boolean ignorePrevious)
In synchronous mode, wait for the defined interrupt to occur.
|
checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPDPModule, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, free, getDefaultSolenoidModule, setDefaultSolenoidModule
protected int m_interrupt
protected boolean m_isSynchronousInterrupt
public InterruptableSensorBase()
public abstract int getAnalogTriggerTypeForRouting()
public abstract int getPortHandleForRouting()
public void requestInterrupts(InterruptHandlerFunction<?> handler)
handler
- The InterruptHandlerFunction
that contains the method InterruptHandlerFunction.interruptFired(int, Object)
that will be called
whenever there is an interrupt on this device. Request interrupts in synchronous
mode where the user program interrupt handler will be called when an interrupt
occurs. The default is interrupt on rising edges only.public void requestInterrupts()
waitForInterrupt(double, boolean)
. The default is interrupt on rising edges only.protected void allocateInterrupts(boolean watcher)
watcher
- true if the interrupt should be in synchronous mode where the user program will
have to explicitly wait for the interrupt to occur.public void cancelInterrupts()
public InterruptableSensorBase.WaitResult waitForInterrupt(double timeout, boolean ignorePrevious)
timeout
- Timeout in secondsignorePrevious
- If true, ignore interrupts that happened before waitForInterrupt was
called.public InterruptableSensorBase.WaitResult waitForInterrupt(double timeout)
timeout
- Timeout in secondspublic void enableInterrupts()
public void disableInterrupts()
public double readRisingTimestamp()
setUpSourceEdge(boolean, boolean)
.public double readFallingTimestamp()
setUpSourceEdge(boolean, boolean)
.public void setUpSourceEdge(boolean risingEdge, boolean fallingEdge)
risingEdge
- true to interrupt on rising edgefallingEdge
- true to interrupt on falling edge