/*
  plot.cpp -- code to package SimPlot messages
 */
#include "Plot.h"

#define PMSGSIZE 4		// number of values to send in SimPlot message

/** send a message
 *  @param d* -- data elements to send
 */
void Plot::plot( int data1, int data2, int data3, int data4 )
{
	// buffer for message, a two int header followed by data
	static int buffer[2+PMSGSIZE];

	//SimPlot packet header. Indicates start of data packet
	buffer[0] = 0xCDAB;
	//Size of data in bytes. Does not include the header and size fields
	buffer[1] = PMSGSIZE*sizeof(int);
	buffer[2] = data1;
	buffer[3] = data2;
	buffer[4] = data3;
	buffer[5] = data4;

	Serial.write( (uint8_t * )buffer, sizeof(buffer) );

	return;
}
