#include <dsp.h>
#include "config.h"
#include "can.h"
#include "types.h"

volatile float time;


volatile int outSamples[FILTERSAMPLES];

volatile int temp_inSamples[FILTERSAMPLES];
volatile int temp_outSamples[FILTERSAMPLES];

int raw = 0;  //indicates if output should be raw counts or engineering units



volatile int VBatt_ADC[FILTERSAMPLES];
volatile int Ips_ADC[FILTERSAMPLES];
volatile int V_StopCharge_ADC[FILTERSAMPLES];
volatile int V_Balance_ADC[FILTERSAMPLES];
volatile int Rgroundfault_ADC[FILTERSAMPLES];
volatile int H2Sensor_ADC[FILTERSAMPLES];

volatile int VBatt_Buf[REPORTINGSAMPLES];
volatile int Ips_Buf[REPORTINGSAMPLES];
volatile int V_StopCharge_Buf[REPORTINGSAMPLES];
volatile int V_Balance_Buf[REPORTINGSAMPLES];
volatile int Rgroundfault_Buf[REPORTINGSAMPLES];
volatile int H2Sensor_Buf[REPORTINGSAMPLES];


unsigned int BufferA[FILTERSAMPLES*NUMAIO] __attribute__((space(dma),aligned(64)));
unsigned int BufferB[FILTERSAMPLES*NUMAIO] __attribute__((space(dma),aligned(64)));


unsigned int ECAN1MSGBUF[ECAN1_MSG_BUF_LENGTH][8] __attribute__((space(dma),aligned(ECAN1_MSG_BUF_LENGTH*16)));
//unsigned int BufferCAN1TX[CAN1TXBUFFSIZE] __attribute__((space(dma)));



unsigned int Current;


unsigned int uiTemp1;

int iTemp1;
int iTemp2;
int iTemp3;
int iTemp4;

float  fTemp1;
float  fTemp2;




CANmsg message[ECAN1_NUM_TX_BUFFERS-1];  //One message structure for each buffer


volatile STATUS Status;
;