/* ==================================================================================
File name:       F280XADC_6CH.H
                    
Originator:		ECS Development

Description: This header file contains source for the F280X general purpose 
6 conversions ADC driver for bipolar signals

Target: TMS320F280x family
              
=====================================================================================
History:
-------------------------------------------------------------------------------------
 04-15-2005	Version 3.20: Using DSP280x v. 1.10 or higher 
------------------------------------------------------------------------------------*/

#ifndef __F280XADC_6CH_H__
#define __F280XADC_6CH_H__

#include "f280xbmsk.h"


/*----------------------------------------------------------------------------
Initialization constant for the ADC Control Registers
----------------------------------------------------------------------------*/
#define ADC6CH_ADCTRL1_INIT  ADC_SUS_MODE0 + ADC_ACQ_PS_16 + \
                                ADC_CPS_2 + ADC_SEQ_CASC

#define ADC6CH_ADCTRL2_INIT  ADC_EPWM_SOCA_SEQ1 

/*-----------------------------------------------------------------------------
Define the structure of the ADC6CH Object
-----------------------------------------------------------------------------*/
typedef struct { int Ch1Gain;         // Parameter: ADC gain (Q13) 
                 int Ch1Offset;       // Parameter: ADC offset (Q15) 
                 int Ch1Out;          // Output: ADC output (Q15) 
                 int Ch2Gain;         // Parameter: ADC gain (Q13)  
                 int Ch2Offset;       // Parameter: ADC offset (Q15) 
                 int Ch2Out;          // Output: ADC output (Q15) 
                 int Ch3Gain;         // Parameter: ADC gain (Q13)  
                 int Ch3Offset;       // Parameter: ADC offset (Q15) 
                 int Ch3Out;          // Output: ADC output (Q15) 
                 int Ch4Gain;         // Parameter: ADC gain (Q13)  
                 int Ch4Offset;       // Parameter: ADC offset (Q15) 
                 int Ch4Out;          // Output: ADC output (Q15) 
                 int Ch5Gain;         // Parameter: ADC gain (Q13)  
                 int Ch5Offset;       // Parameter: ADC offset (Q15) 
                 int Ch5Out;          // Output: ADC output (Q15) 
                 int Ch6Gain;         // Parameter: ADC gain (Q13)  
                 int Ch6Offset;       // Parameter: ADC offset (Q15) 
                 int Ch6Out;          // Output: ADC output (Q15) 
        unsigned int ChSelect1;       // Parameter: ADC channel selection 
        unsigned int ChSelect2;       // Parameter: ADC channel selection 
                void (*init)();       // Pointer to the init function 
                void (*update)();     // Pointer to the update function 
              } ADC6CH;

/*-----------------------------------------------------------------------------
 Note 1 : It is necessary to call the init function to change the ADC 
            register settings, for the change in the channel setting for 
            Ch_sel setting changes to take effect.
            The read function will not detect or act upon this change.
-----------------------------------------------------------------------------*/
#define ADC6CH_BIPOLAR_DEFAULTS  { 0x1FFF,0x0000,0x0000,             \
                                  0x1FFF,0x0000,0x0000,             \
                                  0x1FFF,0x0000,0x0000,             \
                                  0x1FFF,0x0000,0x0000,             \
                                  0x1FFF,0x0000,0x0000,             \
                                  0x1FFF,0x0000,0x0000,             \
                                  0x3210,0x0054,                    \
                                  (void (*)(unsigned long))F280Xadc06_Init, \
                                  (void (*)(unsigned long))F280Xadc06_Bipolar_Update  \
                                 }

#define ADC6CH_UNIPOLAR_DEFAULTS  { 0x1FFF,0x0000,0x0000,             \
                                  0x1FFF,0x0000,0x0000,             \
                                  0x1FFF,0x0000,0x0000,             \
                                  0x1FFF,0x0000,0x0000,             \
                                  0x1FFF,0x0000,0x0000,             \
                                  0x1FFF,0x0000,0x0000,             \
                                  0x3210,0x0054,                    \
                                  (void (*)(unsigned long))F280Xadc06_Init, \
                                  (void (*)(unsigned long))F280Xadc06_Unipolar_Update  \
                                 }

#define ADC6CH_DEFAULTS   ADC6CH_BIPOLAR_DEFAULTS 
/*------------------------------------------------------------------------------
 Prototypes for the functions in F280XADC_6CH.C
------------------------------------------------------------------------------*/
void F280Xadc06_Init(ADC6CH *);
void F280Xadc06_Bipolar_Update(ADC6CH *);
void F280Xadc06_Unipolar_Update(ADC6CH *);

#endif // __F280XADC_6CH_H__
