/*
  Plot.h -- schip embedded plot util header file
	makes messages to send to Text or SimPlot software on PC
	or Blutooth Graphics Android tablet
	over serial/USB/Bluetooth
  This code is in some domain, probably.
 */
#ifndef Plot_h
#define Plot_h

#include "Arduino.h"

// sample baud rates
#define BAUD96   9600
#define BAUD14K 14400
#define BAUD19K 19200
#define BAUD28K 28800
#define BAUD38K 38400
#define BAUD57K 57600
#define BAUD115K 115200

#define DEFBAUD BAUD96 	// default baud rate so everything works together
#define BTBAUD  BAUD96 	// baud rate for Serial port using BlueTooth dingus
#define FASTBAUD BAUD115K // baud rate for fast Serial port

//#define TEXTSEP	' '		// text field separator, space
#define TEXTSEP	'\t'	// text field separator, tab

// externs for Plot.cpp library
class Plot
{
  public:
	// constructor to initialize system,
	Plot();
	// inits Serial port at specified baud rate
	//  note: can use DEFBAUD define as arg if you like...
	void init( unsigned long baud );
	// send a packet of 4 signed integers in text for tablet plotter
	void graph(int data1, int data2, int data3, int data4);
	// send a packet of 4 signed integers in binary for SimPlot
	void plot(int data1, int data2, int data3, int data4);
	// send a line of 4 integers as whitespaced text WITHOUT newline
	void textn(int data1, int data2, int data3, int data4);
	// send a line of 4 integers as whitespaced text with newline at end
	void text(int data1, int data2, int data3, int data4);
	// send a line of 4 integers as whitespaced text with newline at end
	//  where the last "data4" is printed in hex rather than decimal
	void textX(int data1, int data2, int data3, int data4);
};

// misc utility function, returns available RAM
//int freeRam(void);

#endif //Plot_h
