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

#ifndef CONFIG_H
#define	CONFIG_H




/******** 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 3  //Specific ID identifying messages that originate from this hardware.

/* CAN Baud Rate Configuration */
#define FCAN 40000000
#define BITRATE 1000000
#define NTQ 20 //20 time quanta in a bit time
#define BRP_VAL ((FCAN/(2*NTQ*BITRATE))-1)

/* 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



/******** Configure Analog IO here  *********/
//These defines relate the analog channel numbers to the analog signals, they can be rearranged here without trouble later.

//#define NUMAIO 8
#define NUMAIO 8
#define FILTERSAMPLES 16

#define REPORTINGSAMPLES 20  //Save entire length of reporting period.  20 samples for 1000Hz DMA updates and 50Hz report.  1000/50 = 20

#define AIOMASK_H 0xfff0  //Select AN16-19 to be sampled and scanned
//#define AIOMASK_H 0xffff  //Select AN16-19 to be sampled and scanned

#define AIOMASK_L 0xf3fc  //Select AN0,AN1,AN10,AN11 to be sampled and scanned

#endif	/* CONFIG_H */

