/* 
 * File:   config.h
 * Author: hamilton
 *
 * Created on January 15, 2014, 4:29 PM
 */

#ifndef CONFIG_H
#define	CONFIG_H

#define CODE_VERSION 1
#define CODE_SUBVERSION 1

/******** Configure CAN Bus identifier and speed *********/
//  CAN ID field width definitions, from least sig to most sig.
#define SEQ_WIDTH  9
#define ID_WIDTH  5
#define SRC_WIDTH 4

#define CAN_SRCID 0  //Specific ID identifying messages that originate from this hardware.

#define POWERCONVERTER_CAN_SRCID 2 //Specific ID identifying messages that originate from the power converter

/* number of ECAN message buffers in DMA memory (must be greater or equal to the number of buffers used. */
#define ECAN1_MSG_BUF_LENGTH 16   /* 8 transmit buffers  8 recieve buffers */
#define ECAN1_NUM_TX_BUFFERS 8

#define CAN_PACKET_RATE 10  //Must be 10 or 25

/******** Configure Analog IO here  *********/
//#define ALLOW_CALIBRATION  //This allows the controller to be put into calibration mode and displays raw counts for the AIO on the serial port.


#define NUMAIO 6
#define FILTERSAMPLES 32  //Must be 1,2,4,8,16,32,64,128.  Must match FIR filter length

#define AIOMASK_H 0xfffc  //Select AN16-AN17 to be sampled and scanned
#define AIOMASK_L 0xf3fc  //Select AN0,AN1,AN10,AN11 to be sampled and scanned, total must match NUMAIO

#define REPORTINGSAMPLES 1  //Numbered of filtered results to save for 2nd stage filter.


/******** Configuration for Low Voltage Disconnect is here  ************/

#define LVD_OFF  264  //Volts
#define LVD_OFF_TIME 10 //Seconds.  Controller will turn off 24V power supply when the battery voltage is below LVD_OFF for more than LVD_OFF_TIME seconds

#define LVD_ON  270  //Volts
#define LVD_ON_TIME  120 //Seconds.  Controller will turn on 24V power supply when the battery voltage is above LVD_ON for more than LVD_ON_TIME seconds

#define PS_OUTPUT  _RD3
#define BENDER_OUTPUT  _RD12

/******** Configuration for Ground Fault Detect Cycling  ************/
#define BENDER_ON_TIME  2*60 //Seconds
#define BENDER_PERIOD_TIME 30*60 //Seconds

#define BENDER_SWITCH_FAULT _RD13



#endif	/* CONFIG_H */

