jameslyden_pde-visdebugger/GlobalVars.pde
/* GlobalVars: define global variables for VisDebugger
 * Copyright 2013, James Lyden <james@lyden.org>
 * This code is licensed under the terms of the GNU General Public License.
 * See COPYING, or refer to http://www.gnu.org/licenses, for further details.
 *
 * Contains all global variable definitions for VisDebugger project.
 */

// Create serial port object
import processing.serial.*;
Serial port = new Serial(this, Serial.list()[0], 115200);

// Channel definitions
int channels;				// number of channels
int chanHeight;			// height of each channel
int paddedChanHeight;	// height of each channel after padding
String[] chanName;		// stores autogenerated name of each channel
boolean[] chanDigital;	// flag for digital/analog treatment of each channel

// Scaling quantities
float zoom = 1.0f;		// controls zoom levels
final float voltFactor = 0.02;	// Volts per unit, for analog channels

// Database of values
int[][] value;				// data storage for all channels, all samples
int currSample = 0;		// column in value that represents the current time
final int maxSamples = 40960;		// 40k samples is roughly 10-60 seconds worth
											// (depending on total analog channel count)

// Buffering
int currReadTime = 0;	// time in milliseconds of current data read
int lastReadTime = 0;	// time in ms of previous data read
int readInterval = 0;	// time between last read and this one
int bufferWaiting = 0;	// bytes waiting in the buffer

// Layout dimensions
final int windowHeight = 960;		// Height of overall window
final int windowWidth = 1280;		// Width of overall window
final int headerHeight = 32;		// Height of header section for text output
final int lGutterWidth = 64;		// Width of left gutter for text output
final int rGutterWidth = 96;		// Width of right gutter for text output
final int footerHeight = 24;		// Height of footer section for text output
final int chanPadding = 10;		// Unused pixels at top and bottom of each chan
final int canvasHeight = windowHeight - headerHeight - footerHeight;
final int canvasWidth = windowWidth - lGutterWidth - rGutterWidth;

// Debugging
final int debugLevel = 0;			// controls output of console debug messages


