// © RiceMotion ( Robert Carl Rice ) 2012-2016 - All rights reserved


// This software makes use of tools and libraries obtained from open source projects or released for

// use by relevant hardware manufactures. However, this software is NOT a part of any open source project.

// It is released only on a "need to know" basis for beta testers of the "RiceCNC Interpolation Engine".

// Recipents of this source code must respect the confidential nature of this software and prevent any

// distribution that could result in counterfeit copies of the "RiceCNC Interpolation Engine".


// © RiceMotion ( Robert Carl Rice ) 2012-2016 - All rights reserved

#ifndef ADC_h

#define ADC_h


#include "Energia.h"


class     AnalogPin;



class ADC {

     // sequenceNumbers 0-3 are for ADC0_BASE

     // sequenceNumbers 4-8 are for ADC1_BASE

     static AnalogPin*     sequencerReg[ 8 ][ 8 ];

     static bool               adcRunning;


     public:


     static void

          configure();


     static void

          configureBase(          uint32_t adcBase );


     static void

          addAnalogPin(          AnalogPin* analogPin );


     static void

          removeAnalogPin(     AnalogPin* analogPin );


     static void

          intHandler(

               uint32_t     adcBase,

               uint32_t     sequenceNumber,

               uint32_t     fifo );


     static void

          triggerNextSequence(

               uint32_t     adcBase,

               uint32_t     sequenceNumber );


};


#endif