edu.wpi.first.wpilibj
Class InterruptableSensorBase

java.lang.Object
  extended by edu.wpi.first.wpilibj.SensorBase
      extended by edu.wpi.first.wpilibj.InterruptableSensorBase
All Implemented Interfaces:
FrcBotSimComponent
Direct Known Subclasses:
DigitalSource

public abstract class InterruptableSensorBase
extends SensorBase

Base for sensors to be used with interrupts


Field Summary
protected static Resource interrupts
          Resource manager
protected  tInterrupt m_interrupt
          The interrupt resource
protected  int m_interruptIndex
          The index of the interrupt
protected  tInterruptManager m_manager
          The interrupt manager resource
 
Fields inherited from class edu.wpi.first.wpilibj.SensorBase
kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond, n_simProperties
 
Constructor Summary
InterruptableSensorBase()
          Create a new InterrupatableSensorBase
 
Method Summary
 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.
 double readInterruptTimestamp()
          Return the timestamp for the interrupt that occurred most recently.
 void waitForInterrupt(double timeout)
          In synchronous mode, wait for the defined interrupt to occur.
 
Methods inherited from class edu.wpi.first.wpilibj.SensorBase
checkAnalogChannel, checkAnalogModule, checkDigitalChannel, checkDigitalModule, checkPWMChannel, checkPWMModule, checkRelayChannel, checkRelayModule, checkSolenoidChannel, checkSolenoidModule, free, getDefaultAnalogModule, getDefaultDigitalModule, getDefaultSolenoidModule, getSimProperties, setDefaultAnalogModule, setDefaultDigitalModule, setDefaultSolenoidModule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_interrupt

protected tInterrupt m_interrupt
The interrupt resource


m_manager

protected tInterruptManager m_manager
The interrupt manager resource


m_interruptIndex

protected int m_interruptIndex
The index of the interrupt


interrupts

protected static Resource interrupts
Resource manager

Constructor Detail

InterruptableSensorBase

public InterruptableSensorBase()
Create a new InterrupatableSensorBase

Method Detail

allocateInterrupts

public void allocateInterrupts(boolean watcher)
Allocate the interrupt

Parameters:
watcher -

cancelInterrupts

public void cancelInterrupts()
Cancel interrupts on this device. This deallocates all the chipobject structures and disables any interrupts.


waitForInterrupt

public void waitForInterrupt(double timeout)
In synchronous mode, wait for the defined interrupt to occur.

Parameters:
timeout - Timeout in seconds

enableInterrupts

public void enableInterrupts()
Enable interrupts to occur on this input. Interrupts are disabled when the RequestInterrupt call is made. This gives time to do the setup of the other options before starting to field interrupts.


disableInterrupts

public void disableInterrupts()
Disable Interrupts without without deallocating structures.


readInterruptTimestamp

public double readInterruptTimestamp()
Return the timestamp for the interrupt that occurred most recently. This is in the same time domain as getClock().

Returns:
Timestamp in seconds since boot.