DCT Lightfoot v3 API specification

com.dctl.hardware.timer
Class Timer

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--com.dctl.hardware.timer.Timer
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
TickTimer

public abstract class Timer
extends Thread

Base timer class. All timers extend this class


Field Summary
protected  TimerCallback callback
          The callback to call
protected static int EVENT_COUNTER
           
protected  int hHandle
          The timer handle
protected  int instance
          The timer instance
protected static int MEASUREMENT
           
protected  int mode
          The mode the timer is in
protected  int pQueue
          The queue
protected static int PWM
           
protected static int TICK_TIMER
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Timer(int instance, int mode)
          Create a new timer on the specified instance
 
Method Summary
 void run()
          The main processing loop.
protected  void setCallback(TimerCallback callback)
          Set the callback to call and the interval in microseconds to call it
protected  void setContinuous(boolean continuous)
          Set the continuous mode
protected  void setEnabled(boolean state)
          Set the enabled state
protected  void setInterval(int interval)
          Set the interval in microseconds
protected  void waitForNotification()
          Wait for notification
 
Methods inherited from class java.lang.Thread
activeCount, currentThread, getName, getPriority, isAlive, join, setPriority, sleep, start, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TICK_TIMER

protected static final int TICK_TIMER
See Also:
Constant Field Values

EVENT_COUNTER

protected static final int EVENT_COUNTER
See Also:
Constant Field Values

PWM

protected static final int PWM
See Also:
Constant Field Values

MEASUREMENT

protected static final int MEASUREMENT
See Also:
Constant Field Values

hHandle

protected int hHandle
The timer handle


instance

protected int instance
The timer instance


pQueue

protected int pQueue
The queue


callback

protected TimerCallback callback
The callback to call


mode

protected int mode
The mode the timer is in

Constructor Detail

Timer

public Timer(int instance,
             int mode)
      throws IllegalArgumentException,
             SystemException
Create a new timer on the specified instance

Parameters:
instance - The instance
mode - The mode for the timer
Throws:
IllegalArgumentException - IllegalArgumentException if the timer instance does not exist
SystemException - if there is an error in the operation
Method Detail

setCallback

protected void setCallback(TimerCallback callback)
Set the callback to call and the interval in microseconds to call it

Parameters:
callback - The timer callback

setInterval

protected void setInterval(int interval)
                    throws SystemException
Set the interval in microseconds

Parameters:
interval - The interval
Throws:
SystemException - if there is an error in the operation

setContinuous

protected void setContinuous(boolean continuous)
                      throws SystemException
Set the continuous mode

Parameters:
continuous - True to run continuously, false otherwise
SystemException

setEnabled

protected void setEnabled(boolean state)
                   throws SystemException
Set the enabled state

Parameters:
state - True to enable, false to disable
SystemException

run

public void run()
The main processing loop. Wait for the timer notification and call the callback

Specified by:
run in interface Runnable
Overrides:
run in class Thread

waitForNotification

protected void waitForNotification()
                            throws SystemException
Wait for notification

Throws:
SystemException - if there is an error

DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification