com.ferrettronics.device
Class Ft639

java.lang.Object
  |
  +--com.ferrettronics.device.Ft639

public class Ft639
extends java.lang.Object

Sends commands to a Ft639 chip. The FT639 controls up to five servos. Methods are provided to switch modes of operation and send positional commands to a servo.


Field Summary
static int MODE_ACTIVE
           
static int MODE_SETUP
           
static int PULSE_LONG
           
static int PULSE_SHORT
           
 
Constructor Summary
Ft639()
          Create an Ft639.
 
Method Summary
 void connectTo(javax.comm.CommPort cp)
          Connect to a communications port device.
 void connectTo(Ft649 ft649, int pin)
          Connect to a Ft649.
 int getHeader()
          Gets the header length.
 int getMode()
          Gets the chip's mode.
 DeviceProxy getProxy()
          Gets the device proxy to which this 639 is outputting data.
 int getPulse()
          Gets the pulse length.
 void setHeader(int h)
          Sets the header length.
 void setMode(int m)
          Puts the chip in a mode.
 void setPulse(int p)
          Sets the pulse length.
 void setServoPosition(int pin, int pos)
          Send a command to the FT639.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_SETUP

public static final int MODE_SETUP

MODE_ACTIVE

public static final int MODE_ACTIVE

PULSE_SHORT

public static final int PULSE_SHORT

PULSE_LONG

public static final int PULSE_LONG
Constructor Detail

Ft639

public Ft639()
Create an Ft639.
Method Detail

getProxy

public DeviceProxy getProxy()
Gets the device proxy to which this 639 is outputting data. This proxy is created on the call of the 'connectTo' methods.
Returns:
FtDeviceProxy.

connectTo

public void connectTo(javax.comm.CommPort cp)
Connect to a communications port device. param cp The communications port.

connectTo

public void connectTo(Ft649 ft649,
                      int pin)
Connect to a Ft649.
Parameters:
ft649 - The Ft649.
pin - The pin on the 649 that this 639 is attached.

setServoPosition

public void setServoPosition(int pin,
                             int pos)
Send a command to the FT639. Overrides FtOutputDevice method. Goes to active mode if necessary.
Parameters:
pin - The pin connected to the servo ( 1 to 5 ).
pos - The position to move servo to ( 0 to 255 ).

getHeader

public int getHeader()
Gets the header length.
Returns:
int The header length.

setHeader

public void setHeader(int h)
Sets the header length. Will be forced between 0 and 15. Will change to setup mode if necessary.
Parameters:
h - Specifies the new header length.

getMode

public int getMode()
Gets the chip's mode.
Returns:
int The chip's mode.

setMode

public void setMode(int m)
Puts the chip in a mode. If m is an invalid mode, chip goes to active mode.
Parameters:
m - Specifies the new mode.

getPulse

public int getPulse()
Gets the pulse length.
Returns:
int The pulse length.

setPulse

public void setPulse(int p)
Sets the pulse length. If p is an invalid pulse length, chip goes to short pulse. Will change to setup mode if necessary.
Parameters:
p - specifies pulse length.