Class Device

java.lang.Object
  extended byDevice

public class Device
extends java.lang.Object

Device provides access to the physical logic analyzer device through a serial port. It requires the rxtx package from http://www.rxtx.org/ to function.

Version:
0.0.1
Author:
Michael "Mr. Sump" Poppitz

Constructor Summary
Device()
          Creates a device object.
 
Method Summary
 boolean attach(java.lang.String portName)
          Attaches the given serial port to the device object.
 void detach()
          Detaches the currently attached port, if one exists.
 int[] run()
          Sends the configuration to the device, starts it, reads the captured data and returns an int-array with each int representing one capture of all 32 channels
 void setRate(int rate)
          Set the sampling rate.
 void setRatio(double ratio)
          Sets the ratio for samples to read before and after started.
 void setSize(int size)
          Sets the number of samples to obtain when started.
 void setTrigger(int mask, int value)
          Configures the conditions that must be met to fire the trigger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Device

public Device()
Creates a device object.

Method Detail

attach

public boolean attach(java.lang.String portName)
Attaches the given serial port to the device object. The method will try to open the port.
A return value of true does not guarantee that a logic analyzer is actually attached to the port.

Parameters:
portName - the name of the port to open
Returns:
true when the port has been assigned successfully; false otherwise.

detach

public void detach()
Detaches the currently attached port, if one exists. This will close the serial port.


setSize

public void setSize(int size)
Sets the number of samples to obtain when started.

Parameters:
size - number of samples, must be between 4 and 256*1024

setRatio

public void setRatio(double ratio)
Sets the ratio for samples to read before and after started.

Parameters:
ratio - value between 0 and 1; 0 means all before start, 1 all after

setRate

public void setRate(int rate)
Set the sampling rate. All rates must be a divisor of 50.000.000. Other rates will be adjusted to a matching divisor.

Parameters:
rate - sampling rate in Hz

setTrigger

public void setTrigger(int mask,
                       int value)
Configures the conditions that must be met to fire the trigger.
Each bit of the integer parameters represents one channel.
The LSB represents channel 0, the MSB channel 31.

To disable the trigger, set mask to 0. This will cause it to always fire.

Parameters:
mask - bit map defining which channels to watch
value - bit map defining what value to wait for on watched channels

run

public int[] run()
          throws java.lang.Exception
Sends the configuration to the device, starts it, reads the captured data and returns an int-array with each int representing one capture of all 32 channels

Returns:
array containing the capture data
Throws:
java.lang.Exception - when writing to or reading from device fails